--- a/includes/namespaces/default.php Wed May 13 09:43:00 2009 -0400
+++ b/includes/namespaces/default.php Wed May 13 09:43:57 2009 -0400
@@ -142,8 +142,9 @@
$this->exists = false;
$ns_char = substr($paths->nslist['Special'], -1);
-
$page_name = $this->namespace == 'Article' ? dirtify_page_id($this->page_id) : "{$this->namespace}{$ns_char}" . dirtify_page_id($this->page_id);
+ $this->title = $page_name;
+
$this->cdata = array(
'name' => $page_name,
'urlname' => $this->page_id,
@@ -735,16 +736,7 @@
$html .= '</div>';
$html .= '<div id="mdgCatBox">' . $lang->get('catedit_catbox_lbl_categories') . ' ';
- $where = '( c.page_id=\'' . $db->escape($this->page_id) . '\' AND c.namespace=\'' . $db->escape($this->namespace) . '\' )';
- $prefix = table_prefix;
- $sql = <<<EOF
-SELECT c.category_id FROM {$prefix}categories AS c
- LEFT JOIN {$prefix}pages AS p
- ON ( ( p.urlname = c.page_id AND p.namespace = c.namespace ) OR ( p.urlname IS NULL AND p.namespace IS NULL ) )
- WHERE $where
- ORDER BY p.name ASC, c.page_id ASC;
-EOF;
- $q = $db->sql_query($sql);
+ $q = $db->sql_query('SELECT category_id FROM ' . table_prefix . "categories WHERE page_id = '$this->page_id' AND namespace = '$this->namespace';");
if ( !$q )
$db->_die();
@@ -945,7 +937,17 @@
$page_id_db = $db->escape($page_id);
$namespace_db = $db->escape($namespace);
- $q = $db->sql_query('SELECT * FROM ' . table_prefix . "pages WHERE urlname = '$page_id_db' AND namespace = '$namespace_db';");
+ $q = $db->sql_query('SELECT p.*, COUNT(ca.comment_id) AS comments_approved, COUNT(cu.comment_id) AS comments_unapproved, COUNT(cs.comment_id) AS comments_spam'
+ . ' FROM ' . table_prefix . "pages AS p\n"
+ . " LEFT JOIN " . table_prefix . "comments AS ca\n"
+ . " ON ( (ca.approved = " . COMMENT_APPROVED . " AND ca.page_id = p.urlname ) OR ca.comment_id IS NULL)\n"
+ . " LEFT JOIN " . table_prefix . "comments AS cu\n"
+ . " ON ( (cu.approved = " . COMMENT_UNAPPROVED . " AND cu.page_id = p.urlname ) OR cu.comment_id IS NULL)\n"
+ . " LEFT JOIN " . table_prefix . "comments AS cs\n"
+ . " ON ( (cs.approved = " . COMMENT_SPAM . " AND cs.page_id = p.urlname ) OR cs.comment_id IS NULL)\n"
+ . " WHERE p.urlname = '$page_id_db' AND p.namespace = '$namespace_db'\n"
+ . " GROUP BY p.urlname, p.name, p.namespace, p.page_order, p.special, p.visible, p.protected, p.wiki_mode, p.comments_on, p.delvotes, p.delvote_ips, p.page_format, p.password;");
+
if ( !$q )
$db->_die();
--- a/includes/namespaces/user.php Wed May 13 09:43:00 2009 -0400
+++ b/includes/namespaces/user.php Wed May 13 09:43:57 2009 -0400
@@ -14,6 +14,21 @@
class Namespace_User extends Namespace_Default
{
+ public function __construct($page_id, $namespace, $revision_id = 0)
+ {
+ global $db, $session, $paths, $template, $plugins; // Common objects
+ global $lang;
+
+ parent::__construct($page_id, $namespace, $revision_id);
+
+ if ( ( $this->title == str_replace('_', ' ', $this->page_id) || $this->title == $paths->nslist['User'] . str_replace('_', ' ', $this->page_id) ) || !$this->exists )
+ {
+ $this->title = $lang->get('userpage_page_title', array('username' => $this->page_id));
+ $this->cdata['name'] = $this->title;
+ }
+
+ }
+
public function send()
{
global $db, $session, $paths, $template, $plugins; // Common objects
@@ -55,10 +70,8 @@
*
* See plugins.php for a guide on creating and attaching to hooks.
*/
-
+
$page_urlname = dirtify_page_id($this->page_id);
- if ( $this->page_id == $paths->page_id && $this->namespace == $paths->namespace )
- $page_name = $this->cdata['name'];
$target_username = strtr($page_urlname,
Array(
@@ -70,13 +83,7 @@
$target_username = preg_replace('/^' . str_replace('/', '\\/', preg_quote($paths->nslist['User'])) . '/', '', $target_username);
list($target_username) = explode('/', $target_username);
- if ( ( $page_name == str_replace('_', ' ', $this->page_id) || $page_name == $paths->nslist['User'] . str_replace('_', ' ', $this->page_id) ) || !$this->exists )
- {
- $page_name = $lang->get('userpage_page_title', array('username' => $target_username));
- }
-
- $output->set_title($page_name);
-
+ $output->set_title($this->title);
$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
FROM '.table_prefix.'users u
LEFT JOIN '.table_prefix.'users_extra AS x
--- a/plugins/SpecialLog.php Wed May 13 09:43:00 2009 -0400
+++ b/plugins/SpecialLog.php Wed May 13 09:43:57 2009 -0400
@@ -311,7 +311,10 @@
$crumb = $lang->get('log_breadcrumb_author', array('user' => $user_link));
break;
case 'page':
- $crumb = $lang->get('log_breadcrumb_page', array('page' => '<a href="' . makeUrl($value, false, true) . '">' . htmlspecialchars(get_page_title($value)) . '</a>'));
+ list($pid, $ns) = RenderMan::strToPageID($value);
+ $ns = namespace_factory($pid, $ns);
+ $exist = $ns->exists() ? '' : ' class="wikilink-nonexistent"';
+ $crumb = $lang->get('log_breadcrumb_page', array('page' => '<a' . $exist . ' href="' . makeUrl($value, false, true) . '">' . htmlspecialchars($ns->title) . '</a>'));
break;
case 'action':
$action = ( $lang->get("log_formaction_{$value}") === "log_formaction_{$value}" ) ? $lang->get("log_action_{$value}") : $lang->get("log_formaction_{$value}");