示例#1
0
/**
 * Get the given amount of top users for the given timeframe.
 *
 * @return String: HTML
 */
function getTopUsersForTag($input, $args, $parser)
{
    global $wgLang;
    // Don't allow showing OVER 9000...I mean, over 50 users, duh.
    // Performance and all that stuff.
    if (!empty($args['limit']) && is_numeric($args['limit']) && $args['limit'] < 50) {
        $limit = intval($args['limit']);
    } else {
        $limit = 5;
    }
    if (!empty($args['period']) && strtolower($args['period']) == 'monthly') {
        $period = 'monthly';
    } else {
        // "period" argument not supplied/it's not "monthly", so assume weekly
        $period = 'weekly';
    }
    $fans = UserStats::getTopFansListPeriod($limit, $period);
    $x = 1;
    $topfans = '';
    foreach ($fans as $fan) {
        $avatar = new wAvatar($fan['user_id'], 'm');
        $user = Title::makeTitle(NS_USER, $fan['user_name']);
        $topfans .= "<div class=\"top-fan\">\n\t\t\t\t<span class=\"top-fan-number\">{$x}.</span>\n\t\t\t\t<a href=\"{$user->getFullURL()}\">{$avatar->getAvatarURL()}</a>\n\t\t\t\t<span class=\"top-fans-user\"><a href=\"{$user->getFullURL()}\">{$fan['user_name']}</a></span>\n\t\t\t\t<span class=\"top-fans-points\"><b>+" . $wgLang->formatNum($fan['points']) . '</b> ' . wfMessage('top-fans-points')->plain() . '</span>
			</div>';
        $x++;
    }
    return $topfans;
}
function wfRelationshipRequestResponse($response, $requestId)
{
    global $wgUser;
    $out = '';
    $rel = new UserRelationship($wgUser->getName());
    if ($rel->verifyRelationshipRequest($requestId) == true) {
        $request = $rel->getRequest($requestId);
        $user_name_from = $request[0]['user_name_from'];
        $user_id_from = User::idFromName($user_name_from);
        $rel_type = strtolower($request[0]['type']);
        $response = isset($_POST['response']) ? $_POST['response'] : $response;
        $rel->updateRelationshipRequestStatus($requestId, intval($response));
        $avatar = new wAvatar($user_id_from, 'l');
        $avatar_img = $avatar->getAvatarURL();
        if ($response == 1) {
            $rel->addRelationship($requestId);
            $out .= "<div class=\"relationship-action red-text\">\n\t\t\t\t{$avatar_img}" . wfMessage("ur-requests-added-message-{$rel_type}", $user_name_from)->escaped() . '<div class="cleared"></div>
			</div>';
        } else {
            $out .= "<div class=\"relationship-action red-text\">\n\t\t\t\t{$avatar_img}" . wfMessage("ur-requests-reject-message-{$rel_type}", $user_name_from)->escaped() . '<div class="cleared"></div>
			</div>';
        }
        $rel->deleteRequest($requestId);
    }
    return $out;
}
    /**
     * Show the special page
     *
     * @param $params Mixed: parameter(s) passed to the page or null
     */
    public function execute($params)
    {
        $out = $this->getOutput();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        /**
         * Redirect anonymous users to the login page
         * It will automatically return them to the ViewRelationshipRequests page
         */
        if (!$user->isLoggedIn()) {
            $out->setPageTitle($this->msg('ur-error-page-title')->plain());
            $login = SpecialPage::getTitleFor('Userlogin');
            $out->redirect($login->getFullURL('returnto=Special:ViewRelationshipRequests'));
            return false;
        }
        // Add CSS & JS
        $out->addModuleStyles('ext.socialprofile.userrelationship.css');
        $out->addModules('ext.socialprofile.userrelationship.js');
        $rel = new UserRelationship($user->getName());
        $friend_request_count = $rel->getOpenRequestCount($user->getID(), 1);
        $foe_request_count = $rel->getOpenRequestCount($user->getID(), 2);
        if ($this->getRequest()->wasPosted() && $_SESSION['alreadysubmitted'] == false) {
            $_SESSION['alreadysubmitted'] = true;
            $rel->addRelationshipRequest($this->user_name_to, $this->relationship_type, $_POST['message']);
            $output = '<br /><span class="title">' . $this->msg('ur-already-submitted')->plain() . '</span><br /><br />';
            $out->addHTML($output);
        } else {
            $_SESSION['alreadysubmitted'] = false;
            $output = '';
            $out->setPageTitle($this->msg('ur-requests-title')->plain());
            $requests = $rel->getRequestList(0);
            if ($requests) {
                foreach ($requests as $request) {
                    $user_from = Title::makeTitle(NS_USER, $request['user_name_from']);
                    $avatar = new wAvatar($request['user_id_from'], 'l');
                    $avatar_img = $avatar->getAvatarURL();
                    if ($request['type'] == 'Foe') {
                        $msg = $this->msg('ur-requests-message-foe', htmlspecialchars($user_from->getFullURL()), $request['user_name_from'])->text();
                    } else {
                        $msg = $this->msg('ur-requests-message-friend', htmlspecialchars($user_from->getFullURL()), $request['user_name_from'])->text();
                    }
                    $message = $out->parse(trim($request['message']), false);
                    $output .= "<div class=\"relationship-action black-text\" id=\"request_action_{$request['id']}\">\n\t\t\t\t\t  \t{$avatar_img}" . $msg;
                    if ($request['message']) {
                        $output .= '<div class="relationship-message">' . $message . '</div>';
                    }
                    $output .= '<div class="cleared"></div>
						<div class="relationship-buttons">
							<input type="button" class="site-button" value="' . $this->msg('ur-accept')->plain() . '" data-response="1" />
							<input type="button" class="site-button" value="' . $this->msg('ur-reject')->plain() . '" data-response="-1" />
						</div>
					</div>';
                }
            } else {
                $output = $this->msg('ur-no-requests-message')->parse();
            }
            $out->addHTML($output);
        }
    }
    /**
     * Show the special page
     *
     * @param $params Mixed: parameter(s) passed to the page or null
     */
    public function execute($params)
    {
        global $wgUser, $wgOut, $wgRequest, $wgUserRelationshipScripts;
        /**
         * Redirect Non-logged in users to Login Page
         * It will automatically return them to the ViewRelationshipRequests page
         */
        if ($wgUser->getID() == 0) {
            $wgOut->setPageTitle(wfMsg('ur-error-page-title'));
            $login = SpecialPage::getTitleFor('Userlogin');
            $wgOut->redirect($login->getFullURL('returnto=Special:ViewRelationshipRequests'));
            return false;
        }
        $wgOut->addScriptFile($wgUserRelationshipScripts . '/UserRelationship.js');
        $wgOut->addExtensionStyle($wgUserRelationshipScripts . '/UserRelationship.css');
        $rel = new UserRelationship($wgUser->getName());
        $friend_request_count = $rel->getOpenRequestCount($wgUser->getID(), 1);
        $foe_request_count = $rel->getOpenRequestCount($wgUser->getID(), 2);
        if (count($_POST) && $_SESSION['alreadysubmitted'] == false) {
            $_SESSION['alreadysubmitted'] = true;
            $rel->addRelationshipRequest($this->user_name_to, $this->relationship_type, $_POST['message']);
            $out = '<br /><span class="title">' . wfMsg('ur-already-submitted') . '</span><br /><br />';
            $wgOut->addHTML($out);
        } else {
            $_SESSION['alreadysubmitted'] = false;
            $output = '';
            $wgOut->setPageTitle(wfMsg('ur-requests-title'));
            $requests = $rel->getRequestList(0);
            if ($requests) {
                foreach ($requests as $request) {
                    $user_from = Title::makeTitle(NS_USER, $request['user_name_from']);
                    $avatar = new wAvatar($request['user_id_from'], 'l');
                    $avatar_img = $avatar->getAvatarURL();
                    if ($request['type'] == 'Foe') {
                        $msg = wfMsg('ur-requests-message-foe', $user_from->escapeFullURL(), $request['user_name_from']);
                    } else {
                        $msg = wfMsg('ur-requests-message-friend', $user_from->escapeFullURL(), $request['user_name_from']);
                    }
                    $message = $wgOut->parse(trim($request['message']), false);
                    $output .= "<div class=\"relationship-action black-text\" id=\"request_action_{$request['id']}\">\r\n\t\t\t\t\t  \t{$avatar_img}" . $msg;
                    if ($request['message']) {
                        $output .= '<div class="relationship-message">' . $message . '</div>';
                    }
                    $output .= '<div class="cleared"></div>
						<div class="relationship-buttons">
							<input type="button" class="site-button" value="' . wfMsg('ur-accept') . '" onclick="javascript:requestResponse(1,' . $request['id'] . ')" />
							<input type="button" class="site-button" value="' . wfMsg('ur-reject') . '" onclick="javascript:requestResponse(-1,' . $request['id'] . ')" />
						</div>
					</div>';
                }
            } else {
                $inviteLink = SpecialPage::getTitleFor('InviteContacts');
                $output = wfMsg('ur-no-requests-message', $inviteLink->escapeFullURL());
            }
            $wgOut->addHTML($output);
        }
    }
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgRequest, $wgOut, $wgUser, $wgUploadPath, $wgScriptPath, $wgSystemGiftsScripts;
        // Variables
        $gift_name_check = '';
        $x = 0;
        $category_number = $wgRequest->getInt('category');
        // System gift class array
        $categories = array(array('category_name' => 'Edit', 'category_threshold' => '500', 'category_id' => 1), array('category_name' => 'Vote', 'category_threshold' => '2000', 'category_id' => 2), array('category_name' => 'Comment', 'category_threshold' => '1000', 'category_id' => 3), array('category_name' => 'Recruit', 'category_threshold' => '0', 'category_id' => 7), array('category_name' => 'Friend', 'category_threshold' => '25', 'category_id' => 8));
        // Set title
        if (!$category_number || $category_number > 4) {
            $category_number = 0;
            $page_category = $categories[$category_number]['category_name'];
        } else {
            $page_category = $categories[$category_number]['category_name'];
        }
        // Database calls
        $dbr = wfGetDB(DB_SLAVE);
        $res = $dbr->select(array('user_system_gift', 'system_gift'), array('sg_user_name', 'sg_user_id', 'gift_category', 'MAX(gift_threshold) AS top_gift'), array("gift_category = {$categories[$category_number]['category_id']}", "gift_threshold > {$categories[$category_number]['category_threshold']}"), __METHOD__, array('GROUP BY' => 'sg_user_name', 'ORDER BY' => 'top_gift DESC'), array('system_gift' => array('INNER JOIN', 'gift_id=sg_gift_id')));
        // Page title
        $wgOut->setPageTitle("Top Awards - {$page_category} Milestones");
        // Add CSS
        $wgOut->addExtensionStyle($wgSystemGiftsScripts . '/SystemGift.css');
        $output = '<div class="top-awards-navigation">
			<h1>Award Categories</h1>';
        $nav_x = 0;
        foreach ($categories as $award_type) {
            if ($nav_x == $category_number) {
                $output .= "<p><b>{$award_type['category_name']}s</b></p>";
            } else {
                $output .= "<p><a href=\"" . $wgScriptPath . "/index.php?title=Special:TopAwards&category={$nav_x}\">{$award_type['category_name']}s</a></p>";
            }
            $nav_x++;
        }
        $output .= '</div>';
        $output .= '<div class="top-awards">';
        foreach ($res as $row) {
            $user_name = $row->sg_user_name;
            $user_id = $row->sg_user_id;
            $avatar = new wAvatar($user_id, 'm');
            $top_gift = $row->top_gift;
            $gift_name = number_format($top_gift) . " {$categories[$category_number][category_name]}" . ($top_gift > 1 ? 's' : '') . " Milestone";
            if ($gift_name !== $gift_name_check) {
                $x = 1;
                $output .= "<div class=\"top-award-title\">\r\n\t\t\t\t\t{$gift_name}\r\n\t\t\t\t</div>";
            } else {
                $x++;
            }
            $userLink = $wgUser->getSkin()->link(Title::makeTitle(NS_USER, $row->sg_user_name), $user_name);
            $output .= "<div class=\"top-award\">\r\n\t\t\t\t\t<span class=\"top-award-number\">{$x}.</span>\r\n\t\t\t\t\t{$avatar->getAvatarURL()}\r\n\t\t\t\t\t{$userLink}\r\n\t\t\t\t</div>";
            $gift_name_check = $gift_name;
        }
        $output .= '</div>
		<div class="cleared"></div>';
        $wgOut->addHTML($output);
    }
function wfGetUserAvatar($username)
{
    if ($username == true) {
        $user_id = User::idFromName($username);
        $avatar = new wAvatar($user_id, 'm');
        $useravatar = $avatar->getAvatarURL();
        $ret = array('success' => true, 'result' => $useravatar);
        $out = json_encode($ret);
        return $out;
    }
}
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgSystemGiftsScripts;
        $wgOut->addExtensionStyle($wgSystemGiftsScripts . '/SystemGift.css');
        $output = '';
        // Prevent E_NOTICE
        // If gift ID wasn't passed in the URL parameters or if it's not
        // numeric, display an error message
        $giftId = $wgRequest->getInt('gift_id');
        if (!$giftId || !is_numeric($giftId)) {
            $wgOut->setPageTitle(wfMsg('ga-error-title'));
            $wgOut->addHTML(wfMsg('ga-error-message-invalid-link'));
            return false;
        }
        $gift = UserSystemGifts::getUserGift($giftId);
        if ($gift) {
            if ($gift['status'] == 1) {
                if ($gift['user_name'] == $wgUser->getName()) {
                    $g = new UserSystemGifts($gift['user_name']);
                    $g->clearUserGiftStatus($gift['id']);
                    $g->decNewSystemGiftCount($wgUser->getID());
                }
            }
            // DB stuff
            $dbr = wfGetDB(DB_MASTER);
            $res = $dbr->select('user_system_gift', array('DISTINCT sg_user_name', 'sg_user_id', 'sg_gift_id', 'sg_date'), array("sg_gift_id = {$gift['gift_id']}", "sg_user_name <> '" . $dbr->strencode($gift['user_name']) . "'"), __METHOD__, array('GROUP BY' => 'sg_user_name', 'ORDER BY' => 'sg_date DESC', 'OFFSET' => 0, 'LIMIT' => 6));
            $wgOut->setPageTitle(wfMsg('ga-gift-title', $gift['user_name'], $gift['name']));
            $profileURL = Title::makeTitle(NS_USER, $gift['user_name'])->escapeFullURL();
            $output .= '<div class="back-links">' . wfMsg('ga-back-link', $profileURL, $gift['user_name']) . '</div>';
            $message = $wgOut->parse(trim($gift['description']), false);
            $output .= '<div class="ga-description-container">';
            $giftImage = "<img src=\"{$wgUploadPath}/awards/" . SystemGifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt=""/>';
            $output .= "<div class=\"ga-description\">\r\n\t\t\t\t\t{$giftImage}\r\n\t\t\t\t\t<div class=\"ga-name\">{$gift['name']}</div>\r\n\t\t\t\t\t<div class=\"ga-timestamp\">({$gift['timestamp']})</div>\r\n\t\t\t\t\t<div class=\"ga-description-message\">\"{$message}\"</div>";
            $output .= '<div class="cleared"></div>
				</div>';
            $output .= '<div class="ga-recent">
					<div class="ga-recent-title">' . wfMsg('ga-recent-recipients-award') . '</div>
					<div class="ga-gift-count">' . wfMsgExt('ga-gift-given-count', 'parsemag', $gift['gift_count']) . '</div>';
            foreach ($res as $row) {
                $userToId = $row->sg_user_id;
                $avatar = new wAvatar($userToId, 'ml');
                $userNameLink = Title::makeTitle(NS_USER, $row->sg_user_name);
                $output .= '<a href="' . $userNameLink->escapeFullURL() . "\">\r\n\t\t\t\t\t{$avatar->getAvatarURL()}\r\n\t\t\t\t</a>";
            }
            $output .= '<div class="cleared"></div>
				</div>
			</div>';
            $wgOut->addHTML($output);
        } else {
            $wgOut->setPageTitle(wfMsg('ga-error-title'));
            $wgOut->addHTML(wfMsg('ga-error-message-invalid-link'));
        }
    }
