1 | --- classes-old.php 2005-12-22 16:52:23.000000000 -0500 |
---|
2 | +++ classes.php 2005-12-22 16:49:32.000000000 -0500 |
---|
3 | @@ -80,7 +80,7 @@ |
---|
4 | $this->query_vars = $qv; |
---|
5 | } |
---|
6 | |
---|
7 | - if ('404' == $qv['error']) { |
---|
8 | + if ((isset($qv['error'])) && ('404' == $qv['error'])) { |
---|
9 | $this->is_404 = true; |
---|
10 | if ( !empty($query) ) { |
---|
11 | do_action('parse_query', array(&$this)); |
---|
12 | @@ -88,32 +88,32 @@ |
---|
13 | return; |
---|
14 | } |
---|
15 | |
---|
16 | - $qv['m'] = (int) $qv['m']; |
---|
17 | - $qv['p'] = (int) $qv['p']; |
---|
18 | + $qv['m'] = (int) isset($qv['m']); |
---|
19 | + $qv['p'] = (int) isset($qv['p']); |
---|
20 | |
---|
21 | // Compat. Map subpost to attachment. |
---|
22 | - if ( '' != $qv['subpost'] ) |
---|
23 | + if (isset($qv['subpost'])) |
---|
24 | $qv['attachment'] = $qv['subpost']; |
---|
25 | - if ( '' != $qv['subpost_id'] ) |
---|
26 | + if (isset($qv['subpost_id'])) |
---|
27 | $qv['attachment_id'] = $qv['subpost_id']; |
---|
28 | |
---|
29 | - if ( ('' != $qv['attachment']) || (int) $qv['attachment_id'] ) { |
---|
30 | + if ((isset($qv['attachment'])) || (int) isset($qv['attachment_id'])) { |
---|
31 | $this->is_single = true; |
---|
32 | $this->is_attachment = true; |
---|
33 | - } elseif ('' != $qv['name']) { |
---|
34 | + } elseif (isset($qv['name'])) { |
---|
35 | $this->is_single = true; |
---|
36 | } elseif ( $qv['p'] ) { |
---|
37 | $this->is_single = true; |
---|
38 | - } elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) { |
---|
39 | + } elseif ((isset($qv['hour'])) && (isset($qv['minute'])) && (isset($qv['second'])) && (isset($qv['year'])) && (isset($qv['monthnum'])) && (isset($qv['day']))) { |
---|
40 | // If year, month, day, hour, minute, and second are set, a single |
---|
41 | // post is being queried. |
---|
42 | $this->is_single = true; |
---|
43 | - } elseif ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) { |
---|
44 | + } elseif (isset($qv['static']) || isset($qv['pagename']) || isset($qv['page_id'])) { |
---|
45 | $this->is_page = true; |
---|
46 | $this->is_single = false; |
---|
47 | } elseif (!empty($qv['s'])) { |
---|
48 | $this->is_search = true; |
---|
49 | - switch ($qv['show_post_type']) { |
---|
50 | + switch (isset($qv['show_post_type'])) { |
---|
51 | case 'page' : |
---|
52 | $this->is_page = true; |
---|
53 | break; |
---|
54 | @@ -124,43 +124,43 @@ |
---|
55 | } else { |
---|
56 | // Look for archive queries. Dates, categories, authors. |
---|
57 | |
---|
58 | - if ( (int) $qv['second']) { |
---|
59 | + if ( (int) isset($qv['second'])) { |
---|
60 | $this->is_time = true; |
---|
61 | $this->is_date = true; |
---|
62 | } |
---|
63 | |
---|
64 | - if ( (int) $qv['minute']) { |
---|
65 | + if ( (int) isset($qv['minute'])) { |
---|
66 | $this->is_time = true; |
---|
67 | $this->is_date = true; |
---|
68 | } |
---|
69 | |
---|
70 | - if ( (int) $qv['hour']) { |
---|
71 | + if ( (int) isset($qv['hour'])) { |
---|
72 | $this->is_time = true; |
---|
73 | $this->is_date = true; |
---|
74 | } |
---|
75 | |
---|
76 | - if ( (int) $qv['day']) { |
---|
77 | + if ( (int) isset($qv['day'])) { |
---|
78 | if (! $this->is_date) { |
---|
79 | $this->is_day = true; |
---|
80 | $this->is_date = true; |
---|
81 | } |
---|
82 | } |
---|
83 | |
---|
84 | - if ( (int) $qv['monthnum']) { |
---|
85 | + if ( (int) isset($qv['monthnum'])) { |
---|
86 | if (! $this->is_date) { |
---|
87 | $this->is_month = true; |
---|
88 | $this->is_date = true; |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | - if ( (int) $qv['year']) { |
---|
93 | + if ( (int) isset($qv['year'])) { |
---|
94 | if (! $this->is_date) { |
---|
95 | $this->is_year = true; |
---|
96 | $this->is_date = true; |
---|
97 | } |
---|
98 | } |
---|
99 | |
---|
100 | - if ( (int) $qv['m']) { |
---|
101 | + if ( (int) isset($qv['m'])) { |
---|
102 | $this->is_date = true; |
---|
103 | if (strlen($qv['m']) > 9) { |
---|
104 | $this->is_time = true; |
---|
105 | @@ -173,7 +173,7 @@ |
---|
106 | } |
---|
107 | } |
---|
108 | |
---|
109 | - if ('' != $qv['w']) { |
---|
110 | + if (isset($qv['w'])) { |
---|
111 | $this->is_date = true; |
---|
112 | } |
---|
113 | |
---|
114 | @@ -187,7 +187,7 @@ |
---|
115 | } |
---|
116 | } |
---|
117 | |
---|
118 | - if ('' != $qv['category_name']) { |
---|
119 | + if (isset($qv['category_name'])) { |
---|
120 | $this->is_category = true; |
---|
121 | } |
---|
122 | |
---|
123 | @@ -197,7 +197,7 @@ |
---|
124 | $this->is_author = true; |
---|
125 | } |
---|
126 | |
---|
127 | - if ('' != $qv['author_name']) { |
---|
128 | + if (isset($qv['author_name'])) { |
---|
129 | $this->is_author = true; |
---|
130 | } |
---|
131 | |
---|
132 | @@ -205,24 +205,24 @@ |
---|
133 | $this->is_archive = true; |
---|
134 | } |
---|
135 | |
---|
136 | - if ( 'attachment' == $qv['show_post_type'] ) { |
---|
137 | + if ( 'attachment' == isset($qv['show_post_type']) ) { |
---|
138 | $this->is_attachment = true; |
---|
139 | } |
---|
140 | } |
---|
141 | |
---|
142 | - if ('' != $qv['feed']) { |
---|
143 | + if (isset($qv['feed'])) { |
---|
144 | $this->is_feed = true; |
---|
145 | } |
---|
146 | |
---|
147 | - if ('' != $qv['tb']) { |
---|
148 | + if (isset($qv['tb'])) { |
---|
149 | $this->is_trackback = true; |
---|
150 | } |
---|
151 | |
---|
152 | - if ('' != $qv['paged']) { |
---|
153 | + if (isset($qv['paged'])) { |
---|
154 | $this->is_paged = true; |
---|
155 | } |
---|
156 | |
---|
157 | - if ('' != $qv['comments_popup']) { |
---|
158 | + if (isset($qv['comments_popup'])) { |
---|
159 | $this->is_comments_popup = true; |
---|
160 | } |
---|
161 | |
---|
162 | @@ -306,7 +306,7 @@ |
---|
163 | $wp_posts_post_date_field = "post_date"; // "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; |
---|
164 | |
---|
165 | // If a month is specified in the querystring, load that month |
---|
166 | - if ( (int) $q['m'] ) { |
---|
167 | + if ( (int) isset($q['m']) ) { |
---|
168 | $q['m'] = '' . preg_replace('|[^0-9]|', '', $q['m']); |
---|
169 | $where .= ' AND YEAR(post_date)=' . substr($q['m'], 0, 4); |
---|
170 | if (strlen($q['m'])>5) |
---|
171 | @@ -321,46 +321,46 @@ |
---|
172 | $where .= ' AND SECOND(post_date)=' . substr($q['m'], 12, 2); |
---|
173 | } |
---|
174 | |
---|
175 | - if ( (int) $q['hour'] ) { |
---|
176 | + if ( (int) isset($q['hour']) ) { |
---|
177 | $q['hour'] = '' . intval($q['hour']); |
---|
178 | $where .= " AND HOUR(post_date)='" . $q['hour'] . "'"; |
---|
179 | } |
---|
180 | |
---|
181 | - if ( (int) $q['minute'] ) { |
---|
182 | + if ( (int) isset($q['minute']) ) { |
---|
183 | $q['minute'] = '' . intval($q['minute']); |
---|
184 | $where .= " AND MINUTE(post_date)='" . $q['minute'] . "'"; |
---|
185 | } |
---|
186 | |
---|
187 | - if ( (int) $q['second'] ) { |
---|
188 | + if ( (int) isset($q['second']) ) { |
---|
189 | $q['second'] = '' . intval($q['second']); |
---|
190 | $where .= " AND SECOND(post_date)='" . $q['second'] . "'"; |
---|
191 | } |
---|
192 | |
---|
193 | - if ( (int) $q['year'] ) { |
---|
194 | + if ( (int) isset($q['year']) ) { |
---|
195 | $q['year'] = '' . intval($q['year']); |
---|
196 | $where .= " AND YEAR(post_date)='" . $q['year'] . "'"; |
---|
197 | } |
---|
198 | |
---|
199 | - if ( (int) $q['monthnum'] ) { |
---|
200 | + if ( (int) isset($q['monthnum']) ) { |
---|
201 | $q['monthnum'] = '' . intval($q['monthnum']); |
---|
202 | $where .= " AND MONTH(post_date)='" . $q['monthnum'] . "'"; |
---|
203 | } |
---|
204 | |
---|
205 | - if ( (int) $q['day'] ) { |
---|
206 | + if ( (int) isset($q['day']) ) { |
---|
207 | $q['day'] = '' . intval($q['day']); |
---|
208 | $where .= " AND DAYOFMONTH(post_date)='" . $q['day'] . "'"; |
---|
209 | } |
---|
210 | |
---|
211 | // Compat. Map subpost to attachment. |
---|
212 | - if ( '' != $q['subpost'] ) |
---|
213 | + if (isset($q['subpost']) ) |
---|
214 | $q['attachment'] = $q['subpost']; |
---|
215 | - if ( '' != $q['subpost_id'] ) |
---|
216 | + if (isset($q['subpost_id']) ) |
---|
217 | $q['attachment_id'] = $q['subpost_id']; |
---|
218 | |
---|
219 | - if ('' != $q['name']) { |
---|
220 | + if (isset($q['name'])) { |
---|
221 | $q['name'] = sanitize_title($q['name']); |
---|
222 | $where .= " AND post_name = '" . $q['name'] . "'"; |
---|
223 | - } else if ('' != $q['pagename']) { |
---|
224 | + } else if (isset($q['pagename'])) { |
---|
225 | $q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename']))); |
---|
226 | $page_paths = '/' . trim($q['pagename'], '/'); |
---|
227 | $q['pagename'] = sanitize_title(basename($page_paths)); |
---|
228 | @@ -380,31 +380,31 @@ |
---|
229 | } |
---|
230 | |
---|
231 | $where .= " AND (ID = '$reqpage')"; |
---|
232 | - } elseif ('' != $q['attachment']) { |
---|
233 | + } elseif (isset($q['attachment'])) { |
---|
234 | $q['attachment'] = sanitize_title($q['attachment']); |
---|
235 | $q['name'] = $q['attachment']; |
---|
236 | $where .= " AND post_name = '" . $q['attachment'] . "'"; |
---|
237 | } |
---|
238 | |
---|
239 | - if ( (int) $q['w'] ) { |
---|
240 | + if ( (int) isset($q['w']) ) { |
---|
241 | $q['w'] = ''.intval($q['w']); |
---|
242 | $where .= " AND WEEK(post_date, 1)='" . $q['w'] . "'"; |
---|
243 | } |
---|
244 | |
---|
245 | - if ( intval($q['comments_popup']) ) |
---|
246 | + if ( intval(isset($q['comments_popup'])) ) |
---|
247 | $q['p'] = intval($q['comments_popup']); |
---|
248 | |
---|
249 | // If a attachment is requested by number, let it supercede any post number. |
---|
250 | - if ( ($q['attachment_id'] != '') && (intval($q['attachment_id']) != 0) ) |
---|
251 | + if ( (isset($q['attachment_id'])) && (intval($q['attachment_id']) != 0) ) |
---|
252 | $q['p'] = (int) $q['attachment_id']; |
---|
253 | |
---|
254 | // If a post number is specified, load that post |
---|
255 | - if (($q['p'] != '') && intval($q['p']) != 0) { |
---|
256 | + if ((isset($q['p'])) && intval($q['p']) != 0) { |
---|
257 | $q['p'] = (int) $q['p']; |
---|
258 | $where = ' AND ID = ' . $q['p']; |
---|
259 | } |
---|
260 | |
---|
261 | - if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) { |
---|
262 | + if ((isset($q['page_id'])) && (intval($q['page_id']) != 0)) { |
---|
263 | $q['page_id'] = intval($q['page_id']); |
---|
264 | $q['p'] = $q['page_id']; |
---|
265 | $where = ' AND ID = '.$q['page_id']; |
---|
266 | @@ -418,12 +418,12 @@ |
---|
267 | $q['s'] = str_replace(',', ' ', $q['s']); |
---|
268 | $q['s'] = str_replace('"', ' ', $q['s']); |
---|
269 | $q['s'] = trim($q['s']); |
---|
270 | - if ($q['exact']) { |
---|
271 | + if (isset($q['exact'])) { |
---|
272 | $n = ''; |
---|
273 | } else { |
---|
274 | $n = '%'; |
---|
275 | } |
---|
276 | - if (!$q['sentence']) { |
---|
277 | + if (!isset($q['sentence'])) { |
---|
278 | $s_array = explode(' ',$q['s']); |
---|
279 | $q['search_terms'] = $s_array; |
---|
280 | $search .= '((post_title LIKE \''.$n.$s_array[0].$n.'\') OR (post_content LIKE \''.$n.$s_array[0].$n.'\'))'; |
---|
281 | @@ -475,7 +475,7 @@ |
---|
282 | // Category stuff for nice URIs |
---|
283 | |
---|
284 | global $cache_categories; |
---|
285 | - if ('' != $q['category_name']) { |
---|
286 | + if (isset($q['category_name'])) { |
---|
287 | $cat_paths = '/' . trim(urldecode($q['category_name']), '/'); |
---|
288 | $q['category_name'] = sanitize_title(basename($cat_paths)); |
---|
289 | $cat_paths = explode('/', $cat_paths); |
---|
290 | @@ -525,7 +525,7 @@ |
---|
291 | |
---|
292 | // Author stuff for nice URIs |
---|
293 | |
---|
294 | - if ('' != $q['author_name']) { |
---|
295 | + if (isset($q['author_name'])) { |
---|
296 | if (stristr($q['author_name'],'/')) { |
---|
297 | $q['author_name'] = explode('/',$q['author_name']); |
---|
298 | if ($q['author_name'][count($q['author_name'])-1]) { |
---|
299 | @@ -539,7 +539,11 @@ |
---|
300 | $whichauthor .= ' AND (post_author = '.intval($q['author']).')'; |
---|
301 | } |
---|
302 | |
---|
303 | - $where .= $search.$whichcat.$whichauthor; |
---|
304 | + if (isset($search)) { |
---|
305 | + $where .= $search.$whichcat.$whichauthor; |
---|
306 | + } else { |
---|
307 | + $where .= $whichcat.$whichauthor; |
---|
308 | + } |
---|
309 | |
---|
310 | if ((empty($q['order'])) || ((strtoupper($q['order']) != 'ASC') && (strtoupper($q['order']) != 'DESC'))) { |
---|
311 | $q['order']='DESC'; |
---|
312 | @@ -602,7 +606,7 @@ |
---|
313 | |
---|
314 | // Paging |
---|
315 | if (empty($q['nopaging']) && ! $this->is_single) { |
---|
316 | - $page = $q['paged']; |
---|
317 | + $page = isset($q['paged']); |
---|
318 | if (empty($page)) { |
---|
319 | $page = 1; |
---|
320 | } |
---|