includes/functions.php
changeset 62 9dc4fded30e6
parent 48 fc9762553a3c
child 73 0a74676a2f2f
equal deleted inserted replaced
61:e9708657875a 62:9dc4fded30e6
   219   
   219   
   220   $baseprot = 'http' . ( isset($_SERVER['HTTPS']) ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'];
   220   $baseprot = 'http' . ( isset($_SERVER['HTTPS']) ? 's' : '' ) . '://' . $_SERVER['HTTP_HOST'];
   221   $url = $baseprot . $url;
   221   $url = $baseprot . $url;
   222   
   222   
   223   return ($escape) ? htmlspecialchars($url) : $url;
   223   return ($escape) ? htmlspecialchars($url) : $url;
       
   224 }
       
   225 
       
   226 /**
       
   227  * Tells you the title for the given page ID string
       
   228  * @param string Page ID string (ex: Special:Administration)
       
   229  * @return string
       
   230  */
       
   231 
       
   232 function get_page_title($page_id)
       
   233 {
       
   234   global $db, $session, $paths, $template, $plugins; // Common objects
       
   235   
       
   236   $idata = RenderMan::strToPageID($page_id);
       
   237   $page_id_key = $paths->nslist[ $idata[1] ] . $idata[0];
       
   238   $page_data = $paths->pages[$page_id_key];
       
   239   $title = ( isset($page_data['name']) ) ? $page_data['name'] : $paths->nslist[$idata[1]] . str_replace('_', ' ', dirtify_page_id( $idata[0] ) );
       
   240   return $title;
       
   241 }
       
   242 
       
   243 /**
       
   244  * Tells you the title for the given page ID and namespace
       
   245  * @param string Page ID
       
   246  * @param string Namespace
       
   247  * @return string
       
   248  */
       
   249 
       
   250 function get_page_title_ns($page_id, $namespace)
       
   251 {
       
   252   global $db, $session, $paths, $template, $plugins; // Common objects
       
   253   
       
   254   $page_id_key = $paths->nslist[ $namespace ] . $page_id;
       
   255   $page_data = $paths->pages[$page_id_key];
       
   256   $title = ( isset($page_data['name']) ) ? $page_data['name'] : $paths->nslist[$namespace] . str_replace('_', ' ', dirtify_page_id( $page_id ) );
       
   257   return $title;
   224 }
   258 }
   225 
   259 
   226 /**
   260 /**
   227  * Redirect the user to the specified URL.
   261  * Redirect the user to the specified URL.
   228  * @param string $url The URL, either relative or absolute.
   262  * @param string $url The URL, either relative or absolute.