87 $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'); |
87 $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'); |
88 $session->register_acl_type('custom_user_title', AUTH_DISALLOW, 'perm_custom_user_title', Array(), 'User|Special'); |
88 $session->register_acl_type('custom_user_title', AUTH_DISALLOW, 'perm_custom_user_title', Array(), 'User|Special'); |
89 $session->register_acl_type('edit_acl', AUTH_DISALLOW, 'perm_edit_acl', Array()); |
89 $session->register_acl_type('edit_acl', AUTH_DISALLOW, 'perm_edit_acl', Array()); |
90 |
90 |
91 // DO NOT add new admin pages here! Use a plugin to call $paths->addAdminNode(); |
91 // DO NOT add new admin pages here! Use a plugin to call $paths->addAdminNode(); |
92 $this->addAdminNode('adm_cat_general', 'adm_page_general_config', 'GeneralConfig', scriptPath . '/images/icons/applets/generalconfig.png'); |
92 $this->addAdminNode('adm_cat_general', 'adm_page_general_config', 'GeneralConfig', array(2, 2)); |
93 $this->addAdminNode('adm_cat_general', 'adm_page_file_uploads', 'UploadConfig', scriptPath . '/images/icons/applets/uploadconfig.png'); |
93 $this->addAdminNode('adm_cat_general', 'adm_page_file_uploads', 'UploadConfig', array(2, 5)); |
94 $this->addAdminNode('adm_cat_general', 'adm_page_file_types', 'UploadAllowedMimeTypes', scriptPath . '/images/icons/applets/uploadallowedmimetypes.png'); |
94 $this->addAdminNode('adm_cat_general', 'adm_page_file_types', 'UploadAllowedMimeTypes', array(1, 5)); |
95 $this->addAdminNode('adm_cat_content', 'adm_page_manager', 'PageManager', scriptPath . '/images/icons/applets/pagemanager.png'); |
95 $this->addAdminNode('adm_cat_content', 'adm_page_manager', 'PageManager', array(1, 4)); |
96 $this->addAdminNode('adm_cat_content', 'adm_page_editor', 'PageEditor', scriptPath . '/images/icons/applets/pageeditor.png'); |
96 $this->addAdminNode('adm_cat_content', 'adm_page_editor', 'PageEditor', array(3, 3)); |
97 $this->addAdminNode('adm_cat_content', 'adm_page_pg_groups', 'PageGroups', scriptPath . '/images/icons/applets/pagegroups.png'); |
97 $this->addAdminNode('adm_cat_content', 'adm_page_pg_groups', 'PageGroups', array(4, 3)); |
98 $this->addAdminNode('adm_cat_appearance', 'adm_page_themes', 'ThemeManager', scriptPath . '/images/icons/applets/thememanager.png'); |
98 $this->addAdminNode('adm_cat_appearance', 'adm_page_themes', 'ThemeManager', array(4, 4)); |
99 $this->addAdminNode('adm_cat_appearance', 'adm_page_plugins', 'PluginManager', scriptPath . '/images/icons/applets/pluginmanager.png'); |
99 $this->addAdminNode('adm_cat_appearance', 'adm_page_plugins', 'PluginManager', array(2, 4)); |
100 $this->addAdminNode('adm_cat_appearance', 'adm_page_db_backup', 'DBBackup', scriptPath . '/images/icons/applets/dbbackup.png'); |
100 $this->addAdminNode('adm_cat_appearance', 'adm_page_db_backup', 'DBBackup', array(1, 2)); |
101 $this->addAdminNode('adm_cat_appearance', 'adm_page_lang_manager', 'LangManager', scriptPath . '/images/icons/applets/langmanager.png'); |
101 $this->addAdminNode('adm_cat_appearance', 'adm_page_lang_manager', 'LangManager', array(1, 3)); |
102 $this->addAdminNode('adm_cat_appearance', 'adm_page_cache_manager', 'CacheManager', scriptPath . '/images/icons/applets/cachemanager.png'); |
102 $this->addAdminNode('adm_cat_appearance', 'adm_page_cache_manager', 'CacheManager', array(3, 1)); |
103 $this->addAdminNode('adm_cat_users', 'adm_page_users', 'UserManager', scriptPath . '/images/icons/applets/usermanager.png'); |
103 $this->addAdminNode('adm_cat_users', 'adm_page_users', 'UserManager', array(3, 5)); |
104 $this->addAdminNode('adm_cat_users', 'adm_page_user_groups', 'GroupManager', scriptPath . '/images/icons/applets/groupmanager.png'); |
104 $this->addAdminNode('adm_cat_users', 'adm_page_user_groups', 'GroupManager', array(3, 2)); |
105 $this->addAdminNode('adm_cat_users', 'adm_page_coppa', 'COPPA', scriptPath . '/images/icons/applets/coppa.png'); |
105 $this->addAdminNode('adm_cat_users', 'adm_page_coppa', 'COPPA', array(4, 1)); |
106 $this->addAdminNode('adm_cat_users', 'adm_page_mass_email', 'MassEmail', scriptPath . '/images/icons/applets/massemail.png'); |
106 $this->addAdminNode('adm_cat_users', 'adm_page_mass_email', 'MassEmail', array(2, 3)); |
107 $this->addAdminNode('adm_cat_users', 'adm_page_user_ranks', 'UserRanks', scriptPath . '/images/icons/applets/userranks.png'); |
107 $this->addAdminNode('adm_cat_users', 'adm_page_user_ranks', 'UserRanks', array(4, 5)); |
108 $this->addAdminNode('adm_cat_security', 'adm_page_security_log', 'SecurityLog', scriptPath . '/images/icons/applets/securitylog.png'); |
108 $this->addAdminNode('adm_cat_security', 'adm_page_security_log', 'SecurityLog', array(3, 4)); |
109 $this->addAdminNode('adm_cat_security', 'adm_page_ban_control', 'BanControl', scriptPath . '/images/icons/applets/bancontrol.png'); |
109 $this->addAdminNode('adm_cat_security', 'adm_page_ban_control', 'BanControl', array(2, 1)); |
110 |
110 |
111 $code = $plugins->setHook('acl_rule_init'); |
111 $code = $plugins->setHook('acl_rule_init'); |
112 foreach ( $code as $cmd ) |
112 foreach ( $code as $cmd ) |
113 { |
113 { |
114 eval($cmd); |
114 eval($cmd); |
475 { |
475 { |
476 $i++; |
476 $i++; |
477 $name = ( preg_match('/^[a-z0-9_]+$/', $key) ) ? $lang->get($c['name']) : $c['name']; |
477 $name = ( preg_match('/^[a-z0-9_]+$/', $key) ) ? $lang->get($c['name']) : $c['name']; |
478 if ( $c['icon'] && $c['icon'] != scriptPath . '/images/spacer.gif' ) |
478 if ( $c['icon'] && $c['icon'] != scriptPath . '/images/spacer.gif' ) |
479 { |
479 { |
480 $icon = "<img alt=\"\" src=\"{$c['icon']}\" style=\"border-width: 0; margin-right: 3px;\" /> "; |
480 if ( is_array($c['icon']) ) |
|
481 { |
|
482 // this is a sprite reference |
|
483 list($ix, $iy) = $c['icon']; |
|
484 $icon = $this->make_sprite_icon($ix, $iy); |
|
485 } |
|
486 else |
|
487 { |
|
488 $icon = "<img alt=\"\" src=\"{$c['icon']}\" style=\"border-width: 0; margin-right: 3px;\" /> "; |
|
489 } |
481 } |
490 } |
482 else |
491 else |
483 { |
492 { |
484 $icon = ''; |
493 $icon = ''; |
485 } |
494 } |
486 $icon = addslashes($icon); |
495 $icon = addslashes($icon); |
487 $ret .= " ['$icon$name', 'javascript:ajaxPage(\\'".$this->nslist['Admin'].$c['pageid']."\\');'],\n"; |
496 $ret .= " ['$icon$name', 'javascript:ajaxPage(\\'".$this->nslist['Admin'].$c['pageid']."\\');'],\n"; |
488 } |
497 } |
489 $ret .= " ],\n"; |
498 $ret .= " ],\n"; |
490 } |
499 } |
491 $icon = "<img alt=\"\" src=\"" . scriptPath . "/images/icons/applets/adminlogout.png\" style=\"border-width: 0; margin-right: 3px;\" /> "; |
500 $icon = $this->make_sprite_icon(1, 1); |
492 $icon = addslashes($icon); |
501 $icon = addslashes($icon); |
493 $ret .= " ['$icon" . $lang->get('adm_btn_logout') . "', 'javascript:ajaxPage(\\'".$this->nslist['Admin']."AdminLogout\\');'],\n"; |
502 $ret .= " ['$icon" . $lang->get('adm_btn_logout') . "', 'javascript:ajaxPage(\\'".$this->nslist['Admin']."AdminLogout\\');'],\n"; |
494 $ret .= " ['<span id=\\'keepalivestat\\'>" . $lang->get('adm_btn_keepalive_loading') . "</span>', 'javascript:ajaxToggleKeepalive();', |
503 $ret .= " ['<span id=\\'keepalivestat\\'>" . $lang->get('adm_btn_keepalive_loading') . "</span>', 'javascript:ajaxToggleKeepalive();', |
495 ['" . $lang->get('adm_btn_keepalive_about') . "', 'javascript:aboutKeepAlive();'] |
504 ['" . $lang->get('adm_btn_keepalive_about') . "', 'javascript:aboutKeepAlive();'] |
496 ],\n"; |
505 ],\n"; |
497 // 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* |
506 // 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* |
498 // $ret .= " ['(debug) Clear menu bitfield', 'javascript:createCookie(\\'admin_menu_state\\', \\'1\\', 365);'],\n"; |
507 // $ret .= " ['(debug) Clear menu bitfield', 'javascript:createCookie(\\'admin_menu_state\\', \\'1\\', 365);'],\n"; |
499 $ret .= "]\n];"; |
508 $ret .= "]\n];"; |
500 return $ret; |
509 return $ret; |
|
510 } |
|
511 |
|
512 /** |
|
513 * Internal function to generate HTML code for an icon in the admin panel tree which is sprited. |
|
514 * @param int X index of icon |
|
515 * @param int Y index of icon |
|
516 * @return string |
|
517 */ |
|
518 |
|
519 function make_sprite_icon($ix, $iy) |
|
520 { |
|
521 $xpos = 16 * ( $ix - 1 ); |
|
522 $ypos = 16 * ( $iy - 1 ); |
|
523 return "<img alt=\"\" src=\"" . scriptPath . "/images/spacer.gif\" class=\"adminiconsprite\" style=\"border-width: 0; margin-right: 3px; background-position: -{$xpos}px -{$ypos}px;\" /> "; |
501 } |
524 } |
502 |
525 |
503 /** |
526 /** |
504 * Creates a new entry in the administration panel's navigation tree. |
527 * Creates a new entry in the administration panel's navigation tree. |
505 * @param string Section name - if this is a language string identifier, it will be sent through $lang->get() |
528 * @param string Section name - if this is a language string identifier, it will be sent through $lang->get() |