예제 #1
0
파일: jsecure.php 프로젝트: 01J/topm
 function onAfterDispatch()
 {
     $app =& JFactory::getApplication();
     if (!$app->isAdmin()) {
         return true;
         // Dont run in admin
     }
     $config = new JConfig();
     $JSecureConfig = new JSecureConfig();
     $app =& JFactory::getApplication();
     $path = '';
     $path .= $JSecureConfig->options == 1 ? JURI::root() . $JSecureConfig->custom_path : JURI::root();
     $jsecure = new jsecure();
     $publish = $JSecureConfig->publish;
     if (!$publish) {
         return true;
     }
     $session =& JFactory::getSession();
     $checkedKey = $session->get('jSecureAuthentication');
     if (!empty($checkedKey)) {
         return true;
     }
     $submit = JRequest::getVar('submit', '');
     $passkey = $JSecureConfig->key;
     if ($submit == 'submit') {
         $resultFormAction = jsecure::formAction($JSecureConfig);
         if (!empty($resultFormAction)) {
             $session->set('jSecureAuthentication', 1);
             $link = JURI::root() . "administrator/index.php?option=com_login";
             $app->redirect($link);
         } else {
             $app->redirect($path);
         }
     }
     $resultBloackIPs = jsecure::checkIps($JSecureConfig);
     if (!$resultBloackIPs) {
         $app->redirect($path);
     }
     $task = $JSecureConfig->passkeytype;
     switch ($task) {
         case 'form':
             jsecure::displayForm();
             exit;
             break;
         case 'url':
         default:
             $resultUrlKey = jsecure::checkUrlKey($JSecureConfig);
             if (!empty($resultUrlKey)) {
                 $session->set('jSecureAuthentication', 1);
                 return true;
             } else {
                 $app->redirect($path);
             }
             break;
     }
 }
예제 #2
0
 function onAfterDispatch()
 {
     $logout = self::$_configuration;
     $app =& JFactory::getApplication();
     if ($app->isAdmin()) {
         $config = new JConfig();
         $JSecureConfig = new JSecureConfig();
         $app =& JFactory::getApplication();
         $path = '';
         $path .= $JSecureConfig->options == 1 ? JURI::root() . $JSecureConfig->custom_path : JURI::root();
         $jsecure = new jsecure();
         $publish = $JSecureConfig->publish;
         if (!$publish) {
             return true;
         }
         $session =& JFactory::getSession();
         $checkedKey = $session->get('jSecureAuthentication');
         if (!empty($checkedKey)) {
             return true;
         }
         $submit = JRequest::getVar('submit', '');
         $passkey = $JSecureConfig->key;
         if ($submit == 'submit') {
             $resultFormAction = jsecure::formAction($JSecureConfig);
             if (!empty($resultFormAction)) {
                 $session->set('jSecureAuthentication', 1);
                 $link = JURI::root() . "administrator/index.php?option=com_login";
                 $app->redirect($link);
             } else {
                 $app->redirect($path);
             }
         }
         $resultBloackIPs = jsecure::checkIps($JSecureConfig);
         if (!$resultBloackIPs) {
             $app->redirect($path);
         }
         $task = $JSecureConfig->passkeytype;
         switch ($task) {
             case 'form':
                 jsecure::displayForm();
                 exit;
                 break;
             case 'url':
             default:
                 $session =& JFactory::getSession();
                 $resultUrlKey = jsecure::checkUrlKey($JSecureConfig);
                 if (!empty($resultUrlKey)) {
                     $session->set('jSecureAuthentication', 1);
                     return true;
                 } else {
                     $app->redirect($path);
                 }
                 break;
         }
     } else {
         /* starts meta tag control for front side */
         $JSecureConfig = new JSecureConfig();
         $document =& JFactory::getDocument();
         $publish = $JSecureConfig->publish;
         if (!$publish) {
             return true;
         }
         if ($JSecureConfig->metatagcontrol) {
             // Set global info in callback function
             $global_info['sitename'] = $app->getCfg('sitename');
             $document_info['title'] = $document->getTitle();
             $document_info['description'] = $document->getDescription();
             $document_info['keywords'] = $document->getMetaData('keywords');
             $document_info['author'] = $document->getMetaData('author');
             $document_info['rights'] = $document->getMetaData('rights');
             $document_info['generator'] = $document->getGenerator();
             $customgenerator = $document->getMetaData('generator');
             if ($JSecureConfig->metatag_generator) {
                 $document->setGenerator(str_replace('"', '"', $JSecureConfig->metatag_generator));
             }
             if ($JSecureConfig->metatag_keywords) {
                 $document->setMetaData('keywords', str_replace('"', '"', $JSecureConfig->metatag_keywords));
             }
             if ($JSecureConfig->metatag_description) {
                 $document->setDescription(str_replace('"', '"', $JSecureConfig->metatag_description));
             }
             if ($JSecureConfig->metatag_rights) {
                 $document->setMetaData('rights', str_replace('"', '"', $JSecureConfig->metatag_rights));
             }
         } else {
             return;
         }
     }
 }