/**
   * Executes this filter.
   *
   * @param sfFilterChain $filter_chain The filter chain
   */
  public function execute(sfFilterChain $filter_chain)
  {
    $action_instance = $this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();

    // Keep track only of trackable actions
    if ($this->isTrackable($action_instance))
    {
      try
      {
        $entry = ncTrackerEntryPeer::createFromAction($action_instance);

        $this->log('Created a new ncTrackerEntry.');
      }
      catch (PropelException $exception)
      {
        $this->log(
          sprintf('Unable to create a new ncTrackerEntry. Error message: %s.', $exception->getMessage())
        );
      }
    }
    else
    {
      $this->log(
        sprintf('Ignored non-trackable action: %s/%s.', $action_instance->getModuleName(), $action_instance->getActionName())
      );
    }

    $filter_chain->execute($filter_chain);
  }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     // disable security on login and secure actions
     if (sfConfig::get('sf_login_module') == $this->context->getModuleName() && sfConfig::get('sf_login_action') == $this->context->getActionName() || sfConfig::get('sf_secure_module') == $this->context->getModuleName() && sfConfig::get('sf_secure_action') == $this->context->getActionName()) {
         $filterChain->execute();
         return;
     }
     // NOTE: the nice thing about the Action class is that getCredential()
     //       is vague enough to describe any level of security and can be
     //       used to retrieve such data and should never have to be altered
     if (!$this->context->getUser()->isAuthenticated()) {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Action "%s/%s" requires authentication, forwarding to "%s/%s"', $this->context->getModuleName(), $this->context->getActionName(), sfConfig::get('sf_login_module'), sfConfig::get('sf_login_action')))));
         }
         // the user is not authenticated
         $this->forwardToLoginAction();
     }
     // the user is authenticated
     $credential = $this->getUserCredential();
     if (null !== $credential && !$this->context->getUser()->hasCredential($credential)) {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Action "%s/%s" requires credentials "%s", forwarding to "%s/%s"', $this->context->getModuleName(), $this->context->getActionName(), sfYaml::dump($credential, 0), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action')))));
         }
         // the user doesn't have access
         $this->forwardToSecureAction();
     }
     // the user has access, continue
     $filterChain->execute();
 }
  /**
   * Executes this filter.
   *
   * @param sfFilterChain $filterChain A sfFilterChain instance
   */
  public function execute($filterChain)
  {
    // execute next filter
    $filterChain->execute();

    // execute this filter only once
    $response = $this->context->getResponse();

    // include javascripts and stylesheets
    $content = $response->getContent();
    if (false !== ($pos = strpos($content, '</head>')))
    {
      $this->context->getConfiguration()->loadHelpers(array('Tag', 'Asset'));
      $html = '';
      if (!sfConfig::get('symfony.asset.javascripts_included', false))
      {
        $html .= get_javascripts($response);
      }
      if (!sfConfig::get('symfony.asset.stylesheets_included', false))
      {
        $html .= get_stylesheets($response);
      }

      if ($html)
      {
        $response->setContent(substr($content, 0, $pos).$html.substr($content, $pos));
      }
    }

    sfConfig::set('symfony.asset.javascripts_included', false);
    sfConfig::set('symfony.asset.stylesheets_included', false);
  }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     // disable stateful security checking on signin and secure actions
     if (sfConfig::get('sf_login_module') == $this->context->getModuleName() && sfConfig::get('sf_login_action') == $this->context->getActionName() || sfConfig::get('sf_secure_module') == $this->context->getModuleName() && sfConfig::get('sf_secure_action') == $this->context->getActionName()) {
         $filterChain->execute();
         return;
     }
     $sf_user = $this->context->getUser();
     // retrieve the current action
     $action = $this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();
     // get the current module and action names
     $module_name = sfInflector::camelize($action->getModuleName());
     $action_name = sfInflector::camelize($action->getActionName());
     // get the object for the current route
     $object = $this->getObjectForRoute($action->getRoute());
     // i.e.: canIndexDefault
     $method = "can{$action_name}{$module_name}";
     // if the method exist
     if (method_exists($sf_user, $method)) {
         // execute it
         if (!$sf_user->{$method}($object)) {
             $this->forwardToSecureAction();
         }
     } else {
         // get the default policy
         $default_policy = $this->getParameter('default_policy', 'allow');
         // if the default policy is not 'allow'
         if ($default_policy != 'allow') {
             $this->forwardToSecureAction();
         }
     }
     $filterChain->execute();
     return;
 }
 /**
  * Insert appropriate experiment code.
  * 
  * @throws  sfConfigurationException If the configured experiment type cannot be found
  * 
  * @param   sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $filterChain->execute();
     // connect to each active experiment
     $prefix = 'app_sf_google_website_optimizer_plugin_';
     if (sfConfig::get($prefix . 'enabled', false)) {
         $request = $this->context->getRequest();
         $response = $this->context->getResponse();
         foreach (sfConfig::get($prefix . 'experiments', array()) as $name => $param) {
             // merge default with configured parameters
             $param = array_merge(array('enabled' => true, 'type' => null, 'key' => null, 'uacct' => sfConfig::get($prefix . 'uacct'), 'pages' => array()), $param);
             if ($param['enabled']) {
                 // determine experiment class
                 $classes = sfConfig::get($prefix . 'classes', array());
                 $classes = array_merge(array('ab' => 'sfGWOExperimentAB', 'multivariate' => 'sfGWOExperimentMultivariate'), $classes);
                 if (isset($classes[$param['type']])) {
                     $class = $classes[$param['type']];
                     $experiment = new $class($name, $param);
                     if ($experiment->connect($request)) {
                         $experiment->insertContent($response);
                     }
                 } else {
                     throw new sfConfigurationException(sprintf('The experiment type "%s" was not found.', $param['type']));
                 }
             }
         }
     }
 }
 /**
  *
  * @param sfFilterChain $filterChain 
  */
 public function execute($filterChain)
 {
     // check to make sure the plugin is enabled, plugin is disabled by default
     if (!sfConfig::get('app_sf_guard_extra_plugin_enabled', false)) {
         $filterChain->execute();
         return;
     }
     // no point in check if user is logged in =\ or if the are going to the locked out module/action
     if (!$this->getContext()->getUser()->isAuthenticated() || sfConfig::get('app_sf_guard_extra_plugin_locked_out_module') == $this->getContext()->getModuleName() && sfConfig::get('app_sf_guard_extra_plugin_locked_out_action') == $this->getContext()->getActionName()) {
         $this->checkIfLockedOut();
     }
     // check to see if user is trying to login
     if (!$this->getContext()->getUser()->isAuthenticated() && sfConfig::get('sf_login_module') == $this->getContext()->getModuleName() && sfConfig::get('sf_login_action') == $this->getContext()->getActionName() && 'POST' == $this->getContext()->getRequest()->getMethod()) {
         /**
          * NOTE: in the future it may be possible to use the form, bind the values,
          *       and check to see if it is valid here. This is worth looking into
          *       so the plugin doesn't need to modify any other files.
          */
         if (sfConfig::get('sf_logging_enabled')) {
             $this->getContext()->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('"%s" ("%s") failed trying to login', $this->getUserIP(), $this->getUserHost()))));
         }
     }
     // check to see if the user is logged in if their password will expire soon
     if ($this->getContext()->getUser()->isAuthenticated()) {
         $this->checkIfPassExpired();
     }
     // user has access to continue
     $filterChain->execute();
 }
