includes/paths.php
changeset 505 3b5b78182ce5
parent 499 6b7fdd898ba3
child 507 586fd7d3202d
equal deleted inserted replaced
504:bc8e0e9ee01d 505:3b5b78182ce5
    76     $session->register_acl_type('html_in_pages',          AUTH_DISALLOW, 'perm_html_in_pages',          Array('edit_page'),                                       'Article|User|Project|Template|File|Help|System|Category|Admin');
    76     $session->register_acl_type('html_in_pages',          AUTH_DISALLOW, 'perm_html_in_pages',          Array('edit_page'),                                       'Article|User|Project|Template|File|Help|System|Category|Admin');
    77     $session->register_acl_type('php_in_pages',           AUTH_DISALLOW, 'perm_php_in_pages',           Array('edit_page', 'html_in_pages'),                      'Article|User|Project|Template|File|Help|System|Category|Admin');
    77     $session->register_acl_type('php_in_pages',           AUTH_DISALLOW, 'perm_php_in_pages',           Array('edit_page', 'html_in_pages'),                      'Article|User|Project|Template|File|Help|System|Category|Admin');
    78     $session->register_acl_type('edit_acl',               AUTH_DISALLOW, 'perm_edit_acl',               Array('read', 'post_comments', 'edit_comments', 'edit_page', 'view_source', 'mod_comments', 'history_view', 'history_rollback', 'history_rollback_extra', 'protect', 'rename', 'clear_logs', 'vote_delete', 'vote_reset', 'delete_page', 'set_wiki_mode', 'password_set', 'password_reset', 'mod_misc', 'edit_cat', 'even_when_protected', 'upload_files', 'upload_new_version', 'create_page', 'php_in_pages'));
    78     $session->register_acl_type('edit_acl',               AUTH_DISALLOW, 'perm_edit_acl',               Array('read', 'post_comments', 'edit_comments', 'edit_page', 'view_source', 'mod_comments', 'history_view', 'history_rollback', 'history_rollback_extra', 'protect', 'rename', 'clear_logs', 'vote_delete', 'vote_reset', 'delete_page', 'set_wiki_mode', 'password_set', 'password_reset', 'mod_misc', 'edit_cat', 'even_when_protected', 'upload_files', 'upload_new_version', 'create_page', 'php_in_pages'));
    79     
    79     
    80     // DO NOT add new admin pages here! Use a plugin to call $paths->addAdminNode();
    80     // DO NOT add new admin pages here! Use a plugin to call $paths->addAdminNode();
    81     $this->addAdminNode('adm_cat_general',    'adm_page_general_config', 'GeneralConfig');
    81     $this->addAdminNode('adm_cat_general',    'adm_page_general_config', 'GeneralConfig', scriptPath . '/images/icons/applets/generalconfig.png');
    82     $this->addAdminNode('adm_cat_general',    'adm_page_file_uploads',   'UploadConfig');
    82     $this->addAdminNode('adm_cat_general',    'adm_page_file_uploads',   'UploadConfig', scriptPath . '/images/icons/applets/uploadconfig.png');
    83     $this->addAdminNode('adm_cat_general',    'adm_page_file_types',     'UploadAllowedMimeTypes');
    83     $this->addAdminNode('adm_cat_general',    'adm_page_file_types',     'UploadAllowedMimeTypes', scriptPath . '/images/icons/applets/uploadallowedmimetypes.png');
    84     $this->addAdminNode('adm_cat_general',    'adm_page_plugins',        'PluginManager');
    84     $this->addAdminNode('adm_cat_general',    'adm_page_plugins',        'PluginManager', scriptPath . '/images/icons/applets/pluginmanager.png');
    85     $this->addAdminNode('adm_cat_general',    'adm_page_db_backup',      'DBBackup');
    85     $this->addAdminNode('adm_cat_general',    'adm_page_db_backup',      'DBBackup', scriptPath . '/images/icons/applets/dbbackup.png');
    86     $this->addAdminNode('adm_cat_general',    'adm_page_lang_manager',   'LangManager');
    86     $this->addAdminNode('adm_cat_general',    'adm_page_lang_manager',   'LangManager', scriptPath . '/images/icons/applets/langmanager.png');
    87     $this->addAdminNode('adm_cat_content',    'adm_page_manager',        'PageManager');
    87     $this->addAdminNode('adm_cat_content',    'adm_page_manager',        'PageManager', scriptPath . '/images/icons/applets/pagemanager.png');
    88     $this->addAdminNode('adm_cat_content',    'adm_page_editor',         'PageEditor');
    88     $this->addAdminNode('adm_cat_content',    'adm_page_editor',         'PageEditor', scriptPath . '/images/icons/applets/pageeditor.png');
    89     $this->addAdminNode('adm_cat_content',    'adm_page_pg_groups',      'PageGroups');
    89     $this->addAdminNode('adm_cat_content',    'adm_page_pg_groups',      'PageGroups', scriptPath . '/images/icons/applets/pagegroups.png');
    90     $this->addAdminNode('adm_cat_appearance', 'adm_page_themes',         'ThemeManager');
    90     $this->addAdminNode('adm_cat_appearance', 'adm_page_themes',         'ThemeManager', scriptPath . '/images/icons/applets/thememanager.png');
    91     $this->addAdminNode('adm_cat_users',      'adm_page_users',          'UserManager');
    91     $this->addAdminNode('adm_cat_users',      'adm_page_users',          'UserManager', scriptPath . '/images/icons/applets/usermanager.png');
    92     $this->addAdminNode('adm_cat_users',      'adm_page_user_groups',    'GroupManager');
    92     $this->addAdminNode('adm_cat_users',      'adm_page_user_groups',    'GroupManager', scriptPath . '/images/icons/applets/groupmanager.png');
    93     $this->addAdminNode('adm_cat_users',      'adm_page_coppa',          'COPPA');
    93     $this->addAdminNode('adm_cat_users',      'adm_page_coppa',          'COPPA', scriptPath . '/images/icons/applets/coppa.png');
    94     $this->addAdminNode('adm_cat_users',      'adm_page_mass_email',     'MassEmail');
    94     $this->addAdminNode('adm_cat_users',      'adm_page_mass_email',     'MassEmail', scriptPath . '/images/icons/applets/massemail.png');
    95     $this->addAdminNode('adm_cat_security',   'adm_page_security_log',   'SecurityLog');
    95     $this->addAdminNode('adm_cat_security',   'adm_page_security_log',   'SecurityLog', scriptPath . '/images/icons/applets/securitylog.png');
    96     $this->addAdminNode('adm_cat_security',   'adm_page_ban_control',    'BanControl');
    96     $this->addAdminNode('adm_cat_security',   'adm_page_ban_control',    'BanControl', scriptPath . '/images/icons/applets/bancontrol.png');
    97     
    97     
    98     $code = $plugins->setHook('acl_rule_init');
    98     $code = $plugins->setHook('acl_rule_init');
    99     foreach ( $code as $cmd )
    99     foreach ( $code as $cmd )
   100     {
   100     {
   101       eval($cmd);
   101       eval($cmd);
   455     global $lang;
   455     global $lang;
   456     
   456     
   457     $k = array_keys($this->admin_tree);
   457     $k = array_keys($this->admin_tree);
   458     $i = 0;
   458     $i = 0;
   459     $ret = '';
   459     $ret = '';
   460     $ret .= "var TREE_ITEMS = [\n  ['" . $lang->get('adm_btn_home') . "', 'javascript:ajaxPage(\'".$this->nslist['Admin']."Home\');',\n    ";
   460     $icon = "<img alt=\"\" src=\"" . scriptPath . "/images/icons/applets/home.png\" style=\"border-width: 0; margin-right: 3px;\" /> ";
       
   461     $icon = addslashes($icon);
       
   462     $ret .= "var TREE_ITEMS = [\n  ['$icon" . $lang->get('adm_btn_home') . "', 'javascript:ajaxPage(\'".$this->nslist['Admin']."Home\');',\n    ";
   461     foreach($k as $key)
   463     foreach($k as $key)
   462     {
   464     {
   463       $i++;
   465       $i++;
   464       $name = ( preg_match('/^[a-z0-9_]+$/', $key) ) ? $lang->get($key) : $key;
   466       $name = ( preg_match('/^[a-z0-9_]+$/', $key) ) ? $lang->get($key) : $key;
   465       $ret .= "['".$name."', 'javascript:trees[0].toggle($i)', \n";
   467       $ret .= "['".$name."', 'javascript:trees[0].toggle($i)', \n";
   466       foreach($this->admin_tree[$key] as $c)
   468       foreach($this->admin_tree[$key] as $c)
   467       {
   469       {
   468         $i++;
   470         $i++;
   469         $name = ( preg_match('/^[a-z0-9_]+$/', $key) ) ? $lang->get($c['name']) : $c['name'];
   471         $name = ( preg_match('/^[a-z0-9_]+$/', $key) ) ? $lang->get($c['name']) : $c['name'];
   470         
   472         if ( $c['icon'] && $c['icon'] != scriptPath . '/images/spacer.gif' )
   471         $ret .= "        ['".$name."', 'javascript:ajaxPage(\\'".$this->nslist['Admin'].$c['pageid']."\\');'],\n";
   473         {
       
   474           $icon = "<img alt=\"\" src=\"{$c['icon']}\" style=\"border-width: 0; margin-right: 3px;\" /> ";
       
   475         }
       
   476         else
       
   477         {
       
   478           $icon = '';
       
   479         }
       
   480         $icon = addslashes($icon);
       
   481         $ret .= "        ['$icon$name', 'javascript:ajaxPage(\\'".$this->nslist['Admin'].$c['pageid']."\\');'],\n";
   472       }
   482       }
   473       $ret .= "      ],\n";
   483       $ret .= "      ],\n";
   474     }
   484     }
   475     $ret .= "    ['" . $lang->get('adm_btn_logout') . "', 'javascript:ajaxPage(\\'".$this->nslist['Admin']."AdminLogout\\');'],\n";
   485     $icon = "<img alt=\"\" src=\"" . scriptPath . "/images/icons/applets/adminlogout.png\" style=\"border-width: 0; margin-right: 3px;\" /> ";
       
   486     $icon = addslashes($icon);
       
   487     $ret .= "    ['$icon" . $lang->get('adm_btn_logout') . "', 'javascript:ajaxPage(\\'".$this->nslist['Admin']."AdminLogout\\');'],\n";
   476     $ret .= "    ['<span id=\\'keepalivestat\\'>" . $lang->get('adm_btn_keepalive_loading') . "</span>', 'javascript:ajaxToggleKeepalive();', 
   488     $ret .= "    ['<span id=\\'keepalivestat\\'>" . $lang->get('adm_btn_keepalive_loading') . "</span>', 'javascript:ajaxToggleKeepalive();', 
   477                    ['" . $lang->get('adm_btn_keepalive_about') . "', 'javascript:aboutKeepAlive();']
   489                    ['" . $lang->get('adm_btn_keepalive_about') . "', 'javascript:aboutKeepAlive();']
   478                  ],\n";
   490                  ],\n";
   479     // I used this while I painstakingly wrote the Runt code that auto-expands certain nodes based on the value of a bitfield stored in a cookie. *shudders*
   491     // I used this while I painstakingly wrote the Runt code that auto-expands certain nodes based on the value of a bitfield stored in a cookie. *shudders*
   480     // $ret .= "    ['(debug) Clear menu bitfield', 'javascript:createCookie(\\'admin_menu_state\\', \\'1\\', 365);'],\n";
   492     // $ret .= "    ['(debug) Clear menu bitfield', 'javascript:createCookie(\\'admin_menu_state\\', \\'1\\', 365);'],\n";
   481     $ret .= "]\n];";
   493     $ret .= "]\n];";
   482     return $ret;
   494     return $ret;
   483   }
   495   }
   484   function addAdminNode($section, $page_title, $url)
   496   
   485   {
   497   /**
       
   498    * Creates a new entry in the administration panel's navigation tree.
       
   499    * @param string Section name - if this is a language string identifier, it will be sent through $lang->get()
       
   500    * @param string The title of the page, also may be a language string identifier
       
   501    * @param string The page ID of the admin page, the namespace Admin is assumed
       
   502    * @param string Optional. The path to a 16x16 image that will be displayed as the icon for this admin page
       
   503    */
       
   504   
       
   505   function addAdminNode($section, $page_title, $url, $icon = false)
       
   506   {
       
   507     if ( !$icon )
       
   508     {
       
   509       $icon = scriptPath . '/images/spacer.gif';
       
   510     }
   486     if(!isset($this->admin_tree[$section]))
   511     if(!isset($this->admin_tree[$section]))
   487     {
   512     {
   488       $this->admin_tree[$section] = Array();
   513       $this->admin_tree[$section] = Array();
   489     }
   514     }
   490     $this->admin_tree[$section][] = Array(
   515     $this->admin_tree[$section][] = Array(
   491         'name'=>$page_title,
   516         'name' => $page_title,
   492         'pageid'=>$url
   517         'pageid' => $url,
       
   518         'icon' => $icon
   493       );
   519       );
   494   }
   520   }
   495   function getParam($id = 0)
   521   function getParam($id = 0)
   496   {
   522   {
   497     $title = $this->parse_url(false);
   523     $title = $this->parse_url(false);