69 function makeUrl($t, $query = false, $escape = false) |
69 function makeUrl($t, $query = false, $escape = false) |
70 { |
70 { |
71 global $db, $session, $paths, $template, $plugins; // Common objects |
71 global $db, $session, $paths, $template, $plugins; // Common objects |
72 $flags = ''; |
72 $flags = ''; |
73 $sep = urlSeparator; |
73 $sep = urlSeparator; |
|
74 $t = sanitize_page_id($t); |
74 if ( isset($_GET['printable'] ) ) |
75 if ( isset($_GET['printable'] ) ) |
75 { |
76 { |
76 $flags .= $sep . 'printable=yes'; |
77 $flags .= $sep . 'printable=yes'; |
77 $sep = '&'; |
78 $sep = '&'; |
78 } |
79 } |
224 } |
225 } |
225 |
226 |
226 /** |
227 /** |
227 * Tells you the title for the given page ID string |
228 * Tells you the title for the given page ID string |
228 * @param string Page ID string (ex: Special:Administration) |
229 * @param string Page ID string (ex: Special:Administration) |
|
230 * @param bool Optional. If true, and if the namespace turns out to be something other than Article, the namespace prefix will be prepended to the return value. |
229 * @return string |
231 * @return string |
230 */ |
232 */ |
231 |
233 |
232 function get_page_title($page_id) |
234 function get_page_title($page_id, $show_ns = true) |
233 { |
235 { |
234 global $db, $session, $paths, $template, $plugins; // Common objects |
236 global $db, $session, $paths, $template, $plugins; // Common objects |
235 |
237 |
236 $idata = RenderMan::strToPageID($page_id); |
238 $idata = RenderMan::strToPageID($page_id); |
237 $page_id_key = $paths->nslist[ $idata[1] ] . $idata[0]; |
239 $page_id_key = $paths->nslist[ $idata[1] ] . $idata[0]; |
|
240 $page_id_key = sanitize_page_id($page_id_key); |
238 $page_data = $paths->pages[$page_id_key]; |
241 $page_data = $paths->pages[$page_id_key]; |
239 $title = ( isset($page_data['name']) ) ? ( $page_data['namespace'] == 'Article' ? '' : $paths->nslist[ $idata[1] ] ) . $page_data['name'] : $paths->nslist[$idata[1]] . str_replace('_', ' ', dirtify_page_id( $idata[0] ) ); |
242 $title = ( isset($page_data['name']) ) ? |
|
243 ( ( $page_data['namespace'] == 'Article' || !$show_ns ) ? |
|
244 '' : |
|
245 $paths->nslist[ $idata[1] ] ) |
|
246 . $page_data['name'] : |
|
247 ( $show_ns ? $paths->nslist[$idata[1]] : '' ) . str_replace('_', ' ', dirtify_page_id( $idata[0] ) ); |
240 return $title; |
248 return $title; |
241 } |
249 } |
242 |
250 |
243 /** |
251 /** |
244 * Tells you the title for the given page ID and namespace |
252 * Tells you the title for the given page ID and namespace |