[wp-cvs] wordpress/wp-admin admin-functions.php, 1.50,
1.51 admin-header.php, 1.32, 1.33 auth.php, 1.14,
1.15 menu.php, 1.28, 1.29 options-discussion.php, 1.22,
1.23 options-general.php, 1.29, 1.30 options-head.php, 1.12,
1.13 options-misc.php, 1.14, 1.15 options-permalink.php, 1.45,
1.46 options-reading.php, 1.17, 1.18 options-writing.php, 1.24, 1.25
Ryan Boren
rboren at users.sourceforge.net
Mon Oct 18 04:50:10 UTC 2004
Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28958
Modified Files:
admin-functions.php admin-header.php auth.php menu.php
options-discussion.php options-general.php options-head.php
options-misc.php options-permalink.php options-reading.php
options-writing.php
Log Message:
Do not stomp permalink setting. Bug 372.
Index: auth.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/auth.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** auth.php 17 Oct 2004 12:42:18 -0000 1.14
--- auth.php 18 Oct 2004 04:50:07 -0000 1.15
***************
*** 1,4 ****
<?php
! require_once('../wp-config.php');
if ( (!empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && !wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true))
--- 1,4 ----
<?php
! require_once(ABSPATH . '/wp-config.php');
if ( (!empty($_COOKIE['wordpressuser_' . COOKIEHASH]) && !wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true))
Index: menu.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/menu.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** menu.php 22 Sep 2004 06:33:54 -0000 1.28
--- menu.php 18 Oct 2004 04:50:07 -0000 1.29
***************
*** 44,48 ****
$submenu['themes.php'][15] = array(__('Other Files'), 5, 'templates.php');
! $self = preg_replace('|.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
if (!isset($parent_file)) $parent_file = '';
foreach ($menu as $item) {
--- 44,56 ----
$submenu['themes.php'][15] = array(__('Other Files'), 5, 'templates.php');
! do_action('admin_menu', '');
!
! if (! user_can_access_admin_page()) {
! die( __('You have do not have sufficient permissions to access this page.') );
! }
!
! $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
! $self = preg_replace('|^.*/plugins/|i', '', $self);
!
if (!isset($parent_file)) $parent_file = '';
foreach ($menu as $item) {
***************
*** 58,62 ****
($user_level >= get_settings('fileupload_minlevel'))
) || 'upload.php' != $item[2])
! echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
}
}
--- 66,70 ----
($user_level >= get_settings('fileupload_minlevel'))
) || 'upload.php' != $item[2])
! echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
}
}
***************
*** 74,80 ****
<?php
foreach ($submenu["$parent_file"] as $item) :
if ( substr($self, -10) == substr($item[2], -10) ) $class = ' class="current"';
else $class = '';
! echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
endforeach;
?>
--- 82,92 ----
<?php
foreach ($submenu["$parent_file"] as $item) :
+ if ($user_level < $item[1]) {
+ continue;
+ }
+
if ( substr($self, -10) == substr($item[2], -10) ) $class = ' class="current"';
else $class = '';
! echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
endforeach;
?>
Index: options-discussion.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-discussion.php,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** options-discussion.php 4 Oct 2004 08:49:45 -0000 1.22
--- options-discussion.php 18 Oct 2004 04:50:07 -0000 1.23
***************
*** 3,43 ****
$title = __('Discussion Options');
- $parent_file = 'options-general.php';
-
- function add_magic_quotes($array) {
- foreach ($array as $k => $v) {
- if (is_array($v)) {
- $array[$k] = add_magic_quotes($v);
- } else {
- $array[$k] = addslashes($v);
- }
- }
- return $array;
- }
-
- if (!get_magic_quotes_gpc()) {
- $_GET = add_magic_quotes($_GET);
- $_POST = add_magic_quotes($_POST);
- $_COOKIE = add_magic_quotes($_COOKIE);
- }
-
- $wpvarstoreset = array('action','standalone', 'option_group_id');
- for ($i=0; $i<count($wpvarstoreset); $i += 1) {
- $wpvar = $wpvarstoreset[$i];
- if (!isset($$wpvar)) {
- if (empty($_POST["$wpvar"])) {
- if (empty($_GET["$wpvar"])) {
- $$wpvar = '';
- } else {
- $$wpvar = $_GET["$wpvar"];
- }
- } else {
- $$wpvar = $_POST["$wpvar"];
- }
- }
- }
-
- $standalone = 0;
- include_once('admin-header.php');
include('options-head.php');
--- 3,6 ----
Index: options-reading.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-reading.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** options-reading.php 5 Sep 2004 00:24:27 -0000 1.17
--- options-reading.php 18 Oct 2004 04:50:07 -0000 1.18
***************
*** 3,43 ****
$title = __('Reading Options');
- $parent_file = 'options-general.php';
-
- function add_magic_quotes($array) {
- foreach ($array as $k => $v) {
- if (is_array($v)) {
- $array[$k] = add_magic_quotes($v);
- } else {
- $array[$k] = addslashes($v);
- }
- }
- return $array;
- }
-
- if (!get_magic_quotes_gpc()) {
- $_GET = add_magic_quotes($_GET);
- $_POST = add_magic_quotes($_POST);
- $_COOKIE = add_magic_quotes($_COOKIE);
- }
-
- $wpvarstoreset = array('action','standalone', 'option_group_id');
- for ($i=0; $i<count($wpvarstoreset); $i += 1) {
- $wpvar = $wpvarstoreset[$i];
- if (!isset($$wpvar)) {
- if (empty($_POST["$wpvar"])) {
- if (empty($_GET["$wpvar"])) {
- $$wpvar = '';
- } else {
- $$wpvar = $_GET["$wpvar"];
- }
- } else {
- $$wpvar = $_POST["$wpvar"];
- }
- }
- }
-
- $standalone = 0;
- include_once('admin-header.php');
include('options-head.php');
?>
--- 3,6 ----
Index: options-head.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-head.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** options-head.php 4 Sep 2004 22:09:21 -0000 1.12
--- options-head.php 18 Oct 2004 04:50:07 -0000 1.13
***************
*** 1,7 ****
<?php
! if ($user_level <= 6) {
! die( __('You have do not have sufficient permissions to edit the options for this blog.') );
}
?>
--- 1,41 ----
<?php
! $parent_file = 'options-general.php';
!
! function add_magic_quotes($array) {
! foreach ($array as $k => $v) {
! if (is_array($v)) {
! $array[$k] = add_magic_quotes($v);
! } else {
! $array[$k] = addslashes($v);
! }
! }
! return $array;
! }
!
! if (!get_magic_quotes_gpc()) {
! $_GET = add_magic_quotes($_GET);
! $_POST = add_magic_quotes($_POST);
! $_COOKIE = add_magic_quotes($_COOKIE);
}
+
+ $wpvarstoreset = array('action','standalone', 'option_group_id');
+ for ($i=0; $i<count($wpvarstoreset); $i += 1) {
+ $wpvar = $wpvarstoreset[$i];
+ if (!isset($$wpvar)) {
+ if (empty($_POST["$wpvar"])) {
+ if (empty($_GET["$wpvar"])) {
+ $$wpvar = '';
+ } else {
+ $$wpvar = $_GET["$wpvar"];
+ }
+ } else {
+ $$wpvar = $_POST["$wpvar"];
+ }
+ }
+ }
+
+ $standalone = 0;
+ include_once('admin-header.php');
?>
Index: options-writing.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-writing.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** options-writing.php 15 Sep 2004 15:09:37 -0000 1.24
--- options-writing.php 18 Oct 2004 04:50:08 -0000 1.25
***************
*** 3,10 ****
$title = __('Writing Options');
- $parent_file = 'options-general.php';
-
- $standalone = 0;
- include_once('./admin-header.php');
include('./options-head.php');
?>
--- 3,6 ----
Index: options-general.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-general.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** options-general.php 14 Sep 2004 12:41:09 -0000 1.29
--- options-general.php 18 Oct 2004 04:50:07 -0000 1.30
***************
*** 3,44 ****
$title = __('General Options');
- $parent_file = 'options-general.php';
- function add_magic_quotes($array) {
- foreach ($array as $k => $v) {
- if (is_array($v)) {
- $array[$k] = add_magic_quotes($v);
- } else {
- $array[$k] = addslashes($v);
- }
- }
- return $array;
- }
-
- if (!get_magic_quotes_gpc()) {
- $_GET = add_magic_quotes($_GET);
- $_POST = add_magic_quotes($_POST);
- $_COOKIE = add_magic_quotes($_COOKIE);
- }
-
- $wpvarstoreset = array('action','standalone', 'option_group_id');
- for ($i=0; $i<count($wpvarstoreset); $i += 1) {
- $wpvar = $wpvarstoreset[$i];
- if (!isset($$wpvar)) {
- if (empty($_POST["$wpvar"])) {
- if (empty($_GET["$wpvar"])) {
- $$wpvar = '';
- } else {
- $$wpvar = $_GET["$wpvar"];
- }
- } else {
- $$wpvar = $_POST["$wpvar"];
- }
- }
- }
-
-
- $standalone = 0;
- include_once('admin-header.php');
include('options-head.php');
?>
--- 3,7 ----
Index: options-misc.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-misc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** options-misc.php 15 Sep 2004 15:09:37 -0000 1.14
--- options-misc.php 18 Oct 2004 04:50:07 -0000 1.15
***************
*** 3,44 ****
$title = __('Miscellaneous Options');
- $parent_file = 'options-general.php';
-
- function add_magic_quotes($array) {
- foreach ($array as $k => $v) {
- if (is_array($v)) {
- $array[$k] = add_magic_quotes($v);
- } else {
- $array[$k] = addslashes($v);
- }
- }
- return $array;
- }
-
- if (!get_magic_quotes_gpc()) {
- $_GET = add_magic_quotes($_GET);
- $_POST = add_magic_quotes($_POST);
- $_COOKIE = add_magic_quotes($_COOKIE);
- }
-
- $wpvarstoreset = array('action','standalone');
- for ($i=0; $i<count($wpvarstoreset); $i += 1) {
- $wpvar = $wpvarstoreset[$i];
- if (!isset($$wpvar)) {
- if (empty($_POST["$wpvar"])) {
- if (empty($_GET["$wpvar"])) {
- $$wpvar = '';
- } else {
- $$wpvar = $_GET["$wpvar"];
- }
- } else {
- $$wpvar = $_POST["$wpvar"];
- }
- }
- }
-
-
- $standalone = 0;
- include_once('admin-header.php');
include('options-head.php');
?>
--- 3,6 ----
Index: admin-header.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/admin-header.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** admin-header.php 5 Oct 2004 06:59:12 -0000 1.32
--- admin-header.php 18 Oct 2004 04:50:07 -0000 1.33
***************
*** 1,5 ****
<?php
! require_once('../wp-config.php');
require_once(ABSPATH . '/wp-admin/auth.php');
require(ABSPATH . '/wp-admin/admin-functions.php');
--- 1,14 ----
<?php
! if (strstr($_SERVER['PHP_SELF'], 'plugins/')) {
! $wp_admin_path = '../../wp-admin/';
! $wp_path = '../../';
! } else {
! $wp_admin_path = './';
! $wp_path = '../';
! }
!
! require_once($wp_path . 'wp-config.php');
!
require_once(ABSPATH . '/wp-admin/auth.php');
require(ABSPATH . '/wp-admin/admin-functions.php');
***************
*** 39,44 ****
<head>
<title><?php bloginfo('name') ?> › <?php echo $title; ?> — WordPress</title>
! <link rel="stylesheet" href="wp-admin.css" type="text/css" />
! <link rel="shortcut icon" href="../wp-images/wp-favicon.png" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
--- 48,53 ----
<head>
<title><?php bloginfo('name') ?> › <?php echo $title; ?> — WordPress</title>
! <link rel="stylesheet" href="<?php echo $wp_admin_path; ?>wp-admin.css" type="text/css" />
! <link rel="shortcut icon" href="<?php echo $wp_path; ?>wp-images/wp-favicon.png" />
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_settings('blog_charset'); ?>" />
***************
*** 111,115 ****
<?php
! require('./menu.php');
endif;
?>
\ No newline at end of file
--- 120,124 ----
<?php
! require(ABSPATH . '/wp-admin/menu.php');
endif;
?>
\ No newline at end of file
Index: admin-functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/admin-functions.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** admin-functions.php 14 Oct 2004 03:54:56 -0000 1.50
--- admin-functions.php 18 Oct 2004 04:50:07 -0000 1.51
***************
*** 623,625 ****
--- 623,670 ----
}
+ function user_can_access_admin_page() {
+ global $parent_file;
+ global $pagenow;
+ global $menu;
+ global $submenu;
+ global $user_level;
+
+ if (! isset($parent_file)) {
+ $parent = $pagenow;
+ } else {
+ $parent = $parent_file;
+ }
+
+ foreach ($menu as $menu_array) {
+ //echo "parent array: " . $menu_array[2];
+ if ($menu_array[2] == $parent) {
+ if ($user_level < $menu_array[1]) {
+ return false;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (isset($submenu[$parent])) {
+ foreach ($submenu[$parent] as $submenu_array) {
+ if ($submenu_array[2] == $pagenow) {
+ if ($user_level < $submenu_array[1]) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ function add_options_menu($title, $access_level, $file) {
+ global $submenu;
+
+ $submenu['options-general.php'][] = array($title, $access_level, $file);
+ }
+
?>
\ No newline at end of file
Index: options-permalink.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/options-permalink.php,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** options-permalink.php 14 Oct 2004 08:09:00 -0000 1.45
--- options-permalink.php 18 Oct 2004 04:50:07 -0000 1.46
***************
*** 7,11 ****
require_once('./admin-header.php');
if ($user_level <= 8)
! die(__('You have do not have sufficient permissions to edit the options for this blog.'));
require('./options-head.php');
--- 7,12 ----
require_once('./admin-header.php');
if ($user_level <= 8)
! die(__('You have do not have sufficient permissions to edit the options
! for this blog.'));
require('./options-head.php');
***************
*** 22,39 ****
if ( isset($_POST) ) {
! if ( $_POST['permalink_structure'] )
! $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
! else
$permalink_structure = $_POST['permalink_structure'];
! if ( $_POST['category_base'] )
! $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
! else
$category_base = $_POST['category_base'];
!
! update_option('permalink_structure', $permalink_structure);
! update_option('category_base', $category_base);
}
!
$permalink_structure = get_settings('permalink_structure');
$category_base = get_settings('category_base');
--- 23,41 ----
if ( isset($_POST) ) {
! if ( isset($_POST['permalink_structure']) ) {
$permalink_structure = $_POST['permalink_structure'];
+ if (! empty($permalink_structure) )
+ $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
+ update_option('permalink_structure', $permalink_structure);
+ }
! if ( isset($_POST['category_base']) ) {
$category_base = $_POST['category_base'];
! if (! empty($category_base) )
! $category_base = preg_replace('#/+#', '/', '/' . $_POST['category_base']);
! update_option('category_base', $category_base);
! }
}
!
$permalink_structure = get_settings('permalink_structure');
$category_base = get_settings('category_base');
More information about the cvs
mailing list