Пример #7
0
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     if ($this->request->getParameter('dm_embed')) {
         sfConfig::set('dm_admin_embedded', true);
         sfConfig::set('dm_toolBar_enabled', false);
     }
     $this->saveApplicationUrl();
     $this->loadAssetConfig();
     if (sfConfig::get('dm_admin_embedded')) {
         $this->response->addStylesheet('admin.embed', 'last');
         $this->getContext()->getEventDispatcher()->connect('admin.save_object', array($this, 'listenToAdminSaveObjectWhenEmbedded'));
     }
     $this->updateLock();
     $filterChain->execute();
     if (sfConfig::get('dm_admin_embedded')) {
         $this->response->addStylesheet('admin.embed');
     } else {
         // If response has no title, generate one with the H1
         if ($this->response->isHtmlForHuman() && !$this->response->getTitle()) {
             preg_match('|<h1[^>]*>(.*)</h1>|iuUx', $this->response->getContent(), $matches);
             if (isset($matches[1])) {
                 $title = 'Admin : ' . strip_tags($matches[1]) . ' - ' . dmConfig::get('site_name');
                 $this->response->setContent(str_replace('<title></title>', '<title>' . $title . '</title>', $this->response->getContent()));
             }
         }
     }
 }
 /**
  * Executes filter chain
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     if ($this->isFirstCall()) {
         $context = $this->getContext();
         $request = $context->getRequest();
         $response = $context->getResponse();
         $user = $context->getUser();
         $cookieName = sfConfig::get('app_translation_cookie', 'myCulture');
         //get the user's preferred browser language
         $culture = $request->getPreferredCulture(sfConfig::get('sf_translations_available', array()));
         $this->log(sprintf('Browser language is %s', $culture));
         //override with a user cookie language if it exists
         if ($request->getCookie($cookieName)) {
             $culture = $request->getCookie($cookieName);
             $this->log(sprintf('Overriding culture %s from culture cookie', $culture));
         }
         //has the user overridden the language manually?
         if ($request->getParameter('sf_culture') && in_array(strtolower($request->getParameter('sf_culture')), array_map('strtolower', sfConfig::get('sf_translations_available', array())))) {
             //set the language for this request, so you don't have to refresh
             $culture = $request->getParameter('sf_culture');
             //update the cookie with the new language for future requests
             $response->setCookie($cookieName, $culture, time() + 60 * 60 * 24 * 30 * 12 * 30, '/');
             $this->log(sprintf('Culture manually overridden to %s', $culture));
         }
         $this->log(sprintf('Applying culture: %s for this session', $culture));
         $user->setCulture($culture);
         sfConfig::set('sf_current_culture', $culture);
         $context->getResponse()->addMeta('language', $culture, true);
     }
     $filterChain->execute();
 }
Пример #9
0
    /**
     *
     * @param sfFilterChain $filterChain
     */
    public function execute($filterChain)
    {
        //Ha be van kapcsolva a Schacc login és
        //Ha nem is akar bejeletkezni, akkor nincs semmi dolgunk, mehet tovább a lánc
        if (!sfConfig::get('sf_Schacc_enable') || !$this->isSignin()) {
            $filterChain->execute();
            return;
        }
        $post = $this->getPostParameter('signin');
        $user = Doctrine::getTable('SchaccUser')->findOneBy('username', $post['username']);
        //Ha van lokális user, ami nem schacc-al került be
        //Ezt nem a mi dolgunk kezelni, továbbküldjük
        if ($user && !$user->is_schacc) {
            $filterChain->execute();
            //ha ide eljutunk azt jelenti, hogy nem sikerült autentikálni lokális adatbázisból
            //ezt később figyelembe kell vennünk
            $has_local_non_schacc_acc = true;
        }
        //Schacc autentikáció
        $this->form = new sfGuardFormSignin();
        $this->form->getValidatorSchema()->setPostValidator(new sfSchaccValidatorUser());
        $this->form->bind($post);
        if ($this->form->isValid()) {
            //sikerült autentikálni a Schacc-t
            if ($has_local_non_schacc_acc) {
                //ha ide jutunk az nagy baj
                //azt jelenti, hogy valaki egy Schacc-al próbált bejelentkezni
                //de már van egy ugyan olyan felhasználó nevű, de más jelszavú user,
                //aki korábban nem Schaccal lépett be,
                //hanem regisztrált
                //erről nem tudhatjuk biztosan, hogy Ő-e, így figyelmeztetjük
                throw new Exception(<<<EOF
                    Schaccal próbáltál bejelentkezni, 
                    de már van egy ilyen nevű user az adatbázisban,
                    aki korábban regisztrált.
                    Ha Te vagy ez a meglévő felhasználó,
                    lépj be a regisztrációnál megadott jelszavaddal.
                    Ha nem Te vagy, akkor sajnos más olyan felhasználónevet választott,
                    ami a Te Schaccod. Kérlek regisztrálj egy másik névvel.
EOF
);
            }
            $values = $this->form->getValues();
            //Ha nem volt eddig ilyen user
            if (!$user) {
                $user = new SchaccUser();
                $user->username = $values['username'];
            }
            $this->updateProfile($user, $post);
            $this->getUser()->signin($user, array_key_exists('remember', $values) ? $values['remember'] : false);
            // always redirect to a URL set in app.yml
            // or to the referer
            // or to the homepage
            $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user->getReferer(''));
            $this->getContext()->getController()->redirect('' != $signinUrl ? $signinUrl : '@homepage');
        }
        $filterChain->execute();
    }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     if ($this->isFirstCall() && !$this->context->getUser()->isAuthenticated()) {
         if ($memberId = $this->context->getUser()->getRememberedMemberId()) {
             $this->context->getUser()->login($memberId);
         }
     }
     $filterChain->execute();
 }
