diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-12-05 15:29:53 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-12-05 15:29:53 +0000 |
| commit | 3055390b6908c8335d154dd8e4dfa374b7fa3783 (patch) | |
| tree | ed05c0516b4cf40831ae49a747946fcfd9162b7f /wp-inst/wp-admin/admin-functions.php | |
| parent | fba798a103256f5f400cb1a1dcb9cc5b45cf8166 (diff) | |
| download | wordpress-mu-3055390b6908c8335d154dd8e4dfa374b7fa3783.tar.gz wordpress-mu-3055390b6908c8335d154dd8e4dfa374b7fa3783.tar.xz wordpress-mu-3055390b6908c8335d154dd8e4dfa374b7fa3783.zip | |
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@461 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-admin/admin-functions.php')
| -rw-r--r-- | wp-inst/wp-admin/admin-functions.php | 50 |
1 files changed, 6 insertions, 44 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php index d89f5b1..3ddc259 100644 --- a/wp-inst/wp-admin/admin-functions.php +++ b/wp-inst/wp-admin/admin-functions.php @@ -40,6 +40,9 @@ function write_post() { if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) $_POST['post_status'] = 'draft'; + if ('static' == $_POST['post_status'] && !current_user_can('edit_pages')) + die(__('This user cannot edit pages.')); + if (!empty ($_POST['edit_date'])) { $aa = $_POST['aa']; $mm = $_POST['mm']; @@ -158,6 +161,9 @@ function edit_post() { if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) $_POST['post_status'] = 'draft'; + if ('static' == $_POST['post_status'] && !current_user_can('edit_pages')) + die(__('This user cannot edit pages.')); + if (!isset ($_POST['comment_status'])) $_POST['comment_status'] = 'closed'; @@ -1588,50 +1594,6 @@ function current_theme_info() { return $ct; } -// Returns an array containing the current upload directory's path and url, or an error message. -function wp_upload_dir() { - if ( defined('UPLOADS') ) - $dir = UPLOADS; - else - $dir = 'wp-content/uploads'; - - $path = ABSPATH . $dir; - - // Give the new dirs the same perms as wp-content. - $stat = stat(ABSPATH . 'wp-content'); - $dir_perms = $stat['mode'] & 0000777; // Get the permission bits. - - // Make sure we have an uploads dir - if ( ! file_exists( $path ) ) { - if ( ! mkdir( $path ) ) - return array('error' => "Unable to create directory $path. Is its parent directory writable by the server?"); - @ chmod( $path, $dir_perms ); - } - - // Generate the yearly and monthly dirs - $time = current_time( 'mysql' ); - $y = substr( $time, 0, 4 ); - $m = substr( $time, 5, 2 ); - $pathy = "$path/$y"; - $pathym = "$path/$y/$m"; - - // Make sure we have a yearly dir - if ( ! file_exists( $pathy ) ) { - if ( ! mkdir( $pathy ) ) - return array('error' => "Unable to create directory $pathy. Is $path writable?"); - @ chmod( $pathy, $dir_perms ); - } - - // Make sure we have a monthly dir - if ( ! file_exists( $pathym ) ) { - if ( ! mkdir( $pathym ) ) - return array('error' => "Unable to create directory $pathym. Is $pathy writable?"); - @ chmod( $pathym, $dir_perms ); - } - - $uploads = array('path' => $pathym, 'url' => get_option('siteurl') . "/$dir/$y/$m", 'error' => false); - return apply_filters('upload_dir', $uploads); -} // array wp_handle_upload ( array &file [, array overrides] ) // file: reference to a single element of $_FILES. Call the function once for each uploaded file. |
