예제 #1
0
 public static function getCurrentBranchId()
 {
     if (!isset($_SESSION['Approved_Branch'])) {
         if (!Branch::checkCurrentBranch()) {
             return null;
         }
     }
     return $_SESSION['Approved_Branch']['id'];
 }
예제 #2
0
 /**
  * Returns true if the site is a hub or if the site is
  * an allowed branch. If false is returned, the index file
  * drops the user to an error page. Also sets the Allow_Entry GLOBAL.
  */
 public static function checkBranch()
 {
     if (isset($GLOBALS['Allow_Entry'])) {
         return $GLOBALS['Allow_Entry'];
     } elseif (PHPWS_SOURCE_DIR == PHPWS_HOME_DIR) {
         $GLOBALS['Allow_Entry'] = true;
         return true;
     } else {
         if (!PHPWS_Core::initModClass('branch', 'Branch.php')) {
             PHPWS_Error::log(PHPWS_HUB_IDENTITY, 'core', 'Cannot load Branch class');
             return false;
         }
         if (Branch::checkCurrentBranch()) {
             $GLOBALS['Allow_Entry'] = true;
             return true;
         } else {
             PHPWS_Error::log(PHPWS_HUB_IDENTITY, 'core', 'Hash not found: ' . SITE_HASH . ' from ' . getcwd());
             return false;
         }
     }
 }