Esempio n. 1
0
 /**
  * @return bool
  */
 public function checkAccess()
 {
     global $xoopsOption;
     if (INSTALL_USER != '' && INSTALL_PASSWORD != '') {
         if (!isset($_SERVER['PHP_AUTH_USER'])) {
             header('WWW-Authenticate: Basic realm="XOOPS Installer"');
             header('HTTP/1.0 401 Unauthorized');
             echo 'You can not access this XOOPS installer.';
             return false;
         }
         if (INSTALL_USER != '' && $_SERVER['PHP_AUTH_USER'] != INSTALL_USER) {
             header('HTTP/1.0 401 Unauthorized');
             echo 'You can not access this XOOPS installer.';
             return false;
         }
         if (INSTALL_PASSWORD != $_SERVER['PHP_AUTH_PW']) {
             header('HTTP/1.0 401 Unauthorized');
             echo 'You can not access this XOOPS installer.';
             return false;
         }
     }
     if (!isset($xoopsOption['checkadmin']) || !$xoopsOption['checkadmin']) {
         return true;
     }
     $xoops = Xoops::getInstance();
     if (!$xoops->isUser() && !empty($_COOKIE["xo_install_user"])) {
         install_acceptUser($_COOKIE["xo_install_user"]);
     }
     if (!$xoops->isUser()) {
         $xoops->redirect($xoops->url('user.php'));
     }
     if (!$xoops->isAdmin()) {
         return false;
     }
     return true;
 }
 function checkAccess()
 {
     if (INSTALL_USER != '' && INSTALL_PASSWORD != '') {
         if (!isset($_SERVER['PHP_AUTH_USER'])) {
             header('WWW-Authenticate: Basic realm="XOOPS Installer"');
             header('HTTP/1.0 401 Unauthorized');
             echo 'You can not access this XOOPS installer.';
             return false;
         }
         if (INSTALL_USER != '' && $_SERVER['PHP_AUTH_USER'] != INSTALL_USER) {
             header('HTTP/1.0 401 Unauthorized');
             echo 'You can not access this XOOPS installer.';
             return false;
         }
         if (INSTALL_PASSWORD != $_SERVER['PHP_AUTH_PW']) {
             header('HTTP/1.0 401 Unauthorized');
             echo 'You can not access this XOOPS installer.';
             return false;
         }
     }
     if (empty($GLOBALS['xoopsOption']['checkadmin'])) {
         return true;
     }
     if (empty($GLOBALS['xoopsUser']) && !empty($_COOKIE["xo_install_user"])) {
         install_acceptUser($_COOKIE["xo_install_user"]);
     }
     if (empty($GLOBALS['xoopsUser'])) {
         redirect_header("../user.php");
     }
     if (!$GLOBALS['xoopsUser']->isAdmin()) {
         return false;
     }
     return true;
 }