diff options
-rw-r--r-- | ratatoeskr/backend.php | 5 | ||||
-rw-r--r-- | ratatoeskr/sys/models.php | 20 |
2 files changed, 21 insertions, 4 deletions
diff --git a/ratatoeskr/backend.php b/ratatoeskr/backend.php index be03fc7..0a33dbc 100644 --- a/ratatoeskr/backend.php +++ b/ratatoeskr/backend.php @@ -15,8 +15,6 @@ require_once(dirname(__FILE__) . "/sys/textprocessors.php"); require_once(dirname(__FILE__) . "/sys/plugin_api.php"); require_once(dirname(__FILE__) . "/languages.php"); -$admin_grp = NULL; - /* Mass creation of tags. */ function maketags($tagnames, $lang) { @@ -53,8 +51,7 @@ $backend_subactions = url_action_subactions(array( { global $ratatoeskr_settings, $admin_grp, $ste, $languages; - if($admin_grp === NULL) - $admin_grp = Group::by_name("admins"); + Group::load_admin_group(); $ste->vars["all_languages"] = array(); $ste->vars["all_langcodes"] = array(); diff --git a/ratatoeskr/sys/models.php b/ratatoeskr/sys/models.php index 44367dd..17afa67 100644 --- a/ratatoeskr/sys/models.php +++ b/ratatoeskr/sys/models.php @@ -42,10 +42,19 @@ $imagetype_file_extensions = array( * "comment_textprocessor" - The textprocessor to be used for comments. * "languages" - Array of activated languages. * "last_db_cleanup" - Timestamp of the last database cleanup. + * "debugmode" - If the debug mode is enabled (can be overwritten by <config.php>. */ $ratatoeskr_settings = NULL; /* + * Variable: $admin_grp + * Since the admin group is used often, here is a global variable holding the <Group>. + * + * Use <Group>::load_admin_group to load this group. + */ +$admin_grp = NULL; + +/* * Constants: ARTICLE_STATUS_ * Possible <Article>::$status values. * @@ -509,6 +518,17 @@ class Group extends BySQLRowEnabled } /* + * Function: load_admin_group + * Will load the admin group into the global <$admin_grp> variable, if not already done. + */ + public static function load_admin_group() + { + global $admin_grp; + if($admin_grp === NULL) + $admin_grp = Group::by_name("admins"); + } + + /* * Function: get_id * Returns: * The group ID. |