Changeset 1810
- Timestamp:
- 10/18/2004 04:50:08 AM (20 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r1792 r1810 623 623 } 624 624 625 function user_can_access_admin_page() { 626 global $parent_file; 627 global $pagenow; 628 global $menu; 629 global $submenu; 630 global $user_level; 631 632 if (! isset($parent_file)) { 633 $parent = $pagenow; 634 } else { 635 $parent = $parent_file; 636 } 637 638 foreach ($menu as $menu_array) { 639 //echo "parent array: " . $menu_array[2]; 640 if ($menu_array[2] == $parent) { 641 if ($user_level < $menu_array[1]) { 642 return false; 643 } else { 644 break; 645 } 646 } 647 } 648 649 if (isset($submenu[$parent])) { 650 foreach ($submenu[$parent] as $submenu_array) { 651 if ($submenu_array[2] == $pagenow) { 652 if ($user_level < $submenu_array[1]) { 653 return false; 654 } else { 655 return true; 656 } 657 } 658 } 659 } 660 661 return true; 662 } 663 664 function add_options_menu($title, $access_level, $file) { 665 global $submenu; 666 667 $submenu['options-general.php'][] = array($title, $access_level, $file); 668 } 669 625 670 ?> -
trunk/wp-admin/admin-header.php
r1743 r1810 1 1 <?php 2 2 3 require_once('../wp-config.php'); 3 if (strstr($_SERVER['PHP_SELF'], 'plugins/')) { 4 $wp_admin_path = '../../wp-admin/'; 5 $wp_path = '../../'; 6 } else { 7 $wp_admin_path = './'; 8 $wp_path = '../'; 9 } 10 11 require_once($wp_path . 'wp-config.php'); 12 4 13 require_once(ABSPATH . '/wp-admin/auth.php'); 5 14 require(ABSPATH . '/wp-admin/admin-functions.php'); … … 39 48 <head> 40 49 <title><?php bloginfo('name') ?> › <?php echo $title; ?> — WordPress</title> 41 <link rel="stylesheet" href=" wp-admin.css" type="text/css" />42 <link rel="shortcut icon" href=" ../wp-images/wp-favicon.png" />50 <link rel="stylesheet" href="<?php echo $wp_admin_path; ?>wp-admin.css" type="text/css" /> 51 <link rel="shortcut icon" href="<?php echo $wp_path; ?>wp-images/wp-favicon.png" /> 43 52 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" /> 44 53 … … 111 120 112 121 <?php 113 require( './menu.php');122 require(ABSPATH . '/wp-admin/menu.php'); 114 123 endif; 115 124 ?> -
trunk/wp-admin/auth.php
r1807 r1810 1 1 <?php 2 require_once( '../wp-config.php');2 require_once(ABSPATH . '/wp-config.php'); 3 3 4 4 if ( (!empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && !wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true)) -
trunk/wp-admin/menu.php
r1703 r1810 44 44 $submenu['themes.php'][15] = array(__('Other Files'), 5, 'templates.php'); 45 45 46 $self = preg_replace('|.*/wp-admin/|i', '', $_SERVER['PHP_SELF']); 46 do_action('admin_menu', ''); 47 48 if (! user_can_access_admin_page()) { 49 die( __('You have do not have sufficient permissions to access this page.') ); 50 } 51 52 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']); 53 $self = preg_replace('|^.*/plugins/|i', '', $self); 54 47 55 if (!isset($parent_file)) $parent_file = ''; 48 56 foreach ($menu as $item) { … … 58 66 ($user_level >= get_settings('fileupload_minlevel')) 59 67 ) || 'upload.php' != $item[2]) 60 echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";68 echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; 61 69 } 62 70 } … … 74 82 <?php 75 83 foreach ($submenu["$parent_file"] as $item) : 84 if ($user_level < $item[1]) { 85 continue; 86 } 87 76 88 if ( substr($self, -10) == substr($item[2], -10) ) $class = ' class="current"'; 77 89 else $class = ''; 78 echo "\n\t<li><a href=' {$item[2]}'$class>{$item[0]}</a></li>";90 echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>"; 79 91 endforeach; 80 92 ?> -
trunk/wp-admin/options-discussion.php
r1737 r1810 3 3 4 4 $title = __('Discussion Options'); 5 $parent_file = 'options-general.php';6 7 function add_magic_quotes($array) {8 foreach ($array as $k => $v) {9 if (is_array($v)) {10 $array[$k] = add_magic_quotes($v);11 } else {12 $array[$k] = addslashes($v);13 }14 }15 return $array;16 }17 18 if (!get_magic_quotes_gpc()) {19 $_GET = add_magic_quotes($_GET);20 $_POST = add_magic_quotes($_POST);21 $_COOKIE = add_magic_quotes($_COOKIE);22 }23 24 $wpvarstoreset = array('action','standalone', 'option_group_id');25 for ($i=0; $i<count($wpvarstoreset); $i += 1) {26 $wpvar = $wpvarstoreset[$i];27 if (!isset($$wpvar)) {28 if (empty($_POST["$wpvar"])) {29 if (empty($_GET["$wpvar"])) {30 $$wpvar = '';31 } else {32 $$wpvar = $_GET["$wpvar"];33 }34 } else {35 $$wpvar = $_POST["$wpvar"];36 }37 }38 }39 40 $standalone = 0;41 include_once('admin-header.php');42 5 include('options-head.php'); 43 6 -
trunk/wp-admin/options-general.php
r1656 r1810 3 3 4 4 $title = __('General Options'); 5 $parent_file = 'options-general.php';6 5 7 function add_magic_quotes($array) {8 foreach ($array as $k => $v) {9 if (is_array($v)) {10 $array[$k] = add_magic_quotes($v);11 } else {12 $array[$k] = addslashes($v);13 }14 }15 return $array;16 }17 18 if (!get_magic_quotes_gpc()) {19 $_GET = add_magic_quotes($_GET);20 $_POST = add_magic_quotes($_POST);21 $_COOKIE = add_magic_quotes($_COOKIE);22 }23 24 $wpvarstoreset = array('action','standalone', 'option_group_id');25 for ($i=0; $i<count($wpvarstoreset); $i += 1) {26 $wpvar = $wpvarstoreset[$i];27 if (!isset($$wpvar)) {28 if (empty($_POST["$wpvar"])) {29 if (empty($_GET["$wpvar"])) {30 $$wpvar = '';31 } else {32 $$wpvar = $_GET["$wpvar"];33 }34 } else {35 $$wpvar = $_POST["$wpvar"];36 }37 }38 }39 40 41 $standalone = 0;42 include_once('admin-header.php');43 6 include('options-head.php'); 44 7 ?> -
trunk/wp-admin/options-head.php
r1596 r1810 1 1 <?php 2 2 3 if ($user_level <= 6) { 4 die( __('You have do not have sufficient permissions to edit the options for this blog.') ); 3 $parent_file = 'options-general.php'; 4 5 function add_magic_quotes($array) { 6 foreach ($array as $k => $v) { 7 if (is_array($v)) { 8 $array[$k] = add_magic_quotes($v); 9 } else { 10 $array[$k] = addslashes($v); 11 } 12 } 13 return $array; 5 14 } 15 16 if (!get_magic_quotes_gpc()) { 17 $_GET = add_magic_quotes($_GET); 18 $_POST = add_magic_quotes($_POST); 19 $_COOKIE = add_magic_quotes($_COOKIE); 20 } 21 22 $wpvarstoreset = array('action','standalone', 'option_group_id'); 23 for ($i=0; $i<count($wpvarstoreset); $i += 1) { 24 $wpvar = $wpvarstoreset[$i]; 25 if (!isset($$wpvar)) { 26 if (empty($_POST["$wpvar"])) { 27 if (empty($_GET["$wpvar"])) { 28 $$wpvar = ''; 29 } else { 30 $$wpvar = $_GET["$wpvar"]; 31 } 32 } else { 33 $$wpvar = $_POST["$wpvar"]; 34 } 35 } 36 } 37 38 $standalone = 0; 39 include_once('admin-header.php'); 6 40 ?> 7 41 -
trunk/wp-admin/options-misc.php
r1664 r1810 3 3 4 4 $title = __('Miscellaneous Options'); 5 $parent_file = 'options-general.php';6 7 function add_magic_quotes($array) {8 foreach ($array as $k => $v) {9 if (is_array($v)) {10 $array[$k] = add_magic_quotes($v);11 } else {12 $array[$k] = addslashes($v);13 }14 }15 return $array;16 }17 18 if (!get_magic_quotes_gpc()) {19 $_GET = add_magic_quotes($_GET);20 $_POST = add_magic_quotes($_POST);21 $_COOKIE = add_magic_quotes($_COOKIE);22 }23 24 $wpvarstoreset = array('action','standalone');25 for ($i=0; $i<count($wpvarstoreset); $i += 1) {26 $wpvar = $wpvarstoreset[$i];27 if (!isset($$wpvar)) {28 if (empty($_POST["$wpvar"])) {29 if (empty($_GET["$wpvar"])) {30 $$wpvar = '';31 } else {32 $$wpvar = $_GET["$wpvar"];33 }34 } else {35 $$wpvar = $_POST["$wpvar"];36 }37 }38 }39 40 41 $standalone = 0;42 include_once('admin-header.php');43 5 include('options-head.php'); 44 6 ?> -
trunk/wp-admin/options-permalink.php
r1798 r1810 7 7 require_once('./admin-header.php'); 8 8 if ($user_level <= 8) 9 die(__('You have do not have sufficient permissions to edit the options for this blog.')); 9 die(__('You have do not have sufficient permissions to edit the options 10 for this blog.')); 10 11 11 12 require('./options-head.php'); … … 22 23 23 24 if ( isset($_POST) ) { 24 if ( $_POST['permalink_structure'] ) 25 $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']); 26 else 25 if ( isset($_POST['permalink_structure']) ) { 27 26 $permalink_structure = $_POST['permalink_structure']; 27 if (! empty($permalink_structure) ) 28 $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']); 29 update_option('permalink_structure', $permalink_structure); 30 } 28 31 29 if ( $_POST['category_base'] ) 30 $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']); 31 else 32 if ( isset($_POST['category_base']) ) { 32 33 $category_base = $_POST['category_base']; 34 if (! empty($category_base) ) 35 $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']); 36 update_option('category_base', $category_base); 37 } 38 } 33 39 34 update_option('permalink_structure', $permalink_structure);35 update_option('category_base', $category_base);36 }37 38 40 $permalink_structure = get_settings('permalink_structure'); 39 41 $category_base = get_settings('category_base'); -
trunk/wp-admin/options-reading.php
r1599 r1810 3 3 4 4 $title = __('Reading Options'); 5 $parent_file = 'options-general.php';6 7 function add_magic_quotes($array) {8 foreach ($array as $k => $v) {9 if (is_array($v)) {10 $array[$k] = add_magic_quotes($v);11 } else {12 $array[$k] = addslashes($v);13 }14 }15 return $array;16 }17 18 if (!get_magic_quotes_gpc()) {19 $_GET = add_magic_quotes($_GET);20 $_POST = add_magic_quotes($_POST);21 $_COOKIE = add_magic_quotes($_COOKIE);22 }23 24 $wpvarstoreset = array('action','standalone', 'option_group_id');25 for ($i=0; $i<count($wpvarstoreset); $i += 1) {26 $wpvar = $wpvarstoreset[$i];27 if (!isset($$wpvar)) {28 if (empty($_POST["$wpvar"])) {29 if (empty($_GET["$wpvar"])) {30 $$wpvar = '';31 } else {32 $$wpvar = $_GET["$wpvar"];33 }34 } else {35 $$wpvar = $_POST["$wpvar"];36 }37 }38 }39 40 $standalone = 0;41 include_once('admin-header.php');42 5 include('options-head.php'); 43 6 ?> -
trunk/wp-admin/options-writing.php
r1664 r1810 3 3 4 4 $title = __('Writing Options'); 5 $parent_file = 'options-general.php';6 7 $standalone = 0;8 include_once('./admin-header.php');9 5 include('./options-head.php'); 10 6 ?>
Note: See TracChangeset
for help on using the changeset viewer.