/**
 * Callback function for the <newusers> tag.
 * Queries the user_register_track database table for new users and renders
 * the list of newest users and their avatars, wrapped in a div with the class
 * "new-users".
 * Disables parser cache and caches the database query results in memcached.
 */
function getNewUsers($input, $args, $parser)
{
    global $wgMemc;
    $parser->disableCache();
    $count = 10;
    $per_row = 5;
    if (isset($args['count']) && is_numeric($args['count'])) {
        $count = intval($args['count']);
    }
    if (isset($args['row']) && is_numeric($args['row'])) {
        $per_row = intval($args['row']);
    }
    // Try cache
    $key = wfMemcKey('users', 'new', $count);
    $data = $wgMemc->get($key);
    if (!$data) {
        $dbr = wfGetDB(DB_SLAVE);
        if ($dbr->tableExists('user_register_track')) {
            $res = $dbr->select('user_register_track', array('ur_user_id', 'ur_user_name'), array(), __METHOD__, array('ORDER BY' => 'ur_date', 'LIMIT' => $count));
        } else {
            // If user_register_track table doesn't exist, use the core logging
            // table
            $res = $dbr->select('logging', array('log_user AS ur_user_id', 'log_user_text AS ur_user_name'), array('log_type' => 'newusers'), __METHOD__, array('ORDER BY' => 'log_timestamp DESC', 'LIMIT' => $count));
        }
        $list = array();
        foreach ($res as $row) {
            $list[] = array('user_id' => $row->ur_user_id, 'user_name' => $row->ur_user_name);
        }
        // Cache in memcached for 10 minutes
        $wgMemc->set($key, $list, 60 * 10);
    } else {
        wfDebugLog('NewUsersList', 'Got new users from cache');
        $list = $data;
    }
    $output = '<div class="new-users">';
    if (!empty($list)) {
        $x = 1;
        foreach ($list as $user) {
            $avatar = new wAvatar($user['user_id'], 'ml');
            $userLink = Title::makeTitle(NS_USER, $user['user_name']);
            $output .= '<a href="' . $userLink->escapeFullURL() . '" rel="nofollow">' . $avatar->getAvatarURL() . '</a>';
            if ($x == $count || $x != 1 && $x % $per_row == 0) {
                $output .= '<div class="cleared"></div>';
            }
            $x++;
        }
    }
    $output .= '<div class="cleared"></div></div>';
    return $output;
}
示例#9
0
function getWelcome()
{
    global $wgUser, $wgOut, $wgLang;
    // Add CSS
    $wgOut->addModuleStyles('ext.socialprofile.userwelcome.css');
    // Get stats and user level
    $stats = new UserStats($wgUser->getID(), $wgUser->getName());
    $stats_data = $stats->getUserStats();
    $user_level = new UserLevel($stats_data['points']);
    // Safe links
    $level_link = Title::makeTitle(NS_HELP, wfMessage('mp-userlevels-link')->inContentLanguage()->plain());
    $avatar_link = SpecialPage::getTitleFor('UploadAvatar');
    // Make an avatar
    $avatar = new wAvatar($wgUser->getID(), 'l');
    // Profile top images/points
    $output = '<div class="mp-welcome-logged-in">
	<h2>' . wfMessage('mp-welcome-logged-in', $wgUser->getName())->parse() . '</h2>
	<div class="mp-welcome-image">
	<a href="' . htmlspecialchars($wgUser->getUserPage()->getFullURL()) . '" rel="nofollow">' . $avatar->getAvatarURL() . '</a>';
    if (strpos($avatar->getAvatarImage(), 'default_') !== false) {
        $uploadOrEditMsg = 'mp-welcome-upload';
    } else {
        $uploadOrEditMsg = 'mp-welcome-edit';
    }
    $output .= '<div><a href="' . htmlspecialchars($avatar_link->getFullURL()) . '" rel="nofollow">' . wfMessage($uploadOrEditMsg)->plain() . '</a></div>';
    $output .= '</div>';
    global $wgUserLevels;
    if ($wgUserLevels) {
        $output .= '<div class="mp-welcome-points">
			<div class="points-and-level">
				<div class="total-points">' . wfMessage('mp-welcome-points', $wgLang->formatNum($stats_data['points']))->parse() . '</div>
				<div class="honorific-level"><a href="' . htmlspecialchars($level_link->getFullURL()) . '">(' . $user_level->getLevelName() . ')</a></div>
			</div>
			<div class="cleared"></div>
			<div class="needed-points">
				<br />' . wfMessage('mp-welcome-needed-points', htmlspecialchars($level_link->getFullURL()), $user_level->getNextLevelName(), $user_level->getPointsNeededToAdvance())->text() . '</div>
		</div>';
    }
    $output .= '<div class="cleared"></div>';
    $output .= getRequests();
    $output .= '</div>';
    return $output;
}
示例#10
0
 /**
  * Display all the comments for the current page.
  * CSS and JS is loaded in Comment.php, function displayComments.
  */
 function display()
 {
     global $wgUser, $wgOut, $wgScriptPath, $wgMemc, $wgUserLevels;
     $output = '';
     // Try cache
     $key = wfMemcKey('comment', 'list', $this->PageID);
     $data = $wgMemc->get($key);
     if (!$data) {
         wfDebug("Loading comments for page {$this->PageID} from DB\n");
         $comments = $this->getCommentList();
         $wgMemc->set($key, $comments);
     } else {
         wfDebug("Loading comments for page {$this->PageID} from cache\n");
         $comments = $data;
     }
     // Try cache for voted list for this user
     $voted = array();
     if ($wgUser->isLoggedIn()) {
         $key = wfMemcKey('comment', 'voted', $this->PageID, 'user_id', $wgUser->getID());
         $data = $wgMemc->get($key);
         if (!$data) {
             $voted = $this->getCommentVotedList();
             $wgMemc->set($key, $voted);
         } else {
             wfDebug("Loading comment voted for page {$this->PageID} for user {$wgUser->getID()} from cache\n");
             $voted = $data;
         }
     }
     // Load complete blocked list for logged in user so they don't see their comments
     $block_list = array();
     if ($wgUser->getID() != 0) {
         $block_list = $this->getBlockList($wgUser->getId());
     }
     $AFCounter = 1;
     $AFBucket = array();
     if ($comments) {
         foreach ($comments as $comment) {
             $CommentScore = $comment['Comment_Score'];
             $CommentPosterLevel = '';
             if ($comment['Comment_user_id'] != 0) {
                 $title = Title::makeTitle(NS_USER, $comment['Comment_Username']);
                 $CommentPoster = '<a href="' . $title->escapeFullURL() . '" rel="nofollow">' . $comment['Comment_Username'] . '</a>';
                 $CommentReplyTo = $comment['Comment_Username'];
                 if ($wgUserLevels && class_exists('UserLevel')) {
                     $user_level = new UserLevel($comment['Comment_user_points']);
                     $CommentPosterLevel = "{$user_level->getLevelName()}";
                 }
             } else {
                 if (!array_key_exists($comment['Comment_Username'], $AFBucket)) {
                     $AFBucket[$comment['Comment_Username']] = $AFCounter;
                     $AFCounter++;
                 }
                 $CommentPoster = wfMsgForContent('comment-anon-name') . ' #' . $AFBucket[$comment['Comment_Username']];
                 $CommentReplyTo = wfMsgForContent('comment-anon-name');
             }
             // Comment delete button for privileged users
             $dlt = '';
             if ($wgUser->isAllowed('commentadmin')) {
                 $dlt = " | <span class=\"c-delete\"><a href=\"javascript:document.commentform.commentid.value={$comment['CommentID']};document.commentform.submit();\">" . wfMsg('comment-delete-link') . '</a></span>';
             }
             // Reply Link (does not appear on child comments)
             $replyRow = '';
             if ($wgUser->isAllowed('comment')) {
                 if ($comment['Comment_Parent_ID'] == 0) {
                     if ($replyRow) {
                         $replyRow .= ' | ';
                     }
                     $replyRow .= " | <a href=\"#end\" rel=\"nofollow\" class=\"comments-reply-to\" data-comment-id=\"{$comment['CommentID']}\" data-comments-safe-username=\"" . htmlspecialchars($CommentReplyTo, ENT_QUOTES) . '">' . wfMsg('comment-reply') . '</a>';
                 }
             }
             if ($comment['Comment_Parent_ID'] == 0) {
                 $container_class = 'full';
                 $comment_class = 'f-message';
             } else {
                 $container_class = 'reply';
                 $comment_class = 'r-message';
             }
             // Display Block icon for logged in users for comments of users
             // that are already not in your block list
             $block_link = '';
             if ($wgUser->getID() != 0 && $wgUser->getID() != $comment['Comment_user_id'] && !in_array($comment['Comment_Username'], $block_list)) {
                 $block_link = '<a href="javascript:void(0);" rel="nofollow" class="comments-block-user" data-comments-safe-username="******" data-comments-comment-id="' . $comment['CommentID'] . '" data-comments-user-id="' . $comment['Comment_user_id'] . "\">\n\t\t\t\t\t<img src=\"{$wgScriptPath}/extensions/Comments/images/block.png\" border=\"0\" alt=\"\"/>\n\t\t\t\t</a>";
             }
             // If you are ignoring the author of the comment, display message in comment box,
             // along with a link to show the individual comment
             $hide_comment_style = '';
             if (in_array($comment['Comment_Username'], $block_list)) {
                 $hide_comment_style = 'display:none;';
                 $blockListTitle = SpecialPage::getTitleFor('CommentIgnoreList');
                 $output .= "<div id=\"ignore-{$comment['CommentID']}\" class=\"c-ignored {$container_class}\">\n";
                 $output .= wfMsgExt('comment-ignore-message', 'parsemag');
                 $output .= '<div class="c-ignored-links">' . "\n";
                 $output .= "<a href=\"javascript:void(0);\" data-comment-id=\"{$comment['CommentID']}\">" . wfMsg('comment-show-comment-link') . '</a> | ';
                 $output .= "<a href=\"{$blockListTitle->escapeFullURL()}\">" . wfMsg('comment-manage-blocklist-link') . '</a>';
                 $output .= '</div>' . "\n";
                 $output .= '</div>' . "\n";
             }
             // Default avatar image, if SocialProfile extension isn't
             // enabled
             global $wgCommentsDefaultAvatar;
             $avatar_img = '<img src="' . $wgCommentsDefaultAvatar . '" alt="" border="0" />';
             // If SocialProfile *is* enabled, then use its wAvatar class
             // to get the avatars for each commenter
             if (class_exists('wAvatar')) {
                 $avatar = new wAvatar($comment['Comment_user_id'], 'ml');
                 $avatar_img = $avatar->getAvatarURL() . "\n";
             }
             $output .= "<div id=\"comment-{$comment['CommentID']}\" class=\"c-item {$container_class}\" style=\"{$hide_comment_style}\">" . "\n";
             $output .= "<div class=\"c-avatar\">{$avatar_img}</div>" . "\n";
             $output .= '<div class="c-container">' . "\n";
             $output .= '<div class="c-user">' . "\n";
             $output .= "{$CommentPoster}";
             $output .= "<span class=\"c-user-level\">{$CommentPosterLevel}</span> {$block_link}" . "\n";
             wfSuppressWarnings();
             // E_STRICT bitches about strtotime()
             $output .= '<div class="c-time">' . wfMsg('comments-time-ago', self::getTimeAgo(strtotime($comment['Comment_Date']))) . '</div>' . "\n";
             wfRestoreWarnings();
             $output .= '<div class="c-score">' . "\n";
             if ($this->AllowMinus == true || $this->AllowPlus == true) {
                 $output .= '<span class="c-score-title">' . wfMsg('comment-score-text') . " <span id=\"Comment{$comment['CommentID']}\">{$CommentScore}</span></span>";
                 // Voting is possible only when database is unlocked
                 if (!wfReadOnly()) {
                     if (!in_array($comment['CommentID'], $voted)) {
                         // You can only vote for other people's comments,
                         // not for your own
                         if ($wgUser->getName() != $comment['Comment_Username']) {
                             $output .= "<span id=\"CommentBtn{$comment['CommentID']}\">";
                             if ($this->AllowPlus == true) {
                                 $output .= $this->getVoteLink($comment['CommentID'], 1);
                             }
                             if ($this->AllowMinus == true) {
                                 $output .= $this->getVoteLink($comment['CommentID'], -1);
                             }
                             $output .= '</span>';
                         } else {
                             $output .= wfMsg('comment-you');
                         }
                     } else {
                         // Already voted?
                         $output .= '<img src="' . $wgScriptPath . '/extensions/Comments/images/voted.gif" border="0" alt="" />' . wfMsg('comment-voted-label');
                     }
                 }
             }
             $output .= '</div>' . "\n";
             // $wgTitle points to Special:CommentListGet...and that special
             // page shouldn't even exist, so we certainly don't want to
             // advertise it...let's point the permalink to the current page
             // instead :)
             $title = Title::newFromID($this->PageID);
             $output .= '</div>' . "\n";
             $output .= "<div class=\"c-comment {$comment_class}\">" . "\n";
             $output .= $this->getCommentText($comment['Comment_Text']);
             $output .= '</div>' . "\n";
             $output .= '<div class="c-actions">' . "\n";
             $output .= '<a href="' . $title->escapeFullURL() . "#comment-{$comment['CommentID']}\" rel=\"nofollow\">" . wfMsg('comment-permalink') . '</a> ';
             if ($replyRow || $dlt) {
                 $output .= "{$replyRow} {$dlt}" . "\n";
             }
             $output .= '</div>' . "\n";
             $output .= '</div>' . "\n";
             $output .= '<div class="cleared"></div>' . "\n";
             $output .= '</div>' . "\n";
         }
     }
     $output .= '<a id="end" name="end" rel="nofollow"></a>';
     return $output;
 }
	/**
	 * Displays the form for removing a friend or a foe
	 * @return $form Mixed: HTML code for the form
	 */
	function displayForm() {
		global $wgOut;

		$avatar = new wAvatar( $this->user_id_to, 'l' );

		if ( $this->relationship_type == 1 ) {
			$title = wfMsg( 'ur-remove-relationship-title-friend', $this->user_name_to );
			$remove = wfMsg( 'ur-remove-relationship-message-friend', $this->user_name_to, wfMsg( 'ur-remove' ) );
		} else {
			$title = wfMsg( 'ur-remove-relationship-title-foe', $this->user_name_to );
			$remove = wfMsg( 'ur-remove-relationship-message-foe', $this->user_name_to, wfMsg( 'ur-remove' ) );
		}
		$wgOut->setPageTitle( $title );

		$form = "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\">
			<div class=\"relationship-action\">
			{$avatar->getAvatarURL()}" .
			$remove .
			'<div class="relationship-buttons">
				<input type="hidden" name="user" value="' . addslashes( $this->user_name_to ) . '" />
				<input type="button" class="site-button" value="' . wfMsg( 'ur-remove' ) . '" size="20" onclick="document.form1.submit()" />
				<input type="button" class="site-button" value="' . wfMsg( 'ur-cancel' ) . '" size="20" onclick="history.go(-1)" />
			</div>
			<div class="cleared"></div>
			</div>

		</form>';

		return $form;
	}
