Make WordPress Core

Ticket #2405: fix_trailing_tabs_2006-02-12_07.51.00_GMT.diff

File fix_trailing_tabs_2006-02-12_07.51.00_GMT.diff, 196.6 KB (added by markjaquith, 19 years ago)

current as of the time in the filename

  • wp-login.php

     
    2828        $redirect_to = 'wp-login.php';
    2929        if ( isset($_REQUEST['redirect_to']) )
    3030                $redirect_to = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $_REQUEST['redirect_to']);
    31                        
     31
    3232        wp_redirect($redirect_to);
    3333        exit();
    3434
     
    139139        $new_pass = substr( md5( uniqid( microtime() ) ), 0, 7);
    140140        $wpdb->query("UPDATE $wpdb->users SET user_pass = MD5('$new_pass'), user_activation_key = '' WHERE user_login = '$user->user_login'");
    141141        wp_cache_delete($user->ID, 'users');
    142         wp_cache_delete($user->user_login, 'userlogins');       
     142        wp_cache_delete($user->user_login, 'userlogins');
    143143        $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
    144144        $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
    145145        $message .= get_settings('siteurl') . "/wp-login.php\r\n";
     
    190190
    191191        if ( $user_login && $user_pass ) {
    192192                $user = new WP_User(0, $user_login);
    193        
     193
    194194                // If the user can't edit posts, send them to their profile.
    195195                if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
    196196                        $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php';
    197        
     197
    198198                if ( wp_login($user_login, $user_pass, $using_cookie) ) {
    199199                        if ( !$using_cookie )
    200200                                wp_setcookie($user_login, $user_pass, false, '', '', $rememberme);
     
    202202                        wp_redirect($redirect_to);
    203203                        exit;
    204204                } else {
    205                         if ( $using_cookie )                   
     205                        if ( $using_cookie )
    206206                                $error = __('Your session has expired.');
    207207                }
    208208        }
  • wp-includes/class-snoopy.php

     
    3939class Snoopy
    4040{
    4141        /**** Public variables ****/
    42        
     42
    4343        /* user definable vars */
    4444
    4545        var $host                       =       "www.php.net";          // host name we are connecting to
     
    4848        var $proxy_port         =       "";                                     // proxy port to use
    4949        var $proxy_user         =       "";                                     // proxy user to use
    5050        var $proxy_pass         =       "";                                     // proxy password to use
    51        
     51
    5252        var $agent                      =       "Snoopy v1.2.3";        // agent we masquerade as
    5353        var     $referer                =       "";                                     // referer info to pass
    5454        var $cookies            =       array();                        // array of cookies to pass
     
    6666        var $passcookies        =       true;                           // pass set cookies back through redirects
    6767                                                                                                // NOTE: this currently does not respect
    6868                                                                                                // dates, domains or paths.
    69        
     69
    7070        var     $user                   =       "";                                     // user for http authentication
    7171        var     $pass                   =       "";                                     // password for http authentication
    72        
     72
    7373        // http accept types
    7474        var $accept                     =       "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
    75        
     75
    7676        var $results            =       "";                                     // where the content is put
    77                
     77
    7878        var $error                      =       "";                                     // error messages sent here
    7979        var     $response_code  =       "";                                     // response code returned from server
    8080        var     $headers                =       array();                        // headers returned from server sent here
     
    100100                                                                                                // library functions built into php,
    101101                                                                                                // as these functions are not stable
    102102                                                                                                // as of this Snoopy release.
    103        
    104         /**** Private variables ****/   
    105        
     103
     104        /**** Private variables ****/
     105
    106106        var     $_maxlinelen    =       4096;                           // max line length (headers)
    107        
     107
    108108        var $_httpmethod        =       "GET";                          // default http request method
    109109        var $_httpversion       =       "HTTP/1.0";                     // default http request version
    110110        var $_submit_method     =       "POST";                         // default submit method
     
    114114        var $_redirectdepth     =       0;                                      // increments on an http redirect
    115115        var $_frameurls         =       array();                        // frame src urls
    116116        var $_framedepth        =       0;                                      // increments on frame depth
    117        
     117
    118118        var $_isproxy           =       false;                          // set if using a proxy server
    119119        var $_fp_timeout        =       30;                                     // timeout for socket connection
    120120
     
    129129
    130130        function fetch($URI)
    131131        {
    132        
     132
    133133                //preg_match("|^([^:]+)://([^:/]+)(:[\d]+)*(.*)|",$URI,$URI_PARTS);
    134134                $URI_PARTS = parse_url($URI);
    135135                if (!empty($URI_PARTS["user"]))
     
    140140                        $URI_PARTS["query"] = '';
    141141                if (empty($URI_PARTS["path"]))
    142142                        $URI_PARTS["path"] = '';
    143                                
     143
    144144                switch(strtolower($URI_PARTS["scheme"]))
    145145                {
    146146                        case "http":
     
    160160                                                // no proxy, send only the path
    161161                                                $this->_httprequest($path, $fp, $URI, $this->_httpmethod);
    162162                                        }
    163                                        
     163
    164164                                        $this->_disconnect($fp);
    165165
    166166                                        if($this->_redirectaddr)
     
    183183                                        {
    184184                                                $frameurls = $this->_frameurls;
    185185                                                $this->_frameurls = array();
    186                                                
     186
    187187                                                while(list(,$frameurl) = each($frameurls))
    188188                                                {
    189189                                                        if($this->_framedepth < $this->maxframes)
     
    194194                                                        else
    195195                                                                break;
    196196                                                }
    197                                         }                                       
     197                                        }
    198198                                }
    199199                                else
    200200                                {
    201201                                        return false;
    202202                                }
    203                                 return true;                                   
     203                                return true;
    204204                                break;
    205205                        case "https":
    206206                                if(!$this->curl_path)
     
    254254                                                else
    255255                                                        break;
    256256                                        }
    257                                 }                                       
    258                                 return true;                                   
     257                                }
     258                                return true;
    259259                                break;
    260260                        default:
    261261                                // not a valid protocol
    262262                                $this->error    =       'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
    263263                                return false;
    264264                                break;
    265                 }               
     265                }
    266266                return true;
    267267        }
    268268
     
    280280        function submit($URI, $formvars="", $formfiles="")
    281281        {
    282282                unset($postdata);
    283                
     283
    284284                $postdata = $this->_prepare_post_body($formvars, $formfiles);
    285                        
     285
    286286                $URI_PARTS = parse_url($URI);
    287287                if (!empty($URI_PARTS["user"]))
    288288                        $this->user = $URI_PARTS["user"];
     
    312312                                                // no proxy, send only the path
    313313                                                $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);
    314314                                        }
    315                                        
     315
    316316                                        $this->_disconnect($fp);
    317317
    318318                                        if($this->_redirectaddr)
    319319                                        {
    320320                                                /* url was redirected, check if we've hit the max depth */
    321321                                                if($this->maxredirs > $this->_redirectdepth)
    322                                                 {                                               
     322                                                {
    323323                                                        if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
    324                                                                 $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);                                         
    325                                                        
     324                                                                $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
     325
    326326                                                        // only follow redirect if it's on this site, or offsiteok is true
    327327                                                        if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
    328328                                                        {
     
    341341                                        {
    342342                                                $frameurls = $this->_frameurls;
    343343                                                $this->_frameurls = array();
    344                                                
     344
    345345                                                while(list(,$frameurl) = each($frameurls))
    346                                                 {                                                                                                               
     346                                                {
    347347                                                        if($this->_framedepth < $this->maxframes)
    348348                                                        {
    349349                                                                $this->fetch($frameurl);
     
    352352                                                        else
    353353                                                                break;
    354354                                                }
    355                                         }                                       
    356                                        
     355                                        }
     356
    357357                                }
    358358                                else
    359359                                {
    360360                                        return false;
    361361                                }
    362                                 return true;                                   
     362                                return true;
    363363                                break;
    364364                        case "https":
    365365                                if(!$this->curl_path)
     
    386386                                {
    387387                                        /* url was redirected, check if we've hit the max depth */
    388388                                        if($this->maxredirs > $this->_redirectdepth)
    389                                         {                                               
     389                                        {
    390390                                                if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
    391                                                         $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);                                         
     391                                                        $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
    392392
    393393                                                // only follow redirect if it's on this site, or offsiteok is true
    394394                                                if(preg_match("|^http://".preg_quote($this->host)."|i",$this->_redirectaddr) || $this->offsiteok)
     
    410410                                        $this->_frameurls = array();
    411411
    412412                                        while(list(,$frameurl) = each($frameurls))
    413                                         {                                                                                                               
     413                                        {
    414414                                                if($this->_framedepth < $this->maxframes)
    415415                                                {
    416416                                                        $this->fetch($frameurl);
     
    419419                                                else
    420420                                                        break;
    421421                                        }
    422                                 }                                       
    423                                 return true;                                   
     422                                }
     423                                return true;
    424424                                break;
    425                                
     425
    426426                        default:
    427427                                // not a valid protocol
    428428                                $this->error    =       'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
    429429                                return false;
    430430                                break;
    431                 }               
     431                }
    432432                return true;
    433433        }
    434434
     
    442442        function fetchlinks($URI)
    443443        {
    444444                if ($this->fetch($URI))
    445                 {                       
     445                {
    446446                        if($this->lastredirectaddr)
    447447                                $URI = $this->lastredirectaddr;
    448448                        if(is_array($this->results))
     
    470470
    471471        function fetchform($URI)
    472472        {
    473                
     473
    474474                if ($this->fetch($URI))
    475                 {                       
     475                {
    476476
    477477                        if(is_array($this->results))
    478478                        {
     
    481481                        }
    482482                        else
    483483                                $this->results = $this->_stripform($this->results);
    484                        
     484
    485485                        return true;
    486486                }
    487487                else
    488488                        return false;
    489489        }
    490        
    491        
     490
     491
    492492/*======================================================================*\
    493493        Function:       fetchtext
    494494        Purpose:        fetch the text from a web page, stripping the links
     
    499499        function fetchtext($URI)
    500500        {
    501501                if($this->fetch($URI))
    502                 {                       
     502                {
    503503                        if(is_array($this->results))
    504504                        {
    505505                                for($x=0;$x<count($this->results);$x++)
     
    523523        function submitlinks($URI, $formvars="", $formfiles="")
    524524        {
    525525                if($this->submit($URI,$formvars, $formfiles))
    526                 {                       
     526                {
    527527                        if($this->lastredirectaddr)
    528528                                $URI = $this->lastredirectaddr;
    529529                        if(is_array($this->results))
     
    557557        function submittext($URI, $formvars = "", $formfiles = "")
    558558        {
    559559                if($this->submit($URI,$formvars, $formfiles))
    560                 {                       
     560                {
    561561                        if($this->lastredirectaddr)
    562562                                $URI = $this->lastredirectaddr;
    563563                        if(is_array($this->results))
     
    581581                        return false;
    582582        }
    583583
    584        
    585584
     585
    586586/*======================================================================*\
    587587        Function:       set_submit_multipart
    588588        Purpose:        Set the form submission content type to
     
    593593                $this->_submit_type = "multipart/form-data";
    594594        }
    595595
    596        
     596
    597597/*======================================================================*\
    598598        Function:       set_submit_normal
    599599        Purpose:        Set the form submission content type to
     
    604604                $this->_submit_type = "application/x-www-form-urlencoded";
    605605        }
    606606
    607        
    608        
    609607
     608
     609
    610610/*======================================================================*\
    611611        Private functions
    612612\*======================================================================*/
    613        
    614        
     613
     614
    615615/*======================================================================*\
    616616        Function:       _striplinks
    617617        Purpose:        strip the hyperlinks from an html document
     
    620620\*======================================================================*/
    621621
    622622        function _striplinks($document)
    623         {       
     623        {
    624624                preg_match_all("'<\s*a\s.*?href\s*=\s*                  # find <a href=
    625625                                                ([\"\'])?                                       # find single or double quote
    626626                                                (?(1) (.*?)\\1 | ([^\s\>]+))            # if quote found, match up to next matching
    627627                                                                                                        # quote, otherwise match up to next space
    628628                                                'isx",$document,$links);
    629                                                
    630629
     630
    631631                // catenate the non-empty matches from the conditional subpattern
    632632
    633633                while(list($key,$val) = each($links[2]))
    634634                {
    635635                        if(!empty($val))
    636636                                $match[] = $val;
    637                 }                               
    638                
     637                }
     638
    639639                while(list($key,$val) = each($links[3]))
    640640                {
    641641                        if(!empty($val))
    642642                                $match[] = $val;
    643                 }               
    644                
     643                }
     644
    645645                // return the links
    646646                return $match;
    647647        }
     
    654654\*======================================================================*/
    655655
    656656        function _stripform($document)
    657         {       
     657        {
    658658                preg_match_all("'<\/?(FORM|INPUT|SELECT|TEXTAREA|(OPTION))[^<>]*>(?(2)(.*(?=<\/?(option|select)[^<>]*>[\r\n]*)|(?=[\r\n]*))|(?=[\r\n]*))'Usi",$document,$elements);
    659                
     659
    660660                // catenate the matches
    661661                $match = implode("\r\n",$elements[0]);
    662                                
     662
    663663                // return the links
    664664                return $match;
    665665        }
    666666
    667        
    668        
     667
     668
    669669/*======================================================================*\
    670670        Function:       _striptext
    671671        Purpose:        strip the text from an html document
     
    675675
    676676        function _striptext($document)
    677677        {
    678                
     678
    679679                // I didn't use preg eval (//e) since that is only available in PHP 4.0.
    680680                // so, list your entities one by one here. I included some of the
    681681                // more common ones.
    682                                                                
     682
    683683                $search = array("'<script[^>]*?>.*?</script>'si",       // strip out javascript
    684684                                                "'<[\/\!]*?[^<>]*?>'si",                        // strip out html tags
    685685                                                "'([\r\n])[\s]+'",                                      // strip out white space
     
    728728                                                        "Ü",
    729729                                                        "ß",
    730730                                                );
    731                                        
     731
    732732                $text = preg_replace($search,$replace,$document);
    733                                                                
     733
    734734                return $text;
    735735        }
    736736
     
    744744
    745745        function _expandlinks($links,$URI)
    746746        {
    747                
     747
    748748                preg_match("/^[^\?]+/",$URI,$match);
    749749
    750750                $match = preg_replace("|/[^\/\.]+\.[^\/\.]+$|","",$match[0]);
     
    752752                $match_part = parse_url($match);
    753753                $match_root =
    754754                $match_part["scheme"]."://".$match_part["host"];
    755                                
     755
    756756                $search = array(        "|^http://".preg_quote($this->host)."|i",
    757757                                                        "|^(\/)|i",
    758758                                                        "|^(?!http://)(?!mailto:)|i",
    759759                                                        "|/\./|",
    760760                                                        "|/[^\/]+/\.\./|"
    761761                                                );
    762                                                
     762
    763763                $replace = array(       "",
    764764                                                        $match_root."/",
    765765                                                        $match."/",
    766766                                                        "/",
    767767                                                        "/"
    768                                                 );                     
    769                                
     768                                                );
     769
    770770                $expandedLinks = preg_replace($search,$replace,$links);
    771771
    772772                return $expandedLinks;
     
    779779                                $fp                     the current open file pointer
    780780                                $URI            the full URI
    781781                                $body           body contents to send if any (POST)
    782         Output:         
     782        Output:
    783783\*======================================================================*/
    784        
     784
    785785        function _httprequest($url,$fp,$URI,$http_method,$content_type="",$body="")
    786786        {
    787787                $cookie_headers = '';
    788788                if($this->passcookies && $this->_redirectaddr)
    789789                        $this->setcookies();
    790                        
     790
    791791                $URI_PARTS = parse_url($URI);
    792792                if(empty($url))
    793793                        $url = "/";
    794                 $headers = $http_method." ".$url." ".$this->_httpversion."\r\n";               
     794                $headers = $http_method." ".$url." ".$this->_httpversion."\r\n";
    795795                if(!empty($this->agent))
    796796                        $headers .= "User-Agent: ".$this->agent."\r\n";
    797797                if(!empty($this->host) && !isset($this->rawheaders['Host'])) {
     
    805805                if(!empty($this->referer))
    806806                        $headers .= "Referer: ".$this->referer."\r\n";
    807807                if(!empty($this->cookies))
    808                 {                       
     808                {
    809809                        if(!is_array($this->cookies))
    810810                                $this->cookies = (array)$this->cookies;
    811        
     811
    812812                        reset($this->cookies);
    813813                        if ( count($this->cookies) > 0 ) {
    814814                                $cookie_headers .= 'Cookie: ';
     
    831831                                $headers .= "; boundary=".$this->_mime_boundary;
    832832                        $headers .= "\r\n";
    833833                }
    834                 if(!empty($body))       
     834                if(!empty($body))
    835835                        $headers .= "Content-length: ".strlen($body)."\r\n";
    836                 if(!empty($this->user) || !empty($this->pass)) 
     836                if(!empty($this->user) || !empty($this->pass))
    837837                        $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
    838                
     838
    839839                //add proxy auth headers
    840                 if(!empty($this->proxy_user))   
     840                if(!empty($this->proxy_user))
    841841                        $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass)."\r\n";
    842842
    843843
    844844                $headers .= "\r\n";
    845                
     845
    846846                // set the read timeout if needed
    847847                if ($this->read_timeout > 0)
    848848                        socket_set_timeout($fp, $this->read_timeout);
    849849                $this->timed_out = false;
    850                
     850
    851851                fwrite($fp,$headers.$body,strlen($headers.$body));
    852                
     852
    853853                $this->_redirectaddr = false;
    854854                unset($this->headers);
    855                                                
     855
    856856                while($currentHeader = fgets($fp,$this->_maxlinelen))
    857857                {
    858858                        if ($this->read_timeout > 0 && $this->_check_timeout($fp))
     
    860860                                $this->status=-100;
    861861                                return false;
    862862                        }
    863                                
     863
    864864                        if($currentHeader == "\r\n")
    865865                                break;
    866                                                
     866
    867867                        // if a header begins with Location: or URI:, set the redirect
    868868                        if(preg_match("/^(Location:|URI:)/i",$currentHeader))
    869869                        {
     
    883883                                else
    884884                                        $this->_redirectaddr = $matches[2];
    885885                        }
    886                
     886
    887887                        if(preg_match("|^HTTP/|",$currentHeader))
    888888                        {
    889889                if(preg_match("|^HTTP/[^\s]*\s(.*?)\s|",$currentHeader, $status))
    890890                                {
    891891                                        $this->status= $status[1];
    892                 }                               
     892                }
    893893                                $this->response_code = $currentHeader;
    894894                        }
    895                                
     895
    896896                        $this->headers[] = $currentHeader;
    897897                }
    898898
     
    910910                        $this->status=-100;
    911911                        return false;
    912912                }
    913                
     913
    914914                // check if there is a a redirect meta tag
    915                
     915
    916916                if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
    917917
    918918                {
    919                         $this->_redirectaddr = $this->_expandlinks($match[1],$URI);     
     919                        $this->_redirectaddr = $this->_expandlinks($match[1],$URI);
    920920                }
    921921
    922922                // have we hit our frame depth and is there frame src to fetch?
     
    932932                // no framed content
    933933                else
    934934                        $this->results = $results;
    935                
     935
    936936                return true;
    937937        }
    938938
     
    942942        Input:          $url            the url to fetch
    943943                                $URI            the full URI
    944944                                $body           body contents to send if any (POST)
    945         Output:         
     945        Output:
    946946\*======================================================================*/
    947        
     947
    948948        function _httpsrequest($url,$URI,$http_method,$content_type="",$body="")
    949949        {
    950950                if($this->passcookies && $this->_redirectaddr)
    951951                        $this->setcookies();
    952952
    953                 $headers = array();             
    954                                        
     953                $headers = array();
     954
    955955                $URI_PARTS = parse_url($URI);
    956956                if(empty($url))
    957957                        $url = "/";
    958958                // GET ... header not needed for curl
    959                 //$headers[] = $http_method." ".$url." ".$this->_httpversion;           
     959                //$headers[] = $http_method." ".$url." ".$this->_httpversion;
    960960                if(!empty($this->agent))
    961961                        $headers[] = "User-Agent: ".$this->agent;
    962962                if(!empty($this->host))
     
    969969                if(!empty($this->referer))
    970970                        $headers[] = "Referer: ".$this->referer;
    971971                if(!empty($this->cookies))
    972                 {                       
     972                {
    973973                        if(!is_array($this->cookies))
    974974                                $this->cookies = (array)$this->cookies;
    975        
     975
    976976                        reset($this->cookies);
    977977                        if ( count($this->cookies) > 0 ) {
    978978                                $cookie_str = 'Cookie: ';
     
    995995                        else
    996996                                $headers[] = "Content-type: $content_type";
    997997                }
    998                 if(!empty($body))       
     998                if(!empty($body))
    999999                        $headers[] = "Content-length: ".strlen($body);
    1000                 if(!empty($this->user) || !empty($this->pass)) 
     1000                if(!empty($this->user) || !empty($this->pass))
    10011001                        $headers[] = "Authorization: BASIC ".base64_encode($this->user.":".$this->pass);
    1002                        
     1002
    10031003                for($curr_header = 0; $curr_header < count($headers); $curr_header++) {
    10041004                        $safer_header = strtr( $headers[$curr_header], "\"", " " );
    10051005                        $cmdline_params .= " -H \"".$safer_header."\"";
    10061006                }
    1007                
     1007
    10081008                if(!empty($body))
    10091009                        $cmdline_params .= " -d \"$body\"";
    1010                
     1010
    10111011                if($this->read_timeout > 0)
    10121012                        $cmdline_params .= " -m ".$this->read_timeout;
    1013                
     1013
    10141014                $headerfile = tempnam($temp_dir, "sno");
    10151015
    10161016                $safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access
    10171017                exec(escapeshellcmd($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\""),$results,$return);
    1018                
     1018
    10191019                if($return)
    10201020                {
    10211021                        $this->error = "Error: cURL could not retrieve the document, error $return.";
    10221022                        return false;
    10231023                }
    1024                        
    1025                        
     1024
     1025
    10261026                $results = implode("\r\n",$results);
    1027                
     1027
    10281028                $result_headers = file("$headerfile");
    1029                                                
     1029
    10301030                $this->_redirectaddr = false;
    10311031                unset($this->headers);
    1032                                                
     1032
    10331033                for($currentHeader = 0; $currentHeader < count($result_headers); $currentHeader++)
    10341034                {
    1035                        
     1035
    10361036                        // if a header begins with Location: or URI:, set the redirect
    10371037                        if(preg_match("/^(Location: |URI: )/i",$result_headers[$currentHeader]))
    10381038                        {
     
    10521052                                else
    10531053                                        $this->_redirectaddr = $matches[2];
    10541054                        }
    1055                
     1055
    10561056                        if(preg_match("|^HTTP/|",$result_headers[$currentHeader]))
    10571057                                $this->response_code = $result_headers[$currentHeader];
    10581058
     
    10601060                }
    10611061
    10621062                // check if there is a a redirect meta tag
    1063                
     1063
    10641064                if(preg_match("'<meta[\s]*http-equiv[^>]*?content[\s]*=[\s]*[\"\']?\d+;[\s]*URL[\s]*=[\s]*([^\"\']*?)[\"\']?>'i",$results,$match))
    10651065                {
    1066                         $this->_redirectaddr = $this->_expandlinks($match[1],$URI);     
     1066                        $this->_redirectaddr = $this->_expandlinks($match[1],$URI);
    10671067                }
    10681068
    10691069                // have we hit our frame depth and is there frame src to fetch?
     
    10811081                        $this->results = $results;
    10821082
    10831083                unlink("$headerfile");
    1084                
     1084
    10851085                return true;
    10861086        }
    10871087
     
    10891089        Function:       setcookies()
    10901090        Purpose:        set cookies for a redirection
    10911091\*======================================================================*/
    1092        
     1092
    10931093        function setcookies()
    10941094        {
    10951095                for($x=0; $x<count($this->headers); $x++)
     
    10991099                }
    11001100        }
    11011101
    1102        
     1102
    11031103/*======================================================================*\
    11041104        Function:       _check_timeout
    11051105        Purpose:        checks whether timeout has occurred
     
    11231123        Purpose:        make a socket connection
    11241124        Input:          $fp     file pointer
    11251125\*======================================================================*/
    1126        
     1126
    11271127        function _connect(&$fp)
    11281128        {
    11291129                if(!empty($this->proxy_host) && !empty($this->proxy_port))
    11301130                        {
    11311131                                $this->_isproxy = true;
    1132                                
     1132
    11331133                                $host = $this->proxy_host;
    11341134                                $port = $this->proxy_port;
    11351135                        }
     
    11381138                        $host = $this->host;
    11391139                        $port = $this->port;
    11401140                }
    1141        
     1141
    11421142                $this->status = 0;
    1143                
     1143
    11441144                if($fp = fsockopen(
    11451145                                        $host,
    11461146                                        $port,
     
    11761176        Purpose:        disconnect a socket connection
    11771177        Input:          $fp     file pointer
    11781178\*======================================================================*/
    1179        
     1179
    11801180        function _disconnect($fp)
    11811181        {
    11821182                return(fclose($fp));
    11831183        }
    11841184
    1185        
     1185
    11861186/*======================================================================*\
    11871187        Function:       _prepare_post_body
    11881188        Purpose:        Prepare post body according to encoding type
     
    11901190                                $formfiles - form upload files
    11911191        Output:         post body
    11921192\*======================================================================*/
    1193        
     1193
    11941194        function _prepare_post_body($formvars, $formfiles)
    11951195        {
    11961196                settype($formvars, "array");
     
    11991199
    12001200                if (count($formvars) == 0 && count($formfiles) == 0)
    12011201                        return;
    1202                
     1202
    12031203                switch ($this->_submit_type) {
    12041204                        case "application/x-www-form-urlencoded":
    12051205                                reset($formvars);
     
    12151215
    12161216                        case "multipart/form-data":
    12171217                                $this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
    1218                                
     1218
    12191219                                reset($formvars);
    12201220                                while(list($key,$val) = each($formvars)) {
    12211221                                        if (is_array($val) || is_object($val)) {
     
    12301230                                                $postdata .= "$val\r\n";
    12311231                                        }
    12321232                                }
    1233                                
     1233
    12341234                                reset($formfiles);
    12351235                                while (list($field_name, $file_names) = each($formfiles)) {
    12361236                                        settype($file_names, "array");
  • wp-includes/wp-l10n.php

     
    1414        // WPLANG is defined in wp-config.
    1515        if (defined('WPLANG'))
    1616                $locale = WPLANG;
    17        
     17
    1818        if (empty($locale))
    1919                $locale = 'en_US';
    2020
     
    7676
    7777        $locale = get_locale();
    7878        $mofile = ABSPATH . "wp-includes/languages/$locale.mo";
    79        
     79
    8080        load_textdomain('default', $mofile);
    8181}
    8282
    8383function load_plugin_textdomain($domain, $path = 'wp-content/plugins') {
    8484        $locale = get_locale();
    85        
     85
    8686        $mofile = ABSPATH . "$path/$domain-$locale.mo";
    8787        load_textdomain($domain, $mofile);
    8888}
    8989
    9090function load_theme_textdomain($domain) {
    9191        $locale = get_locale();
    92        
     92
    9393        $mofile = get_template_directory() . "/$locale.mo";
    9494        load_textdomain($domain, $mofile);
    9595}
  • wp-includes/cache.php

     
    103103
    104104                if ( ! $this->acquire_lock() )
    105105                        return false;
    106                
     106
    107107                $this->rm_cache_dir();
    108108                $this->cache = array ();
    109109                $this->dirty_objects = array ();
    110110                $this->non_existant_objects = array ();
    111                
     111
    112112                $this->release_lock();
    113113
    114114                return true;
     
    248248                        while (($file = @ readdir($dh)) !== false) {
    249249                                if ($file == '.' or $file == '..')
    250250                                        continue;
    251                                        
     251
    252252                                if (@ is_dir($dir . DIRECTORY_SEPARATOR . $file))
    253253                                        $stack[] = $dir . DIRECTORY_SEPARATOR . $file;
    254254                                else if (@ is_file($dir . DIRECTORY_SEPARATOR . $file))
     
    354354                                        if (@ copy($temp_file, $cache_file))
    355355                                                @ unlink($temp_file);
    356356                                        else
    357                                                 $errors++;     
     357                                                $errors++;
    358358                                }
    359359                                @ chmod($cache_file, $file_perms);
    360360                        }
     
    363363                $this->dirty_objects = array();
    364364
    365365                $this->release_lock();
    366                
     366
    367367                if ( $errors )
    368368                        return false;
    369369
  • wp-includes/template-functions-post.php

     
    211211                        // Force subkeys to be array type:
    212212                        if ( !isset($post_meta_cache[$mpid]) || !is_array($post_meta_cache[$mpid]) )
    213213                                $post_meta_cache[$mpid] = array();
    214                                
     214
    215215                        if ( !isset($post_meta_cache[$mpid]["$mkey"]) || !is_array($post_meta_cache[$mpid]["$mkey"]) )
    216216                                $post_meta_cache[$mpid]["$mkey"] = array();
    217217
  • wp-includes/wp-db.php

     
    1616class wpdb {
    1717
    1818        var $show_errors = true;
    19         var $num_queries = 0;   
     19        var $num_queries = 0;
    2020        var $last_query;
    2121        var $col_info;
    2222        var $queries;
     
    7575
    7676        // ====================================================================
    7777        //      Format a string correctly for safe insert under all PHP conditions
    78        
     78
    7979        function escape($string) {
    8080                return addslashes( $string ); // Disable rest for now, causing problems
    8181                if( !$this->dbh || version_compare( phpversion(), '4.3.0' ) == '-1' )
     
    101101                        <code>$this->last_query</code></p>
    102102                        </div>";
    103103                } else {
    104                         return false;   
     104                        return false;
    105105                }
    106106        }
    107107
     
    111111        function show_errors() {
    112112                $this->show_errors = true;
    113113        }
    114        
     114
    115115        function hide_errors() {
    116116                $this->show_errors = false;
    117117        }
     
    142142                // Perform the query via std mysql_query function..
    143143                if (SAVEQUERIES)
    144144                        $this->timer_start();
    145                
     145
    146146                $this->result = @mysql_query($query, $this->dbh);
    147147                ++$this->num_queries;
    148148
     
    159159                        $this->rows_affected = mysql_affected_rows();
    160160                        // Take note of the insert_id
    161161                        if ( preg_match("/^\\s*(insert|replace) /i",$query) ) {
    162                                 $this->insert_id = mysql_insert_id($this->dbh); 
     162                                $this->insert_id = mysql_insert_id($this->dbh);
    163163                        }
    164164                        // Return number of rows affected
    165165                        $return_val = $this->rows_affected;
     
    179179
    180180                        // Log number of rows the query returned
    181181                        $this->num_rows = $num_rows;
    182                        
     182
    183183                        // Return number of rows selected
    184184                        $return_val = $this->num_rows;
    185185                }
     
    293293                $this->time_start = $mtime[1] + $mtime[0];
    294294                return true;
    295295        }
    296        
     296
    297297        function timer_stop($precision = 3) {
    298298                $mtime = microtime();
    299299                $mtime = explode(' ', $mtime);
     
    305305        function bail($message) { // Just wraps errors in a nice header and footer
    306306        if ( !$this->show_errors )
    307307                return false;
    308         header( 'Content-Type: text/html; charset=utf-8');             
     308        header( 'Content-Type: text/html; charset=utf-8');
    309309        echo <<<HEAD
    310310        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    311311        <html xmlns="http://www.w3.org/1999/xhtml">
     
    325325                        margin-right: 25%;
    326326                        padding: .2em 2em;
    327327                }
    328                
     328
    329329                h1 {
    330330                        color: #006;
    331331                        font-size: 18px;
    332332                        font-weight: lighter;
    333333                }
    334                
     334
    335335                h2 {
    336336                        font-size: 16px;
    337337                }
    338                
     338
    339339                p, li, dt {
    340340                        line-height: 140%;
    341341                        padding-bottom: 2px;
    342342                }
    343        
     343
    344344                ul, ol {
    345345                        padding: 5px 5px 5px 20px;
    346346                }
  • wp-includes/template-loader.php

     
    3131                exit;
    3232        } else if ( is_category() && $template = get_category_template()) {
    3333                include($template);
    34                 exit;           
     34                exit;
    3535        } else if ( is_author() && $template = get_author_template() ) {
    3636                include($template);
    3737                exit;
  • wp-includes/functions-formatting.php

     
    3232                        $curl = preg_replace("/'([\s.]|\Z)/", '&#8217;$1', $curl);
    3333                        $curl = preg_replace("/ \(tm\)/i", ' &#8482;', $curl);
    3434                        $curl = str_replace("''", '&#8221;', $curl);
    35                        
     35
    3636                        $curl = preg_replace('/(\d+)x(\d+)/', "$1&#215;$2", $curl);
    3737
    3838                } elseif (strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) {
     
    7474        $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
    7575        $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
    7676        $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' ", $pee);
    77        
     77
    7878        return $pee;
    7979}
    8080
     
    239239                chr(197).chr(190) => 'z', chr(197).chr(191) => 's',
    240240                // Euro Sign
    241241                chr(226).chr(130).chr(172) => 'E');
    242                
     242
    243243                $string = strtr($string, $chars);
    244244        } else {
    245245                // Assume ISO-8859-1 if not UTF-8
     
    374374function funky_javascript_fix($text) {
    375375        // Fixes for browsers' javascript bugs
    376376        global $is_macIE, $is_winIE;
    377        
     377
    378378        if ( $is_winIE || $is_macIE )
    379379                $text =  preg_replace("/\%u([0-9A-F]{4,4})/e",  "'&#'.base_convert('\\1',16,10).';'", $text);
    380        
     380
    381381        return $text;
    382382}
    383383
     
    401401             1.0  First Version
    402402*/
    403403function balanceTags($text, $is_comment = 0) {
    404        
     404
    405405        if ( get_option('use_balanceTags') == 0)
    406406                return $text;
    407407
  • wp-includes/js/tw-sack.js

     
    3232                        this.failed = true;
    3333                }
    3434        };
    35        
     35
    3636        this.setVar = function(name, value){
    3737                if (this.URLString.length < 3){
    3838                        this.URLString = name + "=" + value;
     
    4040                        this.URLString += "&" + name + "=" + value;
    4141                }
    4242        }
    43        
     43
    4444        this.encVar = function(name, value){
    4545                var varString = encodeURIComponent(name) + "=" + encodeURIComponent(value);
    4646        return varString;
    4747        }
    48        
     48
    4949        this.encodeURLString = function(string){
    5050                varArray = string.split('&');
    5151                for (i = 0; i < varArray.length; i++){
     
    5757                }
    5858        return varArray.join('&');
    5959        }
    60        
     60
    6161        this.runResponse = function(){
    6262                eval(this.response);
    6363        }
    64        
     64
    6565        this.runAJAX = function(urlstring){
    6666                this.responseStatus = new Array(2);
    6767                if(this.failed && this.AjaxFailedAlert){
  • wp-includes/js/fat.js

     
    3131                if (!duration) duration = 3000;
    3232                if (!from || from=="#") from = "#FFFF33";
    3333                if (!to) to = this.get_bgcolor(id);
    34                
     34
    3535                var frames = Math.round(fps * (duration / 1000));
    3636                var interval = duration / frames;
    3737                var delay = interval;
    3838                var frame = 0;
    39                
     39
    4040                if (from.length < 7) from += from.substr(1,3);
    4141                if (to.length < 7) to += to.substr(1,3);
    42                
     42
    4343                var rf = parseInt(from.substr(1,2),16);
    4444                var gf = parseInt(from.substr(3,2),16);
    4545                var bf = parseInt(from.substr(5,2),16);
    4646                var rt = parseInt(to.substr(1,2),16);
    4747                var gt = parseInt(to.substr(3,2),16);
    4848                var bt = parseInt(to.substr(5,2),16);
    49                
     49
    5050                var r,g,b,h;
    5151                while (frame < frames)
    5252                {
     
    5454                        g = Math.floor(gf * ((frames-frame)/frames) + gt * (frame/frames));
    5555                        b = Math.floor(bf * ((frames-frame)/frames) + bt * (frame/frames));
    5656                        h = this.make_hex(r,g,b);
    57                
     57
    5858                        setTimeout("Fat.set_bgcolor('"+id+"','"+h+"')", delay);
    5959
    6060                        frame++;
  • wp-includes/js/quicktags.js

     
    205205        else {
    206206                return false; // tag not found
    207207        }
    208 }       
     208}
    209209
    210210function edCloseAllTags() {
    211211        var count = edOpenTags.length;
  • wp-includes/js/colorpicker.js

     
    139139        }
    140140function AnchorPosition_getWindowOffsetLeft (el) {
    141141        return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
    142         }       
     142        }
    143143function AnchorPosition_getPageOffsetTop (el) {
    144144        var ot=el.offsetTop;
    145145        while((el=el.offsetParent) != null) { ot += el.offsetTop; }
     
    434434        this.populated = false;
    435435        this.visible = false;
    436436        this.autoHideEnabled = false;
    437        
     437
    438438        this.contents = "";
    439439        this.url="";
    440440        this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
     
    556556        window.ColorPicker_targetInput = inputobj;
    557557        this.show(linkname);
    558558        }
    559        
     559
    560560// This function runs when you move your mouse over a color block, if you have a newer browser
    561561function ColorPicker_highlightColor(c) {
    562562        var thedoc = (arguments.length>1)?arguments[1]:window.document;
     
    579579        else {
    580580                var divname = arguments[0];
    581581                }
    582        
     582
    583583        if (divname != "") {
    584584                var cp = new PopupWindow(divname);
    585585                }
     
    590590
    591591        // Object variables
    592592        cp.currentValue = "#FFFFFF";
    593        
     593
    594594        // Method Mappings
    595595        cp.writeDiv = ColorPicker_writeDiv;
    596596        cp.highlightColor = ColorPicker_highlightColor;
  • wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js

     
    8787                                // Is selection a image
    8888                                if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
    8989                                        flag = getAttrib(focusElm, 'class');
    90        
     90
    9191                                        if (flag != 'mce_plugin_wordpress_more') // Not a wordpress
    9292                                                return true;
    93        
     93
    9494                                        action = "update";
    9595                                }
    96        
     96
    9797                                html = ''
    9898                                        + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
    9999                                        + ' width="100%" height="10px" '
     
    105105                                var flag = "";
    106106                                var template = new Array();
    107107                                var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
    108        
     108
    109109                                // Is selection a image
    110110                                if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
    111111                                        flag = getAttrib(focusElm, 'name');
    112        
     112
    113113                                        if (flag != 'mce_plugin_wordpress_page') // Not a wordpress
    114114                                                return true;
    115        
     115
    116116                                        action = "update";
    117117                                }
    118        
     118
    119119                                html = ''
    120120                                        + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
    121121                                        + ' width="100%" height="10px" '
     
    131131
    132132function TinyMCE_wordpress_cleanup(type, content) {
    133133        switch (type) {
    134        
     134
    135135                case "insert_to_editor":
    136136                        var startPos = 0;
    137137                        var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
     
    178178
    179179                                if (attribs['class'] == "mce_plugin_wordpress_more") {
    180180                                        endPos += 2;
    181        
     181
    182182                                        var embedHTML = '<!--more-->';
    183        
     183
    184184                                        // Insert embed/object chunk
    185185                                        chunkBefore = content.substring(0, startPos);
    186186                                        chunkAfter = content.substring(endPos);
     
    188188                                }
    189189                                if (attribs['class'] == "mce_plugin_wordpress_page") {
    190190                                        endPos += 2;
    191        
     191
    192192                                        var embedHTML = '<!--nextpage-->';
    193        
     193
    194194                                        // Insert embed/object chunk
    195195                                        chunkBefore = content.substring(0, startPos);
    196196                                        chunkAfter = content.substring(endPos);
     
    221221                        content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'mg'), '<br />\n');
    222222                        content = content.replace(new RegExp('^\\s*', ''), '');
    223223                        content = content.replace(new RegExp('\\s*$', ''), '');
    224                        
     224
    225225                        break;
    226226        }
    227227
  • wp-includes/js/tinymce/tiny_mce.js

     
    353353
    354354                if (inst.formElement == formElement) {
    355355                        var doc = inst.getDoc();
    356        
     356
    357357                        tinyMCE._setHTML(doc, inst.formElement.value);
    358358
    359359                        if (!tinyMCE.isMSIE)
  • wp-includes/js/tinymce/wp-mce-help.php

     
    9393                        c = d('content'+i.toString());
    9494                        t = d('tab'+i.toString());
    9595                        if ( n == i ) {
    96                                 c.className = '';       
     96                                c.className = '';
    9797                                t.className = 'current';
    9898                        } else {
    9999                                c.className = 'hidden';
  • wp-includes/js/tinymce/themes/advanced/jscripts/image.js

     
    6161
    6262function resetImageData() {
    6363        var formObj = document.forms[0];
    64         formObj.width.value = formObj.height.value = "";       
     64        formObj.width.value = formObj.height.value = "";
    6565}
    6666
    6767function updateImageData() {
  • wp-includes/capabilities.php

     
    3434                $this->role_names[$role] = $display_name;
    3535                return $this->role_objects[$role];
    3636        }
    37        
     37
    3838        function remove_role($role) {
    3939                if ( ! isset($this->role_objects[$role]) )
    4040                        return;
    41                
     41
    4242                unset($this->role_objects[$role]);
    4343                unset($this->role_names[$role]);
    4444                unset($this->roles[$role]);
    45                
     45
    4646                update_option($this->role_key, $this->roles);
    4747        }
    4848
     
    7070        function is_role($role)
    7171        {
    7272                return isset($this->role_names[$role]);
    73         }       
     73        }
    7474}
    7575
    7676class WP_Role {
     
    150150                        $this->caps = array();
    151151                $this->get_role_caps();
    152152        }
    153        
     153
    154154        function get_role_caps() {
    155155                global $wp_roles;
    156                
     156
    157157                if ( ! isset($wp_roles) )
    158158                        $wp_roles = new WP_Roles();
    159159
     
    169169                }
    170170                $this->allcaps = array_merge($this->allcaps, $this->caps);
    171171        }
    172        
     172
    173173        function add_role($role) {
    174174                $this->caps[$role] = true;
    175175                update_usermeta($this->id, $this->cap_key, $this->caps);
    176176                $this->get_role_caps();
    177177                $this->update_user_level_from_caps();
    178178        }
    179        
     179
    180180        function remove_role($role) {
    181181                if ( empty($this->roles[$role]) || (count($this->roles) <= 1) )
    182182                        return;
     
    184184                update_usermeta($this->id, $this->cap_key, $this->caps);
    185185                $this->get_role_caps();
    186186        }
    187        
     187
    188188        function set_role($role) {
    189189                foreach($this->roles as $oldrole)
    190190                        unset($this->caps[$oldrole]);
     
    203203                return $max;
    204204            }
    205205        }
    206        
     206
    207207        function update_user_level_from_caps() {
    208208            global $table_prefix;
    209209            $this->user_level = array_reduce(array_keys($this->allcaps),        array(&$this, 'level_reduction'), 0);
    210210            update_usermeta($this->id, $table_prefix.'user_level', $this->user_level);
    211211        }
    212        
     212
    213213        function add_cap($cap, $grant = true) {
    214214                $this->caps[$cap] = $grant;
    215215                update_usermeta($this->id, $this->cap_key, $this->caps);
     
    220220                unset($this->caps[$cap]);
    221221                update_usermeta($this->id, $this->cap_key, $this->caps);
    222222        }
    223        
     223
    224224        //has_cap(capability_or_role_name) or
    225225        //has_cap('edit_post', post_id)
    226226        function has_cap($cap) {
    227227                if ( is_numeric($cap) )
    228228                        $cap = $this->translate_level_to_cap($cap);
    229                
     229
    230230                $args = array_slice(func_get_args(), 1);
    231231                $args = array_merge(array($cap, $this->id), $args);
    232232                $caps = call_user_func_array('map_meta_cap', $args);
     
    345345                break;
    346346        case 'read_post':
    347347                $post = get_post($args[0]);
    348                
     348
    349349                if ( 'private' != $post->post_status ) {
    350350                        $caps[] = 'read';
    351                         break; 
     351                        break;
    352352                }
    353                        
     353
    354354                $author_data = get_userdata($user_id);
    355355                $post_author_data = get_userdata($post->post_author);
    356356                if ($user_id == $post_author_data->ID)
  • wp-includes/functions-post.php

     
    3131        $post_name       = apply_filters('name_save_pre',      $post_name);
    3232        $comment_status  = apply_filters('comment_status_pre', $comment_status);
    3333        $ping_status     = apply_filters('ping_status_pre',    $ping_status);
    34        
     34
    3535        // Make sure we set a valid category
    3636        if (0 == count($post_category) || !is_array($post_category)) {
    3737                $post_category = array(get_option('default_category'));
     
    5959        } else {
    6060                $post_name = sanitize_title($post_name);
    6161        }
    62        
    6362
     63
    6464        // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
    6565        if (empty($post_date)) {
    6666                if ( 'draft' != $post_status )
     
    150150                        (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt,  post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)
    151151                        VALUES
    152152                        ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')");
    153                         $post_ID = $wpdb->insert_id;                   
     153                        $post_ID = $wpdb->insert_id;
    154154        }
    155155
    156156        if ( empty($post_name) && 'draft' != $post_status ) {
     
    177177                        $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'");
    178178                        do_action('private_to_published', $post_ID);
    179179                }
    180                
     180
    181181                do_action('edit_post', $post_ID);
    182182        }
    183183
     
    251251        $update = false;
    252252        if ( !empty($ID) ) {
    253253                $update = true;
    254                 $post_ID = $ID; 
     254                $post_ID = $ID;
    255255        }
    256256
    257257        // Create a valid post name.
     
    259259                $post_name = sanitize_title($post_title);
    260260        else
    261261                $post_name = sanitize_title($post_name);
    262        
     262
    263263        if (empty($post_date))
    264264                $post_date = current_time('mysql');
    265265        if (empty($post_date_gmt))
     
    332332                        (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt,  post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid)
    333333                        VALUES
    334334                        ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')");
    335                         $post_ID = $wpdb->insert_id;                   
     335                        $post_ID = $wpdb->insert_id;
    336336        }
    337        
     337
    338338        if ( empty($post_name) ) {
    339339                $post_name = sanitize_title($post_title, $post_ID);
    340340                $wpdb->query( "UPDATE $wpdb->posts SET post_name = '$post_name' WHERE ID = '$post_ID'" );
     
    352352        } else {
    353353                do_action('add_attachment', $post_ID);
    354354        }
    355        
     355
    356356        return $post_ID;
    357357}
    358358
     
    395395        global $wpdb;
    396396
    397397        $post = get_post($postid, $mode);
    398        
     398
    399399        // Set categories
    400400        if($mode == OBJECT) {
    401401                $post->post_category = wp_get_post_cats('',$postid);
     
    428428                $postarr = get_object_vars($postarr);
    429429
    430430        // First, get all of the original fields
    431         $post = wp_get_single_post($postarr['ID'], ARRAY_A);   
     431        $post = wp_get_single_post($postarr['ID'], ARRAY_A);
    432432
    433433        // Escape data pulled from DB.
    434434        $post = add_magic_quotes($post);
     
    449449
    450450        // Merge old and new fields with new fields overwriting old ones.
    451451        $postarr = array_merge($post, $postarr);
    452         $postarr['post_category'] = $post_cats; 
     452        $postarr['post_category'] = $post_cats;
    453453        if ( $clear_date ) {
    454454                $postarr['post_date'] = '';
    455455                $postarr['post_date_gmt'] = '';
     
    470470        if ( 'publish' == $post->post_status )
    471471                return;
    472472
    473         return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id));     
     473        return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id));
    474474}
    475475
    476476function wp_get_post_cats($blogid = '1', $post_ID = 0) {
    477477        global $wpdb;
    478        
     478
    479479        $sql = "SELECT category_id
    480480                FROM $wpdb->post2cat
    481481                WHERE post_id = $post_ID
     
    494494        // If $post_categories isn't already an array, make it one:
    495495        if (!is_array($post_categories) || 0 == count($post_categories))
    496496                $post_categories = array(get_option('default_category'));
    497        
     497
    498498        $post_categories = array_unique($post_categories);
    499499
    500500        // First the old categories
     
    502502                SELECT category_id
    503503                FROM $wpdb->post2cat
    504504                WHERE post_id = $post_ID");
    505        
     505
    506506        if (!$old_categories) {
    507507                $old_categories = array();
    508508        } else {
     
    532532                                VALUES ($post_ID, $new_cat)");
    533533                }
    534534        }
    535        
     535
    536536        // Update category counts.
    537537        $all_affected_cats = array_unique(array_merge($post_categories, $old_categories));
    538538        foreach ( $all_affected_cats as $cat_id ) {
    539539                $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'");
    540540                $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'");
    541                 wp_cache_delete($cat_id, 'category');           
     541                wp_cache_delete($cat_id, 'category');
    542542        }
    543543}       // wp_set_post_cats()
    544544
     
    568568                $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'");
    569569
    570570        $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid");
    571        
     571
    572572        $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid");
    573573
    574574        $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $postid");
     
    595595// Get the name of a category from its ID
    596596function get_cat_name($cat_id) {
    597597        global $wpdb;
    598        
     598
    599599        $cat_id -= 0;   // force numeric
    600600        $name = $wpdb->get_var("SELECT cat_name FROM $wpdb->categories WHERE cat_ID=$cat_id");
    601        
     601
    602602        return $name;
    603603}
    604604
    605605// Get the ID of a category from its name
    606606function get_cat_ID($cat_name='General') {
    607607        global $wpdb;
    608        
     608
    609609        $cid = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
    610610
    611611        return $cid?$cid:1;     // default to cat 1
     
    639639
    640640                // import postdata as variables
    641641                extract($postdata);
    642                
     642
    643643                // form an excerpt
    644644                $excerpt = strip_tags($post_excerpt?$post_excerpt:$post_content);
    645                
     645
    646646                if (strlen($excerpt) > 255) {
    647647                        $excerpt = substr($excerpt,0,252) . '...';
    648648                }
    649                
     649
    650650                $trackback_urls = explode(',', $tb_list);
    651651                foreach($trackback_urls as $tb_url) {
    652652                    $tb_url = trim($tb_url);
     
    684684                // Do some escaping magic so that '#' chars in the
    685685                // spam words don't break things:
    686686                $word = preg_quote($word, '#');
    687                
     687
    688688                $pattern = "#$word#i";
    689689                if ( preg_match($pattern, $author    ) ) return true;
    690690                if ( preg_match($pattern, $email     ) ) return true;
     
    693693                if ( preg_match($pattern, $user_ip   ) ) return true;
    694694                if ( preg_match($pattern, $user_agent) ) return true;
    695695        }
    696        
     696
    697697        if ( isset($_SERVER['REMOTE_ADDR']) ) {
    698698                if ( wp_proxy_check($_SERVER['REMOTE_ADDR']) ) return true;
    699699        }
     
    722722                $wpdb->query("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = '$post_id'");
    723723                return;
    724724        }
    725        
     725
    726726        if (empty($post->post_excerpt))
    727727                $excerpt = apply_filters('the_content', $post->post_content);
    728728        else
     
    812812
    813813function generate_page_uri_index() {
    814814        global $wpdb;
    815        
     815
    816816        //get pages in order of hierarchy, i.e. children after parents
    817817        $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'"));
    818818        //now reverse it, because we need parents after children for rewrite rules to work properly
     
    822822        $page_attachment_uris = array();
    823823
    824824        if ($posts) {
    825                
     825
    826826                foreach ($posts as $id => $post) {
    827827
    828828                        // URI => page name
     
    839839                }
    840840
    841841                update_option('page_uris', $page_uris);
    842                
     842
    843843                if ( $page_attachment_uris )
    844844                        update_option('page_attachment_uris', $page_attachment_uris);
    845845        }
     
    903903                return true;
    904904        } else {
    905905                if ( is_dir(dirname($target)) )
    906                         return false;   
     906                        return false;
    907907        }
    908908
    909909        // If the above failed, attempt to create the parent node, then try again.
     
    954954                return array('error' => "Empty filename");
    955955
    956956        $upload = wp_upload_dir();
    957        
     957
    958958        if ( $upload['error'] !== false )
    959959                return $upload;
    960960
     
    972972                else
    973973                        $filename = str_replace("$number$ext", ++$number . $ext, $filename);
    974974        }
    975                
     975
    976976        $new_file = $upload['path'] . "/$filename";
    977977        if ( ! wp_mkdir_p( dirname($new_file) ) ) {
    978978                $message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), dirname($new_file));
     
    982982        $ifp = @ fopen($new_file, 'wb');
    983983        if ( ! $ifp )
    984984                return array('error' => "Could not write file $new_file.");
    985                
     985
    986986        $success = @ fwrite($ifp, $bits);
    987987        fclose($ifp);
    988988        // Set correct file permissions
  • wp-includes/classes.php

     
    5353                $this->is_admin = false;
    5454                $this->is_attachment = false;
    5555        }
    56        
     56
    5757        function init () {
    5858                unset($this->posts);
    5959                unset($this->query);
     
    6363                $this->post_count = 0;
    6464                $this->current_post = -1;
    6565                $this->in_the_loop = false;
    66                
     66
    6767                $this->init_query_flags();
    6868        }
    6969
     
    9797                        $qv['attachment'] = $qv['subpost'];
    9898                if ( '' != $qv['subpost_id'] )
    9999                        $qv['attachment_id'] = $qv['subpost_id'];
    100                        
     100
    101101                if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) {
    102102                        $this->is_single = true;
    103103                        $this->is_attachment = true;
     
    226226                if ('' != $qv['comments_popup']) {
    227227                        $this->is_comments_popup = true;
    228228                }
    229                
     229
    230230                //if we're previewing inside the write screen
    231231                if ('' != $qv['preview']) {
    232232                        $this->is_preview = true;
     
    247247
    248248        function set_404() {
    249249                $this->init_query_flags();
    250                 $this->is_404 = true;   
     250                $this->is_404 = true;
    251251        }
    252        
     252
    253253        function get($query_var) {
    254254                if (isset($this->query_vars[$query_var])) {
    255255                        return $this->query_vars[$query_var];
     
    268268                do_action('pre_get_posts', array(&$this));
    269269
    270270                // Shorthand.
    271                 $q = $this->query_vars; 
     271                $q = $this->query_vars;
    272272
    273273                // First let's clear some variables
    274274                $whichcat = '';
     
    306306                        $q['page'] = trim($q['page'], '/');
    307307                        $q['page'] = (int) $q['page'];
    308308                }
    309        
     309
    310310                $add_hours = intval(get_settings('gmt_offset'));
    311311                $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));
    312312                $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)";
     
    372372                        $page_paths = '/' . trim($q['pagename'], '/');
    373373                        $q['pagename'] = sanitize_title(basename($page_paths));
    374374                        $q['name'] = $q['pagename'];
    375                        
     375
    376376                        $where .= " AND (ID = '$reqpage')";
    377377                } elseif ('' != $q['attachment']) {
    378378                        $q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
     
    489489                                        $partial_match = $cat_id;
    490490                                }
    491491                        }
    492                        
     492
    493493                        //if we don't match the entire hierarchy fallback on just matching the nicename
    494494                        if (!$q['cat'] && $partial_match) {
    495495                                $q['cat'] = $partial_match;
    496                         }                       
     496                        }
    497497
    498498                        $tables = ", $wpdb->post2cat, $wpdb->categories";
    499499                        $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
     
    541541                        $q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
    542542                        $whichauthor .= ' AND (post_author = '.intval($q['author']).')';
    543543                }
    544                
     544
    545545                $where .= $search.$whichcat.$whichauthor;
    546546
    547547                if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) {
     
    572572                }
    573573
    574574                //$now = gmdate('Y-m-d H:i:59');
    575                
     575
    576576                //only select past-dated posts, except if a logged in user is viewing a single: then, if they
    577577                //can edit the post, we let them through
    578578                //if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {
     
    593593                                $where .= " OR post_status = 'future'";
    594594                        else
    595595                                $distinct = 'DISTINCT';
    596        
     596
    597597                        if ( is_user_logged_in() )
    598598                                $where .= " OR post_author = $user_ID AND post_status = 'private')";
    599599                        else
    600                                 $where .= ')';                         
     600                                $where .= ')';
    601601                }
    602602
    603603                // Apply filters on where and join prior to paging so that any
     
    680680                if ($this->post_count > 0) {
    681681                        $this->post = $this->posts[0];
    682682                }
    683                
     683
    684684                // Save any changes made to the query vars.
    685685                $this->query_vars = $q;
    686686                return $this->posts;
     
    841841                $head = '<div class="wrap"><h2>' . __('Check Comments Results:') . '</h2>';
    842842
    843843                $foot .= '<p><a href="options-discussion.php">' . __('&laquo; Return to Discussion Options page.') . '</a></p></div>';
    844                
     844
    845845                return $head . $body . $foot;
    846846        }       // End function display_edit_form
    847847
     
    922922                        return false;
    923923                else
    924924                        return true;
    925         }                                       
     925        }
    926926
    927927        function using_index_permalinks() {
    928928                if (empty($this->permalink_structure)) {
     
    942942                        return true;
    943943                else
    944944                        return false;
    945         }                                       
     945        }
    946946
    947947        function preg_index($number) {
    948948                $match_prefix = '$';
     
    987987                        $this->date_structure = '';
    988988                        return false;
    989989                }
    990                
     990
    991991                // The date permalink must have year, month, and day separated by slashes.
    992992                $endians = array('%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%', '%monthnum%/%day%/%year%');
    993993
     
    10701070                        $this->category_structure = $this->category_base . '/';
    10711071
    10721072                $this->category_structure .= '%category%';
    1073                
     1073
    10741074                return $this->category_structure;
    10751075        }
    10761076
     
    11531153                // If the tag already exists, replace the existing pattern and query for
    11541154                // that tag, otherwise add the new tag, pattern, and query to the end of
    11551155                // the arrays.
    1156                 $position = array_search($tag, $this->rewritecode);             
     1156                $position = array_search($tag, $this->rewritecode);
    11571157                if (FALSE !== $position && NULL !== $position) {
    11581158                        $this->rewritereplace[$position] = $pattern;
    1159                         $this->queryreplace[$position] = $query;                       
     1159                        $this->queryreplace[$position] = $query;
    11601160                } else {
    11611161                        $this->rewritecode[] = $tag;
    11621162                        $this->rewritereplace[] = $pattern;
     
    11741174
    11751175                $trackbackregex = 'trackback/?$';
    11761176                $pageregex = 'page/?([0-9]{1,})/?$';
    1177                
     1177
    11781178                $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
    11791179                preg_match_all('/%.+?%/', $permalink_structure, $tokens);
    11801180
     
    13041304                // Date
    13051305                $date_rewrite = $this->generate_rewrite_rules($this->get_date_permastruct());
    13061306                $date_rewrite = apply_filters('date_rewrite_rules', $date_rewrite);
    1307                
     1307
    13081308                // Root
    13091309                $root_rewrite = $this->generate_rewrite_rules($this->root . '/');
    13101310                $root_rewrite = apply_filters('root_rewrite_rules', $root_rewrite);
     
    13721372                        $rules .= "RewriteCond %{REQUEST_FILENAME} -f [OR]\n" .
    13731373                                "RewriteCond %{REQUEST_FILENAME} -d\n" .
    13741374                                "RewriteRule ^.*$ - [S=$num_rules]\n";
    1375                
     1375
    13761376                        foreach ($rewrite as $match => $query) {
    13771377                                // Apache 1.3 does not support the reluctant (non-greedy) modifier.
    13781378                                $match = str_replace('.+?', '.+', $match);
     
    13821382                                if ($match == '(.+)/?$' || $match == '([^/]+)/?$' ) {
    13831383                                        //nada.
    13841384                                }
    1385                        
     1385
    13861386                                if (strstr($query, $this->index)) {
    13871387                                        $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
    13881388                                } else {
     
    14131413
    14141414        function init() {
    14151415                $this->permalink_structure = get_settings('permalink_structure');
    1416                 $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));         
     1416                $this->front = substr($this->permalink_structure, 0, strpos($this->permalink_structure, '%'));
    14171417                $this->root = '';
    14181418                if ($this->using_index_permalinks()) {
    14191419                        $this->root = $this->index . '/';
     
    14931493                        // Trim path info from the end and the leading home path from the
    14941494                        // front.  For path info requests, this leaves us with the requesting
    14951495                        // filename, if any.  For 404 requests, this leaves us with the
    1496                         // requested permalink. 
     1496                        // requested permalink.
    14971497                        $req_uri = str_replace($pathinfo, '', $req_uri);
    14981498                        $req_uri = trim($req_uri, '/');
    14991499                        $req_uri = preg_replace("|^$home_path|", '', $req_uri);
     
    15621562
    15631563                                if (isset($error))
    15641564                                        unset($error);
    1565                                        
     1565
    15661566                                if ( isset($query_vars) && strstr($_SERVER['PHP_SELF'], 'wp-admin/') )
    15671567                                        unset($query_vars);
    1568                                        
     1568
    15691569                                $this->did_permalink = false;
    15701570                        }
    15711571                }
     
    16191619                        // If string is empty, return 0. If not, attempt to parse into a timestamp
    16201620                        $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
    16211621
    1622                         // Make a timestamp for our most recent modification... 
     1622                        // Make a timestamp for our most recent modification...
    16231623                        $wp_modified_timestamp = strtotime($wp_last_modified);
    16241624
    16251625                        if ( ($client_last_modified && $client_etag) ?
  • wp-includes/template-functions-links.php

     
    271271                return null;
    272272
    273273        $current_post_date = $post->post_date;
    274        
     274
    275275        $join = '';
    276276        if ( $in_same_cat ) {
    277277                $join = " INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id ";
     
    437437        if ( $permalink )
    438438                $qstr = trailingslashit($qstr);
    439439        $qstr = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', trailingslashit( get_settings('home') ) . $qstr );
    440        
     440
    441441        // showing /page/1/ or ?paged=1 is redundant
    442442        if ( 1 === $pagenum ) {
    443443                $qstr = str_replace('page/1/', '', $qstr); // for mod_rewrite style
  • wp-includes/pluggable-functions.php

     
    6262                return false;
    6363
    6464        $user = wp_cache_get($user_id, 'users');
    65        
     65
    6666        if ( $user )
    6767                return $user;
    6868
     
    9393                $user->user_lastname = $user->last_name;
    9494        if ( isset($user->description) )
    9595                $user->user_description = $user->description;
    96                
     96
    9797        wp_cache_add($user_id, $user, 'users');
    9898        wp_cache_add($user->user_login, $user, 'userlogins');
    99        
     99
    100100        return $user;
    101101}
    102102endif;
     
    114114
    115115        if ( empty( $user_login ) )
    116116                return false;
    117                
     117
    118118        $userdata = wp_cache_get($user_login, 'userlogins');
    119119        if ( $userdata )
    120120                return $userdata;
     
    202202if ( !function_exists('is_user_logged_in') ) :
    203203function is_user_logged_in() {
    204204        global $current_user;
    205        
     205
    206206        if ( $current_user->id == 0 )
    207207                return false;
    208208        return true;
     
    216216                                !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
    217217                         (empty($_COOKIE[USER_COOKIE])) ) {
    218218                nocache_headers();
    219        
     219
    220220                header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
    221221                exit();
    222222        }
     
    303303        $comment_author_domain = gethostbyaddr($comment->comment_author_IP);
    304304
    305305        $blogname = get_settings('blogname');
    306        
     306
    307307        if ( empty( $comment_type ) ) $comment_type = 'comment';
    308        
     308
    309309        if ('comment' == $comment_type) {
    310310                $notify_message  = sprintf( __('New comment on your post #%1$s "%2$s"'), $comment->comment_post_ID, $post->post_title ) . "\r\n";
    311311                $notify_message .= sprintf( __('Author : %1$s (IP: %2$s , %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
     
    407407if ( !function_exists('wp_new_user_notification') ) :
    408408function wp_new_user_notification($user_id, $plaintext_pass = '') {
    409409        $user = new WP_User($user_id);
    410        
     410
    411411        $user_login = stripslashes($user->user_login);
    412412        $user_email = stripslashes($user->user_email);
    413        
     413
    414414        $message  = sprintf(__('New user registration on your blog %s:'), get_settings('blogname')) . "\r\n\r\n";
    415415        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
    416416        $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
    417        
     417
    418418        @wp_mail(get_settings('admin_email'), sprintf(__('[%s] New User Registration'), get_settings('blogname')), $message);
    419419
    420420        if ( empty($plaintext_pass) )
     
    423423        $message  = sprintf(__('Username: %s'), $user_login) . "\r\n";
    424424        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
    425425        $message .= get_settings('siteurl') . "/wp-login.php\r\n";
    426                
     426
    427427        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_settings('blogname')), $message);
    428        
     428
    429429}
    430430endif;
    431431
  • wp-includes/comment-functions.php

     
    4141
    4242        $commentdata['comment_date']     = current_time('mysql');
    4343        $commentdata['comment_date_gmt'] = current_time('mysql', 1);
    44        
    4544
     45
    4646        $commentdata = wp_filter_comment($commentdata);
    4747
    4848        $commentdata['comment_approved'] = wp_allow_comment($commentdata);
     
    230230
    231231        if ( !isset($comment_count_cache[$post_id]) )
    232232                $comment_count_cache[$id] = $wpdb->get_var("SELECT comment_count FROM $wpdb->posts WHERE ID = '$post_id'");
    233        
     233
    234234        return apply_filters('get_comments_number', $comment_count_cache[$post_id]);
    235235}
    236236
     
    277277function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
    278278        global $id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb;
    279279        global $comment_count_cache;
    280        
     280
    281281        if (! is_single() && ! is_page()) {
    282282        if ( !isset($comment_count_cache[$id]) )
    283283                $comment_count_cache[$id] = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved = '1';");
    284        
     284
    285285        $number = $comment_count_cache[$id];
    286        
     286
    287287        if (0 == $number && 'closed' == $post->comment_status && 'closed' == $post->ping_status) {
    288288                echo $none;
    289289                return;
     
    344344
    345345function get_comment_author_email() {
    346346        global $comment;
    347         return apply_filters('get_comment_author_email', $comment->comment_author_email);       
     347        return apply_filters('get_comment_author_email', $comment->comment_author_email);
    348348}
    349349
    350350function comment_author_email() {
     
    616616        // Debug
    617617        debug_fwrite($log, 'Post contents:');
    618618        debug_fwrite($log, $content."\n");
    619        
     619
    620620        // Step 2.
    621621        // Walking thru the links array
    622622        // first we get rid of links pointing to sites, not to specific files
     
    658658
    659659                        // when set to true, this outputs debug messages by itself
    660660                        $client->debug = false;
    661                        
     661
    662662                        if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) )
    663663                                add_ping( $post_ID, $pagelinkedto );
    664664                        else
     
    769769                $post = & get_post($id);
    770770                if ( 'attachment' == $post->post_status )
    771771                        return true;
    772         }               
     772        }
    773773        return false;
    774774}
    775775
     
    795795   
    796796    if ($wpdb->query($query)) {
    797797                do_action('wp_set_comment_status', $comment_id, $comment_status);
    798                
     798
    799799                $comment = get_comment($comment_id);
    800800                $comment_post_ID = $comment->comment_post_ID;
    801801                $c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'" );
     
    809809
    810810function wp_get_comment_status($comment_id) {
    811811        global $wpdb;
    812        
     812
    813813        $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
    814814        if ($result == NULL) {
    815815                return 'deleted';
     
    845845                        // Do some escaping magic so that '#' chars in the
    846846                        // spam words don't break things:
    847847                        $word = preg_quote($word, '#');
    848                
     848
    849849                        $pattern = "#$word#i";
    850850                        if ( preg_match($pattern, $author) ) return false;
    851851                        if ( preg_match($pattern, $email) ) return false;
  • wp-includes/functions.php

     
    2222                return false;
    2323        }
    2424        $i = mktime(substr($m,11,2),substr($m,14,2),substr($m,17,2),substr($m,5,2),substr($m,8,2),substr($m,0,4));
    25        
     25
    2626        if ( -1 == $i || false == $i )
    2727                $i = 0;
    2828
     
    304304
    305305function get_user_option( $option, $user = 0 ) {
    306306        global $wpdb, $current_user;
    307        
     307
    308308        if ( empty($user) )
    309309                $user = $current_user;
    310310        else
     
    657657                $curpage = get_page($curpage->post_parent);
    658658                $path = '/' . $curpage->post_name . $path;
    659659        }
    660        
     660
    661661        $page->fullpath = $path;
    662662
    663663        return $page;
     
    726726                        wp_cache_add($_page->ID, $_page, 'pages');
    727727                }
    728728        }
    729        
     729
    730730        if (!isset($_page->fullpath)) {
    731731                $_page = set_page_path($_page);
    732732                wp_cache_replace($_page->ID, $_page, 'pages');
     
    751751                $curcat = get_category($curcat->category_parent);
    752752                $path = '/' . $curcat->category_nicename . $path;
    753753        }
    754        
     754
    755755        $cat->fullpath = $path;
    756756
    757757        return $cat;
     
    777777
    778778        if ( !isset($_category->fullpath) ) {
    779779                $_category = set_category_path($_category);
    780                 wp_cache_replace($_category->cat_ID, $_category, 'category');   
     780                wp_cache_replace($_category->cat_ID, $_category, 'category');
    781781        }
    782782
    783783        if ( $output == OBJECT ) {
     
    830830
    831831function get_all_category_ids() {
    832832        global $wpdb;
    833        
     833
    834834        if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
    835835                $cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
    836836                wp_cache_add('all_category_ids', $cat_ids, 'category');
    837837        }
    838        
     838
    839839        return $cat_ids;
    840840}
    841841
    842842function get_all_page_ids() {
    843843        global $wpdb;
    844        
     844
    845845        if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) {
    846846                $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
    847847                wp_cache_add('all_page_ids', $page_ids, 'pages');
    848848        }
    849        
     849
    850850        return $page_ids;
    851851}
    852852
     
    14161416
    14171417        if ( empty($dogs) )
    14181418                return;
    1419                
     1419
    14201420        foreach ($dogs as $catt)
    14211421                $category_cache[$catt->post_id][$catt->category_id] = &get_category($catt->category_id);
    14221422}
     
    15231523
    15241524function is_preview() {
    15251525        global $wp_query;
    1526        
     1526
    15271527        return $wp_query->is_preview;
    15281528}
    15291529
     
    21752175
    21762176function wp($query_vars = '') {
    21772177        global $wp;
    2178        
     2178
    21792179        $wp->main($query_vars);
    21802180}
    21812181
     
    22452245        if ( is_array($meta_value) || is_object($meta_value) )
    22462246                $meta_value = serialize($meta_value);
    22472247        $meta_value = trim( $meta_value );
    2248        
     2248
    22492249        if (empty($meta_value)) {
    22502250                delete_usermeta($user_id, $meta_key);
    22512251        }
     
    22582258        } else if ( $cur->meta_value != $meta_value ) {
    22592259                $wpdb->query("UPDATE $wpdb->usermeta SET meta_value = '$meta_value' WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
    22602260        } else {
    2261                 return false;   
     2261                return false;
    22622262        }
    2263        
     2263
    22642264        $user = get_userdata($user_id);
    22652265        wp_cache_delete($user_id, 'users');
    22662266        wp_cache_delete($user->user_login, 'userlogins');
    2267        
     2267
    22682268        return true;
    22692269}
    22702270
     
    22822282                $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key' AND meta_value = '$meta_value'");
    22832283        else
    22842284                $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$user_id' AND meta_key = '$meta_key'");
    2285                
     2285
    22862286        $user = get_userdata($user_id);
    22872287        wp_cache_delete($user_id, 'users');
    22882288        wp_cache_delete($user->user_login, 'userlogins');
    2289        
     2289
    22902290        return true;
    22912291}
    22922292
  • wp-includes/rss-functions.php

     
    3030        var $inimage                    = false;
    3131        var $current_field              = '';
    3232        var $current_namespace  = false;
    33        
     33
    3434        //var $ERROR = "";
    35        
     35
    3636        var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
    3737
    3838        function MagpieRSS ($source) {
    39                
     39
    4040                # if PHP xml isn't compiled in, die
    4141                #
    4242                if ( !function_exists('xml_parser_create') )
    4343                        trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" );
    44                
     44
    4545                $parser = @xml_parser_create();
    46                
     46
    4747                if ( !is_resource($parser) )
    4848                        trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php");
    4949
    50                
     50
    5151                $this->parser = $parser;
    52                
     52
    5353                # pass in parser, and a reference to this object
    5454                # setup handlers
    5555                #
    5656                xml_set_object( $this->parser, $this );
    5757                xml_set_element_handler($this->parser,
    5858                                'feed_start_element', 'feed_end_element' );
    59                                                
     59
    6060                xml_set_character_data_handler( $this->parser, 'feed_cdata' );
    61        
     61
    6262                $status = xml_parse( $this->parser, $source );
    63                
     63
    6464                if (! $status ) {
    6565                        $errorcode = xml_get_error_code( $this->parser );
    6666                        if ( $errorcode != XML_ERROR_NONE ) {
     
    7272                                $this->error( $errormsg );
    7373                        }
    7474                }
    75                
     75
    7676                xml_parser_free( $this->parser );
    7777
    7878                $this->normalize();
    7979        }
    80        
     80
    8181        function feed_start_element($p, $element, &$attrs) {
    8282                $el = $element = strtolower($element);
    8383                $attrs = array_change_key_case($attrs, CASE_LOWER);
    84                
     84
    8585                // check for a namespace, and split if found
    8686                $ns     = false;
    8787                if ( strpos( $element, ':' ) ) {
     
    9090                if ( $ns and $ns != 'rdf' ) {
    9191                        $this->current_namespace = $ns;
    9292                }
    93                        
     93
    9494                # if feed type isn't set, then this is first element of feed
    9595                # identify feed from root element
    9696                #
     
    110110                        }
    111111                        return;
    112112                }
    113        
     113
    114114                if ( $el == 'channel' )
    115115                {
    116116                        $this->inchannel = true;
     
    119119                {
    120120                        $this->initem = true;
    121121                        if ( isset($attrs['rdf:about']) ) {
    122                                 $this->current_item['about'] = $attrs['rdf:about'];     
     122                                $this->current_item['about'] = $attrs['rdf:about'];
    123123                        }
    124124                }
    125                
     125
    126126                // if we're in the default namespace of an RSS feed,
    127127                //  record textinput or image fields
    128128                elseif (
     
    132132                {
    133133                        $this->intextinput = true;
    134134                }
    135                
     135
    136136                elseif (
    137137                        $this->feed_type == RSS and
    138138                        $this->current_namespace == '' and
     
    140140                {
    141141                        $this->inimage = true;
    142142                }
    143                
     143
    144144                # handle atom content constructs
    145145                elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
    146146                {
     
    148148                        if ($el == 'content' ) {
    149149                                $el = 'atom_content';
    150150                        }
    151                        
     151
    152152                        $this->incontent = $el;
    153                        
    154                        
     153
     154
    155155                }
    156                
     156
    157157                // if inside an Atom content construct (e.g. content or summary) field treat tags as text
    158158                elseif ($this->feed_type == ATOM and $this->incontent )
    159159                {
     
    162162                                        array_map('map_attrs',
    163163                                        array_keys($attrs),
    164164                                        array_values($attrs) ) );
    165                        
     165
    166166                        $this->append_content( "<$element $attrs_str>"  );
    167                                        
     167
    168168                        array_unshift( $this->stack, $el );
    169169                }
    170                
     170
    171171                // Atom support many links per containging element.
    172172                // Magpie treats link elements of type rel='alternate'
    173173                // as being equivalent to RSS's simple link element.
     
    181181                        else {
    182182                                $link_el = 'link_' . $attrs['rel'];
    183183                        }
    184                        
     184
    185185                        $this->append($link_el, $attrs['href']);
    186186                }
    187187                // set stack[0] to current element
     
    189189                        array_unshift($this->stack, $el);
    190190                }
    191191        }
    192        
    193192
    194        
     193
     194
    195195        function feed_cdata ($p, $text) {
    196                
     196
    197197                if ($this->feed_type == ATOM and $this->incontent)
    198198                {
    199199                        $this->append_content( $text );
     
    203203                        $this->append($current_el, $text);
    204204                }
    205205        }
    206        
     206
    207207        function feed_end_element ($p, $el) {
    208208                $el = strtolower($el);
    209                
     209
    210210                if ( $el == 'item' or $el == 'entry' )
    211211                {
    212212                        $this->items[] = $this->current_item;
     
    222222                        $this->inimage = false;
    223223                }
    224224                elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
    225                 {       
     225                {
    226226                        $this->incontent = false;
    227227                }
    228228                elseif ($el == 'channel' or $el == 'feed' )
     
    245245                else {
    246246                        array_shift( $this->stack );
    247247                }
    248                
     248
    249249                $this->current_namespace = false;
    250250        }
    251        
     251
    252252        function concat (&$str1, $str2="") {
    253253                if (!isset($str1) ) {
    254254                        $str1="";
    255255                }
    256256                $str1 .= $str2;
    257257        }
    258        
     258
    259259        function append_content($text) {
    260260                if ( $this->initem ) {
    261261                        $this->concat( $this->current_item[ $this->incontent ], $text );
     
    264264                        $this->concat( $this->channel[ $this->incontent ], $text );
    265265                }
    266266        }
    267        
     267
    268268        // smart append - field and namespace aware
    269269        function append($el, $text) {
    270270                if (!$el) {
     
    306306                                $this->concat(
    307307                                        $this->channel[ $el ], $text );
    308308                        }
    309                        
     309
    310310                }
    311311        }
    312        
     312
    313313        function normalize () {
    314314                // if atom populate rss fields
    315315                if ( $this->is_atom() ) {
     
    320320                                        $item['description'] = $item['summary'];
    321321                                if ( isset($item['atom_content']))
    322322                                        $item['content']['encoded'] = $item['atom_content'];
    323                                
     323
    324324                                $this->items[$i] = $item;
    325                         }               
     325                        }
    326326                }
    327327                elseif ( $this->is_rss() ) {
    328328                        $this->channel['tagline'] = $this->channel['description'];
     
    332332                                        $item['summary'] = $item['description'];
    333333                                if ( isset($item['content']['encoded'] ) )
    334334                                        $item['atom_content'] = $item['content']['encoded'];
    335                        
     335
    336336                                $this->items[$i] = $item;
    337337                        }
    338338                }
    339339        }
    340        
     340
    341341        function is_rss () {
    342342                if ( $this->feed_type == RSS ) {
    343                         return $this->feed_version;     
     343                        return $this->feed_version;
    344344                }
    345345                else {
    346346                        return false;
    347347                }
    348348        }
    349        
     349
    350350        function is_atom() {
    351351                if ( $this->feed_type == ATOM ) {
    352352                        return $this->feed_version;
     
    378378function fetch_rss ($url) {
    379379        // initialize constants
    380380        init();
    381        
     381
    382382        if ( !isset($url) ) {
    383383                // error("fetch_rss called without a url");
    384384                return false;
    385385        }
    386        
     386
    387387        // if cache is disabled
    388388        if ( !MAGPIE_CACHE_ON ) {
    389389                // fetch file, and parse it
     
    403403                // 2. if there is a hit, make sure its fresh
    404404                // 3. if cached obj fails freshness check, fetch remote
    405405                // 4. if remote fails, return stale object, or error
    406                
     406
    407407                $cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
    408                
     408
    409409                if (MAGPIE_DEBUG and $cache->ERROR) {
    410410                        debug($cache->ERROR, E_USER_WARNING);
    411411                }
    412                
    413                
     412
     413
    414414                $cache_status    = 0;           // response of check_cache
    415415                $request_headers = array(); // HTTP headers to send with fetch
    416416                $rss                     = 0;           // parsed RSS object
    417417                $errormsg                = 0;           // errors, if any
    418                
     418
    419419                if (!$cache->ERROR) {
    420420                        // return cache HIT, MISS, or STALE
    421421                        $cache_status = $cache->check_cache( $url );
     
    432432                                return $rss;
    433433                        }
    434434                }
    435                
     435
    436436                // else attempt a conditional get
    437                
     437
    438438                // setup headers
    439439                if ( $cache_status == 'STALE' ) {
    440440                        $rss = $cache->get( $url );
     
    443443                                $request_headers['If-Last-Modified'] = $rss->last_modified;
    444444                        }
    445445                }
    446                
     446
    447447                $resp = _fetch_remote_file( $url, $request_headers );
    448                
     448
    449449                if (isset($resp) and $resp) {
    450450                        if ($resp->status == '304' ) {
    451451                                // we have the most current copy
     
    483483                else {
    484484                        $errormsg = "Unable to retrieve RSS file for unknown reasons.";
    485485                }
    486                
     486
    487487                // else fetch failed
    488                
     488
    489489                // attempt to return cached object
    490490                if ($rss) {
    491491                        if ( MAGPIE_DEBUG ) {
     
    493493                        }
    494494                        return $rss;
    495495                }
    496                
     496
    497497                // else we totally failed
    498                 // error( $errormsg ); 
    499                
     498                // error( $errormsg );
     499
    500500                return false;
    501                
     501
    502502        } // end if ( !MAGPIE_CACHE_ON ) {
    503503} // end fetch_rss()
    504504
     
    511511        if (is_array($headers) ) {
    512512                $client->rawheaders = $headers;
    513513        }
    514        
     514
    515515        @$client->fetch($url);
    516516        return $client;
    517517
     
    519519
    520520function _response_to_rss ($resp) {
    521521        $rss = new MagpieRSS( $resp->results );
    522        
    523         // if RSS parsed successfully           
     522
     523        // if RSS parsed successfully
    524524        if ( $rss and !$rss->ERROR) {
    525                
     525
    526526                // find Etag, and Last-Modified
    527527                foreach($resp->headers as $h) {
    528528                        // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
     
    533533                                $field = $h;
    534534                                $val = "";
    535535                        }
    536                        
     536
    537537                        if ( $field == 'ETag' ) {
    538538                                $rss->etag = $val;
    539539                        }
    540                        
     540
    541541                        if ( $field == 'Last-Modified' ) {
    542542                                $rss->last_modified = $val;
    543543                        }
    544544                }
    545                
    546                 return $rss;   
     545
     546                return $rss;
    547547        } // else construct error message
    548548        else {
    549549                $errormsg = "Failed to parse RSS file.";
    550                
     550
    551551                if ($rss) {
    552552                        $errormsg .= " (" . $rss->ERROR . ")";
    553553                }
    554554                // error($errormsg);
    555                
     555
    556556                return false;
    557557        } // end if ($rss and !$rss->error)
    558558}
     
    569569        else {
    570570                define('MAGPIE_INITALIZED', 1);
    571571        }
    572        
     572
    573573        if ( !defined('MAGPIE_CACHE_ON') ) {
    574574                define('MAGPIE_CACHE_ON', 1);
    575575        }
     
    585585        if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
    586586                define('MAGPIE_CACHE_FRESH_ONLY', 0);
    587587        }
    588        
     588
    589589                if ( !defined('MAGPIE_DEBUG') ) {
    590590                define('MAGPIE_DEBUG', 0);
    591591        }
    592592
    593593        if ( !defined('MAGPIE_USER_AGENT') ) {
    594594                $ua = 'WordPress/' . $wp_version;
    595                
     595
    596596                if ( MAGPIE_CACHE_ON ) {
    597597                        $ua = $ua . ')';
    598598                }
    599599                else {
    600600                        $ua = $ua . '; No cache)';
    601601                }
    602                
     602
    603603                define('MAGPIE_USER_AGENT', $ua);
    604604        }
    605        
     605
    606606        if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
    607607                define('MAGPIE_FETCH_TIME_OUT', 2);     // 2 second timeout
    608608        }
    609        
     609
    610610        // use gzip encoding to fetch rss files if supported?
    611611        if ( !defined('MAGPIE_USE_GZIP') ) {
    612                 define('MAGPIE_USE_GZIP', true);       
     612                define('MAGPIE_USE_GZIP', true);
    613613        }
    614614}
    615615
     
    641641        var $BASE_CACHE = 'wp-content/cache';   // where the cache files are stored
    642642        var $MAX_AGE    = 43200;                // when are files stale, default twelve hours
    643643        var $ERROR              = '';                   // accumulate error messages
    644        
     644
    645645        function RSSCache ($base='', $age='') {
    646646                if ( $base ) {
    647647                        $this->BASE_CACHE = $base;
     
    649649                if ( $age ) {
    650650                        $this->MAX_AGE = $age;
    651651                }
    652        
     652
    653653        }
    654        
     654
    655655/*=======================================================================*\
    656656        Function:       set
    657657        Purpose:        add an item to the cache, keyed on url
    658658        Input:          url from wich the rss file was fetched
    659         Output:         true on sucess 
     659        Output:         true on sucess
    660660\*=======================================================================*/
    661661        function set ($url, $rss) {
    662662                global $wpdb;
    663663                $cache_option = 'rss_' . $this->file_name( $url );
    664664                $cache_timestamp = 'rss_' . $this->file_name( $url ) . '_ts';
    665                
     665
    666666                if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_option'") )
    667667                        add_option($cache_option, '', '', 'no');
    668668                if ( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$cache_timestamp'") )
    669669                        add_option($cache_timestamp, '', '', 'no');
    670                
     670
    671671                update_option($cache_option, $rss);
    672672                update_option($cache_timestamp, time() );
    673                
     673
    674674                return $cache_option;
    675675        }
    676        
     676
    677677/*=======================================================================*\
    678678        Function:       get
    679679        Purpose:        fetch an item from the cache
    680680        Input:          url from wich the rss file was fetched
    681         Output:         cached object on HIT, false on MISS     
    682 \*=======================================================================*/     
     681        Output:         cached object on HIT, false on MISS
     682\*=======================================================================*/
    683683        function get ($url) {
    684684                $this->ERROR = "";
    685685                $cache_option = 'rss_' . $this->file_name( $url );
    686                
     686
    687687                if ( ! get_option( $cache_option ) ) {
    688688                        $this->debug(
    689689                                "Cache doesn't contain: $url (cache option: $cache_option)"
    690690                        );
    691691                        return 0;
    692692                }
    693                
     693
    694694                $rss = get_option( $cache_option );
    695                
     695
    696696                return $rss;
    697697        }
    698698
     
    701701        Purpose:        check a url for membership in the cache
    702702                                and whether the object is older then MAX_AGE (ie. STALE)
    703703        Input:          url from wich the rss file was fetched
    704         Output:         cached object on HIT, false on MISS     
    705 \*=======================================================================*/             
     704        Output:         cached object on HIT, false on MISS
     705\*=======================================================================*/
    706706        function check_cache ( $url ) {
    707707                $this->ERROR = "";
    708708                $cache_option = $this->file_name( $url );
     
    729729
    730730/*=======================================================================*\
    731731        Function:       serialize
    732 \*=======================================================================*/             
     732\*=======================================================================*/
    733733        function serialize ( $rss ) {
    734734                return serialize( $rss );
    735735        }
    736736
    737737/*=======================================================================*\
    738738        Function:       unserialize
    739 \*=======================================================================*/             
     739\*=======================================================================*/
    740740        function unserialize ( $data ) {
    741741                return unserialize( $data );
    742742        }
    743        
     743
    744744/*=======================================================================*\
    745745        Function:       file_name
    746746        Purpose:        map url to location in cache
    747747        Input:          url from wich the rss file was fetched
    748748        Output:         a file name
    749 \*=======================================================================*/             
     749\*=======================================================================*/
    750750        function file_name ($url) {
    751751                return md5( $url );
    752752        }
    753        
     753
    754754/*=======================================================================*\
    755755        Function:       error
    756756        Purpose:        register error
    757 \*=======================================================================*/                     
     757\*=======================================================================*/
    758758        function error ($errormsg, $lvl=E_USER_WARNING) {
    759759                // append PHP's error message if track_errors enabled
    760760                if ( isset($php_errormsg) ) {
     
    776776}
    777777
    778778function parse_w3cdtf ( $date_str ) {
    779        
     779
    780780        # regex to match wc3dtf
    781781        $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
    782        
     782
    783783        if ( preg_match( $pat, $date_str, $match ) ) {
    784784                list( $year, $month, $day, $hours, $minutes, $seconds) =
    785785                        array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
    786                
     786
    787787                # calc epoch for current date assuming GMT
    788788                $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
    789                
     789
    790790                $offset = 0;
    791791                if ( $match[10] == 'Z' ) {
    792792                        # zulu time, aka GMT
     
    794794                else {
    795795                        list( $tz_mod, $tz_hour, $tz_min ) =
    796796                                array( $match[8], $match[9], $match[10]);
    797                        
     797
    798798                        # zero out the variables
    799799                        if ( ! $tz_hour ) { $tz_hour = 0; }
    800800                        if ( ! $tz_min ) { $tz_min = 0; }
    801                
     801
    802802                        $offset_secs = (($tz_hour*60)+$tz_min)*60;
    803                        
     803
    804804                        # is timezone ahead of GMT?  then subtract offset
    805805                        #
    806806                        if ( $tz_mod == '+' ) {
    807807                                $offset_secs = $offset_secs * -1;
    808808                        }
    809                        
    810                         $offset = $offset_secs; 
     809
     810                        $offset = $offset_secs;
    811811                }
    812812                $epoch = $epoch + $offset;
    813813                return $epoch;
     
    829829                                        echo htmlentities($item['title']);
    830830                                        echo "</a><br />\n";
    831831                                        echo "</li>\n";
    832                                 }               
     832                                }
    833833                        echo "</ul>";
    834834        }
    835835                else {
  • wp-includes/registration-functions.php

     
    2323        $valid = true;
    2424
    2525        if ( $name != $username )
    26                 $valid = false; 
     26                $valid = false;
    2727
    28         return apply_filters('validate_username', $valid, $username);   
     28        return apply_filters('validate_username', $valid, $username);
    2929}
    3030
    3131function wp_insert_user($userdata) {
     
    4141                // Password is not hashed when creating new user.
    4242                $user_pass = md5($user_pass);
    4343        }
    44        
     44
    4545        $user_login = sanitize_user($user_login, true);
    4646
    4747        if ( empty($user_nicename) )
     
    4949
    5050        if ( empty($display_name) )
    5151                $display_name = $user_login;
    52                
     52
    5353        if ( empty($nickname) )
    5454                $nickname = $user_login;
    55                        
     55
    5656        if ( empty($user_registered) )
    5757                $user_registered = gmdate('Y-m-d H:i:s');
    5858
     
    7070                $wpdb->query( $query );
    7171                $user_id = $wpdb->insert_id;
    7272        }
    73        
     73
    7474        update_usermeta( $user_id, 'first_name', $first_name);
    7575        update_usermeta( $user_id, 'last_name', $last_name);
    7676        update_usermeta( $user_id, 'nickname', $nickname );
     
    9191
    9292        wp_cache_delete($user_id, 'users');
    9393        wp_cache_delete($user_login, 'userlogins');
    94        
     94
    9595        if ( $update )
    9696                do_action('profile_update', $user_id);
    9797        else
    9898                do_action('user_register', $user_id);
    99                
    100         return $user_id;       
     99
     100        return $user_id;
    101101}
    102102
    103103function wp_update_user($userdata) {
    104104        global $wpdb, $current_user;
    105105
    106106        $ID = (int) $userdata['ID'];
    107        
     107
    108108        // First, get all of the original fields
    109         $user = get_userdata($ID);     
     109        $user = get_userdata($ID);
    110110
    111111        // Escape data pulled from DB.
    112112        $user = add_magic_quotes(get_object_vars($user));
     
    121121        $userdata = array_merge($user, $userdata);
    122122        $user_id = wp_insert_user($userdata);
    123123
    124         // Update the cookies if the password changed. 
     124        // Update the cookies if the password changed.
    125125        if( $current_user->id == $ID ) {
    126126                if ( isset($plaintext_pass) ) {
    127127                        wp_clearcookie();
    128128                        wp_setcookie($userdata['user_login'], $plaintext_pass);
    129129                }
    130130        }
    131        
     131
    132132        return $user_id;
    133133}
    134134
    135135function wp_create_user( $username, $password, $email = '') {
    136136        global $wpdb;
    137        
     137
    138138        $user_login = $wpdb->escape( $username );
    139139        $user_email = $wpdb->escape( $email );
    140140        $user_pass = $password;
     
    145145
    146146
    147147function create_user( $username, $password, $email ) {
    148         return wp_create_user( $username, $password, $email ); 
     148        return wp_create_user( $username, $password, $email );
    149149}
    150150
    151151
  • xmlrpc.php

     
    577577              $post_category[] = get_cat_ID($cat);
    578578            }
    579579          }
    580                
     580
    581581          // We've got all the data -- post it:
    582582          $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_category', 'post_status', 'post_excerpt', 'comment_status', 'ping_status', 'to_ping');
    583583
     
    623623          $catnames = $content_struct['categories'];
    624624
    625625          $post_category = array();
    626                
     626
    627627          if (is_array($catnames)) {
    628628            foreach ($catnames as $cat) {
    629629              $post_category[] = get_cat_ID($cat);
     
    861861                        logIO('O', '(MW) Could not write file '.$name);
    862862                        return new IXR_Error(500, 'Could not write file '.$name);
    863863                }
    864                
     864
    865865                return array('url' => $upload['url']);
    866866        }
    867867
     
    995995          foreach($categories as $cat) {
    996996            $catids[] = $cat['categoryId'];
    997997          }
    998        
     998
    999999          wp_set_post_cats('', $post_ID, $catids);
    10001000
    10011001          return true;
     
    11991199                $linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
    12001200
    12011201                $p = explode( "\n\n", $linea );
    1202                
     1202
    12031203                $sem_regexp_pb = "/(\\/|\\\|\*|\?|\+|\.|\^|\\$|\(|\)|\[|\]|\||\{|\})/";
    12041204                $sem_regexp_fix = "\\\\$1";
    12051205                $link = preg_replace( $sem_regexp_pb, $sem_regexp_fix, $pagelinkedfrom );
    1206                
     1206
    12071207                $finished = false;
    12081208                foreach ( $p as $para ) {
    12091209                        if ( $finished )
     
    12381238
    12391239                wp_new_comment($commentdata);
    12401240                do_action('pingback_post', $wpdb->insert_id);
    1241                
     1241
    12421242                return "Pingback from $pagelinkedfrom to $pagelinkedto registered. Keep the web talking! :-)";
    12431243        }
    12441244
  • wp-mail.php

     
    8181                                }
    8282                                $date_arr = explode(' ', $ddate);
    8383                                $date_time = explode(':', $date_arr[3]);
    84                                
     84
    8585                                $ddate_H = $date_time[0];
    8686                                $ddate_i = $date_time[1];
    8787                                $ddate_s = $date_time[2];
    88                                
     88
    8989                                $ddate_m = $date_arr[1];
    9090                                $ddate_d = $date_arr[0];
    9191                                $ddate_Y = $date_arr[2];
  • wp-content/plugins/wp-db-backup.php

     
    3636        }
    3737
    3838        function wpdbBackup() {
    39                                
     39
    4040                add_action('wp_cron_daily', array(&$this, 'wp_cron_daily'));
    4141
    4242                $this->backup_dir = trailingslashit($this->backup_dir);
    4343                $this->basename = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', __FILE__);
    44        
     44
    4545                if (isset($_POST['do_backup'])) {
    4646                        switch($_POST['do_backup']) {
    4747                        case 'backup':
     
    4949                                break;
    5050                        case 'fragments':
    5151                                add_action('admin_menu', array(&$this, 'fragment_menu'));
    52                                 break;                         
     52                                break;
    5353                        }
    5454                } elseif (isset($_GET['fragment'] )) {
    5555                        add_action('init', array(&$this, 'init'));
     
    5959                        add_action('admin_menu', array(&$this, 'admin_menu'));
    6060                }
    6161        }
    62        
     62
    6363        function init() {
    6464                global $user_level;
    6565                get_currentuserinfo();
     
    6868
    6969                if (isset($_GET['backup'])) {
    7070                        $via = isset($_GET['via']) ? $_GET['via'] : 'http';
    71                        
     71
    7272                        $this->backup_file = $_GET['backup'];
    73                        
     73
    7474                        switch($via) {
    7575                        case 'smtp':
    7676                        case 'email':
     
    101101
    102102                die();
    103103        }
    104        
     104
    105105        function build_backup_script() {
    106106                global $table_prefix, $wpdb;
    107        
     107
    108108                $datum = date("Ymd_B");
    109109                $backup_filename = DB_NAME . "_$table_prefix$datum.sql";
    110110                if ($this->gzip()) $backup_filename .= '.gz';
    111                
     111
    112112                echo "<div class='wrap'>";
    113113                //echo "<pre>" . print_r($_POST, 1) . "</pre>";
    114114                echo '<h2>' . __('Backup') . '</h2>
     
    143143                        }
    144144
    145145                        function backup(table, segment) {
    146                                 var fram = document.getElementById("backuploader");                             
     146                                var fram = document.getElementById("backuploader");
    147147                                fram.src = "' . $_SERVER['REQUEST_URI'] . '&fragment=" + table + ":" + segment + ":' . $backup_filename . '";
    148148                        }
    149                        
     149
    150150                        var curStep = 0;
    151                        
     151
    152152                        function nextStep() {
    153153                                backupStep(curStep);
    154154                                curStep++;
    155155                        }
    156                        
     156
    157157                        function finishBackup() {
    158                                 var fram = document.getElementById("backuploader");                             
     158                                var fram = document.getElementById("backuploader");
    159159                                setMeter(100);
    160160                ';
    161161
     
    179179                                setProgress("' . sprintf(__("Backup complete, download <a href=\\\"%s\\\">here</a>."), $download_uri) . '");
    180180                        ';
    181181                }
    182                
     182
    183183                echo '
    184184                        }
    185                        
     185
    186186                        function backupStep(step) {
    187187                                switch(step) {
    188188                                case 0: backup("", 0); break;
    189189                ';
    190                
     190
    191191                $also_backup = array();
    192192                if (isset($_POST['other_tables'])) {
    193193                        $also_backup = $_POST['other_tables'];
     
    210210                        $step_count++;
    211211                }
    212212                echo "case {$step_count}: finishBackup(); break;";
    213                
     213
    214214                echo '
    215215                                }
    216216                                if(step != 0) setMeter(100 * step / ' . $step_count . ');
     
    224224
    225225        function backup_fragment($table, $segment, $filename) {
    226226                global $table_prefix, $wpdb;
    227                        
     227
    228228                echo "$table:$segment:$filename";
    229                
     229
    230230                if($table == '') {
    231231                        $msg = __('Creating backup file...');
    232232                } else {
     
    236236                                $msg = sprintf(__('Backing up table \\"%s\\"...'), $table);
    237237                        }
    238238                }
    239                
     239
    240240                echo '<script type="text/javascript"><!--//
    241241                var msg = "' . $msg . '";
    242242                window.parent.setProgress(msg);
    243243                ';
    244                        
     244
    245245                if (is_writable(ABSPATH . $this->backup_dir)) {
    246246                        $this->fp = $this->open(ABSPATH . $this->backup_dir . $filename, 'a');
    247247                        if(!$this->fp) {
     
    249249                                $this->fatal_error = __('The backup file could not be saved.  Please check the permissions for writing to your backup directory and try again.');
    250250                        }
    251251                        else {
    252                                 if($table == '') {             
     252                                if($table == '') {
    253253                                        //Begin new backup of MySql
    254254                                        $this->stow("# WordPress MySQL database backup\n");
    255255                                        $this->stow("#\n");
     
    266266                                                $this->stow("# --------------------------------------------------------\n");
    267267                                                $this->stow("# Table: " . $this->backquote($table) . "\n");
    268268                                                $this->stow("# --------------------------------------------------------\n");
    269                                         }                       
     269                                        }
    270270                                        $this->backup_table($table, $segment);
    271271                                }
    272272                        }
     
    276276                }
    277277
    278278                if($this->fp) $this->close($this->fp);
    279                
     279
    280280                if($this->backup_errors) {
    281281                        foreach($this->backup_errors as $error) {
    282282                                echo "window.parent.addError('$error');\n";
     
    294294                                //--></script>
    295295                        ';
    296296                }
    297                
     297
    298298                die();
    299299        }
    300300
     
    304304                if (isset($_POST['other_tables'])) {
    305305                        $also_backup = $_POST['other_tables'];
    306306                }
    307                
     307
    308308                $core_tables = $_POST['core_tables'];
    309309                $this->backup_file = $this->db_backup($core_tables, $also_backup);
    310310                if (FALSE !== $backup_file) {
     
    318318                        $this->backup_complete = true;
    319319                }
    320320        }
    321        
     321
    322322        ///////////////////////////////
    323323        function admin_menu() {
    324324                add_management_page(__('Backup'), __('Backup'), 9, basename(__FILE__), array(&$this, 'backup_menu'));
     
    387387                        fclose($fp);
    388388                }
    389389        }
    390        
     390
    391391        //////////////
    392392        function stow($query_line) {
    393393                if ($this->gzip()) {
     
    402402                        }
    403403                }
    404404        }
    405        
     405
    406406        function backup_error($err) {
    407407                if(count($this->backup_errors) < 20) {
    408408                        $this->backup_errors[] = $err;
     
    410410                        $this->backup_errors[] = __('Subsequent errors have been omitted from this log.');
    411411                }
    412412        }
    413        
     413
    414414        /////////////////////////////
    415415        function backup_table($table, $segment = 'none') {
    416416                global $wpdb;
    417                
     417
    418418                /*
    419419                Taken partially from phpMyAdmin and partially from
    420420                Alain Wolf, Zurich - Switzerland
    421421                Website: http://restkultur.ch/personal/wolf/scripts/db_backup/
    422                
     422
    423423                Modified by Scott Merril (http://www.skippy.net/)
    424424                to use the WordPress $wpdb object
    425425                */
     
    429429                        backup_errors(__('Error getting table details') . ": $table");
    430430                        return FALSE;
    431431                }
    432        
     432
    433433                if(($segment == 'none') || ($segment == 0)) {
    434434                        //
    435435                        // Add SQL statement to drop existing table
     
    439439                        $this->stow("#\n");
    440440                        $this->stow("\n");
    441441                        $this->stow("DROP TABLE IF EXISTS " . $this->backquote($table) . ";\n");
    442                        
     442
    443443                        //
    444444                        //Table structure
    445445                        // Comment in SQL-file
     
    448448                        $this->stow("# Table structure of table " . $this->backquote($table) . "\n");
    449449                        $this->stow("#\n");
    450450                        $this->stow("\n");
    451                        
     451
    452452                        $create_table = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_N);
    453453                        if (FALSE === $create_table) {
    454454                                $this->backup_error(sprintf(__("Error with SHOW CREATE TABLE for %s."), $table));
    455455                                $this->stow("#\n# Error with SHOW CREATE TABLE for $table!\n#\n");
    456456                        }
    457457                        $this->stow($create_table[0][1] . ' ;');
    458                        
     458
    459459                        if (FALSE === $table_structure) {
    460460                                $this->backup_error(sprintf(__("Error getting table structure of %s"), $table));
    461461                                $this->stow("#\n# Error getting table structure of $table!\n#\n");
    462462                        }
    463                
     463
    464464                        //
    465465                        // Comment in SQL-file
    466466                        $this->stow("\n\n");
     
    468468                        $this->stow('# Data contents of table ' . $this->backquote($table) . "\n");
    469469                        $this->stow("#\n");
    470470                }
    471                
     471
    472472                if(($segment == 'none') || ($segment >= 0)) {
    473473                        $ints = array();
    474474                        foreach ($table_structure as $struct) {
     
    481481                                                $ints[strtolower($struct->Field)] = "1";
    482482                                }
    483483                        }
    484                        
    485                        
     484
     485
    486486                        // Batch by $row_inc
    487                        
     487
    488488                        if($segment == 'none') {
    489489                                $row_start = 0;
    490490                                $row_inc = ROWS_PER_SEGMENT;
     
    492492                                $row_start = $segment * ROWS_PER_SEGMENT;
    493493                                $row_inc = ROWS_PER_SEGMENT;
    494494                        }
    495                        
    496                         do {   
     495
     496                        do {
    497497                                if ( !ini_get('safe_mode')) @set_time_limit(15*60);
    498498                                $table_data = $wpdb->get_results("SELECT * FROM $table LIMIT {$row_start}, {$row_inc}", ARRAY_A);
    499499
     
    503503                                        fwrite($fp, "#\n# Error getting table contents fom $table!\n#\n");
    504504                                }
    505505                                */
    506                                        
    507                                 $entries = 'INSERT INTO ' . $this->backquote($table) . ' VALUES (';     
     506
     507                                $entries = 'INSERT INTO ' . $this->backquote($table) . ' VALUES (';
    508508                                //    \x08\\x09, not required
    509509                                $search = array("\x00", "\x0a", "\x0d", "\x1a");
    510510                                $replace = array('\0', '\n', '\r', '\Z');
     
    524524                                }
    525525                        } while((count($table_data) > 0) and ($segment=='none'));
    526526                }
    527                
    528                
     527
     528
    529529                if(($segment == 'none') || ($segment < 0)) {
    530530                        // Create footer/closing comment in SQL-file
    531531                        $this->stow("\n");
     
    534534                        $this->stow("# --------------------------------------------------------\n");
    535535                        $this->stow("\n");
    536536                }
    537                
     537
    538538        } // end backup_table()
    539        
     539
    540540        function return_bytes($val) {
    541541           $val = trim($val);
    542542           $last = strtolower($val{strlen($val)-1});
     
    549549               case 'k':
    550550                   $val *= 1024;
    551551           }
    552        
     552
    553553           return $val;
    554554        }
    555        
     555
    556556        ////////////////////////////
    557557        function db_backup($core_tables, $other_tables) {
    558558                global $table_prefix, $wpdb;
    559                
     559
    560560                $datum = date("Ymd_B");
    561561                $wp_backup_filename = DB_NAME . "_$table_prefix$datum.sql";
    562562                        if ($this->gzip()) {
    563563                                $wp_backup_filename .= '.gz';
    564564                        }
    565                
     565
    566566                if (is_writable(ABSPATH . $this->backup_dir)) {
    567567                        $this->fp = $this->open(ABSPATH . $this->backup_dir . $wp_backup_filename);
    568568                        if(!$this->fp) {
     
    573573                        $this->backup_error(__('The backup directory is not writeable!'));
    574574                        return false;
    575575                }
    576                
     576
    577577                //Begin new backup of MySql
    578578                $this->stow("# WordPress MySQL database backup\n");
    579579                $this->stow("#\n");
     
    581581                $this->stow("# Hostname: " . DB_HOST . "\n");
    582582                $this->stow("# Database: " . $this->backquote(DB_NAME) . "\n");
    583583                $this->stow("# --------------------------------------------------------\n");
    584                
     584
    585585                        if ( (is_array($other_tables)) && (count($other_tables) > 0) )
    586586                        $tables = array_merge($core_tables, $other_tables);
    587587                else
    588588                        $tables = $core_tables;
    589                
     589
    590590                foreach ($tables as $table) {
    591591                        // Increase script execution time-limit to 15 min for every table.
    592592                        if ( !ini_get('safe_mode')) @set_time_limit(15*60);
     
    596596                        $this->stow("# --------------------------------------------------------\n");
    597597                        $this->backup_table($table);
    598598                }
    599                                
     599
    600600                $this->close($this->fp);
    601                
     601
    602602                if (count($this->backup_errors)) {
    603603                        return false;
    604604                } else {
    605605                        return $wp_backup_filename;
    606606                }
    607                
     607
    608608        } //wp_db_backup
    609        
     609
    610610        ///////////////////////////
    611611        function deliver_backup ($filename = '', $delivery = 'http', $recipient = '') {
    612612                if ('' == $filename) { return FALSE; }
    613                
     613
    614614                $diskfile = ABSPATH . $this->backup_dir . $filename;
    615615                if ('http' == $delivery) {
    616616                        if (! file_exists($diskfile)) {
     
    640640                        $headers = "MIME-Version: 1.0\n";
    641641                        $headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
    642642                        $headers .= 'From: ' . get_settings('admin_email') . "\n";
    643                
     643
    644644                        $message = sprintf(__("Attached to this email is\n   %1s\n   Size:%2s kilobytes\n"), $filename, round(filesize($diskfile)/1024));
    645645                        // Add a multipart boundary above the plain message
    646646                        $message = "This is a multi-part message in MIME format.\n\n" .
     
    648648                                "Content-Type: text/plain; charset=\"utf-8\"\n" .
    649649                                "Content-Transfer-Encoding: 7bit\n\n" .
    650650                                $message . "\n\n";
    651                        
     651
    652652                        // Add file attachment to the message
    653653                        $message .= "--{$boundary}\n" .
    654654                                "Content-Type: application/octet-stream;\n" .
     
    658658                                "Content-Transfer-Encoding: base64\n\n" .
    659659                                $data . "\n\n" .
    660660                                "--{$boundary}--\n";
    661                        
     661
    662662                        if (function_exists('wp_mail')) {
    663663                                wp_mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers);
    664664                        } else {
    665665                                mail ($recipient, get_bloginfo('name') . ' ' . __('Database Backup'), $message, $headers);
    666666                        }
    667                        
     667
    668668                        unlink($diskfile);
    669669                }
    670670                return;
    671671        }
    672        
     672
    673673        ////////////////////////////
    674674        function backup_menu() {
    675675                global $table_prefix, $wpdb;
    676676                $feedback = '';
    677677                $WHOOPS = FALSE;
    678                
     678
    679679                // did we just do a backup?  If so, let's report the status
    680680                if ( $this->backup_complete ) {
    681681                        $feedback = '<div class="updated"><p>' . __('Backup Successful') . '!';
     
    698698                        }
    699699                        $feedback .= '</p></div>';
    700700                }
    701                
     701
    702702                if (count($this->backup_errors)) {
    703703                        $feedback .= '<div class="updated error">' . __('The following errors were reported:') . "<pre>";
    704704                        foreach($this->backup_errors as $error) {
     
    706706                        }
    707707                        $feedback .= "</pre></div>";
    708708                }
    709                
     709
    710710                // did we just save options for wp-cron?
    711711                if ( (function_exists('wp_cron_init')) && isset($_POST['wp_cron_backup_options']) ) {
    712712                        update_option('wp_cron_backup_schedule', intval($_POST['cron_schedule']), FALSE);
     
    716716                        }
    717717                        $feedback .= '<div class="updated"><p>' . __('Scheduled Backup Options Saved!') . '</p></div>';
    718718                }
    719                
     719
    720720                // Simple table name storage
    721721                $wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta');
    722722                // Apply WP DB prefix to table names
    723723                $wp_table_names = array_map(create_function('$a', 'global $table_prefix;return "{$table_prefix}{$a}";'), $wp_table_names);
    724                
     724
    725725                $other_tables = array();
    726726                $also_backup = array();
    727        
    728                 // Get complete db table list   
     727
     728                // Get complete db table list
    729729                $all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
    730730                $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
    731731                // Get list of WP tables that actually exist in this DB (for 1.6 compat!)
    732732                $wp_backup_default_tables = array_intersect($all_tables, $wp_table_names);
    733733                // Get list of non-WP tables
    734734                $other_tables = array_diff($all_tables, $wp_backup_default_tables);
    735                
     735
    736736                if ('' != $feedback) {
    737737                        echo $feedback;
    738738                }
     
    749749                        $WHOOPS = TRUE;
    750750                        }
    751751                }
    752                
     752
    753753                if ( !is_writable( ABSPATH . $this->backup_dir) ) {
    754754                        echo '<div class="updated error"><p align="center">' . __('WARNING: Your backup directory is <strong>NOT</strong> writable! We can not create the backup directory.') . '<br />' . ABSPATH . "</p></div>";
    755755                }
     
    781781                echo '<label style="display:block;"><input type="radio" checked="checked" name="deliver" value="http" /> ' . __('Download to your computer') . '</label>';
    782782                echo '<div><input type="radio" name="deliver" id="do_email" value="smtp" /> ';
    783783                echo '<label for="do_email">'.__('Email backup to:').'</label><input type="text" name="backup_recipient" size="20" value="' . get_settings('admin_email') . '" />';
    784                
     784
    785785                // Check DB dize.
    786786                $table_status = $wpdb->get_results("SHOW TABLE STATUS FROM " . $this->backquote(DB_NAME));
    787787                $core_size = $db_size = 0;
    788788                foreach($table_status as $table) {
    789789                        $table_size = $table->Data_length - $table->Data_free;
    790790                        if(in_array($table->Name, $wp_backup_default_tables)) {
    791                                 $core_size += $table_size;     
     791                                $core_size += $table_size;
    792792                        }
    793793                        $db_size += $table_size;
    794794                }
    795795                $mem_limit = ini_get('memory_limit');
    796796                $mem_limit = $this->return_bytes($mem_limit);
    797797                $mem_limit = ($mem_limit == 0) ? 8*1024*1024 :  $mem_limit - 2000000;
    798                
     798
    799799                if (! $WHOOPS) {
    800800                        echo '<input type="hidden" name="do_backup" id="do_backup" value="backup" /></div>';
    801801                        echo '<p class="submit"><input type="submit" name="submit" onclick="document.getElementById(\'do_backup\').value=\'fragments\';" value="' . __('Backup') . '!" / ></p>';
     
    804804                }
    805805                echo '</fieldset>';
    806806                echo '</form>';
    807                
     807
    808808                // this stuff only displays if wp_cron is installed
    809809                if (function_exists('wp_cron_init')) {
    810810                        echo '<fieldset class="options"><legend>' . __('Scheduled Backup') . '</legend>';
     
    850850                        echo '</fieldset>';
    851851                }
    852852                // end of wp_cron section
    853                
     853
    854854                echo '</div>';
    855                
     855
    856856        }// end wp_backup_menu()
    857        
     857
    858858        /////////////////////////////
    859859        function wp_cron_daily() {
    860                
     860
    861861                $schedule = intval(get_option('wp_cron_backup_schedule'));
    862862                if (0 == $schedule) {
    863863                        // Scheduled backup is disabled
    864864                        return;
    865865                }
    866                
     866
    867867                global $table_prefix, $wpdb;
    868868
    869869                $wp_table_names = explode(',','categories,comments,linkcategories,links,options,post2cat,postmeta,posts,users,usermeta');
     
    872872                $all_tables = array_map(create_function('$a', 'return $a[0];'), $all_tables);
    873873                $core_tables = array_intersect($all_tables, $wp_table_names);
    874874                $other_tables = get_option('wp_cron_backup_tables');
    875                
     875
    876876                $recipient = get_option('wp_cron_backup_recipient');
    877                
     877
    878878                $backup_file = $this->db_backup($core_tables, $other_tables);
    879879                if (FALSE !== $backup_file) {
    880880                        $this->deliver_backup ($backup_file, 'smtp', $recipient);
    881881                }
    882                
     882
    883883                return;
    884884        } // wp_cron_db_backup
    885885}
  • wp-content/themes/classic/sidebar.php

     
    1111        </ul>
    1212 </li>
    1313 <li id="search">
    14    <label for="s"><?php _e('Search:'); ?></label>       
     14   <label for="s"><?php _e('Search:'); ?></label>
    1515   <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    1616        <div>
    1717                <input type="text" name="s" id="s" size="15" /><br />
  • wp-content/themes/classic/comments-popup.php

     
    103103<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
    104104<script type="text/javascript">
    105105<!--
    106 document.onkeypress = function esc(e) { 
     106document.onkeypress = function esc(e) {
    107107        if(typeof(e) == "undefined") { e=event; }
    108108        if (e.keyCode == 27) { self.close(); }
    109109}
  • wp-content/themes/classic/index.php

     
    55<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    66
    77<?php the_date('','<h2>','</h2>'); ?>
    8        
     8
    99<div class="post" id="post-<?php the_ID(); ?>">
    1010         <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    1111        <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
    12        
     12
    1313        <div class="storycontent">
    1414                <?php the_content(__('(more...)')); ?>
    1515        </div>
    16        
     16
    1717        <div class="feedback">
    1818            <?php wp_link_pages(); ?>
    1919            <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
  • wp-content/themes/classic/header.php

     
    55        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    66
    77        <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
    8        
     8
    99        <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
    1010
    1111        <style type="text/css" media="screen">
     
    1515        <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    1616        <link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
    1717        <link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
    18        
     18
    1919        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    2020    <?php wp_get_archives('type=monthly&format=link'); ?>
    2121        <?php //comments_popup_script(); // off by default ?>
  • wp-content/themes/default/style.css

     
    1414
    1515        The CSS, XHTML and design is released under GPL:
    1616        http://www.opensource.org/licenses/gpl-license.php
    17        
    1817
     18
    1919        *** REGARDING IMAGES ***
    2020        All CSS that involves the use of images, can be found in the 'index.php' file.
    2121        This is to ease installation inside subdirectories of a server.
     
    5959.widecolumn {
    6060        line-height: 1.6em;
    6161        }
    62        
     62
    6363.narrowcolumn .postmetadata {
    6464        text-align: center;
    6565        }
     
    132132.commentlist li, #commentform input, #commentform textarea {
    133133        font: 0.9em 'Lucida Grande', Verdana, Arial, Sans-Serif;
    134134        }
    135        
     135
    136136.commentlist li {
    137137        font-weight: bold;
    138138        }
     
    164164small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike {
    165165        color: #777;
    166166        }
    167        
     167
    168168code {
    169169        font: 1.1em 'Courier New', Courier, Fixed;
    170170        }
     
    184184        color: #147;
    185185        text-decoration: underline;
    186186        }
    187        
     187
    188188#wp-calendar #prev a {
    189189        font-size: 9pt;
    190190        }
     
    219219        width: 760px;
    220220        border: 1px solid #959596;
    221221        }
    222        
     222
    223223#header {
    224224        padding: 0;
    225225        margin: 0 auto;
     
    246246        margin: 5px 0 0 150px;
    247247        width: 450px;
    248248        }
    249        
     249
    250250.post {
    251251        margin: 0 0 40px;
    252252        text-align: justify;
     
    339339        thought?!) align the image to the right. And using 'class="centered',
    340340        will of course center the image. This is much better than using
    341341        align="center", being much more futureproof (and valid) */
    342        
     342
    343343img.centered {
    344344        display: block;
    345345        margin-left: auto;
    346346        margin-right: auto;
    347347        }
    348        
     348
    349349img.alignright {
    350350        padding: 4px;
    351351        margin: 0 0 2px 7px;
     
    361361.alignright {
    362362        float: right;
    363363        }
    364        
     364
    365365.alignleft {
    366366        float: left
    367367        }
     
    405405        list-style-type: none;
    406406        list-style-image: none;
    407407        }
    408        
     408
    409409#sidebar ul, #sidebar ul ol {
    410410        margin: 0;
    411411        padding: 0;
  • wp-content/themes/default/archives.php

     
    2020     <?php wp_list_cats(); ?>
    2121  </ul>
    2222
    23 </div> 
     23</div>
    2424
    2525<?php get_footer(); ?>
  • wp-content/themes/default/search.php

     
    55        <?php if (have_posts()) : ?>
    66
    77                <h2 class="pagetitle">Search Results</h2>
    8                
     8
    99                <div class="navigation">
    1010                        <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    1111                        <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
     
    1313
    1414
    1515                <?php while (have_posts()) : the_post(); ?>
    16                                
     16
    1717                        <div class="post">
    1818                                <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    1919                                <small><?php the_time('l, F jS, Y') ?></small>
    20                
     20
    2121                                <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
    2222                        </div>
    23        
     23
    2424                <?php endwhile; ?>
    2525
    2626                <div class="navigation">
    2727                        <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    2828                        <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    2929                </div>
    30        
     30
    3131        <?php else : ?>
    3232
    3333                <h2 class="center">No posts found. Try a different search?</h2>
    3434                <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    3535
    3636        <?php endif; ?>
    37                
     37
    3838        </div>
    3939
    4040<?php get_sidebar(); ?>
  • wp-content/themes/default/index.php

     
    33        <div id="content" class="narrowcolumn">
    44
    55        <?php if (have_posts()) : ?>
    6                
     6
    77                <?php while (have_posts()) : the_post(); ?>
    8                                
     8
    99                        <div class="post" id="post-<?php the_ID(); ?>">
    1010                                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    1111                                <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    12                                
     12
    1313                                <div class="entry">
    1414                                        <?php the_content('Read the rest of this entry &raquo;'); ?>
    1515                                </div>
    16                
     16
    1717                                <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
    1818                        </div>
    19        
     19
    2020                <?php endwhile; ?>
    2121
    2222                <div class="navigation">
    2323                        <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    2424                        <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    2525                </div>
    26                
     26
    2727        <?php else : ?>
    2828
    2929                <h2 class="center">Not Found</h2>
  • wp-content/themes/default/functions.php

     
    5757        $color = kubrick_header_color();
    5858        if ( false === $color )
    5959                return 'white';
    60                
     60
    6161        return $color;
    6262}
    6363
     
    100100                                        }
    101101                                }
    102102                        } else {
    103        
     103
    104104                                if ( isset($_REQUEST['headerimage']) ) {
    105105                                        if ( '' == $_REQUEST['headerimage'] )
    106106                                                delete_option('kubrick_header_image');
    107107                                        else
    108108                                                update_option('kubrick_header_image', $_REQUEST['headerimage']);
    109109                                }
    110        
     110
    111111                                if ( isset($_REQUEST['fontcolor']) ) {
    112112                                        if ( '' == $_REQUEST['fontcolor'] )
    113113                                                delete_option('kubrick_header_color');
    114114                                        else
    115115                                                update_option('kubrick_header_color', $_REQUEST['fontcolor']);
    116116                                }
    117        
     117
    118118                                if ( isset($_REQUEST['fontdisplay']) ) {
    119119                                        if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
    120120                                                delete_option('kubrick_header_display');
     
    268268                font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
    269269                font-size: 1.2em;
    270270                text-align: center;
    271         }       
     271        }
    272272        #kubrick-header #header {
    273273                text-decoration: none;
    274274                color: <?php echo kubrick_header_color_string(); ?>;
  • wp-content/themes/default/sidebar.php

     
    11        <div id="sidebar">
    22                <ul>
    3                        
     3
    44                        <li>
    55                                <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    66                        </li>
     
    1515                        <?php /* If this is a 404 page */ if (is_404()) { ?>
    1616                        <?php /* If this is a category archive */ } elseif (is_category()) { ?>
    1717                        <p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
    18                        
     18
    1919                        <?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
    2020                        <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
    2121                        for the day <?php the_time('l, F jS, Y'); ?>.</p>
    22                        
     22
    2323                        <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    2424                        <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
    2525                        for <?php the_time('F, Y'); ?>.</p>
     
    2727      <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    2828                        <p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
    2929                        for the year <?php the_time('Y'); ?>.</p>
    30                        
     30
    3131                 <?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
    3232                        <p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
    3333                        for <strong>'<?php echo wp_specialchars($s); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
     
    5252                                </ul>
    5353                        </li>
    5454
    55                         <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>                         
     55                        <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    5656                                <?php get_links_list(); ?>
    57                                
     57
    5858                                <li><h2>Meta</h2>
    5959                                <ul>
    6060                                        <?php wp_register(); ?>
     
    6666                                </ul>
    6767                                </li>
    6868                        <?php } ?>
    69                        
     69
    7070                </ul>
    7171        </div>
    7272
  • wp-content/themes/default/page.php

     
    77                <h2><?php the_title(); ?></h2>
    88                        <div class="entrytext">
    99                                <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    10        
     10
    1111                                <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
    12        
     12
    1313                        </div>
    1414                </div>
    1515          <?php endwhile; endif; ?>
  • wp-content/themes/default/links.php

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    1313<?php get_links_list(); ?>
    1414</ul>
    1515
    16 </div> 
     16</div>
    1717
    1818<?php get_footer(); ?>
  • wp-content/themes/default/single.php

     
    11<?php get_header(); ?>
    22
    33        <div id="content" class="widecolumn">
    4                                
     4
    55  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    6        
     6
    77                <div class="navigation">
    88                        <div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
    99                        <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
    1010                </div>
    11        
     11
    1212                <div class="post" id="post-<?php the_ID(); ?>">
    1313                        <h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    14        
     14
    1515                        <div class="entrytext">
    1616                                <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    17        
     17
    1818                                <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
    19        
     19
    2020                                <p class="postmetadata alt">
    2121                                        <small>
    2222                                                This entry was posted
     
    2727                                                on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
    2828                                                and is filed under <?php the_category(', ') ?>.
    2929                                                You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
    30                                                
     30
    3131                                                <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    3232                                                        // Both Comments and Pings are open ?>
    3333                                                        You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
    34                                                
     34
    3535                                                <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    3636                                                        // Only Pings are Open ?>
    3737                                                        Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
    38                                                
     38
    3939                                                <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    4040                                                        // Comments are open, Pings are not ?>
    4141                                                        You can skip to the end and leave a response. Pinging is currently not allowed.
    42                        
     42
    4343                                                <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    4444                                                        // Neither Comments, nor Pings are open ?>
    45                                                         Both comments and pings are currently closed.                   
    46                                                
     45                                                        Both comments and pings are currently closed.
     46
    4747                                                <?php } edit_post_link('Edit this entry.','',''); ?>
    48                                                
     48
    4949                                        </small>
    5050                                </p>
    51        
     51
    5252                        </div>
    5353                </div>
    54                
     54
    5555        <?php comments_template(); ?>
    56        
     56
    5757        <?php endwhile; else: ?>
    58        
     58
    5959                <p>Sorry, no posts matched your criteria.</p>
    60        
     60
    6161<?php endif; ?>
    62        
     62
    6363        </div>
    6464
    6565<?php get_footer(); ?>
  • wp-content/themes/default/archive.php

     
    55                <?php if (have_posts()) : ?>
    66
    77                 <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    8 <?php /* If this is a category archive */ if (is_category()) { ?>                               
     8<?php /* If this is a category archive */ if (is_category()) { ?>
    99                <h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2>
    10                
     10
    1111          <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    1212                <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
    13                
     13
    1414         <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    1515                <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
    1616
    1717                <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    1818                <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
    19                
     19
    2020          <?php /* If this is a search */ } elseif (is_search()) { ?>
    2121                <h2 class="pagetitle">Search Results</h2>
    22                
     22
    2323          <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    2424                <h2 class="pagetitle">Author Archive</h2>
    2525
     
    3838                <div class="post">
    3939                                <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    4040                                <small><?php the_time('l, F jS, Y') ?></small>
    41                                
     41
    4242                                <div class="entry">
    4343                                        <?php the_content() ?>
    4444                                </div>
    45                
     45
    4646                                <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
    4747
    4848                        </div>
    49        
     49
    5050                <?php endwhile; ?>
    5151
    5252                <div class="navigation">
    5353                        <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    5454                        <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    5555                </div>
    56        
     56
    5757        <?php else : ?>
    5858
    5959                <h2 class="center">Not Found</h2>
    6060                <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    6161
    6262        <?php endif; ?>
    63                
     63
    6464        </div>
    6565
    6666<?php get_sidebar(); ?>
  • wp-content/themes/default/comments.php

     
    55        if (!empty($post->post_password)) { // if there's a password
    66            if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
    77                                ?>
    8                                
     8
    99                                <p class="nocomments">This post is password protected. Enter the password to view comments.<p>
    10                                
     10
    1111                                <?php
    1212                                return;
    1313            }
     
    3939
    4040                </li>
    4141
    42         <?php /* Changes every other comment to a different class */   
     42        <?php /* Changes every other comment to a different class */
    4343                if ('alt' == $oddcomment) $oddcomment = '';
    4444                else $oddcomment = 'alt';
    4545        ?>
     
    5252
    5353  <?php if ('open' == $post->comment_status) : ?>
    5454                <!-- If comments are open, but there are no comments. -->
    55                
     55
    5656         <?php else : // comments are closed ?>
    5757                <!-- If comments are closed. -->
    5858                <p class="nocomments">Comments are closed.</p>
    59                
     59
    6060        <?php endif; ?>
    6161<?php endif; ?>
    6262
  • wp-content/themes/default/comments-popup.php

     
    103103<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
    104104<script type="text/javascript">
    105105<!--
    106 document.onkeypress = function esc(e) { 
     106document.onkeypress = function esc(e) {
    107107        if(typeof(e) == "undefined") { e=event; }
    108108        if (e.keyCode == 27) { self.close(); }
    109109}
  • wp-content/themes/default/header.php

     
    1616/*      To accomodate differing install paths of WordPress, images are referred only here,
    1717        and not in the wp-layout.css file. If you prefer to use only CSS for colors and what
    1818        not, then go right ahead and delete the following lines, and the image files. */
    19                
    20         body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); }       
     19
     20        body { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgcolor.jpg"); }
    2121<?php /* Checks to see whether it needs a sidebar or not */ if ((! $withcomments) && (! is_single())) { ?>
    2222        #page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; }
    2323<?php } else { // No sidebar ?>
     
    2828
    2929/*      Because the template is slightly different, size-wise, with images, this needs to be set here
    3030        If you don't want to use the template's images, you can also delete the following two lines. */
    31                
     31
    3232        #header         { margin: 0 !important; margin: 0 0 0 1px; padding: 1px; height: 198px; width: 758px; }
    3333        #headerimg      { margin: 7px 9px 0; height: 192px; width: 740px; }
    3434
  • wp-content/themes/default/attachment.php

     
    11<?php get_header(); ?>
    22
    33        <div id="content" class="widecolumn">
    4                                
     4
    55  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    6        
     6
    77                <div class="navigation">
    88                        <div class="alignleft">&nbsp;</div>
    99                        <div class="alignright">&nbsp;</div>
     
    1616                                <p class="<?php echo $classname; ?>"><?php echo $attachment_link; ?><br /><?php echo basename($post->guid); ?></p>
    1717
    1818                                <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    19        
     19
    2020                                <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
    21        
     21
    2222                                <p class="postmetadata alt">
    2323                                        <small>
    2424                                                This entry was posted
     
    2929                                                on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
    3030                                                and is filed under <?php the_category(', ') ?>.
    3131                                                You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
    32                                                
     32
    3333                                                <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    3434                                                        // Both Comments and Pings are open ?>
    3535                                                        You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
    36                                                
     36
    3737                                                <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    3838                                                        // Only Pings are Open ?>
    3939                                                        Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
    40                                                
     40
    4141                                                <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    4242                                                        // Comments are open, Pings are not ?>
    4343                                                        You can skip to the end and leave a response. Pinging is currently not allowed.
    44                        
     44
    4545                                                <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    4646                                                        // Neither Comments, nor Pings are open ?>
    47                                                         Both comments and pings are currently closed.                   
    48                                                
     47                                                        Both comments and pings are currently closed.
     48
    4949                                                <?php } edit_post_link('Edit this entry.','',''); ?>
    50                                                
     50
    5151                                        </small>
    5252                                </p>
    53        
     53
    5454                        </div>
    5555                </div>
    56                
     56
    5757        <?php comments_template(); ?>
    58        
     58
    5959        <?php endwhile; else: ?>
    60        
     60
    6161                <p>Sorry, no attachments matched your criteria.</p>
    62        
     62
    6363<?php endif; ?>
    64        
     64
    6565        </div>
    6666
    6767<?php get_footer(); ?>
  • wp-register.php

     
    1414
    1515        $user_login = sanitize_user( $_POST['user_login'] );
    1616        $user_email = $_POST['user_email'];
    17        
     17
    1818        $errors = array();
    19                
     19
    2020        if ( $user_login == '' )
    2121                $errors['user_login'] = __('<strong>ERROR</strong>: Please enter a username.');
    2222
     
    4545                else
    4646                        wp_new_user_notification($user_id, $password);
    4747        }
    48        
     48
    4949        if ( 0 == count($errors) ) {
    5050
    5151        ?>
     
    5353<html xmlns="http://www.w3.org/1999/xhtml">
    5454<head>
    5555        <title>WordPress &raquo; <?php _e('Registration Complete') ?></title>
    56         <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />       
     56        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" />
    5757        <link rel="stylesheet" href="wp-admin/wp-admin.css" type="text/css" />
    5858        <style type="text/css">
    5959        .submit {
  • readme.html

     
    1616                margin-right: 25%;
    1717                padding: .2em 2em;
    1818        }
    19        
     19
    2020        h1 {
    2121                color: #006;
    2222                font-size: 18px;
    2323                font-weight: lighter;
    2424        }
    25        
     25
    2626        h2 {
    2727                font-size: 16px;
    2828        }
    29        
     29
    3030        p, li, dt {
    3131                line-height: 140%;
    3232                padding-bottom: 2px;
  • wp-commentsrss2.php

     
    5656                        $title = apply_filters('the_title', $title);
    5757                        $title = apply_filters('the_title_rss', $title);
    5858                        printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
    59                 } else {       
    60                         printf(__('by: %s'), get_comment_author_rss());                 
     59                } else {
     60                        printf(__('by: %s'), get_comment_author_rss());
    6161                } ?></title>
    6262                <link><?php comment_link() ?></link>
    6363                <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
  • wp-settings.php

     
    99
    1010        // Variables that shouldn't be unset
    1111        $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
    12        
     12
    1313        $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
    1414        foreach ( $input as $k => $v )
    1515                if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) )
     
    2727// Fix for IIS, which doesn't set REQUEST_URI
    2828if ( empty( $_SERVER['REQUEST_URI'] ) ) {
    2929        $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; // Does this work under CGI?
    30        
     30
    3131        // Append the query string if it exists and isn't null
    3232        if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
    3333                $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
  • wp-admin/menu-header.php

     
    1313   
    1414        if ( current_user_can($item[1]) ) {
    1515                if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
    16                         echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";                 
     16                        echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
    1717                else
    1818                        echo "\n\t<li><a href='" . get_settings('siteurl') . "/wp-admin/{$item[2]}'$class>{$item[0]}</a></li>";
    1919        }
  • wp-admin/users.php

     
    44
    55$title = __('Users');
    66$parent_file = 'profile.php';
    7        
     7
    88$action = $_REQUEST['action'];
    99$update = '';
    1010
     
    3232                $user = new WP_User($id);
    3333                $user->set_role($_POST['new_role']);
    3434        }
    35                
     35
    3636        header('Location: users.php?update=' . $update);
    3737
    3838break;
     
    4949                die(__('You can&#8217;t delete users.'));
    5050
    5151        $userids = $_POST['users'];
    52        
     52
    5353        $update = 'del';
    5454        foreach ($userids as $id) {
    5555                if($id == $current_user->id) {
     
    132132
    133133case 'adduser':
    134134        check_admin_referer();
    135        
     135
    136136        $errors = add_user();
    137        
     137
    138138        if(count($errors) == 0) {
    139139                header('Location: users.php?update=add');
    140140                die();
    141141        }
    142142
    143143default:
    144        
     144
    145145        include ('admin-header.php');
    146        
     146
    147147        $userids = $wpdb->get_col("SELECT ID FROM $wpdb->users;");
    148        
     148
    149149        foreach($userids as $userid) {
    150150                $tmp_user = new WP_User($userid);
    151151                $roles = $tmp_user->roles;
    152152                $role = array_shift($roles);
    153153                $roleclasses[$role][$tmp_user->user_login] = $tmp_user;
    154         }       
    155        
     154        }
     155
    156156        ?>
    157157
    158158        <?php
     
    198198        <?php
    199199        endif;
    200200        ?>
    201        
     201
    202202<form action="" method="post" name="updateusers" id="updateusers">
    203203<div class="wrap">
    204204        <h2><?php _e('User List by Role'); ?></h2>
     
    250250        echo '</td>';
    251251        echo '</tr>';
    252252        }
    253        
     253
    254254        ?>
    255        
    256255
     256
    257257<?php
    258258        }
    259259?>
  • wp-admin/edit-comments.php

     
    8888                        if ($i % 2)
    8989                                $class .= ' alternate';
    9090                        echo "<li id='comment-$comment->comment_ID' class='$class'>";
    91 ?>             
     91?>
    9292        <p><strong><?php _e('Name:') ?></strong> <?php comment_author() ?> <?php if ($comment->comment_author_email) { ?>| <strong><?php _e('E-mail:') ?></strong> <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | <strong><?php _e('URI:') ?></strong> <?php comment_author_url_link() ?> <?php } ?>| <strong><?php _e('IP:') ?></strong> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>
    93                
     93
    9494                <?php comment_text() ?>
    9595
    9696        <p><?php _e('Posted'); echo ' '; comment_date('M j, g:i A'); 
     
    118118                ?>
    119119                <p>
    120120        <strong><?php _e('No comments found.') ?></strong></p>
    121                
     121
    122122                <?php
    123123        } // end if ($comments)
    124124} elseif ('edit' == $mode) {
  • wp-admin/list-manipulation.php

     
    5454
    5555        if ( !$comment = get_comment($id) )
    5656                die('0');
    57         if ( !current_user_can('edit_post', $comment->comment_post_ID) )       
     57        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    5858                die('-1');
    5959
    6060        if ( wp_delete_comment($comment->comment_ID) ) {
     
    7777                die('0');
    7878        }
    7979        break;
    80 endswitch;             
     80endswitch;
    8181?>
  • wp-admin/edit-form-ajax-cat.php

     
    1717
    1818foreach ($names as $cat_name) {
    1919        $cat_name = trim( $cat_name );
    20        
     20
    2121        if ( !$category_nicename = sanitize_title($cat_name) )
    2222                continue;
    2323        if ( $already = category_exists($cat_name) ) {
    2424                $ids[] = (string) $already;
    2525                continue;
    2626        }
    27        
     27
    2828        $new_cat_id = wp_create_category($cat_name);
    29        
     29
    3030        $ids[] = (string) $new_cat_id;
    3131}
    3232
  • wp-admin/wp-admin.css

     
    872872.dbx-handle-cursor {
    873873        cursor: move;
    874874}
    875        
     875
    876876/* toggle images */
    877877a.dbx-toggle, a.dbx-toggle:visited {
    878878        display:block;
  • wp-admin/xfn.js

     
    3838
    3939        var aInputs = document.getElementsByTagName('input');
    4040
    41         for (var i = 0; i < aInputs.length; i++) {             
     41        for (var i = 0; i < aInputs.length; i++) {
    4242                 aInputs[i].onclick = aInputs[i].onkeyup = upit;
    4343        }
    4444}
  • wp-admin/plugins.php

     
    33
    44if ( isset($_GET['action']) ) {
    55        check_admin_referer();
    6        
     6
    77        if ('activate' == $_GET['action']) {
    88                $current = get_settings('active_plugins');
    99                if (!in_array($_GET['plugin'], $current)) {
     
    3636// empty array.
    3737if ( !is_array($check_plugins) ) {
    3838        $check_plugins = array();
    39         update_option('active_plugins', $check_plugins);       
     39        update_option('active_plugins', $check_plugins);
    4040}
    4141
    4242// If a plugin file does not exist, remove it from the list of active
     
    9191        function sort_plugins($plug1, $plug2) {
    9292                return strnatcasecmp($plug1['Name'], $plug2['Name']);
    9393        }
    94        
     94
    9595        uksort($plugins, 'sort_plugins');
    9696
    9797        foreach($plugins as $plugin_file => $plugin_data) {
  • wp-admin/cat-js.php

     
    6767        var id    = 0;
    6868        var ids   = new Array();
    6969        var names = new Array();
    70        
     70
    7171        ids   = myPload( ajaxCat.response );
    7272        names = myPload( newcat.value );
    7373        for ( i = 0; i < ids.length; i++ ) {
     
    8080                        p.innerHTML = "<?php echo addslashes(__('That category name is invalid.  Try something else.')); ?>";
    8181                        return;
    8282                }
    83                
     83
    8484                var exists = document.getElementById('category-' + id);
    85                
     85
    8686                if (exists) {
    8787                        var moveIt = exists.parentNode;
    8888                        var container = moveIt.parentNode;
     
    100100                        newLabel.setAttribute('for', 'category-' + id);
    101101                        newLabel.id = 'new-category-' + id;
    102102                        newLabel.className = 'selectit fade';
    103        
     103
    104104                        var newCheck = document.createElement('input');
    105105                        newCheck.type = 'checkbox';
    106106                        newCheck.value = id;
    107107                        newCheck.name = 'post_category[]';
    108108                        newCheck.id = 'category-' + id;
    109109                        newLabel.appendChild(newCheck);
    110        
     110
    111111                        var newLabelText = document.createTextNode(' ' + names[i]);
    112112                        newLabel.appendChild(newLabelText);
    113        
     113
    114114                        catDiv.insertBefore(newLabel, catDiv.firstChild);
    115115                        newCheck.checked = 'checked';
    116        
     116
    117117                        Fat.fade_all();
    118118                        newLabel.className = 'selectit';
    119119                }
  • wp-admin/post.php

     
    7171                die ( __('You are not allowed to edit this post.') );
    7272
    7373        $post = get_post_to_edit($post_ID);
    74        
     74
    7575        if ($post->post_type == 'page')
    7676                include('edit-page-form.php');
    7777        else
     
    130130        $post_id = (isset($_GET['post']))  ? intval($_GET['post']) : intval($_POST['post_ID']);
    131131
    132132        $post = & get_post($post_id);
    133        
    134         if ( !current_user_can('edit_post', $post_id) ) 
     133
     134        if ( !current_user_can('edit_post', $post_id) )
    135135                die( __('You are not allowed to delete this post.') );
    136136
    137137        if ( $post->post_type == 'attachment' ) {
     
    161161        if ( ! $comment = get_comment($comment) )
    162162                die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
    163163
    164         if ( !current_user_can('edit_post', $comment->comment_post_ID) )       
     164        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    165165                die( __('You are not allowed to edit comments on this post.') );
    166166
    167167        $comment = get_comment_to_edit($comment);
     
    180180        if ( ! $comment = get_comment($comment) )
    181181                die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    182182
    183         if ( !current_user_can('edit_post', $comment->comment_post_ID) )       
     183        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    184184                die( __('You are not allowed to delete comments on this post.') );
    185185
    186186        echo "<div class='wrap'>\n";
     
    223223        if ( ! $comment = get_comment($comment) )
    224224                         die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php'));
    225225
    226         if ( !current_user_can('edit_post', $comment->comment_post_ID) )       
     226        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    227227                die( __('You are not allowed to edit comments on this post.') );
    228228
    229229        wp_set_comment_status($comment->comment_ID, "delete");
     
    252252        if ( ! $comment = get_comment($comment) )
    253253                die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    254254
    255         if ( !current_user_can('edit_post', $comment->comment_post_ID) )       
     255        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    256256                die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
    257257
    258258        wp_set_comment_status($comment->comment_ID, "hold");
     
    272272        if ( ! $comment = get_comment($comment) )
    273273                         die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    274274
    275         if ( !current_user_can('edit_post', $comment->comment_post_ID) )       
     275        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    276276                die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
    277277
    278278        if ('1' != $comment->comment_approved) {
     
    298298        if ( ! $comment = get_comment($comment) )
    299299                die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    300300
    301         if ( !current_user_can('edit_post', $comment->comment_post_ID) )       
     301        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    302302                die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
    303303
    304304        wp_set_comment_status($comment->comment_ID, "approve");
  • wp-admin/edit.php

     
    9393        <legend><?php _e('Browse Month&hellip;') ?></legend>
    9494    <select name='m'>
    9595        <?php
    96                 foreach ($arc_result as $arc_row) {                     
     96                foreach ($arc_result as $arc_row) {
    9797                        $arc_year  = $arc_row->yyear;
    9898                        $arc_month = $arc_row->mmonth;
    99                        
     99
    100100                        if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] )
    101101                                $default = 'selected="selected"';
    102102                        else
    103103                                $default = null;
    104                        
     104
    105105                        echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
    106106                        echo $month[zeroise($arc_month, 2)] . " $arc_year";
    107107                        echo "</option>\n";
     
    157157foreach($posts_columns as $column_name=>$column_display_name) {
    158158
    159159        switch($column_name) {
    160        
     160
    161161        case 'id':
    162162                ?>
    163163                <th scope="row"><?php echo $id ?></th>
  • wp-admin/theme-editor.php

     
    6666break;
    6767
    6868default:
    69        
     69
    7070        require_once('admin-header.php');
    7171        if ( !current_user_can('edit_themes') )
    7272        die('<p>'.__('You have do not have sufficient permissions to edit themes for this blog.').'</p>');
    7373
    7474        update_recently_edited($file);
    75        
     75
    7676        if (!is_file($real_file))
    7777                $error = 1;
    78        
     78
    7979        if (!$error && filesize($real_file) > 0) {
    8080                $f = fopen($real_file, 'r');
    8181                $content = fread($f, filesize($real_file));
  • wp-admin/upgrade.php

     
    2727                margin-right: 20%;
    2828                padding: .2em 2em;
    2929        }
    30        
     30
    3131        h1 {
    3232                color: #006;
    3333                font-size: 18px;
    3434                font-weight: lighter;
    3535        }
    36        
     36
    3737        h2 {
    3838                font-size: 16px;
    3939        }
    40        
     40
    4141        p, li, dt {
    4242                line-height: 140%;
    4343                padding-bottom: 2px;
     
    7373        <h2 class="step"><a href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress &raquo;'); ?></a></h2>
    7474<?php
    7575        break;
    76        
     76
    7777        case 1:
    7878        wp_cache_flush();
    7979        make_db_current_silent();
  • wp-admin/admin.php

     
    5353        if ( $page_hook ) {
    5454                if (! isset($_GET['noheader']))
    5555                        require_once(ABSPATH . '/wp-admin/admin-header.php');
    56                
     56
    5757                do_action($page_hook);
    5858        } else {
    5959                if ( validate_file($plugin_page) ) {
    6060                        die(__('Invalid plugin page'));
    6161                }
    62                
     62
    6363                if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
    6464                        die(sprintf(__('Cannot load %s.'), $plugin_page));
    6565
    6666                if (! isset($_GET['noheader']))
    6767                        require_once(ABSPATH . '/wp-admin/admin-header.php');
    68                
     68
    6969                include(ABSPATH . "wp-content/plugins/$plugin_page");
    7070        }
    71        
     71
    7272        include(ABSPATH . 'wp-admin/admin-footer.php');
    7373
    7474        exit();
    7575} else if (isset($_GET['import'])) {
    76        
     76
    7777        $importer = $_GET['import'];
    7878
    7979        if ( validate_file($importer) ) {
    8080                die(__('Invalid importer.'));
    8181        }
    82                
     82
    8383        if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
    8484                die(__('Cannot load importer.'));
    85        
     85
    8686        include(ABSPATH . "wp-admin/import/$importer.php");
    8787
    8888        $parent_file = 'import.php';
    8989        $title = __('Import');
    90        
     90
    9191        if (! isset($_GET['noheader']))
    9292                require_once(ABSPATH . 'wp-admin/admin-header.php');
    9393
     
    9797        kses_init_filters();  // Always filter imported data with kses.
    9898
    9999        call_user_func($wp_importers[$importer][2]);
    100                        
     100
    101101        include(ABSPATH . 'wp-admin/admin-footer.php');
    102102
    103103        exit();
  • wp-admin/options.php

     
    2828
    2929case 'update':
    3030        $any_changed = 0;
    31        
     31
    3232        check_admin_referer();
    3333
    3434        if (!$_POST['page_options']) {
     
    5252                        $value = trim(stripslashes($_POST[$option]));
    5353                                if( in_array($option, $nonbools) && ( $value == '0' || $value == '') )
    5454                                $value = 'closed';
    55                        
     55
    5656                        if( $option == 'blogdescription' || $option == 'blogname' )
    5757                                if (current_user_can('unfiltered_html') == false)
    5858                                        $value = wp_filter_post_kses( $value );
    59                        
     59
    6060                        if (update_option($option, $value) ) {
    6161                                $any_changed++;
    6262                        }
  • wp-admin/upgrade-functions.php

     
    2020                if ( !empty($template) )
    2121                        $wp_current_db_version = 2541;
    2222        }
    23        
     23
    2424        populate_options();
    2525
    2626        if ( $wp_current_db_version < 2541 ) {
     
    2929                upgrade_110();
    3030                upgrade_130();
    3131        }
    32        
     32
    3333        if ( $wp_current_db_version < 3308 )
    3434                upgrade_160();
    3535
     
    3737                upgrade_210();
    3838
    3939        $wp_rewrite->flush_rules();
    40        
     40
    4141        update_option('db_version', $wp_db_version);
    4242}
    4343
     
    5454                        }
    5555                }
    5656        }
    57        
     57
    5858        $categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
    5959        foreach ($categories as $category) {
    6060                if ('' == $category->category_nicename) {
     
    7777        else:
    7878                $catwhere = '';
    7979        endif;
    80        
     80
    8181        $allposts = $wpdb->get_results("SELECT ID, post_category FROM $wpdb->posts WHERE post_category != '0' $catwhere");
    8282        if ($allposts) :
    8383                foreach ($allposts as $post) {
     
    111111
    112112function upgrade_110() {
    113113        global $wpdb;
    114        
     114
    115115    // Set user_nicename.
    116116        $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
    117117        foreach ($users as $user) {
     
    280280                        $id = $wpdb->escape( $id );
    281281                        $wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
    282282                endif;
    283                
     283
    284284                // FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
    285285                $caps = get_usermeta( $user->ID, $table_prefix . 'capabilities');
    286286                if ( empty($caps) || defined('RESET_CAPS') ) {
     
    288288                        $role = translate_level_to_role($level);
    289289                        update_usermeta( $user->ID, $table_prefix . 'capabilities', array($role => true) );
    290290                }
    291                        
     291
    292292        endforeach;
    293293        $old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' );
    294294        $wpdb->hide_errors();
    295295        foreach ( $old_user_fields as $old )
    296296                $wpdb->query("ALTER TABLE $wpdb->users DROP $old");
    297297        $wpdb->show_errors();
    298        
     298
    299299        if ( 0 == $wpdb->get_var("SELECT SUM(category_count) FROM $wpdb->categories") ) { // Create counts
    300300                $categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories");
    301301                foreach ( $categories as $cat_id ) {
     
    321321                        post_mime_type = '$object->post_type',
    322322                        post_type = ''
    323323                        WHERE ID = $object->ID");
    324                        
     324
    325325                        $meta = get_post_meta($object->ID, 'imagedata', true);
    326326                        if ( ! empty($meta['file']) )
    327327                                add_post_meta($object->ID, '_wp_attached_file', $meta['file']);
     
    335335        if ( $wp_current_db_version < 3506 ) {
    336336                // Update status and type.
    337337                $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
    338        
     338
    339339                if ( ! empty($posts) ) foreach ($posts as $post) {
    340340                        $status = $post->post_status;
    341341                        $type = 'post';
     
    345345                                $type = 'page';
    346346                        } else if ( 'attachment' == $status ) {
    347347                                $status = 'inherit';
    348                                 $type = 'attachment';   
     348                                $type = 'attachment';
    349349                        }
    350                
     350
    351351                        $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
    352352                }
    353353        }
    354        
     354
    355355        if ( $wp_current_db_version < 3513 ) {
    356                 populate_roles_210();   
     356                populate_roles_210();
    357357        }
    358358}
    359359
     
    477477
    478478function dbDelta($queries, $execute = true) {
    479479        global $wpdb;
    480        
     480
    481481        // Seperate individual queries into an array
    482482        if( !is_array($queries) ) {
    483483                $queries = explode( ';', $queries );
    484484                if('' == $queries[count($queries) - 1]) array_pop($queries);
    485485        }
    486        
     486
    487487        $cqueries = array(); // Creation Queries
    488488        $iqueries = array(); // Insertion Queries
    489489        $for_update = array();
    490        
     490
    491491        // Create a tablename index for an array ($cqueries) of queries
    492492        foreach($queries as $qry) {
    493493                if(preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
     
    506506                else {
    507507                        // Unrecognized query type
    508508                }
    509         }       
     509        }
    510510
    511511        // Check to see which tables and fields exist
    512512        if($tables = $wpdb->get_col('SHOW TABLES;')) {
     
    525525                                $flds = explode("\n", $qryline);
    526526
    527527                                //echo "<hr/><pre>\n".print_r(strtolower($table), true).":\n".print_r($cqueries, true)."</pre><hr/>";
    528                                
     528
    529529                                // For every field line specified in the query
    530530                                foreach($flds as $fld) {
    531531                                        // Extract the field name
    532532                                        preg_match("|^([^ ]*)|", trim($fld), $fvals);
    533533                                        $fieldname = $fvals[1];
    534                                        
     534
    535535                                        // Verify the found field name
    536536                                        $validfield = true;
    537537                                        switch(strtolower($fieldname))
     
    547547                                                break;
    548548                                        }
    549549                                        $fld = trim($fld);
    550                                        
     550
    551551                                        // If it's a valid field, add it to the field array
    552552                                        if($validfield) {
    553553                                                $cfields[strtolower($fieldname)] = trim($fld, ", \n");
    554554                                        }
    555555                                }
    556                                
     556
    557557                                // Fetch the table column structure from the database
    558558                                $tablefields = $wpdb->get_results("DESCRIBE {$table};");
    559                                                                
     559
    560560                                // For every field in the table
    561                                 foreach($tablefields as $tablefield) {                         
     561                                foreach($tablefields as $tablefield) {
    562562                                        // If the table field exists in the field array...
    563563                                        if(array_key_exists(strtolower($tablefield->Field), $cfields)) {
    564564                                                // Get the field type from the query
     
    571571                                                        $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)];
    572572                                                        $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
    573573                                                }
    574                                                
     574
    575575                                                // Get the default value from the array
    576576                                                        //echo "{$cfields[strtolower($tablefield->Field)]}<br>";
    577577                                                if(preg_match("| DEFAULT '(.*)'|i", $cfields[strtolower($tablefield->Field)], $matches)) {
     
    598598                                        $cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
    599599                                        $for_update[$table.'.'.$fieldname] = 'Added column '.$table.'.'.$fieldname;
    600600                                }
    601                                
     601
    602602                                // Index stuff goes here
    603603                                // Fetch the table index structure from the database
    604604                                $tableindices = $wpdb->get_results("SHOW INDEX FROM {$table};");
    605                                
     605
    606606                                if($tableindices) {
    607607                                        // Clear the index array
    608608                                        unset($index_ary);
     
    631631                                                }
    632632                                                $index_columns = '';
    633633                                                // For each column in the index
    634                                                 foreach($index_data['columns'] as $column_data) {                                       
     634                                                foreach($index_data['columns'] as $column_data) {
    635635                                                        if($index_columns != '') $index_columns .= ',';
    636636                                                        // Add the field to the column list string
    637637                                                        $index_columns .= $column_data['fieldname'];
  • wp-admin/list-manipulation.js

     
    5151                listItems.splice(pos,1);
    5252                recolorList(pos);
    5353                ajaxDel.myResponseElement.parentNode.removeChild(ajaxDel.myResponseElement);
    54                
     54
    5555        }
    5656}
    5757
     
    6363                }
    6464        }
    6565        return pos;
    66 }       
     66}
    6767
    6868function getListItems() {
    6969        if (list) return;
  • wp-admin/admin-functions.php

     
    66
    77        if ( 'page' == $_POST['post_type'] ) {
    88                if ( !current_user_can('edit_pages') )
    9                         die(__('You are not allowed to create pages on this blog.'));   
     9                        die(__('You are not allowed to create pages on this blog.'));
    1010        } else {
    1111                if ( !current_user_can('edit_posts') )
    1212                        die(__('You are not allowed to create posts or drafts on this blog.'));
     
    3030        }
    3131
    3232        if ($_POST['post_author'] != $_POST['user_ID']) {
    33                 if ( 'page' == $_POST['post_type'] ) {         
     33                if ( 'page' == $_POST['post_type'] ) {
    3434                        if ( !current_user_can('edit_others_pages') )
    3535                                die(__('You cannot create pages as this user.'));
    3636                } else {
    3737                        if ( !current_user_can('edit_others_posts') )
    3838                                die(__('You cannot post as this user.'));
    39                        
     39
    4040                }
    4141        }
    4242
     
    5252
    5353        if ( 'page' == $_POST['post_type'] ) {
    5454                if ('publish' == $_POST['post_status'] && !current_user_can('publish_pages'))
    55                         $_POST['post_status'] = 'draft';       
     55                        $_POST['post_status'] = 'draft';
    5656        } else {
    5757                if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts'))
    5858                        $_POST['post_status'] = 'draft';
     
    140140
    141141        if ( 'page' == $_POST['post_type'] ) {
    142142                if ( !current_user_can('edit_page', $post_ID) )
    143                         die(__('You are not allowed to edit this page.'));     
     143                        die(__('You are not allowed to edit this page.'));
    144144        } else {
    145145                if ( !current_user_can('edit_post', $post_ID) )
    146146                        die(__('You are not allowed to edit this post.'));
     
    163163                }
    164164
    165165        if ($_POST['post_author'] != $_POST['user_ID']) {
    166                 if ( 'page' == $_POST['post_type'] ) {         
     166                if ( 'page' == $_POST['post_type'] ) {
    167167                        if ( !current_user_can('edit_others_pages') )
    168168                                die(__('You cannot edit pages as this user.'));
    169169                } else {
    170170                        if ( !current_user_can('edit_others_posts') )
    171171                                die(__('You cannot edit posts as this user.'));
    172                        
     172
    173173                }
    174174        }
    175175
     
    185185
    186186        if ( 'page' == $_POST['post_type'] ) {
    187187                if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_pages'))
    188                         $_POST['post_status'] = 'draft';       
     188                        $_POST['post_status'] = 'draft';
    189189        } else {
    190190                if ('publish' == $_POST['post_status'] && !current_user_can('edit_published_posts'))
    191191                        $_POST['post_status'] = 'draft';
     
    217217                foreach ($_POST['meta'] as $key => $value)
    218218                        update_meta($key, $value['key'], $value['value']);
    219219        }
    220        
     220
    221221        if ($_POST['deletemeta']) {
    222222                foreach ($_POST['deletemeta'] as $key => $value)
    223223                        delete_meta($key);
     
    464464
    465465function get_link_to_edit($link_id) {
    466466        $link = get_link($link_id);
    467        
     467
    468468        $link->link_url = wp_specialchars($link->link_url, 1);
    469469        $link->link_name = wp_specialchars($link->link_name, 1);
    470470        $link->link_description = wp_specialchars($link->link_description);
    471471        $link->link_notes = wp_specialchars($link->link_notes);
    472472        $link->link_rss = wp_specialchars($link->link_rss);
    473        
     473
    474474        return $link;
    475475}
    476476
     
    479479                $link->link_url = wp_specialchars($_GET['linkurl'], 1);
    480480        else
    481481                $link->link_url = '';
    482        
     482
    483483        if ( isset($_GET['name']) )
    484484                $link->link_name = wp_specialchars($_GET['name'], 1);
    485485        else
    486486                $link->link_name = '';
    487                
     487
    488488        return $link;
    489489}
    490490
    491491function add_link() {
    492         return edit_link();     
     492        return edit_link();
    493493}
    494494
    495495function edit_link($link_id = '') {
     
    502502        $_POST['link_image'] = wp_specialchars($_POST['link_image']);
    503503        $_POST['link_rss'] = wp_specialchars($_POST['link_rss']);
    504504        $auto_toggle = get_autotoggle($_POST['link_category']);
    505        
     505
    506506        // if we are in an auto toggle category and this one is visible then we
    507507        // need to make the others invisible before we add this new one.
    508508        // FIXME Add category toggle func.
     
    577577                        $result[$cat]['cat_name'] = get_the_category_by_ID($cat);
    578578                }
    579579        }
    580        
     580
    581581        usort($result, 'sort_cats');
    582582
    583583        return $result;
     
    615615                                if ( current_user_can('manage_categories') ) {
    616616                                        $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>";
    617617                                        $default_cat_id = get_option('default_category');
    618                                        
     618
    619619                                        if ($category->cat_ID != $default_cat_id)
    620620                                                $edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts will go to the default category.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>";
    621621                                        else
     
    699699
    700700function link_category_dropdown($fieldname, $selected = 0) {
    701701        global $wpdb;
    702        
     702
    703703        $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id");
    704704        echo "\n<select name='$fieldname' size='1'>\n";
    705705        foreach ($results as $row) {
     
    18341834<input type="button" value="<?php _e('Cancel'); ?>" onclick="cancelUpload()" />
    18351835</div>
    18361836</form>
    1837 <?php   
     1837<?php
    18381838}
    18391839
    18401840function wp_import_handle_upload() {
  • wp-admin/templates.php

     
    6060default:
    6161
    6262        require_once('./admin-header.php');
    63        
     63
    6464        if ( ! current_user_can('edit_files') )
    6565        die('<p>'.__('You have do not have sufficient permissions to edit templates for this blog.').'</p>');
    6666
     
    7171
    7272        if (!is_file($real_file))
    7373                $error = true;
    74        
     74
    7575        if (!$error) {
    7676                $f = @ fopen($real_file, 'r');
    7777                if ( $f ) {
     
    8888 <div id="message" class="error"><p><?php _e('Could not save file.') ?></p></div>
    8989        <?php else: ?>
    9090 <div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
    91         <?php endif; ?> 
     91        <?php endif; ?>
    9292<?php endif; ?>
    9393 <div class="wrap">
    9494<?php
  • wp-admin/moderation.php

     
    115115}
    116116
    117117?>
    118        
     118
    119119<div class="wrap">
    120120
    121121<?php
  • wp-admin/user-edit.php

     
    22require_once('admin.php');
    33
    44$title = __('Edit User');
    5 $parent_file = 'profile.php';   
     5$parent_file = 'profile.php';
    66$submenu_file = 'users.php';
    77
    88$wpvarstoreset = array('action', 'redirect', 'profile', 'user_id');
  • wp-admin/page-new.php

     
    1414if ( current_user_can('edit_pages') ) {
    1515        $action = 'post';
    1616        get_currentuserinfo();
    17        
     17
    1818        $post = get_default_post_to_edit();
    1919        $post->post_type = 'page';
    2020
  • wp-admin/setup-config.php

     
    103103</form>
    104104<?php
    105105        break;
    106        
     106
    107107        case 2:
    108108        $dbname  = trim($_POST['dbname']);
    109109    $uname   = trim($_POST['uname']);
  • wp-admin/link-manager.php

     
    128128    check_admin_referer();
    129129
    130130        add_link();
    131        
     131
    132132    header('Location: ' . $_SERVER['HTTP_REFERER'] . '?added=true');
    133133    break;
    134134  } // end Add
     
    137137  {
    138138 
    139139        check_admin_referer();
    140         
     140 
    141141        if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
    142142                $cat_id = $links_show_cat_id;
    143143
     
    149149
    150150        $link_id = (int) $_POST['link_id'];
    151151        edit_link($link_id);
    152        
     152
    153153    setcookie('links_show_cat_id_' . COOKIEHASH, $links_show_cat_id, time()+600);
    154154    wp_redirect($this_file);
    155155    break;
     
    165165    $link_id = (int) $_GET['link_id'];
    166166
    167167        wp_delete_link($link_id);
    168        
     168
    169169    if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
    170170        $cat_id = $links_show_cat_id;
    171171
     
    184184        include_once ('admin-header.php');
    185185        if ( !current_user_can('manage_links') )
    186186                die(__('You do not have sufficient permissions to edit the links for this blog.'));
    187        
     187
    188188        $link_id = (int) $_GET['link_id'];
    189        
     189
    190190        if ( !$link = get_link_to_edit($link_id) )
    191191                die( __('Link not found.') );
    192        
     192
    193193        include('edit-link-form.php');
    194194        break;
    195195  } // end linkedit
     
    370370?>
    371371    <tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>>
    372372                <td><strong><?php echo $link->link_name; ?></strong><br />
    373 <?php                   
     373<?php
    374374        echo sprintf(__('Description: %s'), $link->link_description) . "</td>";
    375375        echo "<td><a href=\"$link->link_url\" title=\"" . sprintf(__('Visit %s'), $link->link_name) . "\">$short_url</a></td>";
    376376        echo <<<LINKS
  • wp-admin/install.php

     
    3333                margin-right: 20%;
    3434                padding: .2em 2em;
    3535        }
    36        
     36
    3737        h1 {
    3838                color: #006;
    3939                font-size: 18px;
    4040                font-weight: lighter;
    4141        }
    42        
     42
    4343        h2 {
    4444                font-size: 16px;
    4545        }
    46        
     46
    4747        p, li, dt {
    4848                line-height: 140%;
    4949                padding-bottom: 2px;
     
    127127} else if (!is_email($admin_email)) {
    128128        die (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
    129129}
    130        
     130
    131131?>
    132132<h1><?php _e('Second Step'); ?></h1>
    133133<p><?php _e('Now we&#8217;re going to create the database tables and fill them with some default data.'); ?></p>
  • wp-admin/bookmarklet.php

     
    2525
    2626$popuptitle = wp_specialchars(stripslashes($popuptitle));
    2727$text       = wp_specialchars(stripslashes(urldecode($text)));
    28        
     28
    2929$popuptitle = funky_javascript_fix($popuptitle);
    3030$text       = funky_javascript_fix($text);
    31        
     31
    3232$post_title = wp_specialchars($_REQUEST['post_title']);
    3333if (!empty($post_title))
    3434        $post->post_title =  stripslashes($post_title);
    3535else
    3636        $post->post_title = $popuptitle;
    37        
     37
    3838 
    3939$content  = wp_specialchars($_REQUEST['content']);
    4040$popupurl = wp_specialchars($_REQUEST['popupurl']);
  • wp-admin/admin-db.php

     
    1414        $level_key = $wpdb->prefix . 'user_level';
    1515
    1616        $editable = get_editable_user_ids( $user_id );
    17        
     17
    1818        if( !$editable ) {
    1919                $other_drafts = '';
    2020        } else {
     
    4242
    4343function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
    4444        global $wpdb;
    45        
     45
    4646        $user = new WP_User( $user_id );
    47        
     47
    4848        if ( ! $user->has_cap('edit_others_posts') ) {
    4949                if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
    5050                        return array($user->id);
     
    5757        $query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
    5858        if ( $exclude_zeros )
    5959                $query .= " AND meta_value != '0'";
    60                
     60
    6161        return $wpdb->get_col( $query );
    6262}
    6363
     
    111111        } else {
    112112                $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'");
    113113        }
    114        
     114
    115115        if ( $category_nicename == '' ) {
    116116                $category_nicename = sanitize_title($cat_name, $cat_ID );
    117117                $wpdb->query( "UPDATE $wpdb->categories SET category_nicename = '$category_nicename' WHERE cat_ID = '$cat_ID'" );
     
    242242
    243243function get_link($link_id, $output = OBJECT) {
    244244        global $wpdb;
    245        
     245
    246246        $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'");
    247247
    248248        if ( $output == OBJECT ) {
     
    258258
    259259function wp_insert_link($linkdata) {
    260260        global $wpdb, $current_user;
    261        
     261
    262262        extract($linkdata);
    263263
    264264        $update = false;
     
    266266                $update = true;
    267267
    268268        if ( empty($link_rating) )
    269                 $link_rating = 0;       
     269                $link_rating = 0;
    270270
    271271        if ( empty($link_target) )
    272                 $link_target = '';     
     272                $link_target = '';
    273273
    274274        if ( empty($link_visible) )
    275275                $link_visible = 'Y';
    276                
     276
    277277        if ( empty($link_owner) )
    278278                $link_owner = $current_user->id;
    279279
     
    292292                $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
    293293                $link_id = $wpdb->insert_id;
    294294        }
    295        
     295
    296296        if ( $update )
    297297                do_action('edit_link', $link_id);
    298298        else
     
    305305        global $wpdb;
    306306
    307307        $link_id = (int) $linkdata['link_id'];
    308        
     308
    309309        $link = get_link($link_id, ARRAY_A);
    310        
     310
    311311        // Escape data pulled from DB.
    312312        $link = add_magic_quotes($link);
    313        
     313
    314314        // Merge old and new fields with new fields overwriting old ones.
    315315        $linkdata = array_merge($link, $linkdata);
    316316
     
    321321        global $wpdb;
    322322
    323323        do_action('delete_link', $link_id);
    324         return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");     
     324        return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
    325325}
    326326
    327327function post_exists($title, $content = '', $post_date = '') {
  • wp-admin/options-permalink.php

     
    4141
    4242var aInputs = document.getElementsByTagName('input');
    4343
    44 for (var i = 0; i < aInputs.length; i++) {             
     44for (var i = 0; i < aInputs.length; i++) {
    4545aInputs[i].onclick = aInputs[i].onkeyup = upit;
    4646}
    4747}
     
    6464                        $permalink_structure = preg_replace('#/+#', '/', '/' . $_POST['permalink_structure']);
    6565                $wp_rewrite->set_permalink_structure($permalink_structure);
    6666        }
    67        
     67
    6868        if ( isset($_POST['category_base']) ) {
    6969                $category_base = $_POST['category_base'];
    7070                if (! empty($category_base) )
     
    7272                $wp_rewrite->set_category_base($category_base);
    7373        }
    7474}
    75        
     75
    7676$permalink_structure = get_settings('permalink_structure');
    7777$category_base = get_settings('category_base');
    7878
     
    141141checked="checked"
    142142<?php } ?>
    143143 />
    144 <?php _e('Custom, specify below'); ?>   
     144<?php _e('Custom, specify below'); ?>
    145145</label>
    146146<br />
    147147</p>
  • wp-admin/plugin-editor.php

     
    5252break;
    5353
    5454default:
    55        
     55
    5656        require_once('admin-header.php');
    5757        if ( !current_user_can('edit_plugins') )
    5858        die('<p>'.__('You have do not have sufficient permissions to edit plugins for this blog.').'</p>');
    5959
    6060        update_recently_edited("wp-content/plugins/$file");
    61        
     61
    6262        if (!is_file($real_file))
    6363                $error = 1;
    64        
     64
    6565        if (!$error) {
    6666                $f = fopen($real_file, 'r');
    6767                $content = fread($f, filesize($real_file));
  • wp-admin/import/livejournal.php

     
    1818                $trans_tbl = array_flip($trans_tbl);
    1919                return strtr($string, $trans_tbl);
    2020        }
    21        
     21
    2222        function greet() {
    2323                echo '<p>'.__('Howdy! This importer allows you to extract posts from LiveJournal XML export file into your blog.  Pick a LiveJournal file to upload and click Import.').'</p>';
    2424                wp_import_upload_form("admin.php?import=livejournal&amp;step=1");
     
    2626
    2727        function import_posts() {
    2828                global $wpdb, $current_user;
    29                
     29
    3030                set_magic_quotes_runtime(0);
    3131                $importdata = file($this->file); // Read the file into an array
    3232                $importdata = implode('', $importdata); // squish it
     
    3535                preg_match_all('|<entry>(.*?)</entry>|is', $importdata, $posts);
    3636                $posts = $posts[1];
    3737                unset($importdata);
    38                 echo '<ol>';           
     38                echo '<ol>';
    3939                foreach ($posts as $post) {
    4040                        flush();
    4141                        preg_match('|<subject>(.*?)</subject>|is', $post, $post_title);
     
    7878
    7979                        preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
    8080                        $comments = $comments[1];
    81                        
     81
    8282                        if ( $comments ) {
    8383                                $comment_post_ID = $post_id;
    8484                                $num_comments = 0;
     
    134134                $this->file = $file['file'];
    135135                $this->import_posts();
    136136                wp_import_cleanup($file['id']);
    137                
     137
    138138                echo '<h3>';
    139139                printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
    140140                echo '</h3>';
     
    147147                        $step = (int) $_GET['step'];
    148148
    149149                $this->header();
    150                
     150
    151151                switch ($step) {
    152152                        case 0 :
    153153                                $this->greet();
     
    156156                                $this->import();
    157157                                break;
    158158                }
    159                
     159
    160160                $this->footer();
    161161        }
    162162
    163163        function LJ_Import() {
    164                 // Nothing.     
     164                // Nothing.
    165165        }
    166166}
    167167
  • wp-admin/import/dotclear.php

     
    77        function get_catbynicename($category_nicename)
    88        {
    99        global $wpdb;
    10        
     10
    1111        $cat_id -= 0;   // force numeric
    1212        $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
    13        
     13
    1414        return $name;
    1515        }
    1616}
     
    135135        {
    136136                echo '</div>';
    137137        }
    138        
     138
    139139        function greet()
    140140        {
    141141                echo '<p>'.__('Howdy! This importer allows you to extract posts from a Dotclear database into your blog.  Mileage may vary.').'</p>';
     
    153153                $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
    154154                set_magic_quotes_runtime(0);
    155155                $prefix = get_option('tpre');
    156                
     156
    157157                // Get Categories
    158158                return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A);
    159159        }
    160        
     160
    161161        function get_dc_users()
    162162        {
    163163                global $wpdb;
     
    165165                $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
    166166                set_magic_quotes_runtime(0);
    167167                $prefix = get_option('tpre');
    168                
     168
    169169                // Get Users
    170                
     170
    171171                return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A);
    172172        }
    173        
     173
    174174        function get_dc_posts()
    175175        {
    176176                // General Housekeeping
    177177                $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
    178178                set_magic_quotes_runtime(0);
    179179                $prefix = get_option('tpre');
    180                
     180
    181181                // Get Posts
    182182                return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name
    183183                                                FROM dc_post INNER JOIN dc_categorie
    184184                                                  ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A);
    185185        }
    186        
     186
    187187        function get_dc_comments()
    188188        {
    189189                global $wpdb;
     
    191191                $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost'));
    192192                set_magic_quotes_runtime(0);
    193193                $prefix = get_option('tpre');
    194                
     194
    195195                // Get Comments
    196196                return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A);
    197197        }
    198        
     198
    199199        function get_dc_links()
    200200        {
    201201                //General Housekeeping
     
    205205
    206206                return $dcdb->get_results('SELECT * FROM dc_link ORDER BY position', ARRAY_A);
    207207        }
    208        
     208
    209209        function cat2wp($categories='')
    210210        {
    211211                // General Housekeeping
     
    220220                        {
    221221                                $count++;
    222222                                extract($category);
    223                                
     223
    224224                                // Make Nice Variables
    225225                                $name = $wpdb->escape($cat_libelle_url);
    226226                                $title = $wpdb->escape(csc ($cat_libelle));
     
    236236                                }
    237237                                $dccat2wpcat[$id] = $ret_id;
    238238                        }
    239                        
     239
    240240                        // Store category translation for future use
    241241                        add_option('dccat2wpcat',$dccat2wpcat);
    242242                        echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
     
    245245                echo __('No Categories to Import!');
    246246                return false;
    247247        }
    248        
     248
    249249        function users2wp($users='')
    250250        {
    251251                // General Housekeeping
    252252                global $wpdb;
    253253                $count = 0;
    254254                $dcid2wpid = array();
    255                
     255
    256256                // Midnight Mojo
    257257                if(is_array($users))
    258258                {
     
    261261                        {
    262262                                $count++;
    263263                                extract($user);
    264                                
     264
    265265                                // Make Nice Variables
    266266                                $name = $wpdb->escape(csc ($name));
    267267                                $RealName = $wpdb->escape(csc ($user_pseudo));
    268                                
     268
    269269                                if($uinfo = get_userdatabylogin($name))
    270270                                {
    271                                        
     271
    272272                                        $ret_id = wp_insert_user(array(
    273273                                                                'ID'            => $uinfo->ID,
    274274                                                                'user_login'    => $user_id,
     
    289289                                                                );
    290290                                }
    291291                                $dcid2wpid[$user_id] = $ret_id;
    292                                
     292
    293293                                // Set Dotclear-to-WordPress permissions translation
    294                                
     294
    295295                                // Update Usermeta Data
    296296                                $user = new WP_User($ret_id);
    297297                                $wp_perms = $user_level + 1;
     
    302302                                else if(3  <= $wp_perms) { $user->set_role('contributor'); }
    303303                                else if(2  <= $wp_perms) { $user->set_role('contributor'); }
    304304                                else                     { $user->set_role('subscriber'); }
    305                                
     305
    306306                                update_usermeta( $ret_id, 'wp_user_level', $wp_perms);
    307307                                update_usermeta( $ret_id, 'rich_editing', 'false');
    308308                                update_usermeta( $ret_id, 'first_name', csc ($user_prenom));
    309309                                update_usermeta( $ret_id, 'last_name', csc ($user_nom));
    310310                        }// End foreach($users as $user)
    311                        
     311
    312312                        // Store id translation array for future use
    313313                        add_option('dcid2wpid',$dcid2wpid);
    314                        
    315                        
     314
     315
    316316                        echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
    317317                        return true;
    318318                }// End if(is_array($users)
    319                
     319
    320320                echo __('No Users to Import!');
    321321                return false;
    322                
     322
    323323        }// End function user2wp()
    324        
     324
    325325        function posts2wp($posts='')
    326326        {
    327327                // General Housekeeping
     
    338338                        {
    339339                                $count++;
    340340                                extract($post);
    341                                
     341
    342342                                // Set Dotclear-to-WordPress status translation
    343343                                $stattrans = array(0 => 'draft', 1 => 'publish');
    344344                                $comment_status_map = array (0 => 'closed', 1 => 'open');
    345                                
     345
    346346                                //Can we do this more efficiently?
    347347                                $uinfo = ( get_userdatabylogin( $user_id ) ) ? get_userdatabylogin( $user_id ) : 1;
    348348                                $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
     
    356356                                $post_excerpt = $wpdb->escape ($post_excerpt);
    357357                                $post_content = $wpdb->escape ($post_content);
    358358                                $post_status = $stattrans[$post_pub];
    359                                
     359
    360360                                // Import Post data into WordPress
    361                                
     361
    362362                                if($pinfo = post_exists($Title,$post_content))
    363363                                {
    364364                                        $ret_id = wp_insert_post(array(
     
    397397                                                        );
    398398                                }
    399399                                $dcposts2wpposts[$post_id] = $ret_id;
    400                                
     400
    401401                                // Make Post-to-Category associations
    402402                                $cats = array();
    403403                                if($cat1 = get_catbynicename($post_cat_name)) { $cats[1] = $cat1; }
     
    407407                }
    408408                // Store ID translation for later use
    409409                add_option('dcposts2wpposts',$dcposts2wpposts);
    410                
     410
    411411                echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
    412                 return true;   
     412                return true;
    413413        }
    414        
     414
    415415        function comments2wp($comments='')
    416416        {
    417417                // General Housekeeping
     
    419419                $count = 0;
    420420                $dccm2wpcm = array();
    421421                $postarr = get_option('dcposts2wpposts');
    422                
     422
    423423                // Magic Mojo
    424424                if(is_array($comments))
    425425                {
     
    428428                        {
    429429                                $count++;
    430430                                extract($comment);
    431                                
     431
    432432                                // WordPressify Data
    433433                                $comment_ID = ltrim($comment_id, '0');
    434434                                $comment_post_ID = $postarr[$post_id];
     
    437437                                $email = $wpdb->escape($comment_email);
    438438                                $web = "http://".$wpdb->escape($comment_site);
    439439                                $message = $wpdb->escape(textconv ($comment_content));
    440                                
     440
    441441                                if($cinfo = comment_exists($name, $comment_dt))
    442442                                {
    443443                                        // Update comments
     
    472472                                $dccm2wpcm[$comment_ID] = $ret_id;
    473473                        }
    474474                        // Store Comment ID translation for future use
    475                         add_option('dccm2wpcm', $dccm2wpcm);                   
    476                        
     475                        add_option('dccm2wpcm', $dccm2wpcm);
     476
    477477                        // Associate newly formed categories with posts
    478478                        get_comment_count($ret_id);
    479                        
    480                        
     479
     480
    481481                        echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
    482482                        return true;
    483483                }
    484484                echo __('No Comments to Import!');
    485485                return false;
    486486        }
    487        
     487
    488488        function links2wp($links='')
    489489        {
    490490                // General Housekeeping
    491491                global $wpdb;
    492492                $count = 0;
    493                
     493
    494494                // Deal with the links
    495495                if(is_array($links))
    496496                {
     
    499499                        {
    500500                                $count++;
    501501                                extract($link);
    502                                
     502
    503503                                if ($title != "") {
    504504                                        if ($cinfo = link_cat_exists (csc ($title))) {
    505505                                                $category = $cinfo;
     
    511511                                } else {
    512512                                        $linkname = $wpdb->escape(csc ($label));
    513513                                        $description = $wpdb->escape(csc ($title));
    514                                
     514
    515515                                        if($linfo = link_exists($linkname)) {
    516516                                                $ret_id = wp_insert_link(array(
    517517                                                                        'link_id'               => $linfo,
     
    540540                echo __('No Links to Import!');
    541541                return false;
    542542        }
    543                
     543
    544544        function import_categories()
    545         {       
    546                 // Category Import     
     545        {
     546                // Category Import
    547547                $cats = $this->get_dc_cats();
    548548                $this->cat2wp($cats);
    549549                add_option('dc_cats', $cats);
    550                
    551                
    552                        
     550
     551
     552
    553553                echo '<form action="admin.php?import=dotclear&amp;step=2" method="post">';
    554554                printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
    555555                echo '</form>';
    556556
    557557        }
    558        
     558
    559559        function import_users()
    560560        {
    561561                // User Import
    562562                $users = $this->get_dc_users();
    563563                $this->users2wp($users);
    564                
     564
    565565                echo '<form action="admin.php?import=dotclear&amp;step=3" method="post">';
    566566                printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
    567567                echo '</form>';
    568568        }
    569        
     569
    570570        function import_posts()
    571571        {
    572572                // Post Import
    573573                $posts = $this->get_dc_posts();
    574574                $this->posts2wp($posts);
    575                
     575
    576576                echo '<form action="admin.php?import=dotclear&amp;step=4" method="post">';
    577577                printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
    578578                echo '</form>';
    579579        }
    580        
     580
    581581        function import_comments()
    582582        {
    583583                // Comment Import
    584584                $comments = $this->get_dc_comments();
    585585                $this->comments2wp($comments);
    586                
     586
    587587                echo '<form action="admin.php?import=dotclear&amp;step=5" method="post">';
    588588                printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
    589589                echo '</form>';
    590590        }
    591        
     591
    592592        function import_links()
    593593        {
    594594                //Link Import
    595595                $links = $this->get_dc_links();
    596596                $this->links2wp($links);
    597597                add_option('dc_links', $links);
    598                
     598
    599599                echo '<form action="admin.php?import=dotclear&amp;step=6" method="post">';
    600600                printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
    601601                echo '</form>';
    602602        }
    603        
     603
    604604        function cleanup_dcimport()
    605605        {
    606606                delete_option('tpre');
     
    617617                delete_option('dccharset');
    618618                $this->tips();
    619619        }
    620        
     620
    621621        function tips()
    622622        {
    623623                echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from Dotclear, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
     
    636636                echo '</ul>';
    637637                echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
    638638        }
    639        
     639
    640640        function db_form()
    641641        {
    642642                echo '<ul>';
     
    648648                printf('<li><label for="dccharset">%s</label> <input type="text" name="dccharset" value="ISO-8859-15"/></li>', __('Originating character set:'));
    649649                echo '</ul>';
    650650        }
    651        
     651
    652652        function dispatch()
    653653        {
    654654
     
    657657                else
    658658                        $step = (int) $_GET['step'];
    659659                $this->header();
    660                
     660
    661661                if ( $step > 0 )
    662662                {
    663663                        if($_POST['dbuser'])
    664664                        {
    665665                                if(get_option('dcuser'))
    666                                         delete_option('dcuser');       
     666                                        delete_option('dcuser');
    667667                                add_option('dcuser',$_POST['dbuser']);
    668668                        }
    669669                        if($_POST['dbpass'])
    670670                        {
    671671                                if(get_option('dcpass'))
    672                                         delete_option('dcpass');       
     672                                        delete_option('dcpass');
    673673                                add_option('dcpass',$_POST['dbpass']);
    674674                        }
    675                        
     675
    676676                        if($_POST['dbname'])
    677677                        {
    678678                                if(get_option('dcname'))
    679                                         delete_option('dcname');       
     679                                        delete_option('dcname');
    680680                                add_option('dcname',$_POST['dbname']);
    681681                        }
    682682                        if($_POST['dbhost'])
     
    690690                                if(get_option('dccharset'))
    691691                                        delete_option('dccharset');
    692692                                add_option('dccharset',$_POST['dccharset']);
    693                         }                       
     693                        }
    694694                        if($_POST['dbprefix'])
    695695                        {
    696696                                if(get_option('tpre'))
    697697                                        delete_option('tpre');
    698698                                add_option('tpre',$_POST['dbprefix']);
    699                         }                       
     699                        }
    700700
    701701
    702702                }
     
    726726                                $this->cleanup_dcimport();
    727727                                break;
    728728                }
    729                
     729
    730730                $this->footer();
    731731        }
    732732
    733733        function Dotclear_Import()
    734734        {
    735                 // Nothing.     
     735                // Nothing.
    736736        }
    737737}
    738738
  • wp-admin/import/mt.php

     
    379379                                }
    380380                                if ( $num_pings )
    381381                                        printf(__('(%s pings)'), $num_pings);
    382                                
     382
    383383                                echo "</li>";
    384384                        }
    385385                        flush();
     
    420420        }
    421421
    422422        function MT_Import() {
    423                 // Nothing.     
     423                // Nothing.
    424424        }
    425425}
    426426
  • wp-admin/import/blogger.php

     
    135135                curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    136136                if ($header) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    137137                $response = curl_exec ($ch);
    138        
     138
    139139                if ($parse) {
    140140                        $response = $this->parse_response($response);
    141141                        $response['url'] = $url;
    142142                        return $response;
    143143                }
    144        
     144
    145145                return $response;
    146146        }
    147147
     
    210210                $this->import['blogs'][$_GET['blog']]['nextstep'] = $step;
    211211                update_option('import-blogger', $this->import);
    212212        }
    213        
     213
    214214        // Redirects to next step
    215215        function do_next_step() {
    216216                header("Location: admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
     
    224224                        if ( ! ( $_POST['user'] && $_POST['pass'] ) ) {
    225225                                $this->login_form(__('The script will log into your Blogger account, change some settings so it can read your blog, and restore the original settings when it\'s done. Here\'s what you do:').'</p><ol><li>'.__('Back up your Blogger template.').'</li><li>'.__('Back up any other Blogger settings you might need later.').'</li><li>'.__('Log out of Blogger').'</li><li>'.__('Log in <em>here</em> with your Blogger username and password.').'</li><li>'.__('On the next screen, click one of your Blogger blogs.').'</li><li>'.__('Do not close this window or navigate away until the process is complete.').'</li></ol>');
    226226                        }
    227                
    228                         // Try logging in. If we get an array of cookies back, we at least connected.           
     227
     228                        // Try logging in. If we get an array of cookies back, we at least connected.
    229229                        $this->import['cookies'] = $this->login_blogger($_POST['user'], $_POST['pass']);
    230230                        if ( !is_array( $this->import['cookies'] ) ) {
    231231                                $this->login_form(__('Login failed. Please enter your credentials again.'));
    232232                        }
    233                        
     233
    234234                        // Save the password so we can log the browser in when it's time to publish.
    235235                        $this->import['pass'] = $_POST['pass'];
    236236                        $this->import['user'] = $_POST['user'];
     
    395395                                update_option('import-blogger', $import);
    396396                                $archive = $this->get_blogger($url);
    397397                                if ( $archive['code'] > 200 )
    398                                         continue;       
     398                                        continue;
    399399                                $posts = explode('<wordpresspost>', $archive['body']);
    400400                                for ($i = 1; $i < count($posts); $i = $i + 1) {
    401401                                        $postparts = explode('<wordpresscomment>', $posts[$i]);
     
    409409                                        $post_title = ( $postinfo[4] != '' ) ? $postinfo[4] : $postinfo[3];
    410410                                        $post_author_name = $wpdb->escape(trim($postinfo[1]));
    411411                                        $post_author_email = $postinfo[5] ? $postinfo[5] : 'user@wordpress.org';
    412        
     412
    413413                                        if ( $this->lump_authors ) {
    414414                                                // Ignore Blogger authors. Use the current user_ID for all posts imported.
    415415                                                $post_author = $GLOBALS['user_ID'];
     
    435435                                        $posthour = zeroise($post_date_His[0], 2);
    436436                                        $postminute = zeroise($post_date_His[1], 2);
    437437                                        $postsecond = zeroise($post_date_His[2], 2);
    438        
     438
    439439                                        if (($post_date[2] == 'PM') && ($posthour != '12'))
    440440                                                $posthour = $posthour + 12;
    441441                                        else if (($post_date[2] == 'AM') && ($posthour == '12'))
    442442                                                $posthour = '00';
    443        
     443
    444444                                        $post_date = "$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
    445        
     445
    446446                                        $post_content = addslashes($post_content);
    447447                                        $post_content = str_replace(array('<br>','<BR>','<br/>','<BR/>','<br />','<BR />'), "\n", $post_content); // the XHTML touch... ;)
    448        
     448
    449449                                        $post_title = addslashes($post_title);
    450                        
     450
    451451                                        $post_status = 'publish';
    452        
     452
    453453                                        if ( $ID = post_exists($post_title, '', $post_date) ) {
    454454                                                $post_array[$i]['ID'] = $ID;
    455455                                                $skippedpostcount++;
     
    597597                if ( $_GET['restart'] == 'true' ) {
    598598                        $this->restart();
    599599                }
    600                
     600
    601601                if ( isset($_GET['noheader']) ) {
    602602                        $this->import = get_settings('import-blogger');
    603603
     
    647647                                        break;
    648648                        }
    649649                        die;
    650                        
     650
    651651                } else {
    652652                        $this->greet();
    653653                }
  • wp-admin/import/textpattern.php

     
    77        function get_catbynicename($category_nicename)
    88        {
    99        global $wpdb;
    10        
     10
    1111        $cat_id -= 0;   // force numeric
    1212        $name = $wpdb->get_var('SELECT cat_ID FROM '.$wpdb->categories.' WHERE category_nicename="'.$category_nicename.'"');
    13        
     13
    1414        return $name;
    1515        }
    1616}
     
    4949        {
    5050                echo '</div>';
    5151        }
    52        
     52
    5353        function greet()
    5454        {
    5555                echo '<p>'.__('Howdy! This importer allows you to extract posts from any Textpattern 4.0.2+ into your blog. This has not been tested on previous versions of Textpattern.  Mileage may vary.').'</p>';
     
    6767                $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
    6868                set_magic_quotes_runtime(0);
    6969                $prefix = get_option('tpre');
    70                
     70
    7171                // Get Categories
    7272                return $txpdb->get_results('SELECT
    7373                                                                                id,
     
    7777                                                                         WHERE type = "article"',
    7878                                                                         ARRAY_A);
    7979        }
    80        
     80
    8181        function get_txp_users()
    8282        {
    8383                global $wpdb;
     
    8585                $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
    8686                set_magic_quotes_runtime(0);
    8787                $prefix = get_option('tpre');
    88                
     88
    8989                // Get Users
    90                
     90
    9191                return $txpdb->get_results('SELECT
    9292                                                                                user_id,
    9393                                                                                name,
     
    9696                                                                                privs
    9797                                                                        FROM '.$prefix.'txp_users', ARRAY_A);
    9898        }
    99        
     99
    100100        function get_txp_posts()
    101101        {
    102102                // General Housekeeping
    103103                $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
    104104                set_magic_quotes_runtime(0);
    105105                $prefix = get_option('tpre');
    106                
     106
    107107                // Get Posts
    108108                return $txpdb->get_results('SELECT
    109109                                                                                ID,
     
    122122                                                                        FROM '.$prefix.'textpattern
    123123                                                                        ', ARRAY_A);
    124124        }
    125        
     125
    126126        function get_txp_comments()
    127127        {
    128128                global $wpdb;
     
    130130                $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
    131131                set_magic_quotes_runtime(0);
    132132                $prefix = get_option('tpre');
    133                
     133
    134134                // Get Comments
    135135                return $txpdb->get_results('SELECT * FROM '.$prefix.'txp_discuss', ARRAY_A);
    136136        }
    137        
     137
    138138                function get_txp_links()
    139139        {
    140140                //General Housekeeping
    141141                $txpdb = new wpdb(get_option('txpuser'), get_option('txppass'), get_option('txpname'), get_option('txphost'));
    142142                set_magic_quotes_runtime(0);
    143143                $prefix = get_option('tpre');
    144                
     144
    145145                return $txpdb->get_results('SELECT
    146146                                                                                id,
    147147                                                                                date,
     
    152152                                                                          FROM '.$prefix.'txp_link',
    153153                                                                          ARRAY_A);                                               
    154154        }
    155        
     155
    156156        function cat2wp($categories='')
    157157        {
    158158                // General Housekeeping
     
    167167                        {
    168168                                $count++;
    169169                                extract($category);
    170                                
    171                                
     170
     171
    172172                                // Make Nice Variables
    173173                                $name = $wpdb->escape($name);
    174174                                $title = $wpdb->escape($title);
    175                                
     175
    176176                                if($cinfo = category_exists($name))
    177177                                {
    178178                                        $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title));
     
    183183                                }
    184184                                $txpcat2wpcat[$id] = $ret_id;
    185185                        }
    186                        
     186
    187187                        // Store category translation for future use
    188188                        add_option('txpcat2wpcat',$txpcat2wpcat);
    189189                        echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> categories imported.'), $count).'<br /><br /></p>';
     
    192192                echo __('No Categories to Import!');
    193193                return false;
    194194        }
    195        
     195
    196196        function users2wp($users='')
    197197        {
    198198                // General Housekeeping
    199199                global $wpdb;
    200200                $count = 0;
    201201                $txpid2wpid = array();
    202                
     202
    203203                // Midnight Mojo
    204204                if(is_array($users))
    205205                {
     
    208208                        {
    209209                                $count++;
    210210                                extract($user);
    211                                
     211
    212212                                // Make Nice Variables
    213213                                $name = $wpdb->escape($name);
    214214                                $RealName = $wpdb->escape($RealName);
    215                                
     215
    216216                                if($uinfo = get_userdatabylogin($name))
    217217                                {
    218                                        
     218
    219219                                        $ret_id = wp_insert_user(array(
    220220                                                                'ID'                    => $uinfo->ID,
    221221                                                                'user_login'    => $name,
     
    236236                                                                );
    237237                                }
    238238                                $txpid2wpid[$user_id] = $ret_id;
    239                                
     239
    240240                                // Set Textpattern-to-WordPress permissions translation
    241241                                $transperms = array(1 => '10', 2 => '9', 3 => '5', 4 => '4', 5 => '3', 6 => '2', 7 => '0');
    242                                
     242
    243243                                // Update Usermeta Data
    244244                                $user = new WP_User($ret_id);
    245245                                if('10' == $transperms[$privs]) { $user->set_role('administrator'); }
     
    249249                                if('3'  == $transperms[$privs]) { $user->set_role('contributor'); }
    250250                                if('2'  == $transperms[$privs]) { $user->set_role('contributor'); }
    251251                                if('0'  == $transperms[$privs]) { $user->set_role('subscriber'); }
    252                                
     252
    253253                                update_usermeta( $ret_id, 'wp_user_level', $transperms[$privs] );
    254254                                update_usermeta( $ret_id, 'rich_editing', 'false');
    255255                        }// End foreach($users as $user)
    256                        
     256
    257257                        // Store id translation array for future use
    258258                        add_option('txpid2wpid',$txpid2wpid);
    259                        
    260                        
     259
     260
    261261                        echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> users imported.'), $count).'<br /><br /></p>';
    262262                        return true;
    263263                }// End if(is_array($users)
    264                
     264
    265265                echo __('No Users to Import!');
    266266                return false;
    267                
     267
    268268        }// End function user2wp()
    269        
     269
    270270        function posts2wp($posts='')
    271271        {
    272272                // General Housekeeping
     
    283283                        {
    284284                                $count++;
    285285                                extract($post);
    286                                
     286
    287287                                // Set Textpattern-to-WordPress status translation
    288288                                $stattrans = array(1 => 'draft', 2 => 'private', 3 => 'draft', 4 => 'publish', 5 => 'publish');
    289                                
     289
    290290                                //Can we do this more efficiently?
    291291                                $uinfo = ( get_userdatabylogin( $AuthorID ) ) ? get_userdatabylogin( $AuthorID ) : 1;
    292292                                $authorid = ( is_object( $uinfo ) ) ? $uinfo->ID : $uinfo ;
     
    295295                                $Body = $wpdb->escape($Body);
    296296                                $Excerpt = $wpdb->escape($Excerpt);
    297297                                $post_status = $stattrans[$Status];
    298                                
     298
    299299                                // Import Post data into WordPress
    300                                
     300
    301301                                if($pinfo = post_exists($Title,$Body))
    302302                                {
    303303                                        $ret_id = wp_insert_post(array(
     
    332332                                                        );
    333333                                }
    334334                                $txpposts2wpposts[$ID] = $ret_id;
    335                                
     335
    336336                                // Make Post-to-Category associations
    337337                                $cats = array();
    338338                                if($cat1 = get_catbynicename($Category1)) { $cats[1] = $cat1; }
     
    343343                }
    344344                // Store ID translation for later use
    345345                add_option('txpposts2wpposts',$txpposts2wpposts);
    346                
     346
    347347                echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> posts imported.'), $count).'<br /><br /></p>';
    348                 return true;   
     348                return true;
    349349        }
    350        
     350
    351351        function comments2wp($comments='')
    352352        {
    353353                // General Housekeeping
     
    355355                $count = 0;
    356356                $txpcm2wpcm = array();
    357357                $postarr = get_option('txpposts2wpposts');
    358                
     358
    359359                // Magic Mojo
    360360                if(is_array($comments))
    361361                {
     
    364364                        {
    365365                                $count++;
    366366                                extract($comment);
    367                                
     367
    368368                                // WordPressify Data
    369369                                $comment_ID = ltrim($discussid, '0');
    370370                                $comment_post_ID = $postarr[$parentid];
     
    373373                                $email = $wpdb->escape($email);
    374374                                $web = $wpdb->escape($web);
    375375                                $message = $wpdb->escape($message);
    376                                
     376
    377377                                if($cinfo = comment_exists($name, $posted))
    378378                                {
    379379                                        // Update comments
     
    405405                                $txpcm2wpcm[$comment_ID] = $ret_id;
    406406                        }
    407407                        // Store Comment ID translation for future use
    408                         add_option('txpcm2wpcm', $txpcm2wpcm);                 
    409                        
     408                        add_option('txpcm2wpcm', $txpcm2wpcm);
     409
    410410                        // Associate newly formed categories with posts
    411411                        get_comment_count($ret_id);
    412                        
    413                        
     412
     413
    414414                        echo '<p>'.sprintf(__('Done! <strong>%1$s</strong> comments imported.'), $count).'<br /><br /></p>';
    415415                        return true;
    416416                }
    417417                echo __('No Comments to Import!');
    418418                return false;
    419419        }
    420        
     420
    421421        function links2wp($links='')
    422422        {
    423423                // General Housekeeping
    424424                global $wpdb;
    425425                $count = 0;
    426                
     426
    427427                // Deal with the links
    428428                if(is_array($links))
    429429                {
     
    432432                        {
    433433                                $count++;
    434434                                extract($link);
    435                                
     435
    436436                                // Make nice vars
    437437                                $category = $wpdb->escape($category);
    438438                                $linkname = $wpdb->escape($linkname);
    439439                                $description = $wpdb->escape($description);
    440                                
     440
    441441                                if($linfo = link_exists($linkname))
    442442                                {
    443443                                        $ret_id = wp_insert_link(array(
     
    470470                echo __('No Links to Import!');
    471471                return false;
    472472        }
    473                
     473
    474474        function import_categories()
    475         {       
    476                 // Category Import     
     475        {
     476                // Category Import
    477477                $cats = $this->get_txp_cats();
    478478                $this->cat2wp($cats);
    479479                add_option('txp_cats', $cats);
    480                
    481                
    482                        
     480
     481
     482
    483483                echo '<form action="admin.php?import=textpattern&amp;step=2" method="post">';
    484484                printf('<input type="submit" name="submit" value="%s" />', __('Import Users'));
    485485                echo '</form>';
    486486
    487487        }
    488        
     488
    489489        function import_users()
    490490        {
    491491                // User Import
    492492                $users = $this->get_txp_users();
    493493                $this->users2wp($users);
    494                
     494
    495495                echo '<form action="admin.php?import=textpattern&amp;step=3" method="post">';
    496496                printf('<input type="submit" name="submit" value="%s" />', __('Import Posts'));
    497497                echo '</form>';
    498498        }
    499        
     499
    500500        function import_posts()
    501501        {
    502502                // Post Import
    503503                $posts = $this->get_txp_posts();
    504504                $this->posts2wp($posts);
    505                
     505
    506506                echo '<form action="admin.php?import=textpattern&amp;step=4" method="post">';
    507507                printf('<input type="submit" name="submit" value="%s" />', __('Import Comments'));
    508508                echo '</form>';
    509509        }
    510        
     510
    511511        function import_comments()
    512512        {
    513513                // Comment Import
    514514                $comments = $this->get_txp_comments();
    515515                $this->comments2wp($comments);
    516                
     516
    517517                echo '<form action="admin.php?import=textpattern&amp;step=5" method="post">';
    518518                printf('<input type="submit" name="submit" value="%s" />', __('Import Links'));
    519519                echo '</form>';
    520520        }
    521        
     521
    522522        function import_links()
    523523        {
    524524                //Link Import
    525525                $links = $this->get_txp_links();
    526526                $this->links2wp($links);
    527527                add_option('txp_links', $links);
    528                
     528
    529529                echo '<form action="admin.php?import=textpattern&amp;step=6" method="post">';
    530530                printf('<input type="submit" name="submit" value="%s" />', __('Finish'));
    531531                echo '</form>';
    532532        }
    533        
     533
    534534        function cleanup_txpimport()
    535535        {
    536536                delete_option('tpre');
     
    546546                delete_option('txphost');
    547547                $this->tips();
    548548        }
    549        
     549
    550550        function tips()
    551551        {
    552552                echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from Textpattern, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
     
    565565                echo '</ul>';
    566566                echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>';
    567567        }
    568        
     568
    569569        function db_form()
    570570        {
    571571                echo '<ul>';
     
    576576                printf('<li><label for="dbprefix">%s</label> <input type="text" name="dbprefix" /></li>', __('Textpattern Table prefix (if any):'));
    577577                echo '</ul>';
    578578        }
    579        
     579
    580580        function dispatch()
    581581        {
    582582
     
    585585                else
    586586                        $step = (int) $_GET['step'];
    587587                $this->header();
    588                
     588
    589589                if ( $step > 0 )
    590590                {
    591591                        if($_POST['dbuser'])
    592592                        {
    593593                                if(get_option('txpuser'))
    594                                         delete_option('txpuser');       
     594                                        delete_option('txpuser');
    595595                                add_option('txpuser',$_POST['dbuser']);
    596596                        }
    597597                        if($_POST['dbpass'])
    598598                        {
    599599                                if(get_option('txppass'))
    600                                         delete_option('txppass');       
     600                                        delete_option('txppass');
    601601                                add_option('txppass',$_POST['dbpass']);
    602602                        }
    603                        
     603
    604604                        if($_POST['dbname'])
    605605                        {
    606606                                if(get_option('txpname'))
    607                                         delete_option('txpname');       
     607                                        delete_option('txpname');
    608608                                add_option('txpname',$_POST['dbname']);
    609609                        }
    610610                        if($_POST['dbhost'])
     
    618618                                if(get_option('tpre'))
    619619                                        delete_option('tpre');
    620620                                add_option('tpre',$_POST['dbprefix']);
    621                         }                       
     621                        }
    622622
    623623
    624624                }
     
    648648                                $this->cleanup_txpimport();
    649649                                break;
    650650                }
    651                
     651
    652652                $this->footer();
    653653        }
    654654
    655655        function Textpattern_Import()
    656656        {
    657                 // Nothing.     
     657                // Nothing.
    658658        }
    659659}
    660660
  • wp-admin/import/rss.php

     
    1919                $trans_tbl = array_flip($trans_tbl);
    2020                return strtr($string, $trans_tbl);
    2121        }
    22        
     22
    2323        function greet() {
    2424                echo '<p>'.__('Howdy! This importer allows you to extract posts from any RSS 2.0 file into your blog. This is useful if you want to import your posts from a system that is not handled by a custom import tool. Pick an RSS file to upload and click Import.').'</p>';
    2525                wp_import_upload_form("admin.php?import=rss&amp;step=1");
     
    2727
    2828        function get_posts() {
    2929                global $wpdb;
    30                
     30
    3131                set_magic_quotes_runtime(0);
    3232                $datalines = file($this->file); // Read the file into an array
    3333                $importdata = implode('', $datalines); // squish it
     
    134134                $this->get_posts();
    135135                $this->import_posts();
    136136                wp_import_cleanup($file['id']);
    137                
     137
    138138                echo '<h3>';
    139139                printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
    140140                echo '</h3>';
     
    147147                        $step = (int) $_GET['step'];
    148148
    149149                $this->header();
    150                
     150
    151151                switch ($step) {
    152152                        case 0 :
    153153                                $this->greet();
     
    156156                                $this->import();
    157157                                break;
    158158                }
    159                
     159
    160160                $this->footer();
    161161        }
    162162
    163163        function RSS_Import() {
    164                 // Nothing.     
     164                // Nothing.
    165165        }
    166166}
    167167
  • wp-admin/categories.php

     
    2727
    2828        if ( !current_user_can('manage_categories') )
    2929                die (__('Cheatin&#8217; uh?'));
    30        
     30
    3131        wp_insert_category($_POST);
    3232
    3333        header('Location: categories.php?message=1#addcat');
     
    9696case 'editedcat':
    9797        if ( !current_user_can('manage_categories') )
    9898                die (__('Cheatin&#8217; uh?'));
    99        
     99
    100100        wp_update_category($_POST);
    101101
    102102        header('Location: categories.php?message=3');
  • wp-admin/themes.php

     
    33
    44if ( isset($_GET['action']) ) {
    55        check_admin_referer();
    6        
     6
    77        if ('activate' == $_GET['action']) {
    88                if ( isset($_GET['template']) )
    99                        update_option('template', $_GET['template']);
    10                
     10
    1111                if ( isset($_GET['stylesheet']) )
    1212                        update_option('stylesheet', $_GET['stylesheet']);
    13                
     13
    1414                do_action('switch_theme', get_current_theme());
    15                
     15
    1616                header('Location: themes.php?activated=true');
    1717                exit;
    1818        }
     
    102102        </tr>
    103103<?php
    104104        $theme = '';
    105        
     105
    106106        $theme_names = array_keys($broken_themes);
    107107        natcasesort($theme_names);
    108108
  • wp-admin/upgrade-schema.php

     
    257257        add_role('author', __('Author'));
    258258        add_role('contributor', __('Contributor'));
    259259        add_role('subscriber', __('Subscriber'));
    260        
     260
    261261        // Add caps for Administrator role
    262262        $role = get_role('administrator');
    263263        $role->add_cap('switch_themes');
     
    290290        $role->add_cap('level_2');
    291291        $role->add_cap('level_1');
    292292        $role->add_cap('level_0');
    293        
     293
    294294        // Add caps for Editor role
    295295        $role = get_role('editor');
    296296        $role->add_cap('moderate_comments');
     
    312312        $role->add_cap('level_2');
    313313        $role->add_cap('level_1');
    314314        $role->add_cap('level_0');
    315        
     315
    316316        // Add caps for Author role
    317317        $role = get_role('author');
    318318        $role->add_cap('upload_files');
     
    323323        $role->add_cap('level_2');
    324324        $role->add_cap('level_1');
    325325        $role->add_cap('level_0');
    326        
     326
    327327        // Add caps for Contributor role
    328328        $role = get_role('contributor');
    329329        $role->add_cap('edit_posts');
    330330        $role->add_cap('read');
    331331        $role->add_cap('level_1');
    332332        $role->add_cap('level_0');
    333        
     333
    334334        // Add caps for Subscriber role
    335335        $role = get_role('subscriber');
    336336        $role->add_cap('read');
     
    354354                $role->add_cap('delete_others_posts');
    355355                $role->add_cap('delete_published_posts');
    356356        }
    357        
    358         $role = get_role('author');     
     357
     358        $role = get_role('author');
    359359        if ( ! empty($role) ) {
    360360                $role->add_cap('delete_posts');
    361                 $role->add_cap('delete_published_posts');               
     361                $role->add_cap('delete_published_posts');
    362362        }
    363363
    364         $role = get_role('contributor');       
     364        $role = get_role('contributor');
    365365        if ( ! empty($role) ) {
    366366                $role->add_cap('delete_posts');
    367367        }