Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

63 users online



Cake PHP - Need Help Urgently!

Cake PHP - Need Help Urgently!

Currently viewing this thread: 1 (0 members and 1 guests)


Funkrush

Funkrush

Teh Win
Status: Offline!

Cake PHP - Need Help Urgently!

Hi,

I'm editing the Cake PHP framework, trying to integrate a form for tax credentials. But whenever I submit the form to taxprocess.php I get the following error:

Missing Method in BloggersController

You are seeing this error because the action ... is not defined in controller BloggersController

Notice: this error is being rendered by the app/views/errors/missing_action.thtml view file, a user-customizable error page for handling invalid action dispatches.

Fatal: Create Method:

<?php
class BloggersController extends AppController
{
function ...()
{

}
}
?>

in file : app/controllers/bloggers_controller.php

Error: Unable to execute action ... in BloggersController

Now, I understand what the error is saying...I haven't defined the page (or I think that's what it's saying). But I don't know how to define it in Bloggers_Controller.php.

This is the script, can anyone help me? It's urgent that I get this to work.

<?php

class BloggersController extends AppController
{

var $name = 'Bloggers';
var $uses = array('Blogger', 'Blog', 'BlogLink', 'Client', 'ClientLink', 'Contact', 'Bug', 'Post', 'Setting');
var $components = array('email');
var $helpers = array('Html', 'Time');
var $beforeFilter = array('checkAccess');

/**
* Verify Authorized Blogger
*
* This function checks to make sure the person has a blogger session.
*/

function checkAccess()
{
if (!in_array($this->action, array('login', 'logout', 'password', 'apply', 'contact', 'bug', 'taxprocess')))
{
if ($this->Session->read('group') != 'blogger')
{
$this->redirect('/bloggers/logout/');
}
}

//$this->redirect('/pages/static/maintenance');
}

/**
* Blogger Login
*
* This function displays the login page and also verifies username and password.
*/

function login()
{
if (empty($this->params['data']))
{
$this->render();
}
else
{
$data = $this->Blogger->verify($this->params['data']['Blogger']['email'], $this->params['data']['Blogger']['password']);

if($data)
{
$this->Session->write('loggedin', 1);
$this->Session->write('group', 'blogger');
$this->Session->write('id', $data['Blogger']['id']);
$this->redirect('/bloggers/');
}
else
{
$this->set('message_type', 'failure');
$this->set('message', 'Sorry, this account was not recognized');
}
}
}

/**
* Blogger Logout
*
* This function clears the bloggers session and then redirects them to the login.
*/

function logout()
{
$this->Session->write('loggedin', 0);
$this->Session->write('group', null);
$this->Session->write('userid', null);
$this->redirect('/bloggers/login/');
}

/**
* Display Application
*
* This function displays the application form and validates the data before adding to the db.
*/

function apply(){
if (empty($this->params['data']))
{
$this->render();
}
else
{

if ($this->Blogger->findCount("Blogger.email = '".$this->params['data']['Blogger']['email']."'") || $this->Blog->findCount("Blog.url = '".$this->params['data']['Blogger']['blog_url']."'"))
{
$this->set('message_type', 'failure');
$this->set('message', 'This email or blog is already in our system, please contact us if you have any questions.');

$this->set('data', $this->params['data']);
}
else
{
if ($this->Blogger->save($this->params['data']))
{
$this->params['data'] = null;

$this->set('message_type', 'success');
$this->set('message', 'Thank you for applying, you will receive a response within 2 business days.');
}
else
{
$this->set('message_type', 'failure');
$this->set('message', 'Problems were found with your application, please see details listed in the form below.');

$this->set('data', $this->params['data']);
$this->validateErrors();
}
}

}
}

/**
* Display Index
*
* This function grabs posts, contacts and bugs and sets them to be used in the index render.
*/

function index()
{
$this->set('user', $this->Blogger->find("id = '".$this->Session->read('id')."'"));
$this->set('posts', $this->Post->findAll("", "id,title,abstract", "created DESC", "3"));
}

/**
* Display Offers
*
* This function displays a list of offers available to this blogger.
*/

function offers()
{
$this->set('openbloglinks', $this->BlogLink->findAll("BlogLink.blogger_id = '".$this->Session->read('id')."' AND BlogLink.status = 'open' AND (ClientLink.links_count + ClientLink.blogs_reserved) < ClientLink.links_desired", null, "BlogLink.created DESC"));
$this->set('bloglinks', $this->BlogLink->findAll("BlogLink.blogger_id = '".$this->Session->read('id')."' AND BlogLink.status = 'reserved' AND ClientLink.links_desired > ClientLink.links_count AND '".date("Y-m-d H:i:s")."' < BlogLink.expires", null, "BlogLink.created DESC"));

if (!empty($this->params['data']))
{
$canaccess = $this->BlogLink->postBlogLink($this->params['data'], $this->Session->read('id'));

if($canaccess)
{
$this->params['data']['BlogLink']['status'] = 'pending';

if($this->BlogLink->save($this->params['data']))
{
$bloglink = $this->BlogLink->find("BlogLink.id = '".$this->params['data']['BlogLink']['id']."'");
$clientlink = $this->ClientLink->find("ClientLink.id = '".$bloglink['BlogLink']['client_link_id']."'");

$this->set('message_type', 'success');
$this->set('message', 'Your link posting has been received. Once we approve it you will see it in "completed offers".');

$this->params['data']['BlogLink']['posting_url'] = '';
}
else
{
$this->set('message_type', 'failure');
$this->set('message', 'There was a problem with your posting, please see the specifics below.');

$this->set('data', $this->params['data']);
$this->validateErrors();
}
}
else
{
$this->set('message_type', 'failure');
$this->set('message', 'This offer has expired, please contact us if you feel this is incorrect.');
}
}

}

/**
* Display Terms and Conditions
*
* This function displays the terms and conditions.
*/

function terms()
{
}

/**
* Approve Link
*
* This function puts a link in reserve for a blogger.
*/

function linkapprove($id)
{
$this->BlogLink->reserveBlogLink($id, $this->Session->read('id'));

$this->redirect('/bloggers/offers');
}

/**
* Reject Link
*
* This function puts a link in reject for a blogger.
*/

function linkreject($id)
{
$this->BlogLink->rejectBlogLink($id, $this->Session->read('id'));

$this->redirect('/bloggers/offers');
}

/**
* Display Accounting
*
* This function displays a breakdown of a bloggers accounting numbers.
*/

function accounting()
{
$this->set('bloglinks', $this->BlogLink->findAll("BlogLink.blogger_id = '".$this->Session->read('id')."' and BlogLink.status = 'completed'", "", "BlogLink.created DESC"));
}

/**
* Display Blogs
*
* This function displays a a list of the bloggers blogs.
*/

function blogs()
{
$this->set('blogs', $this->Blog->findAll("Blog.blogger_id = '".$this->Session->read('id')."' and Blog.status = 'approved'", "", "Blog.created DESC"));
}

/**
* Add Blog
*
* This function displays the add blog form and validates it before adding to the db.
*/

function blogAdd()
{
if (empty($this->params['data']))
{
$this->render();
}
else
{
if ($this->Blog->findCount("Blog.url = '".$this->params['data']['Blog']['url']."'"))
{
$this->set('message_type', 'failure');
$this->set('message', 'This blog is already in our system, please contact us if you have any questions.');

$this->set('data', $this->params['data']);
}
else
{
$this->params['data']['Blog']['blogger_id'] = $this->Session->read('id');

if ($this->Blog->save($this->params['data']))
{
$this->set('message_type', 'success');
$this->set('message', 'Your blog is now pending approval, we will respond within 2 business days.');
}
else
{
$this->set('message_type', 'failure');
$this->set('message', 'There was a problem with your blog submission. Please see specifics in the form below.');

$this->set('data', $this->params['data']);
$this->validateErrors($this->Blog);
}
}
}
}

/**
* Edit Blog
*
* This function displays edit form for internal Blogitive blog and validates before adding to the db.
*/

function blogEdit($id=null)
{
if (empty($this->params['data']))
{
$this->Blog->setId($id);
$this->params['data'] = $this->Blog->read();
$this->set('data', $this->params['data']);
}
else
{
$this->Blog->set($this->params['data']);

if ($this->Blog->save())
{
$this->set('message_type', 'success');
$this->set('message', 'Your blog has been updated.');
}
else
{
$this->set('data', $this->params['data']);
$this->validateErrors($this->Blog);
}
}
}

/**
* Display Settings
*
* This function displays the bloggers account settings.
*/

function settings()
{
$id = $this->Session->read('id');
if (empty($this->params['data']))
{
$this->Blogger->setId($id);
$this->params['data'] = $this->Blogger->read();
$this->set('data', $this->params['data']);
}
else
{
$this->params['data']['Blogger']['id'] = $this->Session->read('id');
$this->Blogger->set($this->params['data']);

if ($this->Blogger->save())
{
$this->set('message_type', 'success');
$this->set('message', 'Your account settings have been updated.');
}
else
{
$this->set('data', $this->params['data']);
$this->validateErrors($this->Blogger);
}
}
}

/**
* Display Posts
*
* This function displays the internal Blogitive blog.
*/

function posts()
{
$this->set('posts', $this->Post->findAll("", "id, title, abstract, created", "created DESC"));
}

/**
* Display Post
*
* This function displays a single blog entry for the internal Blogitive blog.
*/

function postView($id)
{
$this->Post->setId($id);
$this->set('data', $this->Post->read());
}

/**
* Display Contact
*
* This function displays the contact form and validates before adding to the db.
*/

function contact(){
if ($this->Session->read('loggedin'))
{
$this->set('loggedin', '1');
}
else
{
$this->set('loggedin', '0');
}

if (empty($this->params['data']))
{
$this->render();
}
else
{
if($this->Session->read('id'))
{
$this->params['data']['Contact']['type'] = 'blogger';
$this->params['data']['Contact']['tid'] = $this->Session->read('id');
}
else
{
$this->params['data']['Contact']['type'] = 'public';
$this->params['data']['Contact']['tid'] = '';
}

$sdata = $this->Contact->save($this->params['data']);

if($sdata)
{
$this->Setting->setId('1');
$settings = $this->Setting->read();

$this->set('name', $this->params['data']['Contact']['first_name']." ".$this->params['data']['Contact']['last_name']);
$this->set('company', $this->params['data']['Contact']['company']);
$this->set('email', $this->params['data']['Contact']['email']);
$this->set('phone', $this->params['data']['Contact']['phone']);
$this->set('person', $this->params['data']['Contact']['person']);
$this->set('message', $this->params['data']['Contact']['message']);

$this->email->controller = $this;
$this->email->tpl = 'email_contact';
$this->email->to = $settings['Setting']['email_customerservice'];
$this->email->from = $settings['Setting']['email_customerservice'];
$this->email->subject = 'Blogitive: (blogger) Contact Submission';
$this->email->send();

$this->params['data'] = null;

$this->set('message_type', 'success');
$this->set('message', 'Thank you for contacting us, we will respond within 2 business days.');
}
else
{
$this->set('message_type', 'failure');
$this->set('message', 'There was a problem with your contact information, please see the form below for details.');

$this->set('data', $this->params['data']);
$this->validateErrors($this->Contact);
}
}
}

/**
* Display Bug
*
* This function displays a bug form and validates the data before adding to the db.
*/

function bug(){
if ($this->Session->read('loggedin'))
{
$this->set('loggedin', '1');
}
else
{
$this->set('loggedin', '0');
}

if (empty($this->params['data']))
{
$this->render();
}
else
{
if($this->Session->read('id'))
{
$this->params['data']['Bug']['type'] = 'blogger';
$this->params['data']['Bug']['tid'] = $this->Session->read('id');
}
else
{
$this->params['data']['Bug']['type'] = 'public';
$this->params['data']['Bug']['tid'] = '';
}

$sdata = $this->Bug->save($this->params['data']);

if($sdata)
{
$this->params['data'] = null;

$this->set('message_type', 'success');
$this->set('message', 'Thank you for informing us regarding this bug. Our engineers will attend to it immediately.');
}
else
{
$this->set('message_type', 'failure');
$this->set('message', 'Problems were found with your bug submission, please see details listed in the form below.');

$this->set('data', $this->params['data']);
$this->validateErrors();
}
}
}

/**
* Password Reminder
*
* This function displays and sends out password reminders.
*/

function password()
{
if (empty($this->params['data']))
{
$this->render();
}
else
{
$usr = $this->Blogger->find("username='{$this->params['data']['Blogger']['email']}'");

if($usr)
{
$this->Setting->setId('1');
$settings = $this->Setting->read();

$this->set('username', $usr['Blogger']['email']);
$this->set('password', $usr['Blogger']['password']);

$this->email->controller = $this;
$this->email->tpl = 'email_password';
$this->email->to = $usr['Blogger']['email'];
$this->email->from = $settings['Setting']['email_customerservice'];
$this->email->subject = 'Blogitive - Password Reminder';
$this->email->send();

$this->set('message_type', 'success');
$this->set('message', 'An email has been sent to you containing your password.');
}
else
{
$this->set('message_type', 'failure');
$this->set('message', 'Sorry, this email account was not recognized in our system.');
}
}
}

}

