Changeset 2914:e4199034aa95 for inc/admin
- Timestamp:
- 01/12/15 11:32:24 (11 years ago)
- Branch:
- twig
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/prepend.php
r2911 r2914 24 24 function dc_load_locales() { 25 25 global $_lang, $core; 26 26 27 27 $_lang = $core->auth->getInfo('user_lang'); 28 28 $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_lang) ? $_lang : 'en'; 29 29 30 30 l10n::lang($_lang); 31 31 if (l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/date') === false && $_lang != 'en') { … … 40 40 { 41 41 global $core; 42 42 43 43 $core->auth->user_prefs->addWorkspace('interface'); 44 44 $user_ui_iconset = @$core->auth->user_prefs->interface->iconset; 45 45 if (($user_ui_iconset) && ($img)) { 46 46 $icon = false; 47 if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) || 47 if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) || 48 48 (preg_match('/^index\.php\?pf=(.+)$/',$img,$m))) { 49 49 if ($m[1]) { … … 73 73 # We have session information in constants 74 74 $_COOKIE[DC_SESSION_NAME] = DC_AUTH_SESS_ID; 75 75 76 76 if (!$core->auth->checkSession(DC_AUTH_SESS_UID)) { 77 77 throw new Exception('Invalid session data.'); 78 78 } 79 79 80 80 # Check nonce from POST requests 81 81 if (!empty($_POST)) … … 85 85 } 86 86 } 87 87 88 88 if (empty($_SESSION['sess_blog_id'])) { 89 89 throw new Exception('Permission denied.'); 90 90 } 91 91 92 92 # Loading locales 93 93 dc_load_locales(); 94 94 95 95 $core->setBlog($_SESSION['sess_blog_id']); 96 96 if (!$core->blog->id) { … … 108 108 $p[3] = '/'; 109 109 call_user_func_array('setcookie',$p); 110 110 111 111 http::redirect('auth.php'); 112 112 } … … 116 116 ,20); 117 117 } 118 118 119 119 # Check nonce from POST requests 120 120 if (!empty($_POST)) … … 127 127 } 128 128 } 129 129 130 130 if (!empty($_REQUEST['switchblog']) 131 131 && $core->auth->getPermissions($_REQUEST['switchblog']) !== false) … … 138 138 unset($_SESSION['media_manager_page']); 139 139 } 140 140 141 141 # Removing switchblog from URL 142 142 $redir = $_SERVER['REQUEST_URI']; … … 146 146 exit; 147 147 } 148 148 149 149 # Check blog to use and log out if no result 150 150 if (isset($_SESSION['sess_blog_id'])) … … 161 161 } 162 162 } 163 163 164 164 # Loading locales 165 165 dc_load_locales(); 166 166 167 167 if (isset($_SESSION['sess_blog_id'])) { 168 168 $core->setBlog($_SESSION['sess_blog_id']); … … 172 172 } 173 173 } 174 # Add admin default templates path 175 $core->loadTemplateEnvironment(); 176 $core->tpl->getLoader()->addPath(dirname(__FILE__).'/default-templates'); 177 # Set admin context 178 $_ctx = new dcAdminContext($core); 179 $core->tpl->addExtension($_ctx); 174 180 175 181 $core->adminurl = new dcAdminURL($core); … … 214 220 } 215 221 unset($f); 216 222 217 223 if (($hfiles = @scandir($locales_root.$_lang.'/help')) !== false) 218 224 { … … 235 241 # [] : Title, URL, small icon, large icon, permissions, id, class 236 242 # NB : '*' in permissions means any, null means super admin only 237 243 238 244 # Menus creation 239 245 $_menu = new ArrayObject(); … … 254 260 255 261 # Set menu titles 256 262 257 263 $_menu['System']->title = __('System settings'); 258 264 $_menu['Blog']->title = __('Blog'); … … 275 281 addMenuItem('Blog',__('New entry'),'admin.post','images/menu/edit.png', 276 282 $core->auth->check('usage,contentadmin',$core->blog->id)); 277 283 278 284 addMenuItem('System',__('Update'),'admin.update','images/menu/update.png', 279 285 $core->auth->isSuperAdmin() && is_readable(DC_DIGESTS)); … … 293 299 } 294 300 295 # Add admin default templates path 296 $core->tpl->getLoader()->addPath(dirname(__FILE__).'/default-templates'); 297 # Set admin context 298 $_ctx = new dcAdminContext($core); 299 $core->tpl->addExtension($_ctx); 301 300 302 301 303 # --BEHAVIOR-- adminPrepend
Note: See TracChangeset
for help on using the changeset viewer.