Changeset 599

Show
Ignore:
Timestamp:
06/27/06 11:03:10 (2 years ago)
Author:
donncha
Message:

WP Merge

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-functions.php

    r595 r599  
    413413                $pass2 = $_POST['pass2']; 
    414414 
    415         if (isset ($_POST['role'])) { 
    416                 if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users')) 
     415        if (isset ($_POST['role']) && current_user_can('edit_users')) { 
     416                if ($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users')) 
    417417                        $user->role = $_POST['role']; 
    418418        } 
  • trunk/wp-admin/categories.php

    r550 r599  
    3232        wp_insert_category($_POST); 
    3333 
    34         header('Location: categories.php?message=1#addcat'); 
     34        wp_redirect('categories.php?message=1#addcat'); 
    3535break; 
    3636 
     
    5353        wp_delete_category($cat_ID); 
    5454 
    55         header('Location: categories.php?message=2'); 
     55        wp_redirect('categories.php?message=2'); 
    5656 
    5757break; 
     
    7575        wp_update_category($_POST); 
    7676 
    77         header('Location: categories.php?message=3'); 
     77        wp_redirect('categories.php?message=3'); 
    7878break; 
    7979 
  • trunk/wp-admin/comment.php

    r595 r599  
    119119 
    120120        if ((wp_get_referer() != '') && (false == $noredir)) { 
    121                 header('Location: ' . wp_get_referer()); 
    122         } else { 
    123                 header('Location: '. get_settings('siteurl') .'/wp-admin/edit-comments.php'); 
     121                wp_redirect(wp_get_referer()); 
     122        } else { 
     123                wp_redirect(get_settings('siteurl') .'/wp-admin/edit-comments.php'); 
    124124        } 
    125125        exit(); 
     
    146146 
    147147        if ((wp_get_referer() != "") && (false == $noredir)) { 
    148                 header('Location: ' . wp_get_referer()); 
    149         } else { 
    150                 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 
     148                wp_redirect(wp_get_referer()); 
     149        } else { 
     150                wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 
    151151        } 
    152152        exit(); 
     
    177177 
    178178        if ((wp_get_referer() != "") && (false == $noredir)) { 
    179                 header('Location: ' . wp_get_referer()); 
    180         } else { 
    181                 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 
     179                wp_redirect(wp_get_referer()); 
     180        } else { 
     181                wp_redirect(get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 
    182182        } 
    183183        exit(); 
     
    195195        $referredby = $_POST['referredby']; 
    196196        if (!empty($referredby)) { 
    197                 header('Location: ' . $referredby); 
    198         } else { 
    199                 header ("Location: edit.php?p=$comment_post_ID&c=1#comments"); 
     197                wp_redirect($referredby); 
     198        } else { 
     199                wp_redirect("edit.php?p=$comment_post_ID&c=1#comments"); 
    200200        } 
    201201 
  • trunk/wp-admin/edit-page-form.php

    r595 r599  
    185185 
    186186<?php if ('edit' == $action) : 
     187        $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );  
    187188        if ( current_user_can('delete_page', $post->ID) ) ?> 
    188                 <input name="deletepost" class="delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"return confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "')\""; ?> /> 
     189                <input name="deletepost" class="button" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> /> 
    189190<?php endif; ?> 
    190191</form> 
  • trunk/wp-admin/import/blogger.php

    r550 r599  
    3131        function restart() { 
    3232                delete_option('import-blogger'); 
    33                 header("Location: admin.php?import=blogger"); 
     33                wp_redirect("admin.php?import=blogger"); 
    3434                die(); 
    3535        } 
     
    219219        // Redirects to next step 
    220220        function do_next_step() { 
    221                 header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}"); 
     221                wp_redirect("admin.php?import=blogger&noheader=true&blog={$_GET['blog']}"); 
    222222                die(); 
    223223        } 
     
    279279                        } 
    280280                        update_option('import-blogger', $this->import); 
    281                         header("Location: admin.php?import=blogger&noheader=true&step=1"); 
     281                        wp_redirect("admin.php?import=blogger&noheader=true&step=1"); 
    282282                } 
    283283                die(); 
  • trunk/wp-admin/inline-uploading.php

    r550 r599  
    4242wp_delete_attachment($attachment); 
    4343 
    44 header("Location: " . basename(__FILE__) ."?post=$post&all=$all&action=view&start=$start"); 
     44wp_redirect(basename(__FILE__) ."?post=$post&all=$all&action=view&start=$start"); 
    4545die; 
    4646 
     
    106106} 
    107107 
    108 header("Location: " . basename(__FILE__) . "?post=$post&all=$all&action=view&start=0"); 
     108wp_redirect(basename(__FILE__) . "?post=$post&all=$all&action=view&start=0"); 
    109109die(); 
    110110 
     
    145145 
    146146if ( count($attachments) == 0 ) { 
    147         header("Location: " . basename(__FILE__) ."?post=$post&action=upload" ); 
     147        wp_redirect( basename(__FILE__) ."?post=$post&action=upload" ); 
    148148        die; 
    149149} elseif ( count($attachments) > $num ) { 
  • trunk/wp-admin/link.php

    r595 r599  
    3838                //for each link id (in $linkcheck[]) change category to selected value 
    3939                if (count($linkcheck) == 0) { 
    40                         header('Location: '.$this_file); 
     40                        wp_redirect($this_file); 
    4141                        exit; 
    4242                } 
     
    5050                } 
    5151 
    52                 header("Location: $this_file?deleted=$deleted"); 
     52                wp_redirect("$this_file?deleted=$deleted"); 
    5353                break; 
    5454 
     
    6262                //for each link id (in $linkcheck[]) change category to selected value 
    6363                if (count($linkcheck) == 0) { 
    64                         header('Location: '.$this_file); 
     64                        wp_redirect($this_file); 
    6565                        exit; 
    6666                } 
     
    6969                //$q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)"); 
    7070 
    71                 header('Location: '.$this_file); 
     71                wp_redirect($this_file); 
    7272                break; 
    7373 
     
    7777                add_link(); 
    7878 
    79                 header('Location: '.wp_get_referer().'?added=true'); 
     79                wp_redirect(wp_get_referer().'?added=true'); 
    8080                break; 
    8181 
  • trunk/wp-admin/moderation.php

    r550 r599  
    7171 
    7272        $file = basename(__FILE__); 
    73         header("Location: $file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam"); 
     73        wp_redirect("$file?ignored=$item_ignored&deleted=$item_deleted&approved=$item_approved&spam=$item_spam"); 
    7474        exit(); 
    7575 
  • trunk/wp-admin/options-discussion.php

    r550 r599  
    8888<textarea name="blacklist_keys" cols="60" rows="4" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>  
    8989</p> 
    90 <p><label for="open_proxy_check">  
    91 <input name="open_proxy_check" type="checkbox" id="open_proxy_check" value="1" <?php checked('1', get_settings('open_proxy_check')); ?> />  
    92 <?php _e('Blacklist comments from open and insecure proxies.') ?></label></p> 
    9390</fieldset> 
    9491<p class="submit"> 
  • trunk/wp-admin/page.php

    r595 r599  
    5353                $location = "page.php?action=edit&post=$page_ID"; 
    5454 
    55         header("Location: $location"); 
     55        wp_redirect($location); 
    5656        exit(); 
    5757        break; 
     
    121121                $location = 'page-new.php'; 
    122122        } 
    123         header ('Location: ' . $location); // Send user on their way while we keep working 
     123        wp_redirect($location); // Send user on their way while we keep working 
    124124 
    125125        exit(); 
     
    147147        elseif (strstr($sendback, 'attachments.php')) $sendback = get_settings('siteurl') .'/wp-admin/attachments.php'; 
    148148        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 
    149         header ('Location: ' . $sendback); 
     149        wp_redirect($sendback); 
    150150        exit(); 
    151151        break; 
    152152 
    153153default: 
    154         header('Location: edit-pages.php'); 
     154        wp_redirect('edit-pages.php'); 
    155155        exit(); 
    156156        break; 
  • trunk/wp-admin/plugin-editor.php

    r559 r599  
    4646                fwrite($f, $newcontent); 
    4747                fclose($f); 
    48                 header("Location: plugin-editor.php?file=$file&a=te"); 
     48                wp_redirect("plugin-editor.php?file=$file&a=te"); 
    4949        } else { 
    50                 header("Location: plugin-editor.php?file=$file"); 
     50                wp_redirect("plugin-editor.php?file=$file"); 
    5151        } 
    5252 
  • trunk/wp-admin/plugins.php

    r550 r599  
    2020                        do_action('activate_' . trim( $_GET['plugin'] )); 
    2121                } 
    22                 header('Location: plugins.php?activate=true'); 
     22                wp_redirect('plugins.php?activate=true'); 
    2323        } else if ('deactivate' == $_GET['action']) { 
    2424                check_admin_referer('deactivate-plugin_' . $_GET['plugin']); 
     
    2727                update_option('active_plugins', $current); 
    2828                do_action('deactivate_' . trim( $_GET['plugin'] )); 
    29                 header('Location: plugins.php?deactivate=true'); 
     29                wp_redirect('plugins.php?deactivate=true'); 
    3030        } 
    3131        exit; 
  • trunk/wp-admin/post.php

    r595 r599  
    5353                $location = "post.php?action=edit&post=$post_ID"; 
    5454 
    55         header("Location: $location"); 
     55        wp_redirect($location); 
    5656        exit(); 
    5757        break; 
     
    124124        } 
    125125 
    126         header ('Location: ' . $location); // Send user on their way while we keep working 
     126        wp_redirect($location); // Send user on their way while we keep working 
    127127 
    128128        exit(); 
     
    150150        elseif (strstr($sendback, 'attachments.php')) $sendback = get_settings('siteurl') .'/wp-admin/attachments.php'; 
    151151        $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 
    152         header ('Location: ' . $sendback); 
     152        wp_redirect($sendback); 
    153153        exit(); 
    154154        break; 
    155155 
    156156default: 
    157         header('Location: edit.php'); 
     157        wp_redirect('edit.php'); 
    158158        exit(); 
    159159        break; 
  • trunk/wp-admin/templates.php

    r559 r599  
    4949                        fwrite($f, $newcontent); 
    5050                        fclose($f); 
    51                         header("Location: templates.php?file=$file&a=te"); 
     51                        wp_redirect("templates.php?file=$file&a=te"); 
    5252                } else { 
    53                         header("Location: templates.php?file=$file&a=err"); 
     53                        wp_redirect("templates.php?file=$file&a=err"); 
    5454                } 
    5555        } else { 
    56                 header("Location: templates.php?file=$file&a=err"); 
     56                wp_redirect("templates.php?file=$file&a=err"); 
    5757        } 
    5858 
  • trunk/wp-admin/theme-editor.php

    r559 r599  
    6060                fwrite($f, $newcontent); 
    6161                fclose($f); 
    62                 header("Location: theme-editor.php?file=$file&theme=$theme&a=te"); 
     62                wp_redirect("theme-editor.php?file=$file&theme=$theme&a=te"); 
    6363        } else { 
    64                 header("Location: theme-editor.php?file=$file&theme=$theme"); 
     64                wp_redirect("theme-editor.php?file=$file&theme=$theme"); 
    6565        } 
    6666 
  • trunk/wp-admin/themes.php

    r550 r599  
    22require_once('admin.php'); 
    33 
    4 if ( isset($_GET['action']) ) { 
    5         check_admin_referer('switch-theme_' . $_GET['template']); 
    6  
    7         if ('activate' == $_GET['action']) { 
    8                 if ( isset($_GET['template']) ) 
    9                         update_option('template', $_GET['template']); 
    10  
    11                 if ( isset($_GET['stylesheet']) ) 
    12                         update_option('stylesheet', $_GET['stylesheet']); 
    13  
    14                 do_action('switch_theme', get_current_theme()); 
    15  
    16                 header('Location: themes.php?activated=true'); 
    17                 exit; 
    18         } 
    19 } 
    20  
    21 $title = __('Manage Themes'); 
    22 $parent_file = 'themes.php'; 
    23 require_once('admin-header.php'); 
    24 ?> 
    25  
    26 <?php if ( ! validate_current_theme() ) : ?> 
    27 <div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div> 
    28 <?php elseif ( isset($_GET['activated']) ) : ?> 
    29 <div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site &raquo;</a>'), get_bloginfo('home') . '/'); ?></p></div> 
    30 <?php endif; ?> 
    31  
    32 <?php 
    334$themes = get_themes(); 
    345$ct = current_theme_info(); 
     
    5223} 
    5324reset( $themes ); 
     25 
     26if ( isset($_GET['action']) ) { 
     27        check_admin_referer('switch-theme_' . $_GET['template']); 
     28 
     29        if ('activate' == $_GET['action']) { 
     30                $found = false; 
     31                while( list( $key, $details ) = each( $themes ) ) {  
     32                        if( $details[ 'Template' ] == $_GET['template'] && $details[ 'Stylesheet' ] == $_GET['stylesheet'] ) { 
     33                                $found = true; 
     34                                break; 
     35                        } 
     36                } 
     37                if( $found == true ) { 
     38                        if ( isset($_GET['template']) ) 
     39                                update_option('template', $_GET['template']); 
     40 
     41                        if ( isset($_GET['stylesheet']) ) 
     42                                update_option('stylesheet', $_GET['stylesheet']); 
     43 
     44                        do_action('switch_theme', get_current_theme()); 
     45 
     46                        wp_redirect('themes.php?activated=true'); 
     47                } else { 
     48                        wp_redirect('themes.php'); 
     49                } 
     50                exit; 
     51        } 
     52} 
     53 
     54$title = __('Manage Themes'); 
     55$parent_file = 'themes.php'; 
     56require_once('admin-header.php'); 
    5457?> 
     58 
     59<?php if ( ! validate_current_theme() ) : ?> 
     60<div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div> 
     61<?php elseif ( isset($_GET['activated']) ) : ?> 
     62<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site &raquo;</a>'), get_bloginfo('home') . '/'); ?></p></div> 
     63<?php endif; ?> 
     64 
    5565 
    5666<div class="wrap"> 
  • trunk/wp-admin/user-edit.php

    r598 r599  
    2626 
    2727$wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashes($wp_http_referer)); 
    28 $errors = array(); 
    29  
    3028// Only allow site admins to edit every user. 
    31 if( is_site_admin() == false )  
    32         if( $user_id != $current_user->ID ) $errors = new WP_Error('head', __('You do not have permission to edit this user.')); 
     29if ( !is_site_admin() && ($user_id != $current_user->ID) ) 
     30        $errors = new WP_Error('head', __('You do not have permission to edit this user.')); 
    3331 
    3432switch ($action) { 
     
    4745if ( !current_user_can('edit_user', $user_id) ) 
    4846        $errors = new WP_Error('head', __('You do not have permission to edit this user.')); 
    49 else 
    50         if( isset( $errors ) == false ) $errors = edit_user($user_id); 
     47 
     48if ( !isset($errors) ) 
     49        $errors = edit_user($user_id); 
    5150 
    5251if( !is_wp_error( $errors ) ) { 
    5352        $redirect = "user-edit.php?user_id=$user_id&updated=true"; 
    5453        $redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect); 
    55         header("Location: $redirect"); 
     54        wp_redirect($redirect); 
    5655        exit; 
    5756} 
  • trunk/wp-admin/users.php

    r559 r599  
    125125 
    126126        if (empty($_POST['users'])) { 
    127                 header('Location: ' . $redirect); 
     127                wp_redirect($redirect); 
    128128        } 
    129129 
     
    146146        } 
    147147 
    148         header('Location: ' . add_query_arg('update', $update, $redirect)); 
     148        wp_redirect(add_query_arg('update', $update, $redirect)); 
    149149 
    150150break; 
     
    155155 
    156156        if ( empty($_POST['users']) ) { 
    157                 header('Location: ' . $redirect); 
     157                wp_redirect($redirect); 
    158158        } 
    159159 
     
    186186        $redirect = add_query_arg('delete_count', $delete_count, $redirect); 
    187187 
    188         header('Location: ' . add_query_arg('update', $update, $redirect)); 
     188        wp_redirect(add_query_arg('update', $update, $redirect)); 
    189189 
    190190break; 
     
    195195 
    196196        if ( empty($_POST['users']) ) 
    197                 header('Location: ' . $redirect); 
     197                wp_redirect($redirect); 
    198198 
    199199        if ( !current_user_can('delete_users') ) 
     
    333333                $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_POST['user_login']), true)); 
    334334                $redirect = add_query_arg('usersearch', $new_user_login, $redirect); 
    335                 header('Location: ' . add_query_arg('update', $update, $redirect) . '#user-' . $user_id); 
     335                wp_redirect(add_query_arg('update', $update, $redirect) . '#user-' . $user_id); 
    336336                die(); 
    337337        } 
  • trunk/wp-content/mu-plugins/misc.php

    r551 r599  
    11<?php 
     2 
     3function kill_proxy_check( $option ) { 
     4        return 0; 
     5} 
     6add_filter('option_open_proxy_check', 'kill_proxy_check'); 
    27 
    38function graceful_fail( $message ) { 
  • trunk/wp-content/themes/default/functions.php

    r541 r599  
    124124                        } 
    125125                        //print_r($_REQUEST); 
    126                         header("Location: themes.php?page=functions.php&saved=true"); 
     126                        wp_redirect("themes.php?page=functions.php&saved=true"); 
    127127                        die; 
    128128                } 
  • trunk/wp-includes/cron.php

    r559 r599  
    6666 
    6767function spawn_cron() { 
    68         $keys = array_keys( get_option( 'cron' ) ); 
     68        $crons = get_option( 'cron' ); 
     69         
     70        if ( !is_array($crons) ) 
     71                return; 
     72         
     73        $keys = array_keys( $crons ); 
    6974        if ( array_shift( $keys ) > time() ) 
    7075                return; 
  • trunk/wp-includes/functions.php

    r595 r599  
    810810function do_robots() { 
    811811        global $current_blog; 
    812         do_action('do_robots'); 
     812        do_action('do_robotstxt'); 
     813 
    813814        if ( '0' == $current_blog->public ) { 
    814815                echo "User-agent: *\n"; 
     
    10441045} 
    10451046 
     1047function wp_explain_nonce($action) { 
     1048        if ( $action !== -1 && preg_match('/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches) ) { 
     1049                $verb = $matches[1]; 
     1050                $noun = $matches[2]; 
     1051 
     1052                $trans = array(); 
     1053                $trans['update']['attachment'] = array(__('Are you sure you want to edit this attachment: &quot;%s&quot;?'), 'get_the_title'); 
     1054 
     1055                $trans['add']['category'] = array(__('Are you sure you want to add this category?'), false); 
     1056                $trans['delete']['category'] = array(__('Are you sure you want to delete this category: &quot;%s&quot;?'), 'get_catname'); 
     1057                $trans['update']['category'] = array(__('Are you sure you want to edit this category: &quot;%s&quot;?'), 'get_catname'); 
     1058 
     1059                $trans['delete']['comment'] = array(__('Are you sure you want to delete this comment: &quot;%s&quot;?'), 'use_id'); 
     1060                $trans['unapprove']['comment'] = array(__('Are you sure you want to unapprove this comment: &quot;%s&quot;?'), 'use_id'); 
     1061                $trans['approve']['comment'] = array(__('Are you sure you want to approve this comment: &quot;%s&quot;?'), 'use_id'); 
     1062                $trans['update']['comment'] = array(__('Are you sure you want to edit this comment: &quot;%s&quot;?'), 'use_id'); 
     1063                $trans['bulk']['comments'] = array(__('Are you sure you want to bulk modify comments?'), false); 
     1064                $trans['moderate']['comments'] = array(__('Are you sure you want to moderate comments?'), false); 
     1065 
     1066                $trans['add']['bookmark'] = array(__('Are you sure you want to add this bookmark?'), false); 
     1067                $trans['delete']['bookmark'] = array(__('Are you sure you want to delete this bookmark: &quot;%s&quot;?'), 'use_id'); 
     1068                $trans['update']['bookmark'] = array(__('Are you sure you want to edit this bookmark: &quot;%s&quot;?'), 'use_id'); 
     1069                $trans['bulk']['bookmarks'] = array(__('Are you sure you want to bulk modify bookmarks?'), false); 
     1070 
     1071                $trans['add']['page'] = array(__('Are you sure you want to add this page?'), false); 
     1072                $trans['delete']['page'] = array(__('Are you sure you want to delete this page: &quot;%s&quot;?'), 'get_the_title'); 
     1073                $trans['update']['page'] = array(__('Are you sure you want to edit this page: &quot;%s&quot;?'), 'get_the_title'); 
     1074 
     1075                $trans['edit']['plugin'] = array(__('Are you sure you want to edit this plugin file: &quot;%s&quot;?'), 'use_id'); 
     1076                $trans['activate']['plugin'] = array(__('Are you sure you want to activate this plugin: &quot;%s&quot;?'), 'use_id'); 
     1077                $trans['deactivate']['plugin'] = array(__('Are you sure you want to deactivate this plugin: &quot;%s&quot;?'), 'use_id'); 
     1078 
     1079                $trans['add']['post'] = array(__('Are you sure you want to add this post?'), false); 
     1080                $trans['delete']['post'] = array(__('Are you sure you want to delete this post: &quot;%s&quot;?'), 'get_the_title'); 
     1081                $trans['update']['post'] = array(__('Are you sure you want to edit this post: &quot;%s&quot;?'), 'get_the_title'); 
     1082 
     1083                $trans['add']['user'] = array(__('Are you sure you want to add this user?'), false); 
     1084                $trans['delete']['users'] = array(__('Are you sure you want to delete users?'), false); 
     1085                $trans['bulk']['users'] = array(__('Are you sure you want to bulk modify users?'), false); 
     1086                $trans['update']['user'] = array(__('Are you sure you want to edit this user: &quot;%s&quot;?'), 'get_author_name'); 
     1087                $trans['update']['profile'] = array(__('Are you sure you want to modify the profile for: &quot;%s&quot;?'), 'get_author_name'); 
     1088 
     1089                $trans['update']['options'] = array(__('Are you sure you want to edit your settings?'), false); 
     1090                $trans['update']['permalink'] = array(__('Are you sure you want to change your permalink structure to: %s?'), 'use_id'); 
     1091                $trans['edit']['file'] = array(__('Are you sure you want to edit this file: &quot;%s&quot;?'), 'use_id'); 
     1092                $trans['edit']['theme'] = array(__('Are you sure you want to edit this theme file: &quot;%s&quot;?'), 'use_id'); 
     1093                $trans['switch']['theme'] = array(__('Are you sure you want to switch to this theme: &quot;%s&quot;?'), 'use_id'); 
     1094 
     1095                if ( isset($trans[$verb][$noun]) ) { 
     1096                        if ( !empty($trans[$verb][$noun][1]) ) { 
     1097                                $lookup = $trans[$verb][$noun][1]; 
     1098                                $object = $matches[4]; 
     1099                                if ( 'use_id' != $lookup ) 
     1100                                        $object = call_user_func($lookup, $object); 
     1101                                return sprintf($trans[$verb][$noun][0], $object); 
     1102                        } else { 
     1103                                return $trans[$verb][$noun][0]; 
     1104                        } 
     1105                } 
     1106        } 
     1107 
     1108        return __('Are you sure you want to do this'); 
     1109} 
     1110 
     1111function wp_nonce_ays($action) { 
     1112        global $pagenow, $menu, $submenu, $parent_file, $submenu_file; 
     1113 
     1114        $adminurl = get_settings('siteurl') . '/wp-admin'; 
     1115        if ( wp_get_referer() ) 
     1116                $adminurl = wp_get_referer(); 
     1117 
     1118        $title = __('WordPress Confirmation'); 
     1119        require_once(ABSPATH . '/wp-admin/admin-header.php'); 
     1120        // Remove extra layer of slashes. 
     1121        $_POST   = stripslashes_deep($_POST  ); 
     1122        if ( $_POST ) { 
     1123                $q = http_build_query($_POST); 
     1124                $q = explode( ini_get('arg_separator.output'), $q); 
     1125                $html .= "\t<form method='post' action='$pagenow'>\n"; 
     1126                foreach ( (array) $q as $a ) { 
     1127                        $v = substr(strstr($a, '='), 1); 
     1128                        $k = substr($a, 0, -(strlen($v)+1)); 
     1129                        $html .= "\t\t<input type='hidden' name='" . wp_specialchars( urldecode($k), 1 ) . "' value='" . wp_specialchars( urldecode($v), 1 ) . "' />\n"; 
     1130                } 
     1131                $html .= "\t\t<input type='hidden' name='_wpnonce' value='" . wp_create_nonce($action) . "' />\n"; 
     1132                $html .= "\t\t<div id='message' class='confirm fade'>\n\t\t<p>" . wp_explain_nonce($action) . "</p>\n\t\t<p><a href='$adminurl'>" . __('No') . "</a> <input type='submit' value='" . __('Yes') . "' /></p>\n\t\t</div>\n\t</form>\n"; 
     1133        } else { 
     1134                $html .= "\t<div id='message' class='confirm fade'>\n\t<p>" . wp_explain_nonce($action) . "</p>\n\t<p><a href='$adminurl'>" . __('No') . "</a> <a href='" . add_query_arg( '_wpnonce', wp_create_nonce($action), $_SERVER['REQUEST_URI'] ) . "'>" . __('Yes') . "</a></p>\n\t</div>\n"; 
     1135        } 
     1136        $html .= "</body>\n</html>"; 
     1137        echo $html; 
     1138        include_once(ABSPATH . '/wp-admin/admin-footer.php'); 
     1139} 
     1140 
    10461141?> 
  • trunk/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js

    r454 r599  
     1/** 
     2 * $RCSfile: editor_plugin_src.js,v $ 
     3 * $Revision: 1.16 $ 
     4 * $Date: 2006/02/10 21:34:28 $ 
     5 * 
     6 * @author Moxiecode 
     7 * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. 
     8 */ 
     9 
    110/* Import plugin specific language pack */ 
    2 tinyMCE.importPluginLanguagePack('directionality', 'en,sv,fr_ca,zh_cn,cs,da,he,no,de,hu,ru,ru_KOI8-R,ru_UTF-8,es,cy,is,pl'); 
     11tinyMCE.importPluginLanguagePack('directionality', 'en,tr,sv,fr_ca,zh_cn,cs,da,he,nb,de,hu,ru,ru_KOI8-R,ru_UTF-8,nn,es,cy,is,pl,nl,fr,pt_br'); 
    312 
    4 function TinyMCE_directionality_getInfo() { 
    5         return { 
    6                 longname : 'Directionality', 
    7                 author : 'Moxiecode Systems', 
    8                 authorurl : 'http://tinymce.moxiecode.com', 
    9                 infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html', 
    10                 version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
    11         }; 
     13var TinyMCE_DirectionalityPlugin = { 
     14        getInfo : function() { 
     15                return { 
     16                        longname : 'Directionality', 
     17                        author : 'Moxiecode Systems', 
     18                        authorurl : 'http://tinymce.moxiecode.com', 
     19                        infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html', 
     20                        version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
     21                }; 
     22        }, 
     23 
     24        getControlHTML : function(cn) { 
     25                switch (cn) { 
     26                        case "ltr": 
     27                                return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR'); 
     28 
     29                        case "rtl": 
     30                                return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL'); 
     31                } 
     32 
     33                return ""; 
     34        }, 
     35 
     36        execCommand : function(editor_id, element, command, user_interface, value) { 
     37                // Handle commands 
     38                switch (command) { 
     39                        case "mceDirectionLTR": 
     40                                var inst = tinyMCE.getInstanceById(editor_id); 
     41                                var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 
     42 
     43                                if (elm) 
     44                                        elm.setAttribute("dir", "ltr"); 
     45 
     46                                tinyMCE.triggerNodeChange(false); 
     47                                return true; 
     48 
     49                        case "mceDirectionRTL": 
     50                                var inst = tinyMCE.getInstanceById(editor_id); 
     51                                var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 
     52 
     53                                if (elm) 
     54                                        elm.setAttribute("dir", "rtl"); 
     55 
     56                                tinyMCE.triggerNodeChange(false); 
     57                                return true; 
     58                } 
     59 
     60                // Pass to next handler in chain 
     61                return false; 
     62        }, 
     63 
     64        handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { 
     65                function getAttrib(elm, name) { 
     66                        return elm.getAttribute(name) ? elm.getAttribute(name) : ""; 
     67                } 
     68 
     69                if (node == null) 
     70                        return; 
     71 
     72                var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address"); 
     73                if (!elm) { 
     74                        tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled'); 
     75                        tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled'); 
     76                        return true; 
     77                } 
     78 
     79                tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal'); 
     80                tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal'); 
     81 
     82                var dir = getAttrib(elm, "dir"); 
     83                if (dir == "ltr" || dir == "") 
     84                        tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected'); 
     85                else 
     86                        tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected'); 
     87 
     88                return true; 
     89        } 
    1290}; 
    1391 
    14 function TinyMCE_directionality_getControlHTML(control_name) { 
    15     switch (control_name) { 
    16         case "ltr": 
    17                         var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionLTR\');return false;'; 
    18             return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}_ltr" src="{$pluginurl}/images/ltr.gif" title="{$lang_directionality_ltr_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>' 
    19                         + '<div class="zerosize"><input type="button" accesskey="." onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionLTR\',false);" /></div>'; 
    20  
    21         case "rtl": 
    22                         var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionRTL\');return false;'; 
    23             return '<a href="javascript:' + cmd + '" onclick="' + cmd + '" target="_self" onmousedown="return false;"><img id="{$editor_id}_rtl" src="{$pluginurl}/images/rtl.gif" title="{$lang_directionality_rtl_desc}" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>' 
    24                         + '<div class="zerosize"><input type="button" accesskey="," onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceDirectionRTL\',false);" /></div>'; 
    25     } 
    26  
    27     return ""; 
    28 
    29<