?>

I've also attatched the file for editing if you could be so kind as to add what I need. If not, if you could point it out to me that would also be great!

I hope to hear from you all soon.

Thanks!
Tom

Attachments:

bloggers_controller.php (Download) 14.74 Kb, 212 views

Rook

Rook

Everywhere you go. There you are.
Status: Offline!

I can't sift through that, I'll be able to fix it if you upload your script, and I can live test it. Otherwise, hopefully another member will be able to help, by taking a glance at that code.

You've checked all your includes/filenames/paths (the simple basics) ?

___________________

Koreans stole my domain.

Funkrush

Funkrush

Teh Win
Status: Offline!

Yeah all checked. I thought I'd uploaded the script? Grin

Funkrush

Funkrush

Teh Win
Status: Offline!

But also, the other problem I forgot to mention. If I place the taxprocess.php in the html folder where the index.php is, I get a 404 error. Now I'm wondering if this is something to do with PHPCake? I've never used it before, this is my first shot :-)

Would appreciate feedback,

Thanks,
Tom

BigToach

BigToach

Neversidian
Status: Offline!

you need to go through the cakePHP blog guide on cakephp.org

whatever route you are trying to follow doesnt exist, what was the page you were trying to go to when it died?

As far as your index.php file not working that is the way that cakephp works, you need to name it something else Im guessing and put it in the webroot folder in your app folder

___________________

Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0211 seconds.