Пример #11
0
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain The filter chain.
  */
 public function execute($filterChain)
 {
     if (!\Altumo\Http\IncomingHttpRequest::isSecure()) {
         if (\sfConfig::get('app_require_ssl') === true) {
             header('Location: https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
             exit;
         }
     }
     $filterChain->execute();
 }
 public function execute(sfFilterChain $filterChain)
 {
     $module = $this->getContext()->getModuleName();
     $action = $this->getContext()->getActionName();
     $actionsStack = PluginExecutionManager::instance()->getPreExecuteMethodStack($module, $action);
     $this->performServiceOpteration($actionsStack, self::PRE_EXEC);
     $filterChain->execute();
     $actionsStack = PluginExecutionManager::instance()->getPostExecuteMethodStack($module, $action);
     $this->performServiceOpteration($actionsStack, self::POST_EXEC);
 }
 /**
  * Executes the filter chain, returning the response content with an additional admin toolbar.
  * 
  * @param sfFilterChain $filterChain
  */
 public function execute(sfFilterChain $filterChain)
 {
     $filterChain->execute();
     $context = sfContext::getInstance();
     $user = $context->getUser();
     $ph = $context->getRequest()->getParameterHolder();
     if ($ph->get('module') === 'rtShopCategory' && $ph->get('action') === 'show') {
         $user->setAttribute('rt_shop_category_id', $ph->get('id'));
     }
 }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     $request = $this->context->getRequest();
     if (!$request->isMobile()) {
         if (!$this->isErrorAction()) {
             $this->forwardToErrorAction();
         }
     }
     $filterChain->execute();
 }
