Make WordPress Core


Ignore:
Timestamp:
04/20/2004 10:56:47 PM (21 years ago)
Author:
saxmatt
Message:

Changed to superglobals, and eliminated $use_cache (since we always do).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r1084 r1108  
    9999
    100100function get_lastpostdate($timezone = 'server') {
    101     global $tableposts, $cache_lastpostdate, $use_cache, $pagenow, $wpdb;
     101    global $tableposts, $cache_lastpostdate, $pagenow, $wpdb;
    102102    $add_seconds_blog = get_settings('gmt_offset') * 3600;
    103103    $add_seconds_server = date('Z');
    104104    $now = current_time('mysql', 1);
    105     if ((!isset($cache_lastpostdate[$timezone])) OR (!$use_cache)) {
     105    if ( !isset($cache_lastpostdate[$timezone]) ) {
    106106        switch(strtolower($timezone)) {
    107107            case 'gmt':
     
    123123
    124124function get_lastpostmodified($timezone = 'server') {
    125     global $tableposts, $cache_lastpostmodified, $use_cache, $pagenow, $wpdb;
     125    global $tableposts, $cache_lastpostmodified, $pagenow, $wpdb;
    126126    $add_seconds_blog = get_settings('gmt_offset') * 3600;
    127127    $add_seconds_server = date('Z');
    128128    $now = current_time('mysql', 1);
    129     if ((!isset($cache_lastpostmodified[$timezone])) OR (!$use_cache)) {
     129    if ( !isset($cache_lastpostmodified[$timezone]) ) {
    130130        switch(strtolower($timezone)) {
    131131            case 'gmt':
     
    151151
    152152function user_pass_ok($user_login,$user_pass) {
    153     global $cache_userdata,$use_cache;
    154     if ((empty($cache_userdata[$user_login])) OR (!$use_cache)) {
     153    global $cache_userdata;
     154    if ( empty($cache_userdata[$user_login]) ) {
    155155        $userdata = get_userdatabylogin($user_login);
    156156    } else {
     
    174174
    175175function get_userdata($userid) {
    176     global $wpdb, $cache_userdata, $use_cache, $tableusers;
    177     if ((empty($cache_userdata[$userid])) || (!$use_cache)) {
     176    global $wpdb, $cache_userdata, $tableusers;
     177    if ( empty($cache_userdata[$userid]) ) {
    178178        $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID = '$userid'");
    179179        $user->user_nickname = stripslashes($user->user_nickname);
     
    191191
    192192function get_userdatabylogin($user_login) {
    193     global $tableusers, $cache_userdata, $use_cache, $wpdb;
    194     if ((empty($cache_userdata["$user_login"])) OR (!$use_cache)) {
     193    global $tableusers, $cache_userdata, $wpdb;
     194    if ( empty($cache_userdata["$user_login"]) ) {
    195195        $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$user_login'");
    196196        $cache_userdata["$user_login"] = $user;
     
    202202
    203203function get_userid($user_login) {
    204     global $tableusers, $cache_userdata, $use_cache, $wpdb;
    205     if ((empty($cache_userdata["$user_login"])) OR (!$use_cache)) {
     204    global $tableusers, $cache_userdata, $wpdb;
     205    if ( empty($cache_userdata["$user_login"]) ) {
    206206        $user_id = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$user_login'");
    207207
     
    294294
    295295function get_settings($setting) {
    296     global $wpdb, $cache_settings, $use_cache;
     296    global $wpdb, $cache_settings;
    297297    if (strstr($_SERVER['REQUEST_URI'], 'install.php')) {
    298298        return false;
     
    302302    $setting = str_replace('time_difference', 'gmt_offset', $setting);
    303303
    304     if ((empty($cache_settings)) OR (!$use_cache)) {
     304    if ( (empty($cache_settings)) ) {
    305305        $settings = get_alloptions();
    306306        $cache_settings = $settings;
     
    348348        $wpdb->query("INSERT INTO $tableoptions (option_name, option_value) VALUES ('$name', '$value')");
    349349
    350         global $use_cache;
    351         if($wpdb->insert_id && $use_cache) {
     350        if($wpdb->insert_id) {
    352351            global $cache_settings;
    353352            $cache_settings->{$name} = $value;
     
    413412
    414413function get_catname($cat_ID) {
    415     global $tablecategories,$cache_catnames,$use_cache, $wpdb;
    416     if ((!$cache_catnames) || (!$use_cache)) {
     414    global $tablecategories, $cache_catnames, $wpdb;
     415    if ( !$cache_catnames) ) {
    417416        $results = $wpdb->get_results("SELECT * FROM $tablecategories") or die('Oops, couldn\'t query the db for categories.');
    418417        foreach ($results as $post) {
     
    475474            }
    476475        } else if($phpver > "4.0") {
    477             if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
     476            if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
    478477                if(extension_loaded("zlib")) {
    479478                    $do_gzip_compress = TRUE;
     
    10031002
    10041003    if ('' == $comment->comment_author_email || '' == $comment->comment_author) {
    1005         $from = "From: \"$blogname\" <wordpress@" . $HTTP_SERVER_VARS['SERVER_NAME'] . '>';
     1004        $from = "From: \"$blogname\" <wordpress@" . $_SERVER['SERVER_NAME'] . '>';
    10061005    } else {
    10071006        $from = 'From: "' . stripslashes($comment->comment_author) . "\" <$comment->comment_author_email>";
     
    10621061    global $preview_userid,$preview_date,$preview_content,$preview_title,$preview_category,$preview_notify,$preview_make_clickable,$preview_autobr;
    10631062    global $pagenow;
    1064     global $HTTP_GET_VARS;
    10651063    if (!$preview) {
    10661064        $id = $post->ID;
     
    10691067        $postdata = array (
    10701068            'ID' => 0,
    1071             'Author_ID' => $HTTP_GET_VARS['preview_userid'],
    1072             'Date' => $HTTP_GET_VARS['preview_date'],
    1073             'Content' => $HTTP_GET_VARS['preview_content'],
    1074             'Excerpt' => $HTTP_GET_VARS['preview_excerpt'],
    1075             'Title' => $HTTP_GET_VARS['preview_title'],
    1076             'Category' => $HTTP_GET_VARS['preview_category'],
     1069            'Author_ID' => $_GET['preview_userid'],
     1070            'Date' => $_GET['preview_date'],
     1071            'Content' => $_GET['preview_content'],
     1072            'Excerpt' => $_GET['preview_excerpt'],
     1073            'Title' => $_GET['preview_title'],
     1074            'Category' => $_GET['preview_category'],
    10771075            'Notify' => 1
    10781076            );
Note: See TracChangeset for help on using the changeset viewer.