Dotclear


Ignore:
Timestamp:
01/12/15 11:32:24 (11 years ago)
Author:
Dsls
Branch:
twig
Message:

repaired admin.prepend.php, switch to latest twig version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/prepend.php

    r2911 r2914  
    2424function dc_load_locales() { 
    2525     global $_lang, $core; 
    26       
     26 
    2727     $_lang = $core->auth->getInfo('user_lang'); 
    2828     $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$_lang) ? $_lang : 'en'; 
    29       
     29 
    3030     l10n::lang($_lang); 
    3131     if (l10n::set(dirname(__FILE__).'/../../locales/'.$_lang.'/date') === false && $_lang != 'en') { 
     
    4040{ 
    4141     global $core; 
    42       
     42 
    4343     $core->auth->user_prefs->addWorkspace('interface'); 
    4444     $user_ui_iconset = @$core->auth->user_prefs->interface->iconset; 
    4545     if (($user_ui_iconset) && ($img)) { 
    4646          $icon = false; 
    47           if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) ||  
     47          if ((preg_match('/^images\/menu\/(.+)$/',$img,$m)) || 
    4848               (preg_match('/^index\.php\?pf=(.+)$/',$img,$m))) { 
    4949               if ($m[1]) { 
     
    7373     # We have session information in constants 
    7474     $_COOKIE[DC_SESSION_NAME] = DC_AUTH_SESS_ID; 
    75       
     75 
    7676     if (!$core->auth->checkSession(DC_AUTH_SESS_UID)) { 
    7777          throw new Exception('Invalid session data.'); 
    7878     } 
    79       
     79 
    8080     # Check nonce from POST requests 
    8181     if (!empty($_POST)) 
     
    8585          } 
    8686     } 
    87       
     87 
    8888     if (empty($_SESSION['sess_blog_id'])) { 
    8989          throw new Exception('Permission denied.'); 
    9090     } 
    91       
     91 
    9292     # Loading locales 
    9393     dc_load_locales(); 
    94       
     94 
    9595     $core->setBlog($_SESSION['sess_blog_id']); 
    9696     if (!$core->blog->id) { 
     
    108108               $p[3] = '/'; 
    109109               call_user_func_array('setcookie',$p); 
    110                 
     110 
    111111               http::redirect('auth.php'); 
    112112          } 
     
    116116               ,20); 
    117117     } 
    118       
     118 
    119119     # Check nonce from POST requests 
    120120     if (!empty($_POST)) 
     
    127127          } 
    128128     } 
    129       
     129 
    130130     if (!empty($_REQUEST['switchblog']) 
    131131     && $core->auth->getPermissions($_REQUEST['switchblog']) !== false) 
     
    138138               unset($_SESSION['media_manager_page']); 
    139139          } 
    140            
     140 
    141141          # Removing switchblog from URL 
    142142          $redir = $_SERVER['REQUEST_URI']; 
     
    146146          exit; 
    147147     } 
    148       
     148 
    149149     # Check blog to use and log out if no result 
    150150     if (isset($_SESSION['sess_blog_id'])) 
     
    161161          } 
    162162     } 
    163       
     163 
    164164     # Loading locales 
    165165     dc_load_locales(); 
    166       
     166 
    167167     if (isset($_SESSION['sess_blog_id'])) { 
    168168          $core->setBlog($_SESSION['sess_blog_id']); 
     
    172172     } 
    173173} 
     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); 
    174180 
    175181$core->adminurl = new dcAdminURL($core); 
     
    214220     } 
    215221     unset($f); 
    216       
     222 
    217223     if (($hfiles = @scandir($locales_root.$_lang.'/help')) !== false) 
    218224     { 
     
    235241     # [] : Title, URL, small icon, large icon, permissions, id, class 
    236242     # NB : '*' in permissions means any, null means super admin only 
    237       
     243 
    238244     # Menus creation 
    239245     $_menu = new ArrayObject(); 
     
    254260 
    255261     # Set menu titles 
    256       
     262 
    257263     $_menu['System']->title = __('System settings'); 
    258264     $_menu['Blog']->title = __('Blog'); 
     
    275281     addMenuItem('Blog',__('New entry'),'admin.post','images/menu/edit.png', 
    276282          $core->auth->check('usage,contentadmin',$core->blog->id)); 
    277       
     283 
    278284     addMenuItem('System',__('Update'),'admin.update','images/menu/update.png', 
    279285          $core->auth->isSuperAdmin() && is_readable(DC_DIGESTS)); 
     
    293299} 
    294300 
    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 
    300302 
    301303# --BEHAVIOR-- adminPrepend 
Note: See TracChangeset for help on using the changeset viewer.

Sites map