Пример #15
0
 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $cookieName = sfConfig::get('dm_security_remember_cookie_name', 'dm_remember_' . dmProject::getHash());
     if ($this->isFirstCall() && $this->user->isAnonymous() && ($cookie = $this->request->getCookie($cookieName))) {
         $q = Doctrine_Core::getTable('DmRememberKey')->createQuery('r')->innerJoin('r.User u')->where('r.remember_key = ?', $cookie);
         if ($q->count()) {
             $this->user->signIn($q->fetchOne()->get('User'));
         }
     }
     $filterChain->execute();
 }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain The filter chain
  */
 public function execute($filterChain)
 {
     $routing = $this->context->getRouting();
     $routes = $routing->getRoutes();
     $routeName = $routing->getCurrentRouteName();
     $variables = $routes[$routeName]->getDefaults();
     if (isset($variables['noindex']) && $variables['noindex']) {
         $this->context->getResponse()->addMeta('robots', 'noindex,nofollow');
     }
     $filterChain->execute();
 }
 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $cookieName = sfConfig::get('app_sf_com_guard_plugin_remember_cookie_name', 'sfRemember');
     if ($this->isFirstCall() && $this->context->getUser()->isAnonymous() && ($cookie = $this->context->getRequest()->getCookie($cookieName))) {
         $q = Doctrine_Query::create()->from('sfObjectGuardRememberKey r')->innerJoin('r.User u')->where('r.remember_key = ?', $cookie);
         if ($q->count()) {
             $this->context->getUser()->signIn($q->fetchOne()->User);
         }
     }
     $filterChain->execute();
 }
 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $cookieName = sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember');
     if ($this->isFirstCall() && $this->context->getUser()->isAnonymous() && ($cookie = $this->context->getRequest()->getCookie($cookieName))) {
         $q = Doctrine_Core::getTable('sfGuardUser')->createQuery('u')->select('u.*')->innerJoin('u.RememberKeys r')->where('u.is_active = ?', true)->addWhere('r.remember_key = ?', $cookie);
         if ($q->count()) {
             $this->context->getUser()->signIn($q->fetchOne());
         }
     }
     $filterChain->execute();
 }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     $current = $this->context->getRouting()->getCurrentRouteName();
     $configName = 'enable_' . $this->getParameter('app', 'pc');
     if (!opConfig::get($configName)) {
         if ($current !== 'error') {
             $this->context->getController()->redirect('@error');
             throw new sfStopException();
         }
     }
     $filterChain->execute();
 }
