369 function render($incl_inner_headers = true, $_errormsg = false) |
369 function render($incl_inner_headers = true, $_errormsg = false) |
370 { |
370 { |
371 global $db, $session, $paths, $template, $plugins; // Common objects |
371 global $db, $session, $paths, $template, $plugins; // Common objects |
372 |
372 |
373 $text = $this->fetch_text(); |
373 $text = $this->fetch_text(); |
|
374 $text = preg_replace('/([\s]*)__NOBREADCRUMBS__([\s]*)/', '', $text); |
|
375 $text = preg_replace('/([\s]*)__NOTOC__([\s]*)/', '', $text); |
374 |
376 |
375 $redir_enabled = false; |
377 $redir_enabled = false; |
376 if ( preg_match('/^#redirect \[\[([^\]]+?)\]\]/i', $text, $match ) ) |
378 if ( preg_match('/^#redirect \[\[([^\]]+?)\]\]/i', $text, $match ) ) |
377 { |
379 { |
378 $redir_enabled = true; |
380 $redir_enabled = true; |
629 '<' => '<', |
632 '<' => '<', |
630 '>' => '>' |
633 '>' => '>' |
631 )); |
634 )); |
632 |
635 |
633 $target_username = preg_replace('/^' . preg_quote($paths->nslist['User']) . '/', '', $target_username); |
636 $target_username = preg_replace('/^' . preg_quote($paths->nslist['User']) . '/', '', $target_username); |
|
637 $target_username = explode('/', $target_username); |
|
638 $target_username = $target_username[0]; |
634 |
639 |
635 if ( ( $page_name == str_replace('_', ' ', $this->page_id) || $page_name == $paths->nslist['User'] . str_replace('_', ' ', $this->page_id) ) || !$this->page_exists ) |
640 if ( ( $page_name == str_replace('_', ' ', $this->page_id) || $page_name == $paths->nslist['User'] . str_replace('_', ' ', $this->page_id) ) || !$this->page_exists ) |
636 { |
641 { |
637 $page_name = "$target_username's user page"; |
642 $page_name = "$target_username's user page"; |
638 } |
643 } |
1042 |
1047 |
1043 function err_page_not_existent($userpage = false) |
1048 function err_page_not_existent($userpage = false) |
1044 { |
1049 { |
1045 global $db, $session, $paths, $template, $plugins; // Common objects |
1050 global $db, $session, $paths, $template, $plugins; // Common objects |
1046 |
1051 |
|
1052 header('HTTP/1.1 404 Not Found'); |
|
1053 |
1047 $this->header(); |
1054 $this->header(); |
1048 header('HTTP/1.1 404 Not Found'); |
1055 $this->do_breadcrumbs(); |
|
1056 |
1049 if ( $userpage ) |
1057 if ( $userpage ) |
1050 { |
1058 { |
1051 echo '<h3>There is no page with this title yet.</h3> |
1059 echo '<h3>There is no page with this title yet.</h3> |
1052 <p>This user has not created his or her user page yet.'; |
1060 <p>This user has not created his or her user page yet.'; |
1053 } |
1061 } |
1075 { |
1083 { |
1076 $r = $db->fetchrow(); |
1084 $r = $db->fetchrow(); |
1077 echo '<p><b>This page was deleted on ' . $r['date_string'] . '.</b> The stated reason was:</p><blockquote>' . $r['edit_summary'] . '</blockquote><p>You can probably <a href="'.makeUrl($paths->page, 'do=rollback&id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;">roll back</a> the deletion.</p>'; |
1085 echo '<p><b>This page was deleted on ' . $r['date_string'] . '.</b> The stated reason was:</p><blockquote>' . $r['edit_summary'] . '</blockquote><p>You can probably <a href="'.makeUrl($paths->page, 'do=rollback&id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;">roll back</a> the deletion.</p>'; |
1078 } |
1086 } |
1079 $db->free_result(); |
1087 $db->free_result(); |
|
1088 } |
|
1089 if ( $session->user_level >= USER_LEVEL_ADMIN ) |
|
1090 { |
|
1091 echo '<p>Additional admin options: <a href="' . makeUrl($paths->page, 'do=detag', true) . '" title="Remove any tags on this page">detag page</a></p>'; |
1080 } |
1092 } |
1081 echo '<p> |
1093 echo '<p> |
1082 HTTP Error: 404 Not Found |
1094 HTTP Error: 404 Not Found |
1083 </p>'; |
1095 </p>'; |
1084 $this->footer(); |
1096 $this->footer(); |
1085 } |
1097 } |
1086 |
1098 |
1087 /** |
1099 /** |
|
1100 * Echoes out breadcrumb data, if appropriate. |
|
1101 * @access private |
|
1102 */ |
|
1103 |
|
1104 function do_breadcrumbs() |
|
1105 { |
|
1106 global $db, $session, $paths, $template, $plugins; // Common objects |
|
1107 if ( strpos($this->text_cache, '__NOBREADCRUMBS__') !== false ) |
|
1108 return false; |
|
1109 $breadcrumb_data = explode('/', $this->page_id); |
|
1110 if ( count($breadcrumb_data) > 1 ) |
|
1111 { |
|
1112 echo '<!-- Start breadcrumbs --> |
|
1113 <div class="breadcrumbs"> |
|
1114 '; |
|
1115 foreach ( $breadcrumb_data as $i => $higherpage ) |
|
1116 { |
|
1117 $higherpage = $paths->nslist[$this->namespace] . sanitize_page_id(implode('/', array_slice($breadcrumb_data, 0, ($i+1)))); |
|
1118 if ( ($i + 1) == count($breadcrumb_data) ) |
|
1119 { |
|
1120 $title = get_page_title($higherpage, false); |
|
1121 if ( !$this->page_exists ) |
|
1122 { |
|
1123 $title = explode('/', $title); |
|
1124 $title = array_reverse($title); |
|
1125 $title = $title[0]; |
|
1126 } |
|
1127 echo htmlspecialchars($title); |
|
1128 break; |
|
1129 } |
|
1130 else if ( isPage($higherpage) ) |
|
1131 { |
|
1132 $title = get_page_title($higherpage, false); |
|
1133 echo '<a href="' . makeUrl($higherpage, false, true) . '">' . htmlspecialchars($title) . '</a>'; |
|
1134 } |
|
1135 else |
|
1136 { |
|
1137 $title = get_page_title($higherpage, false); |
|
1138 $title = explode('/', $title); |
|
1139 $title = array_reverse($title); |
|
1140 $title = $title[0]; |
|
1141 echo '<a href="' . makeUrl($higherpage, false, true) . '" class="wikilink-nonexistent">' . htmlspecialchars($title) . '</a>'; |
|
1142 } |
|
1143 echo ' » '; |
|
1144 } |
|
1145 echo '</div> |
|
1146 <!-- End breadcrumbs --> |
|
1147 '; |
|
1148 } |
|
1149 } |
|
1150 |
|
1151 /** |
1088 * PHP 4 constructor. |
1152 * PHP 4 constructor. |
1089 * @see PageProcessor::__construct() |
1153 * @see PageProcessor::__construct() |
1090 */ |
1154 */ |
1091 |
1155 |
1092 function PageProcessor( $page_id, $namespace, $revision_id = 0 ) |
1156 function PageProcessor( $page_id, $namespace, $revision_id = 0 ) |