includes/namespaces/user.php
changeset 953 323c4cd1aa37
parent 896 ddecc53004ee
child 970 d894086f38cc
equal deleted inserted replaced
952:d52dfa1f08da 953:323c4cd1aa37
    56      * See plugins.php for a guide on creating and attaching to hooks.
    56      * See plugins.php for a guide on creating and attaching to hooks.
    57      */
    57      */
    58     
    58     
    59     $page_urlname = dirtify_page_id($this->page_id);
    59     $page_urlname = dirtify_page_id($this->page_id);
    60     if ( $this->page_id == $paths->page_id && $this->namespace == $paths->namespace )
    60     if ( $this->page_id == $paths->page_id && $this->namespace == $paths->namespace )
    61     {
    61     $page_name = $this->cdata['name'];
    62       $page_name = ( isset($paths->cpage['name']) ) ? $paths->cpage['name'] : $this->page_id;
       
    63     }
       
    64     else
       
    65     {
       
    66       $page_name = ( isset($paths->pages[$this->page_id]) ) ? $paths->pages[$this->page_id]['name'] : $this->page_id;
       
    67     }
       
    68     
    62     
    69     $target_username = strtr($page_urlname, 
    63     $target_username = strtr($page_urlname, 
    70       Array(
    64       Array(
    71         '_' => ' ',
    65         '_' => ' ',
    72         '<' => '&lt;',
    66         '<' => '&lt;',
    78     
    72     
    79     if ( ( $page_name == str_replace('_', ' ', $this->page_id) || $page_name == $paths->nslist['User'] . str_replace('_', ' ', $this->page_id) ) || !$this->exists )
    73     if ( ( $page_name == str_replace('_', ' ', $this->page_id) || $page_name == $paths->nslist['User'] . str_replace('_', ' ', $this->page_id) ) || !$this->exists )
    80     {
    74     {
    81       $page_name = $lang->get('userpage_page_title', array('username' => $target_username));
    75       $page_name = $lang->get('userpage_page_title', array('username' => $target_username));
    82     }
    76     }
    83     else
    77     
    84     {
    78     $output->set_title($page_name);
    85       // User has a custom title for their userpage
       
    86       $page_name = $paths->pages[ $paths->nslist[$this->namespace] . $this->page_id ]['name'];
       
    87     }
       
    88     
       
    89     $template->tpl_strings['PAGE_NAME'] = htmlspecialchars($page_name);
       
    90     
    79     
    91     $q = $db->sql_query('SELECT u.username, u.user_id AS authoritative_uid, u.real_name, u.email, u.reg_time, u.user_has_avatar, u.avatar_type, x.*, COUNT(c.comment_id) AS n_comments
    80     $q = $db->sql_query('SELECT u.username, u.user_id AS authoritative_uid, u.real_name, u.email, u.reg_time, u.user_has_avatar, u.avatar_type, x.*, COUNT(c.comment_id) AS n_comments
    92                            FROM '.table_prefix.'users u
    81                            FROM '.table_prefix.'users u
    93                            LEFT JOIN '.table_prefix.'users_extra AS x
    82                            LEFT JOIN '.table_prefix.'users_extra AS x
    94                              ON ( u.user_id = x.user_id OR x.user_id IS NULL ) 
    83                              ON ( u.user_id = x.user_id OR x.user_id IS NULL ) 
   273           if ( isPage($c_page_id) )
   262           if ( isPage($c_page_id) )
   274           {
   263           {
   275             $parser->assign_bool(array(
   264             $parser->assign_bool(array(
   276               'page_exists' => true
   265               'page_exists' => true
   277               ));
   266               ));
   278             $page_title = htmlspecialchars($paths->pages[ $c_page_id ]['name']);
   267             $page_title = get_page_title($c_page_id);
   279           }
   268           }
   280           else
   269           else
   281           {
   270           {
   282             $parser->assign_bool(array(
   271             $parser->assign_bool(array(
   283               'page_exists' => false
   272               'page_exists' => false