Пример #20
0
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     // execute this filter only once, if cache is set and no GET or POST parameters
     if (!sfConfig::get('sf_cache')) {
         $filterChain->execute();
         return;
     }
     if ($this->executeBeforeExecution()) {
         $filterChain->execute();
     }
     $this->executeBeforeRendering();
 }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     $request = $this->context->getRequest();
     if (!$request->isMobile() && !$this->isErrorAction()) {
         if ($url = $this->generatePcFrontendUrl()) {
             $this->redirect($url);
         } else {
             $this->forwardToErrorAction();
         }
     }
     $filterChain->execute();
 }
 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $cookieName = sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember');
     $currentPath = trim($this->context->getRequest()->getPathInfo(), "/");
     $loginPath = sfConfig::get('app_sf_guard_plugin_signin_url_path');
     if ($this->isFirstCall() && $this->context->getUser()->isAnonymous() && strcmp($currentPath, $loginPath) != 0 && ($cookie = $this->context->getRequest()->getCookie($cookieName))) {
         $q = Doctrine_Core::getTable('sfGuardRememberKey')->createQuery('r')->innerJoin('r.User u')->where('r.remember_key = ?', $cookie);
         if ($q->count()) {
             $this->context->getUser()->signIn($q->fetchOne()->User);
         }
     }
     $filterChain->execute();
 }
 /**
  * This filter will check if the current connected user has the configured credential in
  * order to load the admin javascript and css files
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     if ($this->isFirstCall()) {
         // load plugin assets if
         //   1) The credential was specified and the user has it
         //   2) No credential was specified, but the user is at least authenticated
         $credential = sfConfig::get('app_sfDoctrineEditableComponentPlugin_admin_credential', 'editable_content_admin');
         if ($credential && $this->context->getUser()->hasCredential($credential) || $credential === false && $this->context->getUser()->isAuthenticated()) {
             $this->addPluginAssets();
         }
     }
     $filterChain->execute();
 }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     // This filter should affect only real mobile phone
     if (sfConfig::get('sf_environment') === 'test') {
         $filterChain->execute();
         return null;
     }
     $this->convertEmojiForInput();
     $this->convertEncodingForInput();
     $filterChain->execute();
     $this->convertEmptyElementsForHTML4();
     $this->convertEncodingForOutput();
     $this->outputContentTypeHeader();
 }
 /**
  * Executes the authorization filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     $moduleName = $this->context->getModuleName();
     $actionName = $this->context->getActionName();
     // disable security on login and secure actions
     if (sfConfig::get('sf_login_module') == $moduleName && sfConfig::get('sf_login_action') == $actionName || sfConfig::get('sf_secure_module') == $moduleName && sfConfig::get('sf_secure_action') == $actionName || 'auth' == $moduleName && ($actionName == 'retryLogin' || $actionName == 'validateCredentials' || $actionName == 'logout')) {
         $filterChain->execute();
         return;
     }
     $logger = Logger::getLogger('filter.ohrmAuthorizationFilter');
     try {
         $userRoleManager = UserRoleManagerFactory::getUserRoleManager();
         $this->context->setUserRoleManager($userRoleManager);
     } catch (Exception $e) {
         $logger->error('Exception: ' . $e);
         $this->forwardToSecureAction();
     }
     // disable security on non-secure actions
     try {
         $secure = $this->context->getController()->getActionStack()->getLastEntry()->getActionInstance()->getSecurityValue('is_secure');
         if (!$secure || $secure === "false" || $secure === "off") {
             $filterChain->execute();
             return;
         }
     } catch (sfStopException $e) {
         // sfStopException is a symfony internal exception and
         //  shouldn't be treated as a normal exception
         throw $e;
     } catch (Exception $e) {
         $logger->error('Error getting is_secure value for action: ' . $e);
         $this->forwardToSecureAction();
     }
     try {
         $permissions = $userRoleManager->getScreenPermissions($moduleName, $actionName);
     } catch (Exception $e) {
         $logger->error('Exception: ' . $e);
         $this->forwardToSecureAction();
     }
     // user does not have read permissions
     if (!$permissions->canRead()) {
         $logger->warn('User does not have access read access to ' . $moduleName . ' - ' . $actionName);
         // the user doesn't have access
         $this->forwardToSecureAction();
     } else {
         // set permissions in context
         $this->context->set('screen_permissions', $permissions);
     }
     // the user has access, continue
     $filterChain->execute();
 }
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain The filter chain.
  *
  * @throws <b>sfInitializeException</b> If an error occurs during view initialization
  * @throws <b>sfViewException</b>       If an error occurs while executing the view
  */
 public function execute($filterChain)
 {
     if ($this->isFirstCall()) {
         ob_start(array("sfErrorHandler", "fatal_error_handler"));
         // if we're in a prod environment we want E_ALL, but not to fail on E_NOTICE, E_WARN or E_STRICT
         if (!sfConfig::get('sf_debug')) {
             set_error_handler(array("sfErrorHandler", "error_handler"), sfConfig::get('sf_error_reporting', E_ALL & ~E_NOTICE & ~E_WARN));
             //$this->log("set error_reporting to : " . sfConfig::get('sf_error_reporting', E_ALL & ~E_NOTICE));
         } else {
             // get from config or default to E_ALL without E_NOTICE (those E_NOTICEs can get annoying...)
             set_error_handler(array("sfErrorHandler", "error_handler"), sfConfig::get('sf_error_reporting', E_ALL & ~E_NOTICE));
             //$this->log("set error_reporting to : " . sfConfig::get('sf_error_reporting', E_ALL & ~E_NOTICE));
         }
     }
     try {
         // execute next filter
         $filterChain->execute();
     } catch (sfLegacyErrorException $e) {
         ob_clean();
         // don't care what's in the buffer, we've got all we need
         throw new sfException($e->getMessage(), $e->getCode());
     } catch (sfStopException $e) {
         // do nothing, these are expected (and therefore need to be caught)
     } catch (sfError404Exception $e) {
         throw new sfError404Exception();
     } catch (ObjectNotFoundException $e) {
         throw new ObjectNotFoundException();
     } catch (Exception $e) {
         ob_clean();
         // don't care what's in the buffer, we've got all we need
         throw new sfException($e->getMessage(), $e->getCode());
     }
     if (ob_get_length()) {
         ob_end_clean();
         // no need for output buffering from here...
     }
     try {
         // get response object
         $response = $this->context->getResponse();
         // send headers
         if (method_exists($response, 'sendHttpHeaders')) {
             $response->sendHttpHeaders();
         }
         // send content
         $response->sendContent();
     } catch (sfLegacyErrorException $e) {
         // why does this always get thrown???
         //throw new sfException($e->getMessage(), $e->getCode())
     }
 }
 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $facebookUid = sfFacebookGraph::getCurrentUser();
     $user = $this->context->getUser();
     // check for logged in user
     if ($facebookUid && !$user->isFacebookConnected()) {
         sfFacebookGraphUserProfile::getCurrentFacebookUser($user);
     }
     // check for logged out
     if ($user->isFacebookAuthenticated() && !$user->isFacebookConnected()) {
         $user->signOut();
     }
     $filterChain->execute();
 }
 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $cookieName = sfConfig::get('app_doAuth_remember_cookie_name', 'doRemember');
     if ($this->isFirstCall() && $this->context->getUser()->isAnonymous() && ($cookie = $this->context->getRequest()->getCookie($cookieName))) {
         $value = unserialize(base64_decode($cookie));
         $user = Doctrine::getTable('User')->createQuery('u')->where('u.username = ?', $value[0])->fetchOne();
         if ($user) {
             if ($value[2] == doAuthTools::rememberHash($user)) {
                 $this->context->getUser()->signIn($q->fetchOne());
             }
         }
     }
     $filterChain->execute();
 }
 /**
  * Executes the filter chain.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     $config = sfConfig::getAll();
     $host = sfContext::getInstance()->getRequest()->getHost();
     foreach ($config as $key => $value) {
         if ($key == 'dm_' . $host) {
             foreach ($value as $subkey => $subval) {
                 $config['dm_' . $subkey] = $subval;
             }
         }
     }
     sfConfig::clear();
     sfConfig::add($config);
     $filterChain->execute();
 }
Пример #30
0
 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     $filterChain->execute();
     $response = $this->getContext()->getResponse();
     $request = $this->getContext()->getRequest();
     $content = $response->getContent();
     if (!$request->isMobile()) {
         list($list, $content) = opToolkit::replacePatternsToMarker($content);
     }
     $content = OpenPNE_KtaiEmoji::convertEmoji($content);
     if (!$request->isMobile()) {
         $content = str_replace(array_keys($list), array_values($list), $content);
     }
     $response->setContent($content);
 }