private function redirectToLoginIfSslRequired(opWebRequest $request)
 {
     $routing = sfContext::getInstance()->getRouting();
     if (sfConfig::get('op_use_ssl', false) && !$request->isSecure()) {
         $app = sfConfig::get('sf_app');
         $sslRequiredList = sfConfig::get('op_ssl_required_actions', array($app => array()));
         $moduleName = sfConfig::get('sf_login_module');
         $actionName = sfConfig::get('sf_login_action');
         if (in_array($moduleName . '/' . $actionName, $sslRequiredList[$app])) {
             $nextUri = $routing->getCurrentInternalUri();
             if ($_SERVER['QUERY_STRING']) {
                 if (false !== strpos($nextUri, '?')) {
                     $nextUri .= '&';
                 } else {
                     $nextUri .= '?';
                 }
                 $nextUri .= $_SERVER['QUERY_STRING'];
             }
             $nextUriParam = array('next_uri' => $nextUri);
             $baseUrl = sfConfig::get('op_ssl_base_url');
             $scriptName = basename($request->getScriptName());
             $replacement = false !== strpos($request->getPathInfoPrefix(), $scriptName) ? '/' . $scriptName : '';
             $loginPath = str_replace($request->getPathInfoPrefix(), $replacement, $this->generateUrl('login'));
             $loginUrl = $baseUrl[$app] . $loginPath;
             $loginUrl .= '?' . http_build_query($nextUriParam, '', '&');
             $this->redirect($loginUrl);
         }
     }
 }