public static function siteOffline($object) { if (modOpts::GetOption('site_online')) { return; } if (flag_is_set($object->GetOptions(), PERSISTENT)) { return; } $parent = get_class($object); if (isset(self::$states[$parent]) && self::$states[$parent]) { return; } if (uUserRoles::IsAdmin()) { return; } // site admin if ($object instanceof iAdminModule) { return; } uConfig::DownMaintenance(); }
public function flag_is_set($flag, $field = null) { if ($field && isset($this->fields[$field]['options'])) { return flag_is_set($this->fields[$field]['options'], $flag); } return parent::flag_is_set($flag); }
public static function AssertAdminUser() { // admin user exists? $obj = utopia::GetInstance('uUsersList'); $obj->BypassSecurity(true); $rec = $obj->LookupRecord(array('role' => -1, 'validated' => 1), true); $obj->BypassSecurity(false); if ($rec) { return; } // module is persist? $curr = utopia::GetInstance(utopia::GetCurrentModule()); if (flag_is_set($curr->GetOptions(), PERSISTENT)) { return; } // redirect to this module $o = utopia::GetInstance(__CLASS__); $o->AssertURL(307, false); }
static function SetCurrentModule($module) { if (!self::ModuleExists($module)) { return; } $cm = utopia::GetCurrentModule(); $o = utopia::GetInstance($cm); if (flag_is_set($o->GetOptions(), PERSISTENT)) { return; } utopia::SetVar('current_module', $module); }
public static function checkLogin($object) { if (flag_is_set($object->GetOptions(), PERSISTENT)) { return; } if (uEvents::TriggerEvent('CanAccessModule', $object) !== FALSE) { return; } if (self::IsLoggedIn()) { uNotices::AddNotice('Sorry, you do not have access to this feature.', NOTICE_TYPE_WARNING); return FALSE; } $parent = get_class($object); if ($parent == utopia::GetCurrentModule() && $parent !== __CLASS__ && !AjaxEcho('window.location.reload();')) { utopia::QueueLauncher(__CLASS__); //$obj = utopia::GetInstance(__CLASS__); //$obj->_RunModule(); } return FALSE; }