function wfUpdateStatus( $user_id, $user_name, $text, $date, $next_row ) {
	$user = User::newFromId( $user_id );

	// Don't do anything if the user is blocked or the DB is read-only
	if ( $user->isBlocked() || wfReadOnly() ) {
		return '';
	}

	// Get a database handler
	$dbw = wfGetDB( DB_MASTER );

	// Write new data to user_status
	$dbw->insert(
		'user_status',
		array(
			'us_user_id' => $user_id,
			'us_user_name' => $user_name,
			'us_text' => $text,
			'us_date' => $date,
		),
		__METHOD__
	);

	// Grab all rows from user_status
	$res = $dbw->select(
		'user_status',
		array(
			'us_user_id', 'us_user_name', 'us_text',
			'UNIX_TIMESTAMP(us_date) AS unix_time'
		),
		array( 'us_id' => intval( $next_row ) ),
		__METHOD__
	);

	$x = 1;

	foreach ( $res as $row ) {
		$db_user_id = $row->us_user_id;
		$db_user_name = $row->us_user_name;
		$db_status_text = $row->us_text;
		$user_status_date = $row->unix_time;
		$avatar = new wAvatar( $db_user_id, 'ml' );
		$userTitle = Title::makeTitle( NS_USER, $db_user_name );

		$output .= "<div class=\"user-status-row\">
			{$avatar->getAvatarURL()}
			<a href=\"{$userTitle->escapeFullURL()}\"><b>{$db_user_name}</b></a> {$db_status_text}
			<span class=\"user-status-date\">" .
				wfMsg( 'userstatus-just-added' ) .
			'</span>
		</div>';

		$x++;
	}

	return $output;
}
    function showHeader()
    {
        global $wgUser, $wgSitename;
        global $wgNavBarClasses, $wgLogo;
        // $output = '';
        $output = '
            <header class="header navbar navbar-default navbar-fixed-top' . $wgNavBarClasses . '" role="navigation">
                <div class="navbar-container">
                    <div class="navbar-header">
                        <a rel="nofollow" class="navbar-brand" href="#menu-toggle" id="menu-toggle">
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </a>
                        <a class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
                            <i class="fa fa-chevron-down"></i>
                        </a>
                        <a class="visible-xs-inline-block search-toggle">
                            <span class="fa fa-search navbar-search"></span>
                        </a>
                        <a title="灰机wiki" href="http://huiji.wiki" class="navbar-brand"><img alt="Logo" src="' . $wgLogo . '"> </a>
                        <a class="visible-sm-block wiki-toggle">
                            <i class="fa fa-chevron-down"></i>
                        </a>
                        <form class="navbar-search navbar-form" action="/index.php" id="searchformphone" role="search">
                            <div>
                                <input class="form-control" type="search" name="search" placeholder="在' . $wgSitename . '内搜索" title="Search ' . $wgSitename . ' [ctrl-option-f]" accesskey="f" id="searchInputPhone" autocomplete="off">
                                <input type="hidden" name="title" value="Special:Search">
                            </div>
                        </form>
                    </div>

                    <div class="collapse navbar-collapse">
                        <ul id="icon-section" class="nav navbar-nav">
                                <li class="dropdown">
                                  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">推荐wiki <span class="caret"></span></a>
                                  <ul class="dropdown-menu hub-menu" role="menu">
                                    <li>
                                        <ul class="hub-list">
                                            <li class="letter active" data-toggle="letter">文学</li>
                                            <li class="movie" data-toggle="movie">影视</li>
                                            <li class="anime" data-toggle="anime">动漫</li>
                                            <li class="game" data-toggle="game">游戏</li>
                                            <li class="star" data-toggle="star">明星</li>
                                            <li class="more" data-toggle="more">更多</li>
                                        </ul>
                                    </li>
                                    <li class="a">
                                        <ul class="hub-selection letter-link active">
                                            <li><a href="http://lotr.huiji.wiki">魔戒</a></li>
                                            <li><a href="http://asoiaf.huiji.wiki">冰与火之歌</a></li>
                                            <li><a href="http://zhoutian.huiji.wiki">周天世界</a></li>
                                            <li><a href="http://witcher.huiji.wiki">猎魔人</a></li>
                                            <li><a href="http://coppermind.huiji.wiki/wiki">红铜智库</a></li>
                                            <li><a href="http://jiuzhou.huiji.wiki">九州</a></li>
                                        </ul>
                                        <ul class="hub-selection movie-link">
                                            <li><a href="http://spn.huiji.wiki">邪恶力量</a></li>
                                            <li><a href="http://jinguang.huiji.wiki">金光布袋戏</a></li>
                                            <li><a href="http://downtonabbey.huiji.wiki">唐顿庄园</a></li>
                                            <li><a href="http://mcu.huiji.wiki">漫威电影宇宙</a></li>
                                            <li><a href="http://htgawm.huiji.wiki">逍遥法外</a></li>
                                            <li><a href="http://doctorwho.huiji.wiki/">神秘博士</a></li>
                                        </ul>
                                        <ul class="hub-selection anime-link">
                                            <li><a href="http://cardcaptorsakura.huiji.wiki/">小樱的封印之书</a></li>
                                            <li><a href="http://kaiji.huiji.wiki">逆境无赖</a></li>
                                            <li><a href="http://gundam.huiji.wiki">高达</a></li>
                                        </ul>
                                        <ul class="hub-selection game-link">
                                            <li><a href="http://gjqt.huiji.wiki">古剑奇谭</a></li>
                                            <li><a href="http://hearthstone.huiji.wiki">炉石传说</a></li>
                                            <li><a href="http://assassinscreed.huiji.wiki">刺客信条</a></li>
                                            <li><a href="http://3pz.huiji.wiki">三国志puzzle大战</a></li>
                                            <li><a href="http://pvz.huiji.wiki">植物大战僵尸</a></li>
                                            <li><a href="http://bravely.huiji.wiki">勇气默示录中文百科</a></li>
                                        </ul>
                                        <ul class="hub-selection star-link">
                                            <li><a href="http://tfboys.huiji.wiki">TFBOYS</a></li>
                                            <li><a href="http://mfassbender.huiji.wiki">迈克尔·法斯宾德</a></li>
                                        </ul>
                                        <ul class="hub-selection more-link">
                                            <li><a href="http://kaixinmahua.huiji.wiki">开心麻花</a></li>
                                            <li><a href="http://mahjong.huiji.wiki">麻将</a></li>
                                            <li><a href="http://arsenal.huiji.wiki">阿森纳</a></li>
                                            <li><a href="http://www.huiji.wiki/wiki/%E7%89%B9%E6%AE%8A:%E7%AB%99%E7%82%B9%E6%8E%92%E8%A1%8C">站点排行榜</a></li>
                                            <a rel="nofollow" href="/wiki/Special:Randomwiki" class="wiki-random">
                                                随机一下试试
                                            </a>
                                        </ul>
                                    </li>
                                  </ul>
                                </li>
                                <li>
                                    <a rel="nofollow" href="http://www.huiji.wiki/wiki/创建新wiki">创建wiki</a>
                                </li>
                                <li class="hidden-xs hidden-sm">
                                    <a rel="nofollow" href="http://www.huiji.wiki/wiki/%E5%B8%AE%E5%8A%A9:%E7%BC%96%E8%BE%91%E6%89%8B%E5%86%8C">帮助文档</a>
                                </li>
                        </ul>';
        if ($wgUser->isLoggedIn()) {
            if (count($this->data['personal_urls']) > 0) {
                $avatar = new wAvatar($wgUser->getID(), 'l');
                // $user_icon = '<span class="user-icon"><img src="https://secure.gravatar.com/avatar/'.md5(strtolower( $wgUser->getEmail())).'.jpg?s=20&r=g"/></span>';
                $user_icon = '<i class="fa fa-cog"></i>';
                $name = $wgUser->getName();
                $personal_urls = $this->data['personal_urls'];
                unset($personal_urls['uls']);
                unset($personal_urls['notifications-alert']);
                unset($personal_urls['notifications-message']);
                unset($personal_urls['userpage']);
                $user_nav = $this->dropdownAdapter($personal_urls, $user_icon, 'user');
                $user_notify = $this->nav_notification($this->notificationAdapter($this->data['personal_urls']));
            }
            $userPage = Title::makeTitle(NS_USER, $wgUser->getName());
            $userPageURL = htmlspecialchars($userPage->getFullURL());
            /*$avatar = new wAvatar( $wgUser->getID(), 'l' );*/
            $output .= '<ul' . $this->html('userlangattributes') . ' class="nav navbar-nav navbar-right navbar-user">';
            $output .= '<li><a href="' . $userPageURL . '"><span class="user-icon" style="border: 0px;">' . $avatar->getAvatarURL() . '</span><span class="hidden-xs">' . $wgUser->getName() . '</span></a></li>';
            $output .= $user_notify;
            $output .= '<li class="dropdown collect"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-heart-o"></i></i></a><ul class="dropdown-menu collect-menu">';
            $sites = UserSiteFollow::getFullFollowedSitesWithDetails($wgUser->getId(), $wgUser->getId());
            $count = count($sites);
            if ($count > 0) {
                $num = $count > 8 ? 8 : $count;
                foreach ($sites as $user) {
                    $site_name[] = $user['val'];
                    $domain_name[] = $user['key'];
                }
                for ($i = 0; $i < $num; $i++) {
                    $output .= '<li><a href=http://' . $domain_name[$i] . '.huiji.wiki>' . $site_name[$i] . '</a></li>';
                }
                if ($count > 3) {
                    $output .= '<li><a rel="nofollow" href="/index.php?title=Special:ShowFollowedSites&user_id=' . $wgUser->getID() . '&target_user_id=' . $wgUser->getID() . '">我关注的全部维基</a></li>';
                }
            } else {
                $output .= '<li><a>暂无</a></li>';
            }
            $output .= '</ul></li>';
            $output .= $user_nav;
            $output .= '</ul>';
        } else {
            // else if is logged in
            //old login
            $output .= '<ul class="nav navbar-nav navbar-right navbar-login">
                            <li id= "pt-login" data-toggle="modal" data-target=".user-login">
                                <a rel="nofollow" class="login-in">登录</a>
                            </li>
                            <li>' . Linker::linkKnown(SpecialPage::getTitleFor('Userlogin'), '注册', array('id' => 'pt-createaccount'), array('type' => 'signup')) . '
                            </li>
                        </ul>';
        }
        $output .= '<form class="navbar-search navbar-form table-cell hidden-xs" action="/index.php" id="searchform" role="search">
                        <div>
                            <span class="fa fa-search navbar-search"></span>
                            <input class="form-control" type="search" name="search" placeholder="在' . $wgSitename . '内搜索" title="Search ' . $wgSitename . ' [ctrl-option-f]" accesskey="f" id="searchInput" autocomplete="off">
                            <input type="hidden" name="title" value="Special:Search">
                        </div>
                    </form>
                    </div>
                </div>
            </header>';
        return $output;
    }
