public static function getCurrentBranchId() { if (!isset($_SESSION['Approved_Branch'])) { if (!Branch::checkCurrentBranch()) { return null; } } return $_SESSION['Approved_Branch']['id']; }
/** * 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; } } }