includes/functions.php
changeset 468 194a19711346
parent 458 c433348f3628
child 472 bc4b58034f4d
equal deleted inserted replaced
467:e4bbd6fb8df3 468:194a19711346
   142   if ( isset($_GET['lang']) && preg_match('/^[a-z0-9_]+$/', @$_GET['lang']) )
   142   if ( isset($_GET['lang']) && preg_match('/^[a-z0-9_]+$/', @$_GET['lang']) )
   143   {
   143   {
   144     $flags .= $sep . 'lang=' . urlencode($_GET['lang']);
   144     $flags .= $sep . 'lang=' . urlencode($_GET['lang']);
   145     $sep = '&';
   145     $sep = '&';
   146   }
   146   }
       
   147   
       
   148   $ns_prefix = "$n:";
   147 
   149 
   148   if(defined('ENANO_BASE_CLASSES_INITIALIZED'))
   150   if(defined('ENANO_BASE_CLASSES_INITIALIZED'))
   149   {
   151   {
   150     $url = contentPath . $paths->nslist[$n] . $t . $flags;
   152     $ns_prefix = ( isset($paths->nslist[$n]) ) ? $paths->nslist[$n] : $n . substr($paths->nslist['Special'], -1);
       
   153     $url = contentPath . $ns_prefix . $t . $flags;
   151   }
   154   }
   152   else
   155   else
   153   {
   156   {
   154     // If the path manager hasn't been initted yet, take an educated guess at what the URI should be
   157     // If the path manager hasn't been initted yet, take an educated guess at what the URI should be
   155     $url = contentPath . $n . ':' . $t . $flags;
   158     $url = contentPath . $n . ':' . $t . $flags;
   309 
   312 
   310 function get_page_title_ns($page_id, $namespace)
   313 function get_page_title_ns($page_id, $namespace)
   311 {
   314 {
   312   global $db, $session, $paths, $template, $plugins; // Common objects
   315   global $db, $session, $paths, $template, $plugins; // Common objects
   313 
   316 
   314   $page_id_key = $paths->nslist[ $namespace ] . $page_id;
   317   $ns_prefix = ( isset($paths->nslist[ $namespace ]) ) ? $paths->nslist[ $namespace ] : $namespace . substr($paths->nslist['Special'], -1);
       
   318   $page_id_key = $ns_prefix . $page_id;
   315   if ( isset($paths->pages[$page_id_key]) )
   319   if ( isset($paths->pages[$page_id_key]) )
   316   {
   320   {
   317     $page_data = $paths->pages[$page_id_key];
   321     $page_data = $paths->pages[$page_id_key];
   318   }
   322   }
   319   else
   323   else
   320   {
   324   {
   321     $page_data = array();
   325     $page_data = array();
   322   }
   326   }
   323   $title = ( isset($page_data['name']) ) ? $page_data['name'] : $paths->nslist[$namespace] . str_replace('_', ' ', dirtify_page_id( $page_id ) );
   327   $title = ( isset($page_data['name']) ) ? $page_data['name'] : $ns_prefix . str_replace('_', ' ', dirtify_page_id( $page_id ) );
   324   return $title;
   328   return $title;
   325 }
   329 }
   326 
   330 
   327 /**
   331 /**
   328  * Redirect the user to the specified URL.
   332  * Redirect the user to the specified URL.