示例#14
0
	/**
	 * Show the special page
	 *
	 * @param $par Mixed: parameter passed to the page or null
	 */
	public function execute( $par ) {
		global $wgRequest, $wgOut, $wgUser, $wgSystemGiftsScripts, $wgUserStatsPointValues;

		// Variables
		$gift_name_check = '';
		$x = 0;
		$category_number = $wgRequest->getInt( 'category' );

		// System gift class array
		// The 'category_name' key is used to build the appropriate i18n
		// message keys later on in the code; 'category_id' corresponds to
		// system_gift.gift_category. Valid categories and their numbers are
		// the same that are shown on Special:SystemGiftManager, which are:
		// 1: edit, 2: vote, 3: comment, 4: comment_plus, 5: opinions_created,
		// 6: opinions_pub, 7: referral_complete, 8: friend, 9: foe,
		// 10: challenges_won, 11: gift_rec, 12: points_winner_weekly,
		// 13: points_winner_monthly, 14: quiz_points
		//
		// @todo I really think that this should be configurable, the way the
		// navigation bar (MediaWiki:Topfans-by-category) shown on
		// Special:TopUsers and related special pages is...this is ugly and
		// far from flexible, since the thresholds are all hard-coded in
		$categories = array(
			array(
				'category_name' => 'Edit',
				'category_threshold' => '500',
				'category_id' => 1
			),
			array(
				'category_name' => 'Friend',
				'category_threshold' => '25',
				'category_id' => 8
			)
		);

		// VoteStars is unique to the VoteNY extension, while there are a bunch
		// of other voting extensions where the main class is named "Vote"
		if ( class_exists( 'VoteStars' ) ) {
			$categories[] = array(
				'category_name' => 'Vote',
				'category_threshold' => '2000',
				'category_id' => 2
			);
		}

		// Show the "Comments" category only if the Comments extension is
		// installed
		if ( class_exists( 'Comment' ) ) {
			$categories[] = array(
				'category_name' => 'Comment',
				'category_threshold' => '1000',
				'category_id' => 3
			);
		}

		// Well, we could test for the existence of the extension which allows
		// for referring users to the wiki so that you get points for it, but
		// this seems like a better thing to check for.
		if ( $wgUserStatsPointValues['referral_complete'] > 0 ) {
			$categories[] = array(
				'category_name' => 'Recruit',
				'category_threshold' => '0',
				'category_id' => 7
			);
		}

		// Set title
		if ( !( $category_number ) || $category_number > 4 ) {
			$category_number = 0;
			$page_category = $categories[$category_number]['category_name'];
		} else {
			$page_category = $categories[$category_number]['category_name'];
		}

		// Database calls
		$dbr = wfGetDB( DB_SLAVE );
		$res = $dbr->select(
			array( 'user_system_gift', 'system_gift' ),
			array(
				'sg_user_name', 'sg_user_id', 'gift_category',
				'MAX(gift_threshold) AS top_gift'
			),
			array(
				"gift_category = {$categories[$category_number]['category_id']}",
				"gift_threshold > {$categories[$category_number]['category_threshold']}"
			),
			__METHOD__,
			array( 'GROUP BY' => 'sg_user_name', 'ORDER BY' => 'top_gift DESC' ),
			array( 'system_gift' => array( 'INNER JOIN', 'gift_id=sg_gift_id' ) )
		);

		// Page title
		// for grep: topawards-edit-title, topawards-vote-title,
		// topawards-comment-title, topawards-recruit-title,
		// topawards-friend-title
		$wgOut->setPageTitle(
			wfMsg( 'topawards-' . strtolower( $page_category ) . '-title' )
		);

		// Add CSS
		$wgOut->addExtensionStyle( $wgSystemGiftsScripts . '/SystemGift.css' );

		$output = '<div class="top-awards-navigation">
			<h1>' . wfMsg( 'topawards-award-categories' ) . '</h1>';

		$nav_x = 0;

		// Build the award categories menu on the right side of the page
		foreach ( $categories as $awardType ) {
			// for grep: topawards-edits, topawards-votes,
			// topawards-comments, topawards-recruits, topawards-friends
			$msg = wfMsg(
				'topawards-' .
				strtolower( $awardType['category_name'] ) . 's'
			);
			if ( $nav_x == $category_number ) {
				$output .= "<p><b>{$msg}</b></p>";
			} else {
				$output .= '<p><a href="' . $this->getTitle()->escapeFullURL(
					"category={$nav_x}" ) . "\">{$msg}</a></p>";
			}
			$nav_x++;
		}

		$output .= '</div>';
		$output .= '<div class="top-awards">';

		// Display a "no results" message if we got no results -- because it's
		// a lot nicer to display something rather than a half-empty page
		if ( $dbr->numRows( $res ) <= 0 ) {
			$output .= wfMsg( 'topawards-empty' );
		} else {
			foreach ( $res as $row ) {
				$user_name = $row->sg_user_name;
				$user_id = $row->sg_user_id;
				$avatar = new wAvatar( $user_id, 'm' );
				$top_gift = $row->top_gift;
				$lower = strtolower( $categories[$category_number]['category_name'] );
				// for grep: topawards-edit-milestone, topawards-vote-milestone,
				// topawards-comment-milestone, topawards-recruit-milestone,
				// topawards-friend-milestone
				$gift_name = wfMsgExt(
					'topawards-' . $lower . '-milestone',
					'parsemag',
					$top_gift
				);

				if ( $gift_name !== $gift_name_check ) {
					$x = 1;
					$output .= "<div class=\"top-award-title\">
					{$gift_name}
				</div>";
				} else {
					$x++;
				}

				$userLink = $wgUser->getSkin()->link(
					Title::makeTitle( NS_USER, $row->sg_user_name ),
					$user_name
				);
				$output .= "<div class=\"top-award\">
					<span class=\"top-award-number\">{$x}.</span>
					{$avatar->getAvatarURL()}
					{$userLink}
				</div>";

				$gift_name_check = $gift_name;
			}
		}

		$output .= '</div>
		<div class="cleared"></div>';

		$wgOut->addHTML( $output );
	}
	/**
	 * Show the special page
	 *
	 * @param $par Mixed: parameter passed to the page or null
	 */
	public function execute( $par ) {
		global $wgUser, $wgOut, $wgRequest, $wgUploadPath, $wgUserGiftsScripts;

		$wgOut->addExtensionStyle( $wgUserGiftsScripts . '/UserGifts.css' );

		$giftId = $wgRequest->getInt( 'gift_id' );
		if ( !$giftId || !is_numeric( $giftId ) ) {
			$wgOut->setPageTitle( wfMsg( 'g-error-title' ) );
			$wgOut->addHTML( wfMsg( 'g-error-message-invalid-link' ) );
			return false;
		}

		$gift = UserGifts::getUserGift( $giftId );

		if ( $gift ) {
			if ( $gift['status'] == 1 ) {
				if ( $gift['user_name_to'] == $wgUser->getName() ) {
					$g = new UserGifts( $gift['user_name_to'] );
					$g->clearUserGiftStatus( $gift['id'] );
					$g->decNewGiftCount( $wgUser->getID() );
				}
			}

			// DB stuff
			$dbr = wfGetDB( DB_SLAVE );
			$res = $dbr->select(
				'user_gift',
				array( 'DISTINCT ug_user_name_to', 'ug_user_id_to', 'ug_date' ),
				array(
					'ug_gift_id' => $gift['gift_id'],
					"ug_user_name_to <> '" . addslashes( $gift['user_name_to'] ) . "'"
				),
				__METHOD__,
				array(
					'GROUP BY' => 'ug_user_name_to',
					'ORDER BY' => 'ug_date DESC',
					'LIMIT' => 6
				)
			);

			$wgOut->setPageTitle( wfMsgExt(
				'g-description-title',
				'parsemag',
				$gift['user_name_to'],
				$gift['name']
			) );

			$output = '<div class="back-links">
				<a href="' . Title::makeTitle( NS_USER, $gift['user_name_to'] )->escapeFullURL() . '">'
				. wfMsg( 'g-back-link', $gift['user_name_to'] ) . '</a>
			</div>';

			$user = Title::makeTitle( NS_USER, $gift['user_name_from'] );
			$removeGiftLink = SpecialPage::getTitleFor( 'RemoveGift' );
			$giveGiftLink = SpecialPage::getTitleFor( 'GiveGift' );

			$giftImage = '<img src="' . $wgUploadPath . '/awards/' .
				Gifts::getGiftImage( $gift['gift_id'], 'l' ) .
				'" border="0" alt="" />';

			$message = $wgOut->parse( trim( $gift['message'] ), false );

			$output .= '<div class="g-description-container">';
			$output .= '<div class="g-description">' .
					$giftImage .
					'<div class="g-name">' . $gift['name'] . '</div>
					<div class="g-timestamp">(' . $gift['timestamp'] . ')</div>
					<div class="g-from">' . wfMsg(
						'g-from',
						$user->escapeFullURL(),
						$gift['user_name_from']
					) . '</div>';
			if ( $message ) {
				$output .= '<div class="g-user-message">' . $message . '</div>';
			}
			$output .= '<div class="cleared"></div>
					<div class="g-describe">' . $gift['description'] . '</div>
					<div class="g-actions">
						<a href="' . $giveGiftLink->escapeFullURL( 'gift_id=' . $gift['gift_id'] ) . '">' .
							wfMsg( 'g-to-another' ) . '</a>';
			if ( $gift['user_name_to'] == $wgUser->getName() ) {
				$output .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
				$output .= '<a href="' . $removeGiftLink->escapeFullURL( 'gift_id=' . $gift['id'] ) . '">' .
					wfMsg( 'g-remove-gift' ) . '</a>';
			}
			$output .= '</div>
				</div>';

			$output .= '<div class="g-recent">
					<div class="g-recent-title">' .
						wfMsg( 'g-recent-recipients' ) .
					'</div>
					<div class="g-gift-count">' .
						wfMsgExt( 'g-given', 'parsemag', $gift['gift_count'] ) .
					'</div>';

			foreach ( $res as $row ) {
				$userToId = $row->ug_user_id_to;
				$avatar = new wAvatar( $userToId, 'ml' );
				$userNameLink = Title::makeTitle( NS_USER, $row->ug_user_name_to );

				$output .= '<a href="' . $userNameLink->escapeFullURL() . "\">
					{$avatar->getAvatarURL()}
				</a>";
			}
			$output .= '<div class="cleared"></div>
				</div>
			</div>';

			$wgOut->addHTML( $output );
		} else {
			$wgOut->setPageTitle( wfMsg( 'g-error-title' ) );
			$wgOut->addHTML( wfMsg( 'g-error-message-invalid-link' ) );
		}
	}
function getWelcome() {
	global $wgUser, $wgOut, $wgScriptPath, $wgLang;

	// Add CSS
	$wgOut->addExtensionStyle( $wgScriptPath . '/extensions/SocialProfile/UserWelcome/UserWelcome.css' );

	// Get stats and user level
	$stats = new UserStats( $wgUser->getID(), $wgUser->getName() );
	$stats_data = $stats->getUserStats();
	$user_level = new UserLevel( $stats_data['points'] );

	// Safe links
	$level_link = Title::makeTitle( NS_HELP, wfMsgForContent( 'mp-userlevels-link' ) );
	$avatar_link = SpecialPage::getTitleFor( 'UploadAvatar' );

	// Make an avatar
	$avatar = new wAvatar( $wgUser->getID(), 'l' );

	// Profile top images/points
	$output = '<div class="mp-welcome-logged-in">
	<h2>' . wfMsg( 'mp-welcome-logged-in', $wgUser->getName() ) . '</h2>
	<div class="mp-welcome-image">
	<a href="' . $wgUser->getUserPage()->escapeFullURL() . '" rel="nofollow">' .
		$avatar->getAvatarURL() . '</a>';
	if ( strpos( $avatar->getAvatarImage(), 'default_' ) !== false ) {
		$output .= '<div><a href="' . $avatar_link->escapeFullURL() . '" rel="nofollow">' . wfMsg( 'mp-welcome-upload' ) . '</a></div>';
	} else {
		$output .= '<div><a href="' . $avatar_link->escapeFullURL() . '" rel="nofollow">' . wfMsg( 'mp-welcome-edit' ) . '</a></div>';
	}
	$output .= '</div>';

	global $wgUserLevels;
	if ( $wgUserLevels ) {
		$output .= '<div class="mp-welcome-points">
			<div class="points-and-level">
				<div class="total-points">' .
					wfMsgExt(
						'mp-welcome-points',
						'parsemag',
						$wgLang->formatNum( $stats_data['points'] )
					) . '</div>
				<div class="honorific-level"><a href="' . $level_link->escapeFullURL() . '">(' . $user_level->getLevelName() . ')</a></div>
			</div>
			<div class="cleared"></div>
			<div class="needed-points">
				<br />'
				. wfMsgExt(
					'mp-welcome-needed-points',
					'parsemag',
					$level_link->escapeFullURL(),
					$user_level->getNextLevelName(),
					$user_level->getPointsNeededToAdvance()
				) .
			'</div>
		</div>';
	}

	$output .= '<div class="cleared"></div>';
	$output .= getRequests();
	$output .= '</div>';

	return $output;
}
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgUploadPath;
        $out = $this->getOutput();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        // Add CSS
        $out->addModuleStyles('ext.socialprofile.systemgifts.css');
        $output = '';
        // Prevent E_NOTICE
        // If gift ID wasn't passed in the URL parameters or if it's not
        // numeric, display an error message
        $giftId = $this->getRequest()->getInt('gift_id');
        if (!$giftId || !is_numeric($giftId)) {
            $out->setPageTitle($this->msg('ga-error-title')->plain());
            $out->addHTML($this->msg('ga-error-message-invalid-link')->plain());
            return false;
        }
        $gift = UserSystemGifts::getUserGift($giftId);
        if ($gift) {
            if ($gift['status'] == 1) {
                if ($gift['user_name'] == $user->getName()) {
                    $g = new UserSystemGifts($gift['user_name']);
                    $g->clearUserGiftStatus($gift['id']);
                    $g->decNewSystemGiftCount($user->getID());
                }
            }
            // DB stuff
            $dbr = wfGetDB(DB_SLAVE);
            $res = $dbr->select('user_system_gift', array('DISTINCT sg_user_name', 'sg_user_id', 'sg_gift_id', 'sg_date'), array("sg_gift_id = {$gift['gift_id']}", 'sg_user_name <> ' . $dbr->addQuotes($gift['user_name'])), __METHOD__, array('GROUP BY' => 'sg_user_name', 'ORDER BY' => 'sg_date DESC', 'OFFSET' => 0, 'LIMIT' => 6));
            $out->setPageTitle($this->msg('ga-gift-title', $gift['user_name'], $gift['name'])->parse());
            $profileURL = htmlspecialchars(Title::makeTitle(NS_USER, $gift['user_name'])->getFullURL());
            $output .= '<div class="back-links">' . $this->msg('ga-back-link', $profileURL, $gift['user_name'])->text() . '</div>';
            $message = $out->parse(trim($gift['description']), false);
            $output .= '<div class="ga-description-container">';
            $giftImage = "<img src=\"{$wgUploadPath}/awards/" . SystemGifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt=""/>';
            $output .= "<div class=\"ga-description\">\n\t\t\t\t\t{$giftImage}\n\t\t\t\t\t<div class=\"ga-name\">{$gift['name']}</div>\n\t\t\t\t\t<div class=\"ga-timestamp\">({$gift['timestamp']})</div>\n\t\t\t\t\t<div class=\"ga-description-message\">{$message}</div>";
            $output .= '<div class="cleared"></div>
				</div>';
            // If someone else in addition to the current user has gotten this
            // award, then and only then show the "Other recipients of this
            // award" header and the list of avatars
            if ($gift['gift_count'] > 1) {
                $output .= '<div class="ga-recent">
					<div class="ga-recent-title">' . $this->msg('ga-recent-recipients-award')->plain() . '</div>
					<div class="ga-gift-count">' . $this->msg('ga-gift-given-count')->numParams($gift['gift_count'])->parse() . '</div>';
                foreach ($res as $row) {
                    $userToId = $row->sg_user_id;
                    $avatar = new wAvatar($userToId, 'ml');
                    $userNameLink = Title::makeTitle(NS_USER, $row->sg_user_name);
                    $output .= '<a href="' . htmlspecialchars($userNameLink->getFullURL()) . "\">\n\t\t\t\t\t{$avatar->getAvatarURL()}\n\t\t\t\t</a>";
                }
                $output .= '<div class="cleared"></div>
				</div>';
                // .ga-recent
            }
            $output .= '</div>';
            $out->addHTML($output);
        } else {
            $out->setPageTitle($this->msg('ga-error-title')->plain());
            $out->addHTML($this->msg('ga-error-message-invalid-link')->plain());
        }
    }
	/**
	 * Show the special page
	 *
	 * @param $par Mixed: parameter passed to the special page or null
	 */
	public function execute( $par ) {
		global $wgRequest, $wgOut, $wgUser, $wgScriptPath;

		$messages_show = 25;
		$output = '';
		$us_id = $wgRequest->getInt( 'id', $par );
		$page = $wgRequest->getInt( 'page', 1 );

		// No ID? Show an error message then.
		if( !$us_id || !is_numeric( $us_id ) ) {
			$wgOut->addHTML( wfMsg( 'userstatus-invalid-link' ) );
			return false;
		}

		/**
		 * Config for the page
		 */
		$per_page = $messages_show;

		$s = new UserStatus();
		$message = $s->getStatusMessage( $us_id );
		$user_name = $message['user_name'];
		$user = Title::makeTitle( NS_USER, $user_name );

		// Different page title, depending on whose status updates we're
		// viewing
		if ( !( $wgUser->getName() == $user_name ) ) {
			$wgOut->setPageTitle( wfMsg( 'userstatus-user-thoughts', $user_name ) );
		} else {
			$wgOut->setPageTitle( wfMsg( 'userstatus-your-thoughts' ) );
		}

		// Add CSS
		if ( defined( 'MW_SUPPORTS_RESOURCE_MODULES' ) ) {
			$wgOut->addModuleStyles( 'ext.userStatus.viewThought' );
		} else {
			$wgOut->addExtensionStyle( $wgScriptPath . '/extensions/UserStatus/ViewThought.css' );
		}

		$output .= "<div class=\"view-thought-links\">
			<a href=\"{$user->getFullURL()}\">" .
				wfMsg( 'userstatus-user-profile', $user_name ) .
			'</a>
		</div>';
		$output .= '<div class="user-status-container">';
		$output .= '<div class="user-status-row">

				<div class="user-status-logo">

					<a href="' . SportsTeams::getNetworkURL( $message['sport_id'], $message['team_id'] ) . '">' .
						SportsTeams::getLogo( $message['sport_id'], $message['team_id'], 'm' ) .
					"</a>

				</div>

				<div class=\"user-status-message\">

					{$message['text']}

					<div class=\"user-status-date\">" .
						wfMsg( 'userstatus-ago', UserStatus::getTimeAgo( $message['timestamp'] ) ) .
					'</div>

				</div>

				<div class="cleared"></div>

		</div>
		</div>';

		$output .= '<div class="who-agrees">';
		$output .= '<h1>' . wfMsg( 'userstatus-who-agrees' ) . '</h1>';
		$voters = $s->getStatusVoters( $us_id );
		// Get the people who agree with this status update, if any
		if( $voters ) {
			foreach ( $voters as $voter ) {
				$user = Title::makeTitle( NS_USER, $voter['user_name'] );
				$avatar = new wAvatar( $voter['user_id'], 'm' );

				$output .= "<div class=\"who-agrees-row\">
					<a href=\"{$user->getFullURL()}\">{$avatar->getAvatarURL()}</a>
					<a href=\"{$user->getFullURL()}\">{$voter['user_name']}</a>
				</div>";
			}
		} else {
			$output .= '<p>' . wfMsg( 'userstatus-nobody-agrees' ) . '</p>';
		}

		$output .= '</div>';

		$wgOut->addHTML( $output );
	}
