Make WordPress Core

Changeset 1246


Ignore:
Timestamp:
05/09/2004 05:54:17 AM (22 years ago)
Author:
saxmatt
Message:

Fixes from Josh.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-blog-header.php

    r1245 r1246  
    11<?php
    22
    3 /* Including config and functions files */
    43$curpath = dirname(__FILE__).'/';
    54
    65if (!file_exists($curpath . '/wp-config.php'))
    7     die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='wp-admin/install-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
     6    die(__("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='wp-admin/install-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file."));
    87
    98require_once($curpath . '/wp-config.php');
    109
    11 /* Process PATH_INFO, if set. */
     10// Process PATH_INFO, if set.
    1211$path_info = array();
    1312if (! empty($_SERVER['PATH_INFO'])) {
     
    7170
    7271
    73 /* Sending HTTP headers */
     72// Sending HTTP headers
    7473
    7574if (!isset($doing_rss) || !$doing_rss) {
     
    104103}
    105104
    106 /* Getting settings from db */
     105// Getting settings from DB
    107106if (isset($doing_rss) && $doing_rss == 1)
    108107    $posts_per_page=get_settings('posts_per_rss');
     
    113112$use_gzipcompression = get_settings('gzipcompression');
    114113
    115 /* First let's clear some variables */
     114// First let's clear some variables
    116115$whichcat = '';
    117116$whichauthor = '';
     
    189188}
    190189
    191 // if a post number is specified, load that post
     190// If a post number is specified, load that post
    192191if (($p != '') && ($p != 'all')) {
    193192    $p = intval($p);
     
    195194}
    196195
    197 // if a search pattern is specified, load the posts that match
     196// If a search pattern is specified, load the posts that match
    198197if (!empty($s)) {
    199198    $s = addslashes_gpc($s);
    200199    $search = ' AND (';
    201     // puts spaces instead of commas
    202     $s = preg_replace('/, +/', '', $s);
     200    $s = preg_replace('/, +/', ' ', $s);
    203201    $s = str_replace(',', ' ', $s);
    204202    $s = str_replace('"', ' ', $s);
     
    222220}
    223221
    224 // category stuff
     222// Category stuff
    225223$dogs = $wpdb->get_results("SELECT * FROM $tablecategories WHERE 1=1");
    226224foreach ($dogs as $catt) {
     
    261259    $whichcat .= ')';
    262260    if ($eq == '!=') {
    263         $cat = '-'.$cat; //put back the knowledge that we are excluding a category.
     261        $cat = '-'.$cat; // Put back the knowledge that we are excluding a category.
    264262    }
    265263}
     
    271269        $category_name = explode('/',$category_name);
    272270        if ($category_name[count($category_name)-1]) {
    273         $category_name = $category_name[count($category_name)-1];#no trailing slash
     271        $category_name = $category_name[count($category_name)-1]; // no trailing slash
    274272        } else {
    275         $category_name = $category_name[count($category_name)-2];#there was a trailling slash
    276         }
    277     }
    278     $category_name = preg_replace('|[^a-z0-9-]|', '', $category_name);
     273        $category_name = $category_name[count($category_name)-2]; // there was a trailling slash
     274        }
     275    }
     276    $category_name = preg_replace('|[^a-z0-9-]|i', '', $category_name);
    279277    $tables = ", $tablepost2cat, $tablecategories";
    280278    $join = " LEFT JOIN $tablepost2cat ON ($tableposts.ID = $tablepost2cat.post_id) LEFT JOIN $tablecategories ON ($tablepost2cat.category_id = $tablecategories.cat_ID) ";
     
    286284
    287285// Author/user stuff
    288 $users = $wpdb->get_results("SELECT * FROM $tableusers WHERE 1=1");
     286$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level > 0");
    289287foreach ($users as $user) {
    290288    $cache_userdata[$user->ID] = $user;
     
    335333}
    336334
    337 // order by stuff
     335// Order by
    338336if (empty($orderby)) {
    339337    $orderby='date '.$order;
    340338} else {
    341     // used to filter values
     339    // Used to filter values
    342340    $allowed_keys = array('author','date','category','title');
    343341    $orderby = urldecode($orderby);
     
    521519        }
    522520    }
    523 } // end if posts.
     521} // End if posts.
    524522?>
Note: See TracChangeset for help on using the changeset viewer.