public function __construct(sfActions $actions) { $this->_actions = $actions; $this->_sympalContext = $actions->getSympalContext(); $this->_user = $actions->getUser(); $this->_response = $actions->getResponse(); $this->_request = $actions->getRequest(); $this->_dispatcher = $this->_sympalContext->getSymfonyContext()->getConfiguration()->getEventDispatcher(); }
public function execute($sfRequest) { if ($id = $sfRequest->getUrlParameter('registration_id')) { $this->getRegistration($sfRequest, 'registration_id'); if ($id = $sfRequest->getUrlParameter('id')) { $this->getContext()->getRouting()->setDefaultParameter('id', $id); } } else { $this->getRegistration($sfRequest); } // $this->checkProcess($sfRequest); // used in dsRegistration // $this->getUser()->setFlash('process', $this->process); $result = parent::execute($sfRequest); // UPDATE: This is required for the 'new' action if (isset($this->form) && $this->form->getObject() && $this->form->getObject()->isNew()) { // $this->form->getObject()-> = $this->course->getID(); } return $result; }
public function forward403Unless($condition, $module, $action, $message) { if (!$condition) { $this->getUser()->setFlash("403message", $message); parent::forwardUnless($condition, $module, $action); } }
public function initialize($context, $moduleName, $actionName) { parent::initialize($context, $moduleName, $actionName); if (!Doctrine::getTable('SnsConfig')->get('op_diary_plugin_use_open_diary', true)) { $this->security = array(); } $this->security['all'] = array('is_secure' => true, 'credentials' => 'SNSMember'); }
public function initialize($context, $moduleName, $actionName) { parent::initialize($context, $moduleName, $actionName); $this->freepage = $this->getRoute()->getObject(); if ($this->freepage->auth) { $this->security[$actionName] = array('is_secure' => true, 'credentials' => 'SNSMember'); } }
public function initialize($context, $moduleName, $actionName) { parent::initialize($context, $moduleName, $actionName); $request = $context->getRequest(); if ($color = $request->getParameter("color")) { $context->getUser()->setAttribute("popup_color", $color, "persistent"); } }
public function preExecute() { parent::preExecute(); $this->upgrade = new sfSympalUpgradeFromWeb($this->getContext()->getConfiguration(), $this->getContext()->getEventDispatcher(), new sfFormatter()); $this->hasNewVersion = $this->upgrade->hasNewVersion(); $this->latestVersion = $this->upgrade->getLatestVersion(); $this->currentVersion = $this->upgrade->getCurrentVersion(); $this->checkFilePermissions(); }
public function preExecute() { parent::preExecute(); $this->config = new sfRestWebServiceConfiguration($this->getContext()->getConfiguration()); $this->enableDoctrineValidation(); if ($this->isProtected()) { $this->authenticate(); } $this->checkContentType(); }
public function preExecute() { $this->configuration = new peticionCodigoGeneratorConfiguration(); if (!$this->getUser()->hasCredential($this->configuration->getCredentials($this->getActionName()))) { $this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); } $this->dispatcher->notify(new sfEvent($this, 'admin.pre_execute', array('configuration' => $this->configuration))); $this->helper = new peticionCodigoGeneratorHelper(); parent::preExecute(); }
public function preExecute() { parent::preExecute(); if ($this->getUser()->hasAttribute('api_log')) { $dispatcher = sfApplicationConfiguration::getActive()->getEventDispatcher(); $string = $this->getUser()->getAttribute('api_log'); $dispatcher->notify(new sfEvent('Api', 'application.log', array('priority' => sfLogger::WARNING, $string))); $this->getUser()->getAttributeHolder()->remove('api_log'); } }
public function getCredential() { $list = $this->retrieveSkinnyList(); if ($list && $this->getUser()->isOwnerOf($list)) { $this->getUser()->addCredential('owner'); } else { $this->getUser()->removeCredential('owner'); } // the hijack is over, let the normal flow continue: return parent::getCredential(); }
public function initialize($context, $moduleName, $actionName) { parent::initialize($context, $moduleName, $actionName); $this->module = $moduleName; if (!isset($this->singular)) { // 5.2.x doesn't have lcfirst(), that arrives in 5.3.0 $this->singular = strtolower(substr($this->module, 0, 1)) . substr($this->module, 1); } $this->list = $this->singular . "_list"; if (!isset($this->model)) { $this->model = ucfirst($this->singular); } }
public function execute($request) { $this->forward404Unless(opConfig::get('enable_jsonapi')); $moduleName = strtolower($this->moduleName); sfConfig::set('mod_' . $moduleName . '_view_class', 'opJsonApi'); $this->getResponse()->setContentType('application/json'); $enableEscaping = true; if (isset($request['escaping'])) { $enableEscaping = in_array($request['escaping'], array('1', 'on', 'true')); } sfConfig::set('sf_escaping_strategy', $enableEscaping); return parent::execute($request); }
/** * Recognizes a need to convert the redirect to a JSON response. */ public function redirect($url, $statusCode = 302) { if ($this->getRequest()->isXmlHttpRequest()) { $url = $this->getController()->genUrl($url, true); $params = array('success' => true, 'redirect' => $url); $response = $this->getResponse(); $response->clearHttpHeaders(); $response->setStatusCode(200); $response->setContent(json_encode($params)); $response->send(); throw new sfStopException(); } else { parent::redirect($url, $statusCode); } }
public function preExecute() { // $module = 'sf_plop_profile'; // if (!in_array($module, array_keys(sfPlop::getSafePluginModules())) // && !$this->getUser()->hasCredential($module) // ) // $this->forward404(); if (!$this->getUser()->isAuthenticated()) { $this->forward(sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action')); } // if (!$this->getUser()->hasCredential($module)) // $this->forward(sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')); parent::preExecute(); ProjectConfiguration::getActive()->LoadHelpers(array('I18N')); $this->getResponse()->setTitle(sfPlop::setMetaTitle(__('User profile', '', 'plopAdmin'))); }
public function execute($request) { // Ensure format is set correctly $params = $this->getRoute()->getParameters(); $request->setRequestFormat(isset($params['sf_format']) ? $params['sf_format'] : 'xml'); // Add layout for xml if ($request->getRequestFormat() == 'xml') { $this->setLayout('layout'); } // Add callback for jsonp if ($request->getRequestFormat() == 'json') { $this->callback = $request->getParameter('callback'); } $this->getResponse()->setStatusCode(200); return parent::execute($request); }
public function preExecute() { parent::preExecute(); // Récupération de l'utilisateur. $this->guard_user = $this->getUser()->getGuardUser(); if ($this->guard_user != null) { $this->ei_user = $this->guard_user->getEiUser(); } else { $this->ei_user = null; } $requiredModules = array("eicampaignexecution", "eitestset", "eilog"); // Mise à jour des statuts des campagnes/JDT. if (in_array($this->getModuleName(), $requiredModules)) { Doctrine_Core::getTable("EiTestSet")->closeUnterminatedTestSet(); } if ($this->getModuleName() == "eicampaignexecution") { Doctrine_Core::getTable("EiCampaignExecution")->closeUnterminatedTestSet(); } }
/** * @return */ public function preExecute() { if ($this->getUser()->id) { // get or create model sfVkontakteUser $this->vkontakteUser = sfVkontakteUserTable::getInstance()->find($this->getUser()->id); if (!$this->vkontakteUser) { $this->vkontakteUser = new sfVkontakteUser(); $this->vkontakteUser->id = $this->getUser()->id; $this->vkontakteUser->save(); } // if we need to fetch profiles $this->getUser()->need_fetch = sfConfig::get('app_vkontakte_enable_fetch') && $this->vkontakteUser->getNeedFetchFriends(); } if (sfConfig::get('app_vkontakte_enable_add_js')) { // add JS to response sfContext::getInstance()->getResponse()->addJavascript('http://vkontakte.ru/js/api/xd_connection.js?2', 'first'); sfContext::getInstance()->getResponse()->addJavascript('/sfVkontaktePlugin/js/common.js', 'first'); } parent::preExecute(); }
/** * Here we will initiate system messages translatable strings * */ public function preExecute() { parent::preExecute(); sfLoader::loadHelpers('I18N'); $this->messages = array('already_voted' => __('You have already voted'), 'missing_params' => __('Parameters are missing to retrieve ratable object'), 'post_only' => __('POST requests only'), 'ratable_error' => __('Unable to retrieve ratable object: %s'), 'thank_you' => __('Thank you for your vote'), 'thank_you_update' => __('Thanks for updating your vote'), 'user_error' => __('A problem has occured, sorry for the inconvenience')); }
public function preExecute() { parent::preExecute(); rtTemplateToolkit::setBackendTemplateDir(); }
public function preExecute() { parent::preExecute(); rtTemplateToolkit::setBackendTemplateDir(); sfConfig::set('app_rt_node_title', 'Search'); }
public function execute($sfRequest) { /* $this->forward404Unless( $this->registration_id = $sfRequest->getUrlParameter('registration_id')); $this->forward404Unless( $this->registration = Doctrine::getTable('smRegistration')->findOneById($this->registration_id)); $this->getContext()->getRouting() ->setDefaultParameter('registration_id', $this->registration_id); */ if ($id = $sfRequest->getUrlParameter('id')) { $this->getContext()->getRouting()->setDefaultParameter('id', $id); } $result = parent::execute($sfRequest); // UPDATE: This is required for the 'new' action /* if (isset($this->form) && $this->form->getObject() && $this->form->getObject()->isNew()) { // $this->form->getObject()-> = $this->course->getID(); } */ return $result; }
public function execute($sfRequest) { $this->forward404Unless( $this->class_id = $sfRequest->getUrlParameter('class_id')); $this->forward404Unless( $this->class = Doctrine::getTable('dsClass')->findOneById($this->class_id)); $this->getContext()->getRouting() ->setDefaultParameter('class_id', $this->class_id); $this->getContext()->getRouting() ->setDefaultParameter('dance_slug', $this->class->getDance()->getSlug() ); $result = parent::execute($sfRequest); return $result; }
public function redirectWithInfo($message, $url = 'default/index') { $this->getUser()->setFlash('info', $message); parent::redirect($url); }
public function preExecute() { parent::preExecute(); $this->searcher = new opThemeAssetSearcher(); $this->config = new opThemeConfig(); }
public function preExecute() { parent::preExecute(); $this->getContext()->getEventDispatcher()->connect('admin.save_object', array($this, 'listenToAdminSaveObject')); }
public function __construct($context, $moduleName, $actionName) { parent::__construct($context, $moduleName, $actionName); $this->_req_fields = array('contact_name', 'contact_number', 'contact_email', 'catalog_number'); $this->_errors = array(); }
public function initialize($context, $moduleName, $actionName) { parent::initialize($context, $moduleName, $actionName); $this->security['all'] = array('is_secure' => true, 'credentials' => 'SNSMember'); }
public function preExecute() { parent::preExecute(); $this->folderProvider = new sfAssetsFolderProvider(); $this->assetProvider = new sfAssetsProvider(); }
public function getCredential() { $this->checkOwnership(); return parent::getCredential(); }