示例#19
0
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgUploadPath;
        $out = $this->getOutput();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        // Add CSS
        $out->addModuleStyles('ext.socialprofile.usergifts.css');
        $giftId = $this->getRequest()->getInt('gift_id');
        if (!$giftId || !is_numeric($giftId)) {
            $out->setPageTitle($this->msg('g-error-title')->plain());
            $out->addHTML($this->msg('g-error-message-invalid-link')->plain());
            return false;
        }
        $gift = UserGifts::getUserGift($giftId);
        if ($gift) {
            if ($gift['status'] == 1) {
                if ($gift['user_name_to'] == $user->getName()) {
                    $g = new UserGifts($gift['user_name_to']);
                    $g->clearUserGiftStatus($gift['id']);
                    $g->decNewGiftCount($user->getID());
                }
            }
            // DB stuff
            $dbr = wfGetDB(DB_SLAVE);
            $res = $dbr->select('user_gift', array('DISTINCT ug_user_name_to', 'ug_user_id_to', 'ug_date'), array('ug_gift_id' => $gift['gift_id'], 'ug_user_name_to <> ' . $dbr->addQuotes($gift['user_name_to'])), __METHOD__, array('GROUP BY' => 'ug_user_name_to', 'ORDER BY' => 'ug_date DESC', 'LIMIT' => 6));
            $out->setPageTitle($this->msg('g-description-title', $gift['user_name_to'], $gift['name'])->parse());
            $output = '<div class="back-links">
				<a href="' . htmlspecialchars(Title::makeTitle(NS_USER, $gift['user_name_to'])->getFullURL()) . '">' . $this->msg('g-back-link', $gift['user_name_to'])->parse() . '</a>
			</div>';
            $sender = Title::makeTitle(NS_USER, $gift['user_name_from']);
            $removeGiftLink = SpecialPage::getTitleFor('RemoveGift');
            $giveGiftLink = SpecialPage::getTitleFor('GiveGift');
            $giftImage = '<img src="' . $wgUploadPath . '/awards/' . Gifts::getGiftImage($gift['gift_id'], 'l') . '" border="0" alt="" />';
            $message = $out->parse(trim($gift['message']), false);
            $output .= '<div class="g-description-container">';
            $output .= '<div class="g-description">' . $giftImage . '<div class="g-name">' . $gift['name'] . '</div>
					<div class="g-timestamp">(' . $gift['timestamp'] . ')</div>
					<div class="g-from">' . $this->msg('g-from', htmlspecialchars($sender->getFullURL()), $gift['user_name_from'])->text() . '</div>';
            if ($message) {
                $output .= '<div class="g-user-message">' . $message . '</div>';
            }
            $output .= '<div class="cleared"></div>
					<div class="g-describe">' . $gift['description'] . '</div>
					<div class="g-actions">
						<a href="' . htmlspecialchars($giveGiftLink->getFullURL('gift_id=' . $gift['gift_id'])) . '">' . $this->msg('g-to-another')->plain() . '</a>';
            if ($gift['user_name_to'] == $user->getName()) {
                $output .= $this->msg('pipe-separator')->escaped();
                $output .= '<a href="' . htmlspecialchars($removeGiftLink->getFullURL('gift_id=' . $gift['id'])) . '">' . $this->msg('g-remove-gift')->plain() . '</a>';
            }
            $output .= '</div>
				</div>';
            $output .= '<div class="g-recent">
					<div class="g-recent-title">' . $this->msg('g-recent-recipients')->plain() . '</div>
					<div class="g-gift-count">' . $this->msg('g-given', $gift['gift_count'])->parse() . '</div>';
            foreach ($res as $row) {
                $userToId = $row->ug_user_id_to;
                $avatar = new wAvatar($userToId, 'ml');
                $userNameLink = Title::makeTitle(NS_USER, $row->ug_user_name_to);
                $output .= '<a href="' . htmlspecialchars($userNameLink->getFullURL()) . "\">\n\t\t\t\t\t{$avatar->getAvatarURL()}\n\t\t\t\t</a>";
            }
            $output .= '<div class="cleared"></div>
				</div>
			</div>';
            $out->addHTML($output);
        } else {
            $out->setPageTitle($this->msg('g-error-title')->plain());
            $out->addHTML($this->msg('g-error-message-invalid-link')->plain());
        }
    }
	/**
	 * Displays the form for adding a friend or a foe
	 * @return $form Mixed: HTML code for the form
	 */
	function displayForm() {
		global $wgOut;

		if ( $this->relationship_type == 1 ) {
			$wgOut->setPageTitle( wfMsg( 'ur-add-title-friend', $this->user_name_to ) );
			$add = wfMsg( 'ur-add-message-friend', $this->user_name_to );
			$button = wfMsg( 'ur-add-button-friend' );
		} else {
			$wgOut->setPageTitle( wfMsg( 'ur-add-title-foe', $this->user_name_to ) );
			$add = wfMsg( 'ur-add-message-foe', $this->user_name_to );
			$button = wfMsg( 'ur-add-button-foe' );
		}

		$avatar = new wAvatar( $this->user_id_to, 'l' );

		$form = "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\">
			<div class=\"relationship-action\">
			{$avatar->getAvatarURL()}
			" . $add .
			'<div class="cleared"></div>
			</div>
			<div class="relationship-textbox-title">' .
				wfMsg( 'ur-add-personal-message' ) .
			'</div>
			<textarea name="message" id="message" rows="3" cols="50"></textarea>
			<div class="relationship-buttons">
				<input type="button" class="site-button" value="' . $button . '" size="20" onclick="document.form1.submit()" />
				<input type="button" class="site-button" value="' . wfMsg( 'ur-cancel' ) . '" size="20" onclick="history.go(-1)" />
			</div>
		</form>';
		return $form;
	}
    /**
     * Show the special page
     *
     * @param $params Mixed: parameter(s) passed to the page or null
     */
    public function execute($params)
    {
        $lang = $this->getLanguage();
        $out = $this->getOutput();
        $request = $this->getRequest();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        // Add CSS
        $out->addModuleStyles('ext.socialprofile.userrelationship.css');
        $output = '';
        /**
         * Get query string variables
         */
        $user_name = $request->getVal('user');
        $rel_type = $request->getInt('rel_type');
        $page = $request->getInt('page');
        /**
         * Redirect Non-logged in users to Login Page
         * It will automatically return them to the ViewRelationships page
         */
        if (!$user->isLoggedIn() && $user_name == '') {
            $out->setPageTitle($this->msg('ur-error-page-title')->plain());
            $login = SpecialPage::getTitleFor('Userlogin');
            $out->redirect(htmlspecialchars($login->getFullURL('returnto=Special:ViewRelationships')));
            return false;
        }
        /**
         * Set up config for page / default values
         */
        if (!$page || !is_numeric($page)) {
            $page = 1;
        }
        if (!$rel_type || !is_numeric($rel_type)) {
            $rel_type = 1;
        }
        $per_page = 50;
        $per_row = 2;
        /**
         * If no user is set in the URL, we assume its the current user
         */
        if (!$user_name) {
            $user_name = $user->getName();
        }
        $user_id = User::idFromName($user_name);
        $userPage = Title::makeTitle(NS_USER, $user_name);
        /**
         * Error message for username that does not exist (from URL)
         */
        if ($user_id == 0) {
            $out->setPageTitle($this->msg('ur-error-title')->plain());
            $output = '<div class="relationship-error-message">' . $this->msg('ur-error-message-no-user')->plain() . '</div>
			<div class="relationship-request-buttons">
				<input type="button" class="site-button" value="' . $this->msg('ur-main-page')->plain() . '" onclick=\'window.location="index.php?title=' . $this->msg('mainpage')->inContentLanguage()->escaped() . '"\' />';
            if ($user->isLoggedIn()) {
                $output .= '<input type="button" class="site-button" value="' . $this->msg('ur-your-profile')->plain() . '" onclick=\'window.location="' . htmlspecialchars($user->getUserPage()->getFullURL()) . '"\' />';
            }
            $output .= '</div>';
            $out->addHTML($output);
            return false;
        }
        /**
         * Get all relationships
         */
        $rel = new UserRelationship($user_name);
        $relationships = $rel->getRelationshipList($rel_type, $per_page, $page);
        $stats = new UserStats($rel->user_id, $rel->user_name);
        $stats_data = $stats->getUserStats();
        $friend_count = $stats_data['friend_count'];
        $foe_count = $stats_data['foe_count'];
        $back_link = Title::makeTitle(NS_USER, $rel->user_name);
        if ($rel_type == 1) {
            $out->setPageTitle($this->msg('ur-title-friend', $rel->user_name)->parse());
            $total = $friend_count;
            $rem = $this->msg('ur-remove-relationship-friend')->plain();
            $output .= '<div class="back-links">
			<a href="' . htmlspecialchars($back_link->getFullURL()) . '">' . $this->msg('ur-backlink', $rel->user_name)->parse() . '</a>
		</div>
		<div class="relationship-count">' . $this->msg('ur-relationship-count-friends', $rel->user_name, $total)->text() . '</div>';
        } else {
            $out->setPageTitle($this->msg('ur-title-foe', $rel->user_name)->parse());
            $total = $foe_count;
            $rem = $this->msg('ur-remove-relationship-foe')->plain();
            $output .= '<div class="back-links">
			<a href="' . htmlspecialchars($back_link->getFullURL()) . '">' . $this->msg('ur-backlink', $rel->user_name)->parse() . '</a>
		</div>
		<div class="relationship-count">' . $this->msg('ur-relationship-count-foes', $rel->user_name, $total)->text() . '</div>';
        }
        if ($relationships) {
            $x = 1;
            foreach ($relationships as $relationship) {
                $indivRelationship = UserRelationship::getUserRelationshipByID($relationship['user_id'], $user->getID());
                // Safe titles
                $userPage = Title::makeTitle(NS_USER, $relationship['user_name']);
                $addRelationshipLink = SpecialPage::getTitleFor('AddRelationship');
                $removeRelationshipLink = SpecialPage::getTitleFor('RemoveRelationship');
                $giveGiftLink = SpecialPage::getTitleFor('GiveGift');
                $userPageURL = htmlspecialchars($userPage->getFullURL());
                $avatar = new wAvatar($relationship['user_id'], 'ml');
                $avatar_img = $avatar->getAvatarURL();
                $username_length = strlen($relationship['user_name']);
                $username_space = stripos($relationship['user_name'], ' ');
                if (($username_space == false || $username_space >= "30") && $username_length > 30) {
                    $user_name_display = substr($relationship['user_name'], 0, 30) . ' ' . substr($relationship['user_name'], 30, 50);
                } else {
                    $user_name_display = $relationship['user_name'];
                }
                $output .= "<div class=\"relationship-item\">\n\t\t\t\t\t<a href=\"{$userPageURL}\">{$avatar_img}</a>\n\t\t\t\t\t<div class=\"relationship-info\">\n\t\t\t\t\t\t<div class=\"relationship-name\">\n\t\t\t\t\t\t\t<a href=\"{$userPageURL}\">{$user_name_display}</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"relationship-actions\">";
                if ($indivRelationship == false) {
                    $output .= $lang->pipeList(array(Linker::link($addRelationshipLink, $this->msg('ur-add-friend')->plain(), array(), array('user' => $relationship['user_name'], 'rel_type' => 1)), Linker::link($addRelationshipLink, $this->msg('ur-add-foe')->plain(), array(), array('user' => $relationship['user_name'], 'rel_type' => 2)), ''));
                } elseif ($user_name == $user->getName()) {
                    $output .= Linker::link($removeRelationshipLink, $rem, array(), array('user' => $relationship['user_name']));
                    $output .= $this->msg('pipe-separator')->escaped();
                }
                $output .= Linker::link($giveGiftLink, $this->msg('ur-give-gift')->plain(), array(), array('user' => $relationship['user_name']));
                $output .= '</div>
					<div class="cleared"></div>
				</div>';
                $output .= '</div>';
                if ($x == count($relationships) || $x != 1 && $x % $per_row == 0) {
                    $output .= '<div class="cleared"></div>';
                }
                $x++;
            }
        }
        /**
         * Build next/prev nav
         */
        $total = intval(str_replace(',', '', $total));
        $numofpages = $total / $per_page;
        $pageLink = $this->getPageTitle();
        if ($numofpages > 1) {
            $output .= '<div class="page-nav">';
            if ($page > 1) {
                $output .= Linker::link($pageLink, $this->msg('ur-previous')->plain(), array(), array('user' => $user_name, 'rel_type' => $rel_type, 'page' => $page - 1)) . $this->msg('word-separator')->plain();
            }
            if ($total % $per_page != 0) {
                $numofpages++;
            }
            if ($numofpages >= 9 && $page < $total) {
                $numofpages = 9 + $page;
            }
            if ($numofpages >= $total / $per_page) {
                $numofpages = $total / $per_page + 1;
            }
            for ($i = 1; $i <= $numofpages; $i++) {
                if ($i == $page) {
                    $output .= $i . ' ';
                } else {
                    $output .= Linker::link($pageLink, $i, array(), array('user' => $user_name, 'rel_type' => $rel_type, 'page' => $i)) . $this->msg('word-separator')->plain();
                }
            }
            if ($total - $per_page * $page > 0) {
                $output .= $this->msg('word-separator')->plain() . Linker::link($pageLink, $this->msg('ur-next')->plain(), array(), array('user' => $user_name, 'rel_type' => $rel_type, 'page' => $page + 1));
            }
            $output .= '</div>';
        }
        $out->addHTML($output);
    }
    /**
     * Shows the requested user's current avatar and the button for deleting it
     *
     * @param $user_name String: name of the user whose avatars we want to delete
     */
    private function showUserAvatar($user_name)
    {
        $user_name = str_replace('_', ' ', $user_name);
        // replace underscores with spaces
        $user_id = User::idFromName($user_name);
        $avatar = new wAvatar($user_id, 'l');
        $output = '<div><b>' . wfMsg('avatarupload-currentavatar', $user_name) . '</b></div>';
        $output .= "<div>{$avatar->getAvatarURL()}</div>";
        $output .= '<div><form method="post" name="avatar" action="">
				<input type="hidden" name="user_id" value="' . $user_id . '" />
				<br />
				<input type="submit" value="' . wfMsg('delete') . '" />
			</form></div>';
        return $output;
    }
    public function displayMessages($user_id, $user_id_2 = 0, $count = 10, $page = 0)
    {
        global $wgUser, $wgTitle;
        $output = '';
        // Prevent E_NOTICE
        $messages = $this->getUserBoardMessages($user_id, $user_id_2, $count, $page);
        if ($messages) {
            foreach ($messages as $message) {
                $user = Title::makeTitle(NS_USER, $message['user_name_from']);
                $avatar = new wAvatar($message['user_id_from'], 'm');
                $board_to_board = '';
                $board_link = '';
                $message_type_label = '';
                $delete_link = '';
                if ($wgUser->getName() != $message['user_name_from']) {
                    $board_to_board = '<a href="' . UserBoard::getUserBoardToBoardURL($message['user_name'], $message['user_name_from']) . '">' . wfMsgHtml('userboard_board-to-board') . '</a>';
                    $board_link = '<a href="' . UserBoard::getUserBoardURL($message['user_name_from']) . '">' . wfMsgHtml('userboard_sendmessage', $message['user_name_from']) . '</a>';
                }
                if ($wgUser->getName() == $message['user_name'] || $wgUser->isAllowed('userboard-delete')) {
                    $delete_link = "<span class=\"user-board-red\">\r\n\t\t\t\t\t\t\t<a href=\"javascript:void(0);\" onclick=\"javascript:delete_message({$message['id']})\">" . wfMsgHtml('userboard_delete') . '</a>
						</span>';
                }
                if ($message['type'] == 1) {
                    $message_type_label = '(' . wfMsgHtml('userboard_private') . ')';
                }
                $message_text = $message['message_text'];
                # $message_text = preg_replace_callback( "/(<a[^>]*>)(.*?)(<\/a>)/i", 'cut_link_text', $message['message_text'] );
                $output .= "<div class=\"user-board-message\">\r\n\t\t\t\t\t<div class=\"user-board-message-from\">\r\n\t\t\t\t\t<a href=\"{$user->escapeFullURL()}\" title=\"{$message['user_name_from']}\">{$message['user_name_from']}</a> {$message_type_label}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"user-board-message-time\">" . wfMsgHtml('userboard_posted_ago', $this->getTimeAgo($message['timestamp'])) . "</div>\r\n\t\t\t\t\t<div class=\"user-board-message-content\">\r\n\t\t\t\t\t\t<div class=\"user-board-message-image\">\r\n\t\t\t\t\t\t\t<a href=\"{$user->escapeFullURL()}\" title=\"{$message['user_name_from']}\">{$avatar->getAvatarURL()}</a>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"user-board-message-body\">\r\n\t\t\t\t\t\t\t{$message_text}\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t<div class=\"cleared\"></div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"user-board-message-links\">\r\n\t\t\t\t\t\t{$board_link}\r\n\t\t\t\t\t\t{$board_to_board}\r\n\t\t\t\t\t\t{$delete_link}\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>";
            }
        } elseif ($wgUser->getName() == $wgTitle->getText()) {
            $output .= '<div class="no-info-container">' . wfMsgHtml('userboard_nomessages') . '</div>';
        }
        return $output;
    }
