--- classes-old.php 2005-12-22 16:52:23.000000000 -0500 +++ classes.php 2005-12-22 16:49:32.000000000 -0500 @@ -80,7 +80,7 @@ $this->query_vars = $qv; } - if ('404' == $qv['error']) { + if ((isset($qv['error'])) && ('404' == $qv['error'])) { $this->is_404 = true; if ( !empty($query) ) { do_action('parse_query', array(&$this)); @@ -88,32 +88,32 @@ return; } - $qv['m'] = (int) $qv['m']; - $qv['p'] = (int) $qv['p']; + $qv['m'] = (int) isset($qv['m']); + $qv['p'] = (int) isset($qv['p']); // Compat. Map subpost to attachment. - if ( '' != $qv['subpost'] ) + if (isset($qv['subpost'])) $qv['attachment'] = $qv['subpost']; - if ( '' != $qv['subpost_id'] ) + if (isset($qv['subpost_id'])) $qv['attachment_id'] = $qv['subpost_id']; - if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) { + if ((isset($qv['attachment'])) || (int) isset($qv['attachment_id'])) { $this->is_single = true; $this->is_attachment = true; - } elseif ('' != $qv['name']) { + } elseif (isset($qv['name'])) { $this->is_single = true; } elseif ( $qv['p'] ) { $this->is_single = true; - } elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) { + } elseif ((isset($qv['hour'])) && (isset($qv['minute'])) && (isset($qv['second'])) && (isset($qv['year'])) && (isset($qv['monthnum'])) && (isset($qv['day']))) { // If year, month, day, hour, minute, and second are set, a single // post is being queried. $this->is_single = true; - } elseif ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) { + } elseif (isset($qv['static']) || isset($qv['pagename']) || isset($qv['page_id'])) { $this->is_page = true; $this->is_single = false; } elseif (!empty($qv['s'])) { $this->is_search = true; - switch ($qv['show_post_type']) { + switch (isset($qv['show_post_type'])) { case 'page' : $this->is_page = true; break; @@ -124,43 +124,43 @@ } else { // Look for archive queries. Dates, categories, authors. - if ( (int) $qv['second']) { + if ( (int) isset($qv['second'])) { $this->is_time = true; $this->is_date = true; } - if ( (int) $qv['minute']) { + if ( (int) isset($qv['minute'])) { $this->is_time = true; $this->is_date = true; } - if ( (int) $qv['hour']) { + if ( (int) isset($qv['hour'])) { $this->is_time = true; $this->is_date = true; } - if ( (int) $qv['day']) { + if ( (int) isset($qv['day'])) { if (! $this->is_date) { $this->is_day = true; $this->is_date = true; } } - if ( (int) $qv['monthnum']) { + if ( (int) isset($qv['monthnum'])) { if (! $this->is_date) { $this->is_month = true; $this->is_date = true; } } - if ( (int) $qv['year']) { + if ( (int) isset($qv['year'])) { if (! $this->is_date) { $this->is_year = true; $this->is_date = true; } } - if ( (int) $qv['m']) { + if ( (int) isset($qv['m'])) { $this->is_date = true; if (strlen($qv['m']) > 9) { $this->is_time = true; @@ -173,7 +173,7 @@ } } - if ('' != $qv['w']) { + if (isset($qv['w'])) { $this->is_date = true; } @@ -187,7 +187,7 @@ } } - if ('' != $qv['category_name']) { + if (isset($qv['category_name'])) { $this->is_category = true; } @@ -197,7 +197,7 @@ $this->is_author = true; } - if ('' != $qv['author_name']) { + if (isset($qv['author_name'])) { $this->is_author = true; } @@ -205,24 +205,24 @@ $this->is_archive = true; } - if ( 'attachment' == $qv['show_post_type'] ) { + if ( 'attachment' == isset($qv['show_post_type']) ) { $this->is_attachment = true; } } - if ('' != $qv['feed']) { + if (isset($qv['feed'])) { $this->is_feed = true; } - if ('' != $qv['tb']) { + if (isset($qv['tb'])) { $this->is_trackback = true; } - if ('' != $qv['paged']) { + if (isset($qv['paged'])) { $this->is_paged = true; } - if ('' != $qv['comments_popup']) { + if (isset($qv['comments_popup'])) { $this->is_comments_popup = true; } @@ -306,7 +306,7 @@ $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; // If a month is specified in the querystring, load that month - if ( (int) $q['m'] ) { + if ( (int) isset($q['m']) ) { $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']); $where .= ' AND YEAR(post_date)=' . substr($q['m'], 0, 4); if (strlen($q['m'])>5) @@ -321,46 +321,46 @@ $where .= ' AND SECOND(post_date)=' . substr($q['m'], 12, 2); } - if ( (int) $q['hour'] ) { + if ( (int) isset($q['hour']) ) { $q['hour'] = '' . intval($q['hour']); $where .= " AND HOUR(post_date)='" . $q['hour'] . "'"; } - if ( (int) $q['minute'] ) { + if ( (int) isset($q['minute']) ) { $q['minute'] = '' . intval($q['minute']); $where .= " AND MINUTE(post_date)='" . $q['minute'] . "'"; } - if ( (int) $q['second'] ) { + if ( (int) isset($q['second']) ) { $q['second'] = '' . intval($q['second']); $where .= " AND SECOND(post_date)='" . $q['second'] . "'"; } - if ( (int) $q['year'] ) { + if ( (int) isset($q['year']) ) { $q['year'] = '' . intval($q['year']); $where .= " AND YEAR(post_date)='" . $q['year'] . "'"; } - if ( (int) $q['monthnum'] ) { + if ( (int) isset($q['monthnum']) ) { $q['monthnum'] = '' . intval($q['monthnum']); $where .= " AND MONTH(post_date)='" . $q['monthnum'] . "'"; } - if ( (int) $q['day'] ) { + if ( (int) isset($q['day']) ) { $q['day'] = '' . intval($q['day']); $where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'"; } // Compat. Map subpost to attachment. - if ( '' != $q['subpost'] ) + if (isset($q['subpost']) ) $q['attachment'] = $q['subpost']; - if ( '' != $q['subpost_id'] ) + if (isset($q['subpost_id']) ) $q['attachment_id'] = $q['subpost_id']; - if ('' != $q['name']) { + if (isset($q['name'])) { $q['name'] = sanitize_title($q['name']); $where .= " AND post_name = '" . $q['name'] . "'"; - } else if ('' != $q['pagename']) { + } else if (isset($q['pagename'])) { $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename']))); $page_paths = '/' . trim($q['pagename'], '/'); $q['pagename'] = sanitize_title(basename($page_paths)); @@ -380,31 +380,31 @@ } $where .= " AND (ID = '$reqpage')"; - } elseif ('' != $q['attachment']) { + } elseif (isset($q['attachment'])) { $q['attachment'] = sanitize_title($q['attachment']); $q['name'] = $q['attachment']; $where .= " AND post_name = '" . $q['attachment'] . "'"; } - if ( (int) $q['w'] ) { + if ( (int) isset($q['w']) ) { $q['w'] = ''.intval($q['w']); $where .= " AND WEEK(post_date, 1)='" . $q['w'] . "'"; } - if ( intval($q['comments_popup']) ) + if ( intval(isset($q['comments_popup'])) ) $q['p'] = intval($q['comments_popup']); // If a attachment is requested by number, let it supercede any post number. - if ( ($q['attachment_id'] != '') && (intval($q['attachment_id']) != 0) ) + if ( (isset($q['attachment_id'])) && (intval($q['attachment_id']) != 0) ) $q['p'] = (int) $q['attachment_id']; // If a post number is specified, load that post - if (($q['p'] != '') && intval($q['p']) != 0) { + if ((isset($q['p'])) && intval($q['p']) != 0) { $q['p'] = (int) $q['p']; $where = ' AND ID = ' . $q['p']; } - if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) { + if ((isset($q['page_id'])) && (intval($q['page_id']) != 0)) { $q['page_id'] = intval($q['page_id']); $q['p'] = $q['page_id']; $where = ' AND ID = '.$q['page_id']; @@ -418,12 +418,12 @@ $q['s'] = str_replace(',', ' ', $q['s']); $q['s'] = str_replace('"', ' ', $q['s']); $q['s'] = trim($q['s']); - if ($q['exact']) { + if (isset($q['exact'])) { $n = ''; } else { $n = '%'; } - if (!$q['sentence']) { + if (!isset($q['sentence'])) { $s_array = explode(' ',$q['s']); $q['search_terms'] = $s_array; $search .= '((post_title LIKE \''.$n.$s_array[0].$n.'\') OR (post_content LIKE \''.$n.$s_array[0].$n.'\'))'; @@ -475,7 +475,7 @@ // Category stuff for nice URIs global $cache_categories; - if ('' != $q['category_name']) { + if (isset($q['category_name'])) { $cat_paths = '/' . trim(urldecode($q['category_name']), '/'); $q['category_name'] = sanitize_title(basename($cat_paths)); $cat_paths = explode('/', $cat_paths); @@ -525,7 +525,7 @@ // Author stuff for nice URIs - if ('' != $q['author_name']) { + if (isset($q['author_name'])) { if (stristr($q['author_name'],'/')) { $q['author_name'] = explode('/',$q['author_name']); if ($q['author_name'][count($q['author_name'])-1]) { @@ -539,7 +539,11 @@ $whichauthor .= ' AND (post_author = '.intval($q['author']).')'; } - $where .= $search.$whichcat.$whichauthor; + if (isset($search)) { + $where .= $search.$whichcat.$whichauthor; + } else { + $where .= $whichcat.$whichauthor; + } if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) { $q['order']='DESC'; @@ -602,7 +606,7 @@ // Paging if (empty($q['nopaging']) && ! $this->is_single) { - $page = $q['paged']; + $page = isset($q['paged']); if (empty($page)) { $page = 1; }