198 </form> |
198 </form> |
199 <?php |
199 <?php |
200 $template->footer(); |
200 $template->footer(); |
201 } |
201 } |
202 |
202 |
|
203 function PagelistingFormatter($id, $row) |
|
204 { |
|
205 global $db, $session, $paths, $template, $plugins; // Common objects |
|
206 static $rowtracker = 0; |
|
207 static $tdclass = 'row2'; |
|
208 static $per_row = 2; |
|
209 $return = ''; |
|
210 if ( $crap === false && $row === false ) |
|
211 { |
|
212 $rowtracker = 0; |
|
213 return false; |
|
214 } |
|
215 $rowtracker++; |
|
216 if ( $rowtracker == $per_row ) |
|
217 { |
|
218 $rowtracker = 0; |
|
219 $tdclass = ( $tdclass == 'row2' ) ? 'row1' : 'row2'; |
|
220 } |
|
221 |
|
222 preg_match('/^ns=(' . implode('|', array_keys($paths->nslist)) . ');pid=(.*?)$/i', $id, $match); |
|
223 $namespace =& $match[1]; |
|
224 $page_id =& $match[2]; |
|
225 $page_id = sanitize_page_id($page_id); |
|
226 |
|
227 $url = makeUrlNS($namespace, $page_id); |
|
228 $url = htmlspecialchars($url); |
|
229 |
|
230 $link = '<a href="' . $url . '">' . htmlspecialchars($row['name']) . '</a>'; |
|
231 $td = '<td class="' . $tdclass . '" style="width: 50%;">' . $link . '</td>'; |
|
232 |
|
233 $return .= $td; |
|
234 |
|
235 if ( $rowtracker == ($per_row - 1) ) |
|
236 $return .= "</tr>\n<tr>"; |
|
237 |
|
238 return $return; |
|
239 } |
|
240 |
203 function page_Special_AllPages() |
241 function page_Special_AllPages() |
204 { |
242 { |
205 // This should be an easy one |
243 // This should be an easy one |
206 global $db, $session, $paths, $template, $plugins; // Common objects |
244 global $db, $session, $paths, $template, $plugins; // Common objects |
207 $template->header(); |
245 $template->header(); |
208 $sz = sizeof( $paths->pages ) / 2; |
246 $sz = sizeof( $paths->pages ) / 2; |
209 echo '<p>Below is a list of all of the pages on this website.</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">'; |
247 echo '<p>Below is a list of all of the pages on this website.</p>'; |
210 $cclass = 'row1'; |
248 |
211 for ( $i = 0; $i < $sz; $i = $i ) |
249 $q = $db->sql_query('SELECT COUNT(urlname) FROM '.table_prefix.'pages WHERE visible!=0;'); |
212 { |
250 if ( !$q ) |
213 if ( $cclass == 'row1') |
251 $db->_die(); |
214 { |
252 $row = $db->fetchrow_num(); |
215 $cclass='row3'; |
253 $count = $row[0]; |
216 } |
254 $db->free_result(); |
217 else if ( $cclass == 'row3') |
255 |
218 { |
256 $q = $db->sql_unbuffered_query('SELECT CONCAT("ns=",namespace,";pid=",urlname) AS identifier, name FROM '.table_prefix.'pages WHERE visible!=0 ORDER BY name ASC;'); |
219 $cclass='row1'; |
257 if ( !$q ) |
220 } |
258 $db->_die(); |
221 echo '<tr>'; |
259 |
222 for ( $j = 0; $j < 2; $j = $j ) |
260 $offset = ( isset($_GET['offset']) ) ? intval($_GET['offset']) : 0; |
223 { |
261 |
224 if ( $i < $sz && $paths->pages[$i]['namespace'] != 'Special' && $paths->pages[$i]['namespace'] != 'Admin' && $paths->pages[$i]['visible'] == 1) |
262 // reset formatter |
225 { |
263 PagelistingFormatter(false, false); |
226 echo '<td style="width: 50%" class="'.$cclass.'"><a href="'.makeUrl($paths->pages[$i]['urlname']).'">'; |
264 |
227 if ( $paths->pages[$i]['namespace'] != 'Article' ) |
265 $result = paginate( |
228 { |
266 $q, // result resource |
229 echo '('.$paths->pages[$i]['namespace'].') '; |
267 '{identifier}', // formatting template |
230 } |
268 $count, // # of results |
231 echo $paths->pages[$i]['name'].'</a></td>'; |
269 makeUrlNS('Special', 'AllPages', 'offset=%s'), // result URL |
232 $j++; |
270 $offset, // start offset |
233 } |
271 40, // results per page |
234 else if ( $i >= $sz ) |
272 array( 'identifier' => 'PagelistingFormatter' ), // hooks |
235 { |
273 '<div class="tblholder"> |
236 echo '<td style="width: 50%" class="row2"></td>'; |
274 <table border="0" cellspacing="1" cellpadding="4"> |
237 $j++; |
275 <tr>', // print at start |
238 } |
276 ' </tr> |
239 $i++; |
277 </table> |
240 } |
278 </div>' // print at end |
241 echo '</tr>'; |
279 ); |
242 } |
280 |
243 echo '</table></div>'; |
281 echo $result; |
|
282 |
244 $template->footer(); |
283 $template->footer(); |
245 } |
284 } |
246 |
285 |
247 function page_Special_SpecialPages() |
286 function page_Special_SpecialPages() |
248 { |
287 { |