示例#24
0
    /**
     * Get the relationships for a given user.
     *
     * @param $user_name String: name of the user whose relationships we want
     *                           to fetch
     * @param $rel_type Integer: 1 for friends, 2 (or anything else than 1) for
     *                           foes
     */
    function getRelationships($user_name, $rel_type)
    {
        global $wgMemc, $wgUser, $wgUserProfileDisplay, $wgLang;
        // If not enabled in site settings, don't display
        if ($rel_type == 1) {
            if ($wgUserProfileDisplay['friends'] == false) {
                return '';
            }
        } else {
            if ($wgUserProfileDisplay['foes'] == false) {
                return '';
            }
        }
        $output = '';
        // Prevent E_NOTICE
        $count = 4;
        $rel = new UserRelationship($user_name);
        $key = wfForeignMemcKey('huiji', '', 'relationship', 'profile', "{$rel->user_id}-{$rel_type}");
        $data = $wgMemc->get($key);
        // Try cache
        if (!$data) {
            $friends = $rel->getRelationshipList($rel_type, $count);
            $wgMemc->set($key, $friends);
        } else {
            wfDebug("Got profile relationship type {$rel_type} for user {$user_name} from cache\n");
            $friends = $data;
        }
        $stats = new UserStats($rel->user_id, $user_name);
        $stats_data = $stats->getUserStats();
        $view_all_title = SpecialPage::getTitleFor('ViewRelationships');
        if ($rel_type == 1) {
            $relationship_count = $stats_data['friend_count'];
            $relationship_title = wfMessage('user-friends-title')->escaped();
        } else {
            $relationship_count = $stats_data['foe_count'];
            $relationship_title = wfMessage('user-foes-title')->escaped();
        }
        if (count($friends) > 0) {
            $x = 1;
            $per_row = 4;
            $output .= '<div class="panel panel-default"><div class="user-section-heading panel-heading">
				<div class="user-section-title">' . $relationship_title . '</div>
				<div class="user-section-actions">
					<div class="action-right">';
            if (intval(str_replace(',', '', $relationship_count)) > 4) {
                $output .= '<a href="' . htmlspecialchars($view_all_title->getFullURL('user='******'&rel_type=' . $rel_type)) . '" rel="nofollow">' . wfMessage('user-view-all')->escaped() . '</a>';
            }
            $output .= '</div>
					<div class="action-left">';
            if (intval(str_replace(',', '', $relationship_count)) > 4) {
                $output .= wfMessage('user-count-separator', $per_row, $relationship_count)->escaped();
            } else {
                $output .= wfMessage('user-count-separator', $relationship_count, $relationship_count)->escaped();
            }
            $output .= '</div>
				</div>
				<div class="cleared"></div>
			</div>
			<div class="cleared"></div>
			<div class="user-relationship-container panel-body">';
            foreach ($friends as $friend) {
                $user = Title::makeTitle(NS_USER, $friend['user_name']);
                $avatar = new wAvatar($friend['user_id'], 'ml');
                // Chop down username that gets displayed
                $user_name = $wgLang->truncate($friend['user_name'], 9, '..');
                $output .= "<a href=\"" . htmlspecialchars($user->getFullURL()) . "\" title=\"{$friend['user_name']}\" rel=\"nofollow\">\n\t\t\t\t\t{$avatar->getAvatarURL()}<br />\n\t\t\t\t\t{$user_name}\n\t\t\t\t</a>";
                if ($x == count($friends) || $x != 1 && $x % $per_row == 0) {
                    $output .= '<div class="cleared"></div>';
                }
                $x++;
            }
            $output .= '</div></div>';
        }
        return $output;
    }
	public static function getReply( $reply, $posted, $buttons, $id, $userId ) {
		$avatar = '';
		if ( $userId && class_exists( 'wAvatar' ) ) {
			$avatarObj = new wAvatar( $userId, 'l' );
			$avatar = '<div class="wikiforum-avatar-image">';
			$avatar .= $avatarObj->getAvatarURL();
			$avatar .= '</div>';
		}
		return '<tr><td class="mw-wikiforum-thread-sub" colspan="2" id="reply_' . intval( $id ) . '">' . $avatar .
			$reply . self::getBottomLine( $posted, $buttons ) . '</td></tr>';
	}
 /**
  * Function to render the {{#avatar:Username}} function
  *
  * @param Parser $parser: MW parser object
  * @param string $username: Username of user to show avatar for
  * @param string $size: Size of avatar to return (s/m/ml/l), or px value (100px, 10px, etc)
  * @return array: output of function, and options for the parser
  */
 static function renderAvatarParserFunction($parser, $username = '', $givenSize = 'm')
 {
     global $wgUploadPath;
     $sizes = array('s', 'm', 'ml', 'l');
     if (in_array($givenSize, $sizes)) {
         // if given size is a code,
         $size = $givenSize;
         // use code,
         $px = '';
         // and leave px value empty
     } elseif (substr($givenSize, -2) == 'px') {
         //given size is a value in px
         $givenPx = intval(substr($givenSize, 0, strlen($givenSize) - 2));
         //get int value of given px size
         if (!is_int($givenPx)) {
             // if px value is not int
             $size = 'm';
             // give default avatar
             $px = '';
             // with no px value
         }
         if ($givenPx <= 16) {
             // if given px value is smaller than small,
             $size = 's';
             // use the small avatar,
             $px = $givenSize;
             // and the given px value
         } elseif ($givenPx <= 30) {
             // if given px value is smaller than medium,
             $size = 'm';
             // use the medium avatar,
             $px = $givenSize;
             // and the given px value
         } elseif ($givenPx <= 50) {
             // if given px value is smaller than medium-large,
             $size = 'ml';
             // use the medium-large avatar,
             $px = $givenSize;
             // and the given px value
         } else {
             // if given px value is bigger then medium large,
             $size = 'l';
             // use the large avatar,
             $px = $givenSize;
             // and the given px value
         }
     } else {
         // size value is not code or px
         $size = 'm';
         // give default avatar
         $px = '';
         // with no px value
     }
     $user = User::newFromName($username);
     if ($user instanceof User) {
         $id = $user->getId();
         $avatar = new wAvatar($id, $size);
     } else {
         // Fallback for the case where an invalid (nonexistent) user name
         // was supplied...
         $avatar = new wAvatar(-1, 'm');
         // not very nice, but -1 will get the default avatar
     }
     if ($px) {
         // if px value needed, set height to it
         $output = $avatar->getAvatarURL(array('height' => $px));
     } else {
         // but if not needed, don't
         $output = $avatar->getAvatarURL();
     }
     return array($output, 'noparse' => true, 'isHTML' => true);
 }
	/**
	 * Show the special page
	 *
	 * @param $params Mixed: parameter(s) passed to the page or null
	 */
	public function execute( $params ) {
		global $wgUser, $wgOut, $wgRequest, $wgUserRelationshipScripts, $wgLang;

		$wgOut->addExtensionStyle( $wgUserRelationshipScripts . '/UserRelationship.css' );

		$output = '';

		/**
		 * Get query string variables
		 */
		$user_name = $wgRequest->getVal( 'user' );
		$rel_type = $wgRequest->getInt( 'rel_type' );
		$page = $wgRequest->getInt( 'page' );

		/**
		 * Redirect Non-logged in users to Login Page
		 * It will automatically return them to the ViewRelationships page
		 */
		if ( !$wgUser->isLoggedIn() && $user_name == '' ) {
			$wgOut->setPageTitle( wfMsg( 'ur-error-page-title' ) );
			$login = SpecialPage::getTitleFor( 'Userlogin' );
			$wgOut->redirect( $login->escapeFullURL( 'returnto=Special:ViewRelationships' ) );
			return false;
		}

		/**
		 * Set up config for page / default values
		 */
		if ( !$page || !is_numeric( $page ) ) {
			$page = 1;
		}
		if ( !$rel_type || !is_numeric( $rel_type ) ) {
			$rel_type = 1;
		}
		$per_page = 50;
		$per_row = 2;

		/**
		 * If no user is set in the URL, we assume its the current user
		 */
		if ( !$user_name ) {
			$user_name = $wgUser->getName();
		}
		$user_id = User::idFromName( $user_name );
		$userPage = Title::makeTitle( NS_USER, $user_name );

		/**
		 * Error message for username that does not exist (from URL)
		 */
		if ( $user_id == 0 ) {
			$wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
			$out = '<div class="relationship-error-message">' .
				wfMsg( 'ur-error-message-no-user' ) .
			'</div>
			<div class="relationship-request-buttons">
				<input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />';
			if ( $wgUser->isLoggedIn() ) {
				$out .= '<input type="button" class="site-button" value="' . wfMsg( 'ur-your-profile' ) . '" onclick=\'window.location="' . $wgUser->getUserPage()->escapeFullURL() . '"\' />';
			}
			$out .= '</div>';
			$wgOut->addHTML( $out );
			return false;
		}

		/**
		 * Get all relationships
		 */
		$rel = new UserRelationship( $user_name );
		$relationships = $rel->getRelationshipList( $rel_type, $per_page, $page );

		$stats = new UserStats( $rel->user_id, $rel->user_name );
		$stats_data = $stats->getUserStats();
		$friend_count = $stats_data['friend_count'];
		$foe_count = $stats_data['foe_count'];

		$back_link = Title::makeTitle( NS_USER, $rel->user_name );
		$inviteContactsLink = SpecialPage::getTitleFor( 'InviteContacts' );

		if ( $rel_type == 1 ) {
			$output .= $wgOut->setPageTitle( wfMsg( 'ur-title-friend', $rel->user_name ) );
			$total = $friend_count;
			$rem = wfMsg( 'ur-remove-relationship-friend' );
			$output .= '<div class="back-links">
			<a href="' . $back_link->escapeFullURL() . '">' .
				wfMsg( 'ur-backlink', $rel->user_name ) .
			'</a>
		</div>
		<div class="relationship-count">' .
			wfMsgExt(
				'ur-relationship-count-friends',
				'parsemag',
				$rel->user_name,
				$total,
				$inviteContactsLink->escapeFullURL()
			) . '</div>';
		} else {
			$output .= $wgOut->setPageTitle( wfMsg( 'ur-title-foe', $rel->user_name ) );
			$total = $foe_count;
			$rem = wfMsg( 'ur-remove-relationship-foe' );
			$output .= '<div class="back-links">
			<a href="' . $back_link->escapeFullURL() . '">' .
				wfMsg( 'ur-backlink', $rel->user_name ) .
			'</a>
		</div>
		<div class="relationship-count">'
			. wfMsgExt(
				'ur-relationship-count-foes',
				'parsemag',
				$rel->user_name,
				$total,
				$inviteContactsLink->escapeFullURL()
			) . '</div>';
		}

		if ( $relationships ) {
			$x = 1;

			foreach ( $relationships as $relationship ) {
				$indivRelationship = UserRelationship::getUserRelationshipByID(
					$relationship['user_id'],
					$wgUser->getID()
				);

				// Safe titles
				$userPage = Title::makeTitle( NS_USER, $relationship['user_name'] );
				$addRelationshipLink = SpecialPage::getTitleFor( 'AddRelationship' );
				$removeRelationshipLink = SpecialPage::getTitleFor( 'RemoveRelationship' );
				$giveGiftLink = SpecialPage::getTitleFor( 'GiveGift' );

				$avatar = new wAvatar( $relationship['user_id'], 'ml' );

				$avatar_img = $avatar->getAvatarURL();

				$user_safe = urlencode( $relationship['user_name'] );

				$username_length = strlen( $relationship['user_name'] );
				$username_space = stripos( $relationship['user_name'], ' ' );

				if ( ( $username_space == false || $username_space >= "30" ) && $username_length > 30 ) {
					$user_name_display = substr( $relationship['user_name'], 0, 30 ) .
						' ' . substr( $relationship['user_name'], 30, 50 );
				} else {
					$user_name_display = $relationship['user_name'];
				}

				$output .= "<div class=\"relationship-item\">
					<a href=\"{$userPage->escapeFullURL()}\">{$avatar_img}</a>
					<div class=\"relationship-info\">
						<div class=\"relationship-name\">
							<a href=\"{$userPage->escapeFullURL()}\">{$user_name_display}</a>
						</div>
					<div class=\"relationship-actions\">";
				if ( $indivRelationship == false ) {
					$output .= $wgLang->pipeList( array(
						'<a href="' . $addRelationshipLink->escapeFullURL( 'user='******'&rel_type=1' ) . '">' . wfMsg( 'ur-add-friend' ) . '</a>',
						'<a href="' . $addRelationshipLink->escapeFullURL( 'user='******'&rel_type=2' ) . '">' . wfMsg( 'ur-add-foe' ) . '</a>',
						''
					) );
				} elseif ( $user_name == $wgUser->getName() ) {
					$output .= '<a href="' . $removeRelationshipLink->escapeFullURL( 'user='******'">' . $rem . '</a>';
					$output .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
				}
				$output .= '<a href="' . $giveGiftLink->escapeFullURL( 'user='******'">' . wfMsg( 'ur-give-gift' ) . '</a>';

				$output .= '</div>
					<div class="cleared"></div>
				</div>';

				$output .= '</div>';
				if ( $x == count( $relationships ) || $x != 1 && $x % $per_row == 0 ) {
					$output .= '<div class="cleared"></div>';
				}
				$x++;
			}
		}

		/**
		 * Build next/prev nav
		 */
		$total = intval( str_replace( ',', '', $total ) );
		$numofpages = $total / $per_page;

		$pageLink = SpecialPage::getTitleFor( 'ViewRelationships' );

		if ( $numofpages > 1 ) {
			$output .= '<div class="page-nav">';
			if ( $page > 1 ) {
				$output .= '<a href="' . $pageLink->escapeFullURL( 'user='******'&rel_type=' . $rel_type . '&page=' . ( $page - 1 ) ) . '">' . wfMsg( 'ur-previous' ) . '</a> ';
			}

			if ( ( $total % $per_page ) != 0 ) {
				$numofpages++;
			}
			if ( $numofpages >= 9 && $page < $total ) {
				$numofpages = 9 + $page;
			}
			if ( $numofpages >= ( $total / $per_page ) ) {
				$numofpages = ( $total / $per_page ) + 1;
			}

			for ( $i = 1; $i <= $numofpages; $i++ ) {
				if ( $i == $page ) {
					$output .= ( $i . ' ' );
				} else {
					$output .= '<a href="' . $pageLink->escapeFullURL( 'user='******'&rel_type=' . $rel_type . '&page=' . $i ) . "\">$i</a> ";
				}
			}

			if ( ( $total - ( $per_page * $page ) ) > 0 ) {
				$output .= ' <a href="' . $pageLink->escapeFullURL( 'user='******'&rel_type=' . $rel_type . '&page=' . ( $page + 1 ) ) . '">' . wfMsg( 'ur-next' ) . '</a>';
			}
			$output .= '</div>';
		}

		$wgOut->addHTML( $output );
	}
示例#28
0
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgMemc;
        $out = $this->getOutput();
        $request = $this->getRequest();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        // Load CSS
        $out->addModuleStyles('ext.socialprofile.userstats.css');
        $periodFromRequest = $request->getVal('period');
        if ($periodFromRequest == 'weekly') {
            $period = 'weekly';
        } elseif ($periodFromRequest == 'monthly') {
            $period = 'monthly';
        }
        if (!isset($period)) {
            $period = 'weekly';
        }
        if ($period == 'weekly') {
            $pageTitle = 'top-fans-weekly-points-link';
        } else {
            $pageTitle = 'top-fans-monthly-points-link';
        }
        $out->addHtml(TopUsersPoints::getRankingDropdown('用户' . $this->msg($pageTitle)->plain()));
        $out->setPageTitle($this->msg($pageTitle)->plain());
        $count = 50;
        $user_list = array();
        // Try cache
        $key = wfForeignMemcKey('huiji', '', 'user_stats', $period, 'points', $count);
        $data = $wgMemc->get($key);
        if ($data != '') {
            wfDebug("Got top users by {$period} points ({$count}) from cache\n");
            $user_list = $data;
        } else {
            wfDebug("Got top users by {$period} points ({$count}) from DB\n");
            $params['ORDER BY'] = 'up_points DESC';
            $params['LIMIT'] = $count;
            $dbr = wfGetDB(DB_SLAVE);
            $res = $dbr->select("user_points_{$period}", array('up_user_id', 'up_user_name', 'up_points'), array('up_user_id <> 0'), __METHOD__, $params);
            foreach ($res as $row) {
                $userObj = User::newFromId($row->up_user_id);
                $user_group = $userObj->getEffectiveGroups();
                if (!in_array('bot', $user_group) && !in_array('bot-global', $user_group)) {
                    $user_list[] = array('user_id' => $row->up_user_id, 'user_name' => $row->up_user_name, 'points' => $row->up_points);
                }
            }
            $wgMemc->set($key, $user_list, 60 * 5);
        }
        // // Top nav bar
        // $top_title = SpecialPage::getTitleFor( 'TopUsers' );
        // $recent_title = SpecialPage::getTitleFor( 'TopUsersRecent' );
        // $output = '<div class="top-fan-nav">
        // 	<h1>' . $this->msg( 'top-fans-by-points-nav-header' )->plain() . '</h1>
        // 	<p><a href="' . htmlspecialchars( $top_title->getFullURL() ) . '">' .
        // 		$this->msg( 'top-fans-total-points-link' )->plain() . '</a></p>';
        // if ( $period == 'weekly' ) {
        // 	$output .= '<p><a href="' . htmlspecialchars( $recent_title->getFullURL( 'period=monthly' ) ) . '">' .
        // 		$this->msg( 'top-fans-monthly-points-link' )->plain() . '</a><p>
        // 	<p><b>' . $this->msg( 'top-fans-weekly-points-link' )->plain() . '</b></p>';
        // } else {
        // 	$output .= '<p><b>' . $this->msg( 'top-fans-monthly-points-link' )->plain() . '</b><p>
        // 	<p><a href="' . htmlspecialchars( $recent_title->getFullURL( 'period=weekly' ) ) . '">' .
        // 		$this->msg( 'top-fans-weekly-points-link' )->plain() . '</a></p>';
        // }
        // // Build nav of stats by category based on MediaWiki:Topfans-by-category
        // $by_category_title = SpecialPage::getTitleFor( 'TopFansByStatistic' );
        // $message = $this->msg( 'topfans-by-category' )->inContentLanguage();
        // if ( !$message->isDisabled() ) {
        // 	$output .= '<h1 class="top-title">' .
        // 		$this->msg( 'top-fans-by-category-nav-header' )->plain() . '</h1>';
        // 	$lines = explode( "\n", $message->text() );
        // 	foreach ( $lines as $line ) {
        // 		if ( strpos( $line, '*' ) !== 0 ) {
        // 			continue;
        // 		} else {
        // 			$line = explode( '|', trim( $line, '* ' ), 2 );
        // 			$stat = $line[0];
        // 			$link_text = $line[1];
        // 			// Check if the link text is actually the name of a system
        // 			// message (refs bug #30030)
        // 			$msgObj = $this->msg( $link_text );
        // 			if ( !$msgObj->isDisabled() ) {
        // 				$link_text = $msgObj->parse();
        // 			}
        // 			$output .= '<p>';
        // 			$output .= Linker::link(
        // 				$by_category_title,
        // 				$link_text,
        // 				array(),
        // 				array( 'stat' => $stat )
        // 			);
        // 			$output .= '</p>';
        // 		}
        // 	}
        // }
        // $output .= '</div>';
        $x = 1;
        $output .= '<div class="top-users">';
        foreach ($user_list as $item) {
            $user_title = Title::makeTitle(NS_USER, $item['user_name']);
            $avatar = new wAvatar($item['user_id'], 'm');
            $avatarImage = $avatar->getAvatarURL();
            if ($item['points'] < 0) {
                $points = 0;
            } else {
                $points = $item['points'];
            }
            if ($user->getName() == $item['user_name']) {
                $active = 'active';
            } else {
                $active = '';
            }
            $output .= '<div class="top-fan-row {$active}">
				<span class="top-fan-num">' . $x . '.</span>
				<span class="top-fan"><a href="' . htmlspecialchars($user_title->getFullURL()) . '" >' . $avatarImage . '</a><a href="' . htmlspecialchars($user_title->getFullURL()) . '" >' . $item['user_name'] . '</a>
				</span>';
            $output .= '<span class="top-fan-points"><b>' . $this->getLanguage()->formatNum($points) . '</b> ' . $this->msg('top-fans-points')->plain() . '</span>';
            $output .= '<div class="cleared"></div>';
            $output .= '</div>';
            $x++;
        }
        $output .= '</div><div class="cleared"></div>';
        $out->addHTML($output);
    }
示例#29
0
            <a>管理员</a>
            <div>
            <?php 
$fanbox_link = SpecialPage::getTitleFor('UserList');
$group = 'sysop';
$ums = self::getSiteManager($wgHuijiPrefix, $group);
foreach ($ums as $value) {
    $uname = User::newFromId($value);
    $user_group = $uname->getEffectiveGroups();
    if (!in_array('bot', $user_group) && !in_array('bot-global', $user_group)) {
        $usersys['user_name'] = $uname->getName();
        $usersys['count'] = UserStats::getSiteEditsCount($uname, $wgHuijiPrefix);
        $userPage = Title::makeTitle(NS_USER, $uname->getName());
        $usersys['url'] = htmlspecialchars($userPage->getFullURL());
        $avatar = new wAvatar($value, 'm');
        $usersys['avatar'] = $avatar->getAvatarURL();
        $sysop[] = $usersys;
    }
}
foreach ($sysop as $key => $value) {
    $count[$key] = $value['count'];
}
array_multisort($count, SORT_DESC, $sysop);
$nums = count($ums) > 5 ? 5 : count($ums);
for ($j = 0; $j < $nums; $j++) {
    echo '<a href="' . $sysop[$j]['url'] . '"  title="' . $sysop[$j]['user_name'] . '">' . $sysop[$j]['avatar'] . '</a>';
}
if (count($ums) > 5) {
    echo Linker::link($fanbox_link, '>>', array('class' => 'more'), array('group' => $group, 'limit' => 50));
}
?>
    /**
     * Show the special page
     *
     * @param $par Mixed: parameter passed to the page or null
     */
    public function execute($par)
    {
        global $wgOut, $wgUser, $wgTitle, $wgRequest, $wgFanBoxScripts;
        // Add CSS & JS
        $wgOut->addExtensionStyle($wgFanBoxScripts . '/FanBoxes.css');
        $wgOut->addScriptFile($wgFanBoxScripts . '/FanBoxes.js');
        $topfanboxId = $wgRequest->getVal('id');
        $topfanboxCategory = $wgRequest->getVal('cat');
        if ($topfanboxId == 'fantag_date') {
            $wgOut->setPageTitle(wfMsg('most-recent-fanboxes-link'));
            $topfanboxes = $this->getTopFanboxes('fantag_date');
        } else {
            $wgOut->setPageTitle(wfMsg('topuserboxes'));
            $topfanboxes = $this->getTopFanboxes('fantag_count');
        }
        $output = '';
        // Make top right nav bar
        $output .= '<div class="fanbox-nav">
			<h2>' . wfMsg('fanbox-nav-header') . "</h2>\n\t\t\t<p><a href=\"{$this->getTitle()->escapeFullURL()}\">" . wfMsg('top-fanboxes-link') . '</a></p>
			<p><a href="' . $this->getTitle()->escapeFullURL('id=fantag_date') . '">' . wfMsg('most-recent-fanboxes-link') . '</a></p>
		</div>';
        // Nothing? That means that no userboxes have been created yet...so
        // show a message to the user about that, prompting them to create some
        // userboxes
        if (empty($topfanboxes)) {
            $output .= wfMsgExt('fanbox-top-list-is-empty', 'parse');
        }
        if (!$topfanboxCategory) {
            $x = 1;
            $output .= '<div class="top-fanboxes">';
            $tagParser = new Parser();
            foreach ($topfanboxes as $topfanbox) {
                $check_user_fanbox = $this->checkIfUserHasFanbox($topfanbox['fantag_id']);
                if ($topfanbox['fantag_image_name']) {
                    $fantag_image_width = 45;
                    $fantag_image_height = 53;
                    $fantag_image = wfFindFile($topfanbox['fantag_image_name']);
                    $fantag_image_url = '';
                    if (is_object($fantag_image)) {
                        $fantag_image_url = $fantag_image->createThumb($fantag_image_width, $fantag_image_height);
                    }
                    $fantag_image_tag = '<img alt="" src="' . $fantag_image_url . '"/>';
                }
                if ($topfanbox['fantag_left_text'] == '') {
                    $fantag_leftside = $fantag_image_tag;
                } else {
                    $fantag_leftside = $topfanbox['fantag_left_text'];
                    $fantag_leftside = $tagParser->parse($fantag_leftside, $wgTitle, $wgOut->parserOptions(), false);
                    $fantag_leftside = $fantag_leftside->getText();
                }
                if ($topfanbox['fantag_left_textsize'] == 'mediumfont') {
                    $leftfontsize = '14px';
                }
                if ($topfanbox['fantag_left_textsize'] == 'bigfont') {
                    $leftfontsize = '20px';
                }
                if ($topfanbox['fantag_right_textsize'] == 'smallfont') {
                    $rightfontsize = '12px';
                }
                if ($topfanbox['fantag_right_textsize'] == 'mediumfont') {
                    $rightfontsize = '14px';
                }
                // Get permalink
                $fantag_title = Title::makeTitle(NS_FANTAG, $topfanbox['fantag_title']);
                // Get creator
                $userftusername = $topfanbox['fantag_user_name'];
                $userftuserid = $topfanbox['fantag_user_id'];
                $user_title = Title::makeTitle(NS_USER, $topfanbox['fantag_user_name']);
                $avatar = new wAvatar($topfanbox['fantag_user_id'], 'm');
                $right_text = $topfanbox['fantag_right_text'];
                $right_text = $tagParser->parse($right_text, $wgTitle, $wgOut->parserOptions(), false);
                $right_text = $right_text->getText();
                $output .= "\n\t\t\t\t<div class=\"top-fanbox-row\">\n\t\t\t\t<span class=\"top-fanbox-num\">{$x}.</span><span class=\"top-fanbox\">\n\n\t\t\t\t<div class=\"fanbox-item\">\n\n\t\t\t\t<div class=\"individual-fanbox\" id=\"individualFanbox" . $topfanbox['fantag_id'] . "\">\n\t\t\t\t\t<div class=\"show-message-container\" id=\"show-message-container" . $topfanbox['fantag_id'] . "\">\n\t\t\t\t\t\t<div class=\"permalink-container\">\n\t\t\t\t\t\t<a class=\"perma\" style=\"font-size:8px; color:" . $topfanbox['fantag_right_textcolor'] . "\" href=\"" . $fantag_title->escapeFullURL() . "\" title=\"{$topfanbox['fantag_title']}\">" . wfMsg('fanbox-perma') . "</a>\n\t\t\t\t\t\t<table class=\"fanBoxTable\" onclick=\"javascript:FanBoxes.openFanBoxPopup('fanboxPopUpBox{$topfanbox['fantag_id']}', 'individualFanbox{$topfanbox['fantag_id']}')\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td id=\"fanBoxLeftSideOutput\" style=\"color:" . $topfanbox['fantag_left_textcolor'] . "; font-size:{$leftfontsize}\" bgcolor=\"" . $topfanbox['fantag_left_bgcolor'] . "\">" . $fantag_leftside . "</td>\n\t\t\t\t\t\t\t<td id=\"fanBoxRightSideOutput\" style=\"color:" . $topfanbox['fantag_right_textcolor'] . "; font-size:{$rightfontsize}\" bgcolor=\"" . $topfanbox['fantag_right_bgcolor'] . "\">" . $right_text . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
                if ($wgUser->isLoggedIn()) {
                    if ($check_user_fanbox == 0) {
                        $output .= "\n\t\t\t\t\t<div class=\"fanbox-pop-up-box\" id=\"fanboxPopUpBox" . $topfanbox['fantag_id'] . "\">\n\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" width=\"258px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">" . wfMsg('fanbox-add-fanbox') . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('fanbox-add') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$topfanbox['fantag_id']}', 'individualFanbox{$topfanbox['fantag_id']}'); FanBoxes.showAddRemoveMessageUserPage(1, {$topfanbox['fantag_id']}, 'show-addremove-message')\" />\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('cancel') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$topfanbox['fantag_id']}', 'individualFanbox{$topfanbox['fantag_id']}')\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>";
                    } else {
                        $output .= "\n\t\t\t\t\t<div class=\"fanbox-pop-up-box\" id=\"fanboxPopUpBox" . $topfanbox['fantag_id'] . "\">\n\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" width=\"258px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">" . wfMsg('fanbox-remove-fanbox') . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('fanbox-remove') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$topfanbox['fantag_id']}', 'individualFanbox{$topfanbox['fantag_id']}'); FanBoxes.showAddRemoveMessageUserPage(2, {$topfanbox['fantag_id']}, 'show-addremove-message')\" />\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('cancel') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$topfanbox['fantag_id']}', 'individualFanbox{$topfanbox['fantag_id']}')\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>";
                    }
                }
                if ($wgUser->getID() == 0) {
                    $login = SpecialPage::getTitleFor('Userlogin');
                    $output .= "<div class=\"fanbox-pop-up-box\" id=\"fanboxPopUpBox" . $topfanbox['fantag_id'] . "\">\n\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" width=\"258px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">" . wfMsg('fanbox-add-fanbox-login') . " <a href=\"{$login->getFullURL()}\">" . wfMsg('fanbox-login') . "</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('cancel') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$topfanbox['fantag_id']}', 'individualFanbox{$topfanbox['fantag_id']}')\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>";
                }
                $output .= '</div></span>';
                $output .= '<div class="top-fanbox-users">
					<table>
						<tr>
							<td class="centerheight">
								<b><a href="' . $fantag_title->escapeFullURL() . '">' . wfMsgExt('fanbox-members', 'parsemag', $topfanbox['fantag_count']) . '</a></b>
							</td>
						</tr>
					</table>
				</div>';
                $output .= '<div class="cleared"></div>';
                $output .= '</div>';
                $x++;
            }
            $output .= '</div><div class="cleared"></div>';
        }
        if ($topfanboxCategory) {
            $x = 1;
            $output .= '<div class="top-fanboxes">';
            // This variable wasn't originally defined, I'm not sure that this
            // is 100% correct, but...
            $categoryfanboxes = $this->getFanBoxByCategory($topfanboxCategory);
            foreach ($categoryfanboxes as $categoryfanbox) {
                $check_user_fanbox = $this->checkIfUserHasFanbox($categoryfanbox['fantag_id']);
                if ($categoryfanbox['fantag_image_name']) {
                    $fantag_image_width = 45;
                    $fantag_image_height = 53;
                    $fantag_image = wfFindFile($categoryfanbox['fantag_image_name']);
                    $fantag_image_url = '';
                    if (is_object($fantag_image)) {
                        $fantag_image_url = $fantag_image->createThumb($fantag_image_width, $fantag_image_height);
                    }
                    $fantag_image_tag = '<img alt="" src="' . $fantag_image_url . '"/>';
                }
                if ($categoryfanbox['fantag_left_text'] == '') {
                    $fantag_leftside = $fantag_image_tag;
                } else {
                    $fantag_leftside = $categoryfanbox['fantag_left_text'];
                }
                if ($categoryfanbox['fantag_left_textsize'] == 'mediumfont') {
                    $leftfontsize = '14px';
                }
                if ($categoryfanbox['fantag_left_textsize'] == 'bigfont') {
                    $leftfontsize = '20px';
                }
                if ($categoryfanbox['fantag_right_textsize'] == 'smallfont') {
                    $rightfontsize = '12px';
                }
                if ($categoryfanbox['fantag_right_textsize'] == 'mediumfont') {
                    $rightfontsize = '14px';
                }
                // Get permalink
                $fantag_title = Title::makeTitle(NS_FANTAG, $categoryfanbox['fantag_title']);
                // Get creator
                $userftusername = $categoryfanbox['fantag_user_name'];
                $userftuserid = $categoryfanbox['fantag_user_id'];
                $user_title = Title::makeTitle(NS_USER, $categoryfanbox['fantag_user_name']);
                $avatar = new wAvatar($categoryfanbox['fantag_user_id'], 'm');
                $output .= "\n\t\t\t\t<div class=\"top-fanbox-row\">\n\t\t\t\t<span class=\"top-fanbox-num\">{$x}.</span><div class=\"top-fanbox\">\n\n\t\t\t\t<div class=\"fanbox-item\">\n\n\t\t\t\t<div class=\"individual-fanbox\" id=\"individualFanbox" . $categoryfanbox['fantag_id'] . "\">\n\t\t\t\t<div class=\"show-message-container\" id=\"show-message-container" . $categoryfanbox['fantag_id'] . "\">\n\t\t\t\t\t<div class=\"permalink-container\">\n\t\t\t\t\t<a class=\"perma\" style=\"font-size:8px; color:" . $categoryfanbox['fantag_right_textcolor'] . "\" href=\"" . $fantag_title->escapeFullURL() . "\" title=\"{$categoryfanbox['fantag_title']}\">" . wfMsg('fanbox-perma') . "</a>\n\t\t\t\t\t<table class=\"fanBoxTable\" onclick=\"javascript:FanBoxes.openFanBoxPopup('fanboxPopUpBox{$categoryfanbox['fantag_id']}', 'individualFanbox{$categoryfanbox['fantag_id']}')\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td id=\"fanBoxLeftSideOutput\" style=\"color:" . $categoryfanbox['fantag_left_textcolor'] . "; font-size:{$leftfontsize}\" bgcolor=\"" . $categoryfanbox['fantag_left_bgcolor'] . "\">" . $fantag_leftside . "</td>\n\t\t\t\t\t\t\t<td id=\"fanBoxRightSideOutput\" style=\"color:" . $categoryfanbox['fantag_right_textcolor'] . "; font-size:{$rightfontsize}\" bgcolor=\"" . $categoryfanbox['fantag_right_bgcolor'] . "\">" . $categoryfanbox['fantag_right_text'] . '</td>
						</tr>
					</table>
					</div>
				</div>
				</div>';
                if ($wgUser->isLoggedIn()) {
                    if ($check_user_fanbox == 0) {
                        $output .= "\n\t\t\t\t\t<div class=\"fanbox-pop-up-box\" id=\"fanboxPopUpBox" . $categoryfanbox['fantag_id'] . "\">\n\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" width=\"258px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">" . wfMsg('fanbox-add-fanbox') . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('fanbox-add') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$categoryfanbox["fantag_id"]}', 'individualFanbox{$categoryfanbox["fantag_id"]}'); FanBoxes.showAddRemoveMessageUserPage(1, {$categoryfanbox["fantag_id"]}, 'show-addremove-message')\" />\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('cancel') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$categoryfanbox["fantag_id"]}', 'individualFanbox{$categoryfanbox["fantag_id"]}')\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>";
                    } else {
                        $output .= "\n\t\t\t\t\t<div class=\"fanbox-pop-up-box\" id=\"fanboxPopUpBox" . $categoryfanbox['fantag_id'] . "\">\n\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" width=\"258px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">" . wfMsg('fanbox-remove-fanbox') . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('fanbox-remove') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$categoryfanbox['fantag_id']}', 'individualFanbox{$categoryfanbox['fantag_id']}'); FanBoxes.showAddRemoveMessageUserPage(2, {$categoryfanbox['fantag_id']}, 'show-addremove-message')\" />\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('cancel') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$categoryfanbox['fantag_id']}', 'individualFanbox{$categoryfanbox['fantag_id']}')\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>";
                    }
                }
                if ($wgUser->getID() == 0) {
                    $login = SpecialPage::getTitleFor('Userlogin');
                    $output .= "<div class=\"fanbox-pop-up-box\" id=\"fanboxPopUpBox" . $categoryfanbox['fantag_id'] . "\">\n\t\t\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" width=\"258px\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">" . wfMsg('fanbox-add-fanbox-login') . " <a href=\"{$login->getFullURL()}\">" . wfMsg('fanbox-login') . "</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td align=\"center\">\n\t\t\t\t\t\t\t\t<input type=\"button\" value=\"" . wfMsg('cancel') . "\" size=\"20\" onclick=\"FanBoxes.closeFanboxAdd('fanboxPopUpBox{$categoryfanbox['fantag_id']}', 'individualFanbox{$categoryfanbox['fantag_id']}')\" />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>";
                }
                $output .= '</div></div>';
                $output .= '<div class="top-fanbox-creator">
				<table>
					<tr>
					<td class="centerheight"> <b> ' . wfMsg('fanbox-created-by') . ' <b> </td>
					<td class="centerheight"> <b> <a href="' . $user_title->escapeFullURL() . "\">\n\t\t\t\t\t\t{$avatar->getAvatarURL()}\n\t\t\t\t\t\t</a></b>\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t</div>";
                $output .= '<div class="top-fanbox-users">
					<table>
						<tr>
							<td class="centerheight">
								<b><a href="' . $fantag_title->escapeFullURL() . '">' . wfMsg('fanbox-members', $categoryfanbox['fantag_count']) . '</a></b>
							</td>
						</tr>
					</table>
				</div>';
                $output .= '<div class="cleared"></div>';
                $output .= '</div>';
                $x++;
            }
            $output .= '</div><div class="cleared"></div>';
        }
        $wgOut->addHTML($output);
    }