Changeset 1260

Show
Ignore:
Timestamp:
04/24/08 11:45:39 (3 months ago)
Author:
donncha
Message:

Merged with WP 2.5, revision 7806

Files:

Legend:

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

    r1218 r1260  
    163163                        continue; 
    164164                $category = get_category( $cat_id ); 
    165                 $checked_categories[] = $cat_id; 
    166165                ob_start(); 
    167                         dropdown_categories( 0, $category ); 
     166                        wp_category_checklist( 0, $cat_id, $checked_categories ); 
    168167                $data = ob_get_contents(); 
    169168                ob_end_clean(); 
     
    435434case 'add-user' : 
    436435        check_ajax_referer( $action ); 
    437         if ( !current_user_can('edit_users') ) 
     436        if ( !current_user_can('create_users') ) 
    438437                die('-1'); 
    439438        require_once(ABSPATH . WPINC . '/registration.php'); 
  • trunk/wp-admin/async-upload.php

    r1214 r1260  
    2121        wp_die(__('You do not have permission to upload files.')); 
    2222 
     23// just fetch the detail form for that attachment        
     24if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) { 
     25        echo get_media_item($id); 
     26        exit; 
     27} 
     28 
    2329$id = media_handle_upload('async-upload', $_REQUEST['post_id']); 
    2430if (is_wp_error($id)) { 
     
    2733} 
    2834 
    29 $type = $_REQUEST['type']; 
    30 echo apply_filters("async_upload_{$type}", $id); 
     35if ( $_REQUEST['short'] ) { 
     36        // short form response - attachment ID only 
     37        echo $id; 
     38
     39else { 
     40        // long form response - big chunk o html 
     41        $type = $_REQUEST['type']; 
     42        echo apply_filters("async_upload_{$type}", $id); 
     43
    3144 
    3245?> 
  • trunk/wp-admin/comment.php

    r1218 r1260  
    142142                wp_delete_comment( $comment->comment_ID ); 
    143143 
    144         if ( '' != wp_get_referer() && false == $noredir
     144        if ( '' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' )
    145145                wp_redirect( wp_get_referer() ); 
     146        else if ( '' != wp_get_original_referer() && false == $noredir ) 
     147                wp_redirect( wp_get_original_referer() ); 
    146148        else 
    147149                wp_redirect( get_option('siteurl') . '/wp-admin/edit-comments.php' ); 
  • trunk/wp-admin/css/media.css

    r1218 r1260  
    9292} 
    9393 
    94 .filename { 
    95         display: none; 
     94.filename.original { 
     95        float: left; 
     96
     97.crunching { 
     98        display: block; 
     99        line-height: 32px; 
     100        text-align: right; 
     101        margin-right: 5px; 
    96102} 
    97103button.dismiss { 
     
    119125        border-right-style: solid; 
    120126} 
     127 
     128#library-form .progress, #gallery-form .progress { 
     129        display: none; 
     130} 
     131 
    121132.media-item .thumbnail { 
    122133        max-width: 128px; 
     
    124135} 
    125136.media-item .pinkynail { 
    126         position: absolute; 
    127         top: 2px; 
    128         left: 2px; 
     137        float: left; 
     138        margin: 2px; 
    129139        height: 32px; 
    130140        max-width: 40px; 
    131141} 
    132142 
    133 tbody.media-item-info tr { 
     143thead.media-item-info tr { 
    134144        background-color: transparent; 
    135145} 
    136 tbody.media-item-info th, tbody.media-item-info td { 
     146thead.media-item-info th, thead.media-item-info td { 
    137147        border: none; 
    138148        margin: 0; 
    139149} 
    140150 
    141 .form-table tbody.media-item-info { 
     151.form-table thead.media-item-info { 
    142152        border: 8px solid #fff; 
    143153} 
     
    165175        display: block; 
    166176        line-height: 36px; 
    167         z-index: 2; 
    168         position: absolute; 
    169         top: 0px; 
    170         right: 20px; 
     177        float: right; 
     178        margin-right: 20px; 
    171179} 
    172180.describe-toggle-off { 
    173181        display: none; 
    174182} 
     183 
    175184.clickmask { 
    176         background: transparent; 
    177         position: absolute; 
    178         top: 0px; 
    179         left: 0px; 
    180         cursor: pointer; 
    181         border: none; 
    182         z-index: 3; 
    183         height: 36px; 
    184185} 
    185186 
     
    211212 
    212213#media-upload .media-item { 
     214        position: relative; 
    213215        border-bottom-width: 1px; 
    214216        border-bottom-style: solid; 
    215         width: 623px; 
    216         position: relative; 
    217217        min-height: 36px; 
    218 
    219 #media-upload .filename { 
    220         display: block; 
     218        width: 100%; 
     219
     220.filename { 
    221221        line-height: 36px; 
    222         margin-left: 50px; 
    223         z-index: 2
     222        margin-left: 10px; 
     223        float: left
    224224} 
    225225#media-upload .describe { 
  • trunk/wp-admin/css/widgets-rtl.css

    r1218 r1260  
    3636li.widget-list-control-item h4.widget-title a, #dragHelper li.widget-list-control-item h4.widget-title a, #draghelper li.widget-list-control-item h4.widget-title a:visited { 
    3737        right:auto; 
    38         left:2em; 
     38        left:1em; 
    3939} 
    4040 
  • trunk/wp-admin/css/widgets.css

    r1218 r1260  
    9292} 
    9393 
     94ul.widget-control-list li { 
     95        position: relative; 
     96} 
     97 
    9498div#current-widgets p.submit { 
    9599        padding: 1em; 
     
    136140#dragHelper li.widget-list-control-item h4.widget-title a, 
    137141#draghelper li.widget-list-control-item h4.widget-title a:visited { 
    138         right: 2em; 
     142        right: 1em; 
    139143} 
    140144 
  • trunk/wp-admin/custom-header.php

    r1218 r1260  
    1212 
    1313                add_action("admin_print_scripts-$page", array(&$this, 'js_includes')); 
     14                add_action("admin_head-$page", array(&$this, 'take_action'), 50); 
    1415                add_action("admin_head-$page", array(&$this, 'js'), 50); 
    1516                add_action("admin_head-$page", $this->admin_header_callback, 51); 
    1617        } 
    1718 
     19        function step() { 
     20                $step = (int) @$_GET['step']; 
     21                if ( $step < 1 || 3 < $step ) 
     22                        $step = 1; 
     23                return $step; 
     24        } 
     25 
    1826        function js_includes() { 
    19                 wp_enqueue_script('cropper'); 
    20                 wp_enqueue_script('colorpicker'); 
    21         } 
    22  
    23         function js() { 
    24  
     27                $step = $this->step(); 
     28                if ( 1 == $step ) 
     29                        wp_enqueue_script('colorpicker'); 
     30                elseif ( 2 == $step )    
     31                        wp_enqueue_script('cropper'); 
     32        } 
     33 
     34        function take_action() { 
    2535                if ( isset( $_POST['textcolor'] ) ) { 
    2636                        check_admin_referer('custom-header'); 
     
    3747                        remove_theme_mods(); 
    3848                } 
    39         ?> 
     49        } 
     50 
     51        function js() { 
     52                $step = $this->step(); 
     53                if ( 1 == $step ) 
     54                        $this->js_1(); 
     55                elseif ( 2 == $step ) 
     56                        $this->js_2(); 
     57        } 
     58 
     59        function js_1() { ?> 
    4060<script type="text/javascript"> 
    41  
     61        var cp = new ColorPicker(); 
     62 
     63        function pickColor(color) { 
     64                $('name').style.color = color; 
     65                $('desc').style.color = color; 
     66                $('textcolor').value = color; 
     67        } 
     68        function PopupWindow_hidePopup(magicword) { 
     69                if ( magicword != 'prettyplease' ) 
     70                        return false; 
     71                if (this.divName != null) { 
     72                        if (this.use_gebi) { 
     73                                document.getElementById(this.divName).style.visibility = "hidden"; 
     74                        } 
     75                        else if (this.use_css) { 
     76                                document.all[this.divName].style.visibility = "hidden"; 
     77                        } 
     78                        else if (this.use_layers) { 
     79                                document.layers[this.divName].visibility = "hidden"; 
     80                        } 
     81                } 
     82                else { 
     83                        if (this.popupWindow && !this.popupWindow.closed) { 
     84                                this.popupWindow.close(); 
     85                                this.popupWindow = null; 
     86                        } 
     87                } 
     88                return false; 
     89        } 
     90        function colorSelect(t,p) { 
     91                if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" ) { 
     92                        cp.hidePopup('prettyplease'); 
     93                } else { 
     94                        cp.p = p; 
     95                        cp.select(t,p); 
     96                } 
     97        } 
     98        function colorDefault() { 
     99                pickColor('#<?php echo HEADER_TEXTCOLOR; ?>'); 
     100        } 
     101 
     102        function hide_text() { 
     103                $('name').style.display = 'none'; 
     104                $('desc').style.display = 'none'; 
     105                $('pickcolor').style.display = 'none'; 
     106                $('defaultcolor').style.display = 'none'; 
     107                $('textcolor').value = 'blank'; 
     108                $('hidetext').value = '<?php _e('Show Text'); ?>'; 
     109//              $('hidetext').onclick = 'show_text()'; 
     110                Event.observe( $('hidetext'), 'click', show_text ); 
     111        } 
     112 
     113        function show_text() { 
     114                $('name').style.display = 'block'; 
     115                $('desc').style.display = 'block'; 
     116                $('pickcolor').style.display = 'inline'; 
     117                $('defaultcolor').style.display = 'inline'; 
     118                $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>'; 
     119                $('hidetext').value = '<?php _e('Hide Text'); ?>'; 
     120                Event.stopObserving( $('hidetext'), 'click', show_text ); 
     121                Event.observe( $('hidetext'), 'click', hide_text ); 
     122        } 
     123 
     124        <?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?> 
     125Event.observe( window, 'load', hide_text ); 
     126        <?php } ?> 
     127 
     128</script> 
     129<?php 
     130        } 
     131 
     132        function js_2() { ?> 
     133<script type="text/javascript"> 
    42134        function onEndCrop( coords, dimensions ) { 
    43135                $( 'x1' ).value = coords.x1; 
     
    78170                } 
    79171        ); 
    80  
    81         var cp = new ColorPicker(); 
    82  
    83         function pickColor(color) { 
    84                 $('name').style.color = color; 
    85                 $('desc').style.color = color; 
    86                 $('textcolor').value = color; 
    87         } 
    88         function PopupWindow_hidePopup(magicword) { 
    89                 if ( magicword != 'prettyplease' ) 
    90                         return false; 
    91                 if (this.divName != null) { 
    92                         if (this.use_gebi) { 
    93                                 document.getElementById(this.divName).style.visibility = "hidden"; 
    94                         } 
    95                         else if (this.use_css) { 
    96                                 document.all[this.divName].style.visibility = "hidden"; 
    97                         } 
    98                         else if (this.use_layers) { 
    99                                 document.layers[this.divName].visibility = "hidden"; 
    100                         } 
    101                 } 
    102                 else { 
    103                         if (this.popupWindow && !this.popupWindow.closed) { 
    104                                 this.popupWindow.close(); 
    105                                 this.popupWindow = null; 
    106                         } 
    107                 } 
    108                 return false; 
    109         } 
    110         function colorSelect(t,p) { 
    111                 if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" ) { 
    112                         cp.hidePopup('prettyplease'); 
    113                 } else { 
    114                         cp.p = p; 
    115                         cp.select(t,p); 
    116                 } 
    117         } 
    118         function colorDefault() { 
    119                 pickColor('<?php echo HEADER_TEXTCOLOR; ?>'); 
    120         } 
    121  
    122         function hide_text() { 
    123                 $('name').style.display = 'none'; 
    124                 $('desc').style.display = 'none'; 
    125                 $('pickcolor').style.display = 'none'; 
    126                 $('defaultcolor').style.display = 'none'; 
    127                 $('textcolor').value = 'blank'; 
    128                 $('hidetext').value = '<?php _e('Show Text'); ?>'; 
    129 //              $('hidetext').onclick = 'show_text()'; 
    130                 Event.observe( $('hidetext'), 'click', show_text ); 
    131         } 
    132  
    133         function show_text() { 
    134                 $('name').style.display = 'block'; 
    135                 $('desc').style.display = 'block'; 
    136                 $('pickcolor').style.display = 'inline'; 
    137                 $('defaultcolor').style.display = 'inline'; 
    138                 $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>'; 
    139                 $('hidetext').value = '<?php _e('Hide Text'); ?>'; 
    140                 Event.stopObserving( $('hidetext'), 'click', show_text ); 
    141                 Event.observe( $('hidetext'), 'click', hide_text ); 
    142         } 
    143  
    144         <?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?> 
    145 Event.observe( window, 'load', hide_text ); 
    146         <?php } ?> 
    147  
    148172</script> 
    149173<?php 
     
    253277 
    254278<p><?php _e('Choose the part of the image you want to use as your header.'); ?></p> 
    255 <div id="testWrap"
     279<div id="testWrap" style="position: relative"
    256280<img src="<?php echo $url; ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" /> 
    257281</div> 
     
    328352 
    329353        function admin_page() { 
    330                 if ( !isset( $_GET['step'] ) ) 
    331                         $step = 1; 
    332                 else 
    333                         $step = (int) $_GET['step']; 
    334  
    335                 if ( 1 == $step ) { 
     354                $step = $this->step(); 
     355                if ( 1 == $step ) 
    336356                        $this->step_1(); 
    337                 } elseif ( 2 == $step ) { 
     357                elseif ( 2 == $step ) 
    338358                        $this->step_2(); 
    339                 } elseif ( 3 == $step ) { 
     359                elseif ( 3 == $step ) 
    340360                        $this->step_3(); 
    341                 } 
    342  
    343361        } 
    344362 
  • trunk/wp-admin/edit-form-advanced.php

    r1218 r1260  
    5555<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" /> 
    5656<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" /> 
    57 <input type="hidden" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" /> 
     57<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" /> 
    5858<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" /> 
    5959<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" /> 
     
    6161if ( !empty($_REQUEST['popupurl']) ) 
    6262        echo clean_url(stripslashes($_REQUEST['popupurl'])); 
    63 else if ( url_to_postid(wp_get_referer()) == $post_ID && strpos( wp_get_referer(), '/wp-admin/' ) === false
     63else if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID
    6464        echo 'redo'; 
    6565else 
     
    223223                <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" /> 
    224224                <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?> 
    225                 <input type="button" id="category-add-sumbit" class="add:categorychecklist:categorydiv button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> 
     225                <input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" /> 
    226226                <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?> 
    227227                <span id="category-ajax-response"></span> 
     
    234234</ul> 
    235235 
     236<div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 
     237        <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 
     238                <?php $popular_ids = wp_popular_terms_checklist('category'); ?> 
     239        </ul> 
     240</div> 
     241 
    236242<div id="categories-all" class="ui-tabs-panel"> 
    237243        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 
    238                 <?php dropdown_categories(); ?> 
    239         </ul> 
    240 </div> 
    241  
    242 <div id="categories-pop" class="ui-tabs-panel" style="display: none;"> 
    243         <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 
    244                 <?php wp_popular_terms_checklist('category'); ?> 
     244                <?php wp_category_checklist($post_ID) ?> 
    245245        </ul> 
    246246</div> 
  • trunk/wp-admin/edit-form-comment.php

    r1218 r1260  
    4747<input type="submit" name="save" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" /> 
    4848<?php 
    49 echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID", 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>"; 
     49echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . wp_get_referer(), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . js_escape(__("You are about to delete this comment. \n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Delete comment') . "</a>"; 
    5050?> 
    5151</p> 
     
    9696<input type="hidden" name="p" value="<?php echo $comment->comment_post_ID ?>" /> 
    9797<input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" /> 
     98<?php wp_original_referer_field(true, 'previous'); ?> 
    9899<input type="hidden" name="noredir" value="1" /> 
    99100</div> 
  • trunk/wp-admin/edit-link-form.php

    r1218 r1260  
    119119<div id="categories-all" class="ui-tabs-panel"> 
    120120        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 
    121                 <?php dropdown_link_categories(); ?> 
     121                <?php wp_link_category_checklist($link_id); ?> 
    122122        </ul> 
    123123</div> 
  • trunk/wp-admin/edit-page-form.php

    r1225 r1260  
    4949<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" /> 
    5050<input name="referredby" type="hidden" id="referredby" value="<?php 
    51 if ( url_to_postid(wp_get_referer()) == $post_ID && strpos( wp_get_referer(), '/wp-admin/' ) === false
     51if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID
    5252        echo 'redo'; 
    5353else 
     
    7373<p> 
    7474<select name='post_status' tabindex='4'> 
    75 <?php if ( current_user_can('publish_posts') ) : ?> 
     75<?php if ( current_user_can('publish_pages') ) : ?> 
    7676<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option> 
    7777<?php else: ?> 
  • trunk/wp-admin/edit-post-rows.php

    r1218 r1260  
    2323$bgcolor = ''; 
    2424add_filter('the_title','wp_specialchars'); 
     25 
     26// Create array of post IDs. 
     27$post_ids = array(); 
     28foreach ( $wp_query->posts as $a_post ) 
     29        $post_ids[] = $a_post->ID; 
     30 
     31$comment_pending_count = get_pending_comments_num($post_ids); 
     32 
    2533while (have_posts()) : the_post(); 
    2634$class = 'alternate' == $class ? '' : 'alternate'; 
     
    6876                } 
    6977                ?> 
    70                 <td><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td> 
     78                <td><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name) ?></abbr></td> 
    7179                <?php 
    7280                break; 
     
    114122                <td class="num"><div class="post-com-count-wrapper"> 
    115123                <?php 
    116                 $left = get_pending_comments_num( $post->ID )
     124                $left = isset($comment_pending_count) ? $comment_pending_count[$post->ID] : 0
    117125                $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); 
    118126                if ( $left ) 
  • trunk/wp-admin/edit.php

    r1218 r1260  
    168168<?php } ?> 
    169169 
    170 <?php wp_dropdown_categories('show_option_all='.__('View all categories').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?> 
    171 <?php do_action('restrict_manage_posts'); ?> 
     170<?php 
     171$dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1, 
     172        'show_count' => 0, 'orderby' => 'name', 'selected' => $cat); 
     173wp_dropdown_categories($dropdown_options); 
     174do_action('restrict_manage_posts'); 
     175?> 
    172176<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" /> 
    173177 
  • trunk/wp-admin/import/blogger.php

    r1218 r1260  
    771771 
    772772                if ( isset( $_REQUEST['blog'] ) ) { 
    773                         $blog = is_array($_REQUEST['blog']) ? array_shift( array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog']; 
     773                        $blog = is_array($_REQUEST['blog']) ? array_shift( $keys = array_keys( $_REQUEST['blog'] ) ) : $_REQUEST['blog']; 
    774774                        $blog = (int) $blog; 
    775775                        $result = $this->import_blog( $blog ); 
  • trunk/wp-admin/import/mt.php

    r1218 r1260  
    313313                                        $ping->title = $title; 
    314314                        } else if ( 0 === strpos($line, "STATUS:") ) { 
    315                                 $status = trim( substr($line, strlen("STATUS:")) ); 
     315                                $status = trim( strtolower( substr($line, strlen("STATUS:")) ) ); 
    316316                                if ( empty($status) ) 
    317317                                        $status = 'publish'; 
  • trunk/wp-admin/includes/admin.php

    r1218 r1260  
    11<?php 
    2  
    3 if ( !defined( 'AUTOSAVE_INTERVAL' ) ) 
    4         define( 'AUTOSAVE_INTERVAL', 60 ); 
    52 
    63require_once(ABSPATH . 'wp-admin/includes/bookmark.php'); 
  • trunk/wp-admin/includes/class-wp-filesystem-direct.php

    r1218 r1260  
    2727        } 
    2828        function put_contents($file,$contents,$mode=false,$type=''){ 
    29                 $fp=@fopen($file,'w'.$type); 
    30                 if (!$fp) 
     29                if ( ! ($fp = @fopen($file,'w'.$type)) ) 
    3130                        return false; 
    3231                @fwrite($fp,$contents); 
     
    3736        function cwd(){ 
    3837                return @getcwd(); 
     38        } 
     39        function chdir($dir){ 
     40                return @chdir($dir); 
    3941        } 
    4042        function chgrp($file,$group,$recursive=false){ 
     
    4648                        return @chgrp($file,$group); 
    4749                //Is a directory, and we want recursive 
     50                $file = trailingslashit($file); 
    4851                $filelist = $this->dirlist($file); 
    49                 foreach($filelist as $filename){ 
    50                         $this->chgrp($file.'/'.$filename,$group,$recursive); 
    51                 } 
     52                foreach($filelist as $filename) 
     53                        $this->chgrp($file . $filename, $group, $recursive); 
     54 
    5255                return true; 
    5356        } 
     
    6265                        return @chmod($file,$mode); 
    6366                //Is a directory, and we want recursive 
     67                $file = trailingslashit($file); 
    6468                $filelist = $this->dirlist($file); 
    65                 foreach($filelist as $filename){ 
    66                         $this->chmod($file.'/'.$filename,$mode,$recursive); 
    67                 } 
     69                foreach($filelist as $filename) 
     70                        $this->chmod($file . $filename, $mode, $recursive); 
     71 
    6872                return true; 
    6973        } 
     
    8387        } 
    8488        function owner($file){ 
    85                 $owneruid=@fileowner($file); 
     89                $owneruid = @fileowner($file); 
    8690                if( ! $owneruid ) 
    8791                        return false; 
    8892                if( !function_exists('posix_getpwuid') ) 
    8993                        return $owneruid; 
    90                 $ownerarray=posix_getpwuid($owneruid); 
     94                $ownerarray = posix_getpwuid($owneruid); 
    9195                return $ownerarray['name']; 
    9296        } 
     
    164168        } 
    165169        function group($file){ 
    166                 $gid=@filegroup($file); 
     170                $gid = @filegroup($file); 
    167171                if( ! $gid ) 
    168172                        return false; 
    169173                if( !function_exists('posix_getgrgid') ) 
    170174                        return $gid; 
    171                 $grouparray=posix_getgrgid($gid); 
     175                $grouparray = posix_getgrgid($gid); 
    172176                return $grouparray['name']; 
    173177        } 
    174178 
    175179        function copy($source,$destination,$overwrite=false){ 
    176                 if( $overwrite && $this->exists($destination) ) 
     180                if( ! $overwrite && $this->exists($destination) ) 
    177181                        return false; 
    178182                return copy($source,$destination); 
     
    180184 
    181185        function move($source,$destination,$overwrite=false){ 
    182                 //Possible to use rename() 
     186                //Possible to use rename()? 
    183187                if( $this->copy($source,$destination,$overwrite) && $this->exists($destination) ){ 
    184188                        $this->delete($source);