Changeset 1344
- Timestamp:
- 12/04/07 08:45:34 (1 year ago)
- Files:
-
- devel/mod/admin/antispam.php (deleted)
- devel/mod/admin/flags.php (deleted)
- devel/mod/admin/index.php (modified) (1 diff)
- devel/mod/admin/lib.php (modified) (2 diffs)
- devel/mod/admin/users.php (deleted)
- devel/mod/admin/users_add.php (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/mod/admin/index.php
r1248 r1344 4 4 5 5 // Run includes 6 require_once(dirname(dirname(__FILE__))."/../includes.php"); 7 8 // Initialise functions for user details, icon management and profile management 9 run("admin:init"); 6 require_once(dirname(dirname(__FILE__))."/../includes.php"); 10 7 11 define("context", "admin"); 12 templates_page_setup(); 13 14 // You must be logged on to view this! 15 16 echo templates_page_draw( array( 17 __gettext("Administration"), 18 templates_draw(array( 19 'context' => 'contentholder', 20 'title' => __gettext("Administration"), 21 'body' => run("admin:main") 22 ) 23 ) 24 ) 25 ); 8 define("context", "admin"); 9 templates_page_setup(); 26 10 11 // controller ;-) 12 $do = optional_param('do'); 13 switch ($do) { 14 case'spam': 15 $title = __gettext('Spam blocking'); 16 $body = run('admin:spam'); 17 break; 18 case 'flags': 19 $title = __gettext('Content flags'); 20 $body = run('admin:contentflags'); 21 break; 22 case 'users': 23 $title = __gettext('Manage users'); 24 $view = optional_param('view'); 25 switch ($view) { 26 case 'add': 27 $title .= ' :: ' . __gettext('Add multiple'); 28 $body = run('admin:users:add'); 29 break; 30 case 'admin': 31 $title .= ' :: ' . __gettext('Administrators'); 32 $body = run('admin:users:admin'); 33 break; 34 case 'banned': 35 $title .= ' :: ' . __gettext('Banned'); 36 $body = run('admin:users:banned'); 37 break; 38 default: 39 $body = run('admin:users'); 40 break; 41 } 42 break; 43 default: 44 $body = run('admin:main'); 45 break; 46 } 47 48 // view :-D 49 templates_page_output($title, $body); 27 50 ?> devel/mod/admin/lib.php
r1293 r1344 26 26 } 27 27 28 if (defined("context") && context == "admin" && logged_on&& user_flag_get("admin", $_SESSION['userid'])) {28 if (defined("context") && context == "admin" && isloggedin() && user_flag_get("admin", $_SESSION['userid'])) { 29 29 $PAGE->menu_sub[] = array ( 30 30 'name' => 'admin', 31 'html' => a_href( "{$CFG->wwwroot}mod/admin/",__gettext("Main")));31 'html' => a_href(get_url(-1, 'admin::main'),__gettext("Main"))); 32 32 33 33 $PAGE->menu_sub[] = array ( 34 'name' => 'admin:user add',35 'html' => a_href( "{$CFG->wwwroot}mod/admin/users_add.php",__gettext("Add users")));34 'name' => 'admin:users:add', 35 'html' => a_href(get_url(-1, 'admin::users::add'),__gettext("Add users"))); 36 36 37 37 $PAGE->menu_sub[] = array ( 38 38 'name' => 'admin:users', 39 'html' => a_href( "{$CFG->wwwroot}mod/admin/users.php",__gettext("Manage users")));39 'html' => a_href(get_url(-1, 'admin::users'),__gettext("Manage users"))); 40 40 41 41 $PAGE->menu_sub[] = array ( 42 'name' => 'admin:users ',43 'html' => a_href( "{$CFG->wwwroot}mod/admin/users.php?flag=banned",__gettext("Banned users")));42 'name' => 'admin:users:banned', 43 'html' => a_href(get_url(-1, 'admin::users::banned'),__gettext("Banned users"))); 44 44 45 45 $PAGE->menu_sub[] = array ( 46 'name' => 'admin:users ',47 'html' => a_href( "{$CFG->wwwroot}mod/admin/users.php?flag=admin",__gettext("Admin users")));46 'name' => 'admin:users:admin', 47 'html' => a_href(get_url(-1, 'admin::users::admin'),__gettext("Admin users"))); 48 48 49 49 $PAGE->menu_sub[] = array ( 50 'name' => 'admin:flag gedcontent',51 'html' => a_href( "{$CFG->wwwroot}mod/admin/flags.php",__gettext("Manage flagged content")));50 'name' => 'admin:flags', 51 'html' => a_href(get_url(-1, 'admin::flags'),__gettext("Manage flagged content"))); 52 52 53 53 $PAGE->menu_sub[] = array ( 54 54 'name' => 'admin:spam', 55 'html' => a_href( "{$CFG->wwwroot}mod/admin/antispam.php",__gettext("Spam control")));55 'html' => a_href(get_url(-1, 'admin::spam'),__gettext("Spam control"))); 56 56 } 57 57 … … 101 101 102 102 // Admin-related actions 103 $function['admin:init'][] = $CFG->dirroot . "mod/admin/lib/admin_actions.php"; 103 // also allows users to flag content 104 $function['init'][] = $CFG->dirroot . "mod/admin/lib/admin_actions.php"; 104 105 105 106 } 107 108 function admin_url($oid, $type) { 109 global $CFG; 110 $url = null; 111 112 if (strpos($type, 'admin::') == 0) { 113 $url = $CFG->wwwroot . 'mod/admin/'; 114 switch ($type) { 115 case 'admin::spam': 116 $url .= '?do=spam'; 117 break; 118 case 'admin::flags': 119 $url .= '?do=flags'; 120 break; 121 case 'admin::users::add': 122 $url .= '?do=users&view=add'; 123 break; 124 case 'admin::users::admin': 125 $url .= '?do=users&view=admin'; 126 break; 127 case 'admin::users::banned': 128 $url .= '?do=users&view=banned'; 129 break; 130 case 'admin::users': 131 $url .= '?do=users'; 132 break; 133 case 'admin::main': 134 default: 135 break; 136 } 137 } 138 139 return $url; 140 } 106 141 ?>
