public function save() { $form = Form::load('logbook.views.AddBlogComment'); $capval = Captcha::validate(); if($form->validate()&&$capval) { Application::alterParam('comment_content',strip_tags(Application::param('comment_content'))); $item = new Comment(); $item->parse(); $item->set('comment_date',date('Y-m-d H:M:S')); $item->setSafe('author_id',Logbook::current()->authorId()); $item->save(); Application::setParam('author_id',Application::param('author_id')); Application::setParam('entry_id',Application::param('entry_id')); $this->redirectOnSave(); } }
/** * Reinitialise the application and execute the handler without redirecting the browser * * This is a useful function to avoid having {@link Handler} classes grows unmaintainably * large, without the invonvenience of redirecting the browser. There is a peformance hit * because the application is reinitialised, and the user is revalidated, however it is * not extreme. * * The important thing to remember when using the execute() method is that if the user * refreshes the browser, the handler that was executed first by the application will be * executed again, not any handler that has been executed using the execute() method. * * If you need to redirect the browser url use {@link Application::redirect()} * * @param handler - the handler class name to execute * @access public * @static */ public static function execute($class_name) { Application::alterParam('h', $class_name); $app = Application::current(); $app->systemSetup(); $app->initUser(); $app->siteNavigationInit(); $app->run(); exit(1); }
public function runHandlerTest() { $redir = Application::current()->redirection_listener; Application::current()->setRedirectionListener($this); Application::alterParam('h', $this->test_handler->getClass()); try { ob_start(); Application::current()->run(); $cached = ob_get_clean(); } catch (RedirectionException $exc) { $this->setResult('Redirected to: ' . $exc->handler() . ' with vars: ' . $exc->varString(), MurphyTest::REDIRECT); Application::current()->setRedirectionLister($redir); } catch (AccessDeniedException $exc) { $this->setResult('Access denied to ' . $this->test_handler->getClass() . ' for user: '******' in test: ' . $this->name, MurphyTest::ACCESS_DENIED); Application::current()->setRedirectionLister($redir); } catch (Exception $exc) { $this->setResult('Exception of type ' . get_class($exc) . ': ' . $exc->getMessage(), MurphyTest::EXCEPTION); Application::current()->setRedirectionLister($redir); } $this->setResult('Completed handler test for: ' . $this->name, MurphyTest::COMPLETE); }