557 } |
557 } |
558 |
558 |
559 /** |
559 /** |
560 * Prints out the categorization box found on most regular pages. Doesn't take or return anything, but assumes that the page information is already set in $paths. |
560 * Prints out the categorization box found on most regular pages. Doesn't take or return anything, but assumes that the page information is already set in $paths. |
561 */ |
561 */ |
562 |
|
563 /* |
|
564 function show_category_info() |
|
565 { |
|
566 global $db, $session, $paths, $template, $plugins; // Common objects |
|
567 dc_here('functions: showing category info'); |
|
568 // if($template->no_headers && !strpos($_SERVER['REQUEST_URI'], 'ajax.php')) return ''; |
|
569 if ( $paths->namespace == 'Category' ) |
|
570 { |
|
571 $q = $db->sql_query('SELECT page_id,namespace FROM '.table_prefix.'categories WHERE category_id=\''.$paths->cpage['urlname_nons'].'\' AND namespace=\'Category\' ORDER BY page_id;'); |
|
572 if(!$q) $db->_die('The category information could not be selected.'); |
|
573 $ticker = -1; |
|
574 echo '<h3>Subcategories</h3>'; |
|
575 if($db->numrows() < 1) echo '<p>There are no subcategories in this category.</p>'; |
|
576 echo '<table border="0" cellspacing="1" cellpadding="4">'; |
|
577 while($row = $db->fetchrow()) |
|
578 { |
|
579 $ticker++; |
|
580 if ( $ticker == 3 ) |
|
581 { |
|
582 $ticker = 0; |
|
583 } |
|
584 if ( $ticker == 0 ) |
|
585 { |
|
586 echo '<tr>'; |
|
587 } |
|
588 echo '<td style="width: 200px;"><a href="' . makeUrlNS($row['namespace'], $row['page_id']) . '">' . htmlspecialchars($paths->pages[$paths->nslist[$row['namespace']].$row['page_id']]['name']) . '</a></td>'; |
|
589 if ( $ticker == 2 ) |
|
590 { |
|
591 echo '</tr>'; |
|
592 } |
|
593 } |
|
594 $db->free_result(); |
|
595 if($ticker) echo '</tr>'; |
|
596 echo '</table>'; |
|
597 |
|
598 $q = $db->sql_query('SELECT page_id,namespace FROM '.table_prefix.'categories WHERE category_id=\''.$paths->cpage['urlname_nons'].'\' AND namespace!=\'Category\' ORDER BY page_id;'); |
|
599 if ( !$q ) |
|
600 { |
|
601 $db->_die('The category information could not be selected.'); |
|
602 } |
|
603 $ticker = -1; |
|
604 echo '<h3>Pages</h3>'; |
|
605 if ( $db->numrows() < 1 ) |
|
606 { |
|
607 echo '<p>There are no pages in this category.</p>'; |
|
608 } |
|
609 echo '<table border="0" cellspacing="1" cellpadding="4">'; |
|
610 while($row = $db->fetchrow()) |
|
611 { |
|
612 $ticker += ( $ticker == 3 ) ? -3 : 1; |
|
613 if ( $ticker == 0 ) |
|
614 { |
|
615 echo '<tr>'; |
|
616 } |
|
617 echo '<td style="width: 200px;"><a href="'.makeUrlNS($row['namespace'], $row['page_id']).'">'.htmlspecialchars($paths->pages[$paths->nslist[$row['namespace']].$row['page_id']]['name']).'</a></td>'; |
|
618 if ( $ticker == 2 ) |
|
619 { |
|
620 echo '</tr>'; |
|
621 } |
|
622 } |
|
623 $db->free_result(); |
|
624 if($ticker) echo '</tr>'; |
|
625 echo '</table><br /><br />'; |
|
626 } |
|
627 $q = $db->sql_query('SELECT category_id FROM '.table_prefix.'categories WHERE page_id=\''.$paths->cpage['urlname_nons'].'\' AND namespace=\''.$paths->namespace.'\''); |
|
628 if(!$q) $db->_die('The error seems to have occurred during selection of category data.'); |
|
629 if($db->numrows() > 0) { |
|
630 echo '<div class="mdg-comment" style="margin-left: 0;">Categories: '; |
|
631 $i=0; |
|
632 while($r = $db->fetchrow()) |
|
633 { |
|
634 if($i>0) echo ', '; |
|
635 $i++; |
|
636 echo '<a href="'.makeUrlNS('Category', $r['category_id']).'">'.$paths->pages[$paths->nslist['Category'].$r['category_id']]['name'].'</a>'; |
|
637 } |
|
638 if( ( $paths->wiki_mode && !$paths->page_protected ) || ( $session->get_permissions('edit_cat') && $session->get_permissions('even_when_protected') ) ) echo ' [ <a href="'.makeUrl($paths->page, 'do=catedit', true).'" onclick="ajaxCatEdit(); return false;">edit categorization</a> ]</div>'; |
|
639 } |
|
640 else |
|
641 { |
|
642 echo '<div class="mdg-comment" style="margin-left: 0;">Categories: '; |
|
643 echo '(Uncategorized)'; |
|
644 if( ( $paths->wiki_mode && !$paths->page_protected ) || ( $session->get_permissions('edit_cat') && $session->get_permissions('even_when_protected') ) ) echo ' [ <a href="'.makeUrl($paths->page, 'do=catedit', true).'" onclick="ajaxCatEdit(); return false;">edit categorization</a> ]</div>'; |
|
645 else echo '</div>'; |
|
646 } |
|
647 $db->free_result(); |
|
648 } |
|
649 */ |
|
650 |
562 |
651 function show_category_info() |
563 function show_category_info() |
652 { |
564 { |
653 global $db, $session, $paths, $template, $plugins; // Common objects |
565 global $db, $session, $paths, $template, $plugins; // Common objects |
654 global $lang; |
566 global $lang; |