Ejemplo n.º 1
0
 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     global $wgUploadPath, $wgUser, $wgHuijiPrefix;
     $templateParser = new TemplateParser(__DIR__ . '/pages');
     $out = $this->getOutput();
     $user = $this->getUser();
     if (!$user->isAllowed('AdminDashboard')) {
         $out->permissionRequired('AdminDashboard');
         return;
     }
     // Set the page title, robot policies, etc.
     $this->setHeaders();
     // Add CSS
     $out->addModules('ext.socialprofile.userprofile.css');
     $out->addModules('ext.socialprofile.admindashboard.css');
     // Add js and message
     // $out->addModules( 'skin.bootstrapmediawiki.huiji.getRecordsInterface.js' );
     $out->addModules('ext.socialprofile.admindashboard.js');
     $out->addModules('ext.socialprofile.userprofile.js');
     $output = '';
     // Prevent E_NOTICE
     $yesterday = date("Y-m-d", strtotime("-1 day"));
     $totaledit = SiteStats::edits();
     $ueb = new UserEditBox();
     $rankInfo = AllSitesInfo::getAllSitesRankData($wgHuijiPrefix, $yesterday);
     $usf = new UserSiteFollow();
     $follows = $usf->getSiteFollowers('', $wgHuijiPrefix);
     // print_r($follows);
     $followCount = count($follows);
     if ($followCount >= 8) {
         $follows = array_slice($follows, 0, 8);
         $display = '';
     } else {
         $display = 'none';
     }
     $newFollow = array();
     foreach ($follows as $value) {
         $arr['user_name'] = $value['user_name'];
         $userPage = Title::makeTitle(NS_USER, $value['user_name']);
         $arr['user_url'] = htmlspecialchars($userPage->getFullURL());
         $arr['follow_date'] = wfMessage('comments-time-ago', HuijiFunctions::getTimeAgo(strtotime($value['follow_date'])))->text();
         $newFollow[] = $arr;
     }
     $sentToAll = SpecialPage::getTitleFor('SendToFollowers')->getFullURL();
     $showMore = SpecialPage::getTitleFor('EditRank')->getFullURL();
     $rightsManage = SpecialPage::getTitleFor('用户权限')->getFullURL();
     $blockUsers = SpecialPage::getTitleFor('封禁')->getFullURL();
     $freezeUsers = SpecialPage::getTitleFor('解除封禁')->getFullURL();
     $replaceText = SpecialPage::getTitleFor('替换文本')->getFullURL();
     $siteRankPage = SpecialPage::getTitleFor('SiteRank')->getFullURL();
     $allSpecial = SpecialPage::getTitleFor('特殊页面')->getFullURL();
     $siteAvatar = (new wSiteAvatar($wgHuijiPrefix, 'l'))->getAvatarHtml();
     $token = $user->getEditToken();
     if (is_null($newFollow)) {
         $newFollow = false;
     }
     $output .= $templateParser->processTemplate('admin_index', array('siteRank' => isset($rankInfo[0]['site_rank']) ? $rankInfo[0]['site_rank'] : '暂无', 'siteScore' => isset($rankInfo[0]['site_score']) ? $rankInfo[0]['site_score'] : '暂无', 'yesterdayCount' => UserSiteFollow::getFollowerCountOneday($wgHuijiPrefix, $yesterday), 'totalCount' => UserSiteFollow::getFollowerCount($wgHuijiPrefix), 'yesterdayEdit' => $ueb->getSiteEditCount('', $wgHuijiPrefix, $yesterday, $yesterday), 'totalEdit' => $totaledit, 'totalView' => $ueb->getSiteViewCount(-1, $wgHuijiPrefix, '', ''), 'yesterdayView' => $ueb->getSiteViewCount(-1, $wgHuijiPrefix, $yesterday, $yesterday), 'newFollow' => $newFollow, 'sendToAll' => $sentToAll, 'showMore' => $showMore, 'display' => $display, 'rightsManage' => $rightsManage, 'blockUsers' => $blockUsers, 'freezeUsers' => $freezeUsers, 'replaceText' => $replaceText, 'siteRankPage' => $siteRankPage, 'allSpecial' => $allSpecial, 'siteAvatar' => $siteAvatar, 'token' => $token));
     $out->addHtml($output);
 }
function wfGetSiteFollowedUsers()
{
    global $wgUser, $wgHuijiPrefix;
    $out = ResponseGenerator::getJson(ResponseGenerator::ERROR_UNKNOWN);
    // This feature is only available for logged-in users.
    if (!$wgUser->isLoggedIn()) {
        $out = ResponseGenerator::getJson(ResponseGenerator::ERROR_NOT_LOGGED_IN);
        return $out;
    }
    $dateArr = array();
    for ($k = 1; $k < 31; $k++) {
        $dateArr[] = date('Y-m-d', strtotime("-{$k} day"));
    }
    $desdateArr = array_reverse($dateArr);
    $res['date'] = $desdateArr;
    foreach ($desdateArr as $key => $value) {
        $dayFollow = UserSiteFollow::getFollowerCountOneday($wgHuijiPrefix, $value);
        $dfol = (int) isset($dayFollow) ? $dayFollow : 0;
        $result[] = (int) $dfol;
    }
    $res['FollowCount'] = $result;
    if ($res) {
        $ret = array('success' => true, 'result' => $res);
        $out = json_encode($ret);
        return $out;
    }
}
Ejemplo n.º 3
0
 /**
  * Get a common dropdown for all ranking pages
  */
 public static function getRankingDropdown($activeList)
 {
     global $wgUser;
     $templateParser = new TemplateParser(__DIR__);
     $followed = UserSiteFollow::getTopFollowedSitesWithDetails($wgUser->getId(), $wgUser->getId());
     $output = $templateParser->processTemplate('dropdown', array('activeList' => $activeList, 'followed' => $followed, 'hasFollowed' => count($followed) > 0));
     return $output;
 }
Ejemplo n.º 4
0
 /**
  * Show the special page
  *
  * @param $par Mixed: parameter passed to the page or null
  */
 public function execute($par)
 {
     global $wgUploadPath, $wgUser, $wgHuijiPrefix;
     $templateParser = new TemplateParser(__DIR__ . '/pages');
     $out = $this->getOutput();
     $user = $this->getUser();
     // Set the page title, robot policies, etc.
     $this->setHeaders();
     // Add Less
     $out->addModuleStyles('ext.socialprofile.admindashboard.less');
     // Add CSS
     $out->addModuleStyles('ext.socialprofile.admindashboard.css');
     // Add js and messages
     $out->addModules('ext.socialprofile.admindashboard.js');
     $output = '';
     // Prevent E_NOTICE
     $yesterday = date("Y-m-d", strtotime("-1 day"));
     $dbr = wfGetDB(DB_SLAVE);
     $counter = new SiteStatsInit($dbr);
     $totaledit = $counter->edits();
     $ueb = new UserEditBox();
     $output .= $templateParser->processTemplate('admin_index', array('yesterdayCount' => UserSiteFollow::getSiteCountOnedayDB($wgHuijiPrefix, $yesterday), 'totalCount' => UserSiteFollow::getSiteCount($wgHuijiPrefix), 'yesterdayEdit' => $ueb->getSiteEditCountOneday($wgHuijiPrefix, $yesterday), 'totalEdit' => $totaledit, 'totalView' => $ueb->getSiteViewCountTotal($wgHuijiPrefix), 'yesterdayView' => $ueb->getSiteViewCountOneday($wgHuijiPrefix, $yesterday)));
     $out->addHtml($output);
 }
    /**
     * Displays the form for sending board blasts
     */
    function displayForm()
    {
        global $wgHuijiPrefix;
        $user = $this->getUser();
        $output = '<div class="board-blast-message-form">
				<h2>' . $this->msg('boardblaststep1')->escaped() . '</h2>
				<form method="post" name="blast" action="">
					<input type="hidden" name="ids" id="ids" />
					<div class="blast-message-text">' . $this->msg('boardblastprivatenote')->escaped() . '</div>
					<textarea name="message" id="message" cols="63" rows="4"></textarea>
				</form>
		</div>
		<div class="blast-nav">
				<h2>' . $this->msg('boardblaststep2')->escaped() . '</h2>
				<div class="blast-nav-links">
					<a href="javascript:void(0);" class="blast-select-all-link">' . $this->msg('boardlinkselectall')->escaped() . '</a> -
					<a href="javascript:void(0);" class="blast-unselect-all-link">' . $this->msg('boardlinkunselectall')->escaped() . '</a> ';
        $output .= '</div>
		</div>';
        $usf = new UserSiteFollow();
        $follows = $usf->getSiteFollowedUser($user->getName(), $wgHuijiPrefix);
        $output .= '<div id="blast-friends-list" class="blast-friends-list">';
        $x = 1;
        $per_row = 3;
        if (count($follows) > 0) {
            foreach ($follows as $follow) {
                if ($follow['type'] == 1) {
                    $class = 'friend';
                } else {
                    $class = 'foe';
                }
                if ($follow !== $user->getName()) {
                    $id = User::idFromName($follow);
                    $output .= '<div class="blast-' . $class . "-unselected\" id=\"user-{$id}\">\n\t\t\t\t\t\t\t" . $follow . "\n\t\t\t\t\t\t</div>";
                    if ($x == count($follows) || $x != 1 && $x % $per_row == 0) {
                        $output .= '<div class="cleared"></div>';
                    }
                }
                $x++;
            }
        } else {
            $output .= '<div>' . $this->msg('boardnofriends')->escaped() . '</div>';
        }
        $output .= '</div>

			<div class="cleared"></div>';
        $output .= '<div class="blast-message-box-button">
			<input type="button" value="' . $this->msg('boardsendbutton')->escaped() . '" class="site-button" />
		</div>';
        return $output;
    }
Ejemplo n.º 6
0
    /**
     * Show the special page
     *
     * @param $params Mixed: parameter(s) passed to the page or null
     */
    public function execute($params)
    {
        global $wgUser, $wgSitename, $wgHuijiPrefix, $wgUserLevels;
        $lang = $this->getLanguage();
        $out = $this->getOutput();
        $request = $this->getRequest();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        $output = '<i>' . $this->msg('followsranknote')->plain() . '</i>';
        // Add CSS
        // $out->addModuleStyles( 'ext.socialprofile.useruserfollows.css' );
        $out->addModuleStyles('ext.socialprofile.userstats.css');
        // Add JS
        // $out->addModuleScripts( 'ext.socialprofile.useruserfollows.js');
        // $output = '';
        /**
         * Get query string variables
         */
        $user_name = $request->getVal('user');
        $rel_type = $request->getInt('rel_type');
        $page = $request->getInt('page');
        /**
         * Set up config for page / default values
         */
        if (!$page || !is_numeric($page)) {
            $page = 1;
        }
        if (!$rel_type || !is_numeric($rel_type)) {
            $rel_type = 2;
        }
        $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);
        $target_user = User::newFromId($user_id);
        $userPage = Title::makeTitle(NS_USER, $user_name);
        $sitefollows = UserSiteFollow::getUserFollowSite($target_user, $wgHuijiPrefix);
        // foreach ( $sitefollows as $follow ) {
        // 	$username = $follow['user'];
        // 	$userPageURL = $follow['userUrl'];
        // 	$avatar_img = $follow['url'];
        // 	$user_level = $follow['level'];
        // 	$username_length = strlen( $follow['user'] );
        // 	$username_space = stripos( $follow['user'], ' ' );
        // 	if ( ( $username_space == false || $username_space >= "30" ) && $username_length > 30 ) {
        // 		$user_name_display = substr( $follow['user'], 0, 30 ) .						' ' . substr( $follow['user'], 30, 50 );
        // 	} else {
        // 		$user_name_display = $follow['user'];
        // 	}
        // 	$output .= "<div class=\"relationship-item\">
        // 		<a href=\"{$userPageURL}\">{$avatar_img}</a>
        // 		<div class=\"relationship-info\">
        // 			<div class=\"relationship-name\">
        // 				<a href=\"{$userPageURL}\">{$user_name_display}</a><i>{$user_level}</i>
        // 			</div>
        // 		<div class=\"relationship-actions\"><ul>";
        // 	$output .= '<li>编辑数:'.$follow['count'].'</li>';
        // 	$output .= $followButton;
        // 	$target = SpecialPage::getTitleFor( 'GiveGift' );
        // 	$query = array('user' => $follow['user']);
        // 	$output .= '<li>'.Linker::LinkKnown($target, '<i class="fa fa-gift"></i>礼物</a>', array(), $query).'</li> ';
        // 	$output .= '</ul></div>
        // 		<div class="cleared"></div>
        // 	</div>';
        // 	$output .= '</div>';
        // 	$output .= '<div class="cleared"></div>';
        // }
        $output .= '<div class="top-users">';
        $x = 1;
        foreach ($sitefollows as $user) {
            $user_title = Title::makeTitle(NS_USER, $user['user']);
            $commentIcon = $user['url'];
            $output .= "<div class=\"top-fan-row\">\r\n\t\t\t\t<span class=\"top-fan-num\">{$x}.</span>\r\n\t\t\t\t<span class=\"top-fan\">\r\n\t\t\t\t\t{$commentIcon} <a href='" . $user['userUrl'] . "'>" . $user['user'] . '</a><i>' . $user['level'] . '
				</i></span>';
            $output .= '<span class="top-fan-points"><b>' . number_format($user['count']) . '</b> ' . $this->msg('top-fans-times')->plain() . '</span>';
            $output .= '<div class="cleared"></div>';
            $output .= '</div>';
            $x++;
        }
        $output .= '</div><div class="cleared"></div>';
        /**
         * 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);
    }
    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;
    }
Ejemplo n.º 8
0
    /**
     * Get common interests with the user you are watching
     *
     * @param $target_user_id:current user; $user_id:his id
     * @return array
     */
    function getCommonInterest($user_id, $target_user_id)
    {
        global $wgUser;
        $user_id = $this->user_id;
        $target_user_id = $wgUser->getId();
        $res = UserSiteFollow::getCommonInterest($user_id, $target_user_id);
        $us = new UserStatus($this->user);
        $gender = $us->getGender();
        if ($gender == 'male') {
            $genderIcon = '他';
        } elseif ($gender == 'female') {
            $genderIcon = '她';
        } else {
            $genderIcon = 'TA';
        }
        $output = '<div class="panel panel-default"><div class="user-section-heading panel-heading">
				<div class="user-section-title">我和' . $genderIcon . '的共同兴趣:
				</div>
				<div class="user-section-actions">
					<div class="action-right">
					</div>
					<div class="action-left">
					</div>
					<div class="cleared"></div>
				</div>
			</div>
			<div class="cleared"></div>
			<div class="common-interest-container panel-body">';
        if (!empty($res)) {
            foreach ($res as $value) {
                $Iname = HuijiPrefix::prefixToSiteName($value);
                $Iurl = HuijiPrefix::prefixToUrl($value);
                $output .= '<span class="label label-primary"><a href="' . $Iurl . '">' . $Iname . '&nbsp;</a></span>';
            }
        } else {
            $output .= '<p>&nbsp;您和' . $genderIcon . '还没有共同兴趣~</p>';
        }
        $output .= '</div></div>';
        return $output;
    }
Ejemplo n.º 9
0
 public static function getTopFollowedSitesWithDetails($user_id, $target_user_id)
 {
     $usf = new UserSiteFollow();
     $tuser = User::newFromId($target_user_id);
     $followedByTargetUser = $usf->getFullFollowedSites($tuser);
     $user = User::newFromId($user_id);
     $followedByCurrentUser = $usf->getFullFollowedSites($user);
     return self::sortFollowedSiteWithDetails($tuser, $followedByTargetUser, $followedByCurrentUser, 5);
 }
function wfUsersFollowingSiteResponse($user, $site_name)
{
    global $wgUser;
    // if ( $wgUser->isLoggedIn() ) {
    $sites = UserSiteFollow::getUserFollowSite($wgUser, $site_name);
    $ret = array('success' => true, 'result' => $sites);
    $out = json_encode($ret);
    return $out;
    // }else{
    // 	$out = ResponseGenerator::getJson(ResponseGenerator::ERROR_NOT_LOGGED_IN);
    // 	return $out;
    // }
}
Ejemplo n.º 11
0
 /**
  * Show the special page
  *
  * @param $params Mixed: parameter(s) passed to the page or null
  */
 public function execute($params)
 {
     global $wgUser, $wgSitename, $wgHuijiPrefix, $wgUserLevels;
     $lang = $this->getLanguage();
     $out = $this->getOutput();
     $request = $this->getRequest();
     $user = $this->getUser();
     // Set the page title, robot policies, etc.
     $this->setHeaders();
     $output = '<i>' . $this->msg('editranknote')->plain() . '</i>';
     // Add CSS
     // $out->addModuleStyles( 'ext.socialprofile.useruserfollows.css' );
     $out->addModuleStyles('ext.socialprofile.userstats.css');
     // Add JS
     $out->addModuleScripts('ext.socialprofile.usersitefollows.js');
     $output = '';
     /**
      * Get query string variables
      */
     $user_id = $request->getVal('user_id');
     $target_user_id = $request->getInt('target_user_id');
     $rel_type = $request->getInt('rel_type');
     $page = $request->getInt('page');
     /**
      * Set up config for page / default values
      */
     if (!$page || !is_numeric($page)) {
         $page = 1;
     }
     if (!$rel_type || !is_numeric($rel_type)) {
         $rel_type = 2;
     }
     //per_page : Limit the number of pages per page
     $per_page = 20;
     $per_row = 2;
     /**
      * If no user is set in the URL, we assume its the current user
      */
     if ($target_user_id == 0 || !is_int($target_user_id)) {
         $out->setPageTitle($this->msg('g-error-title')->plain());
         $out->addHTML($this->msg('g-error-message-invalid-link')->plain());
         return false;
     }
     $sites = UserSiteFollow::getFullFollowedSites($user_id, $target_user_id);
     $total = count($sites);
     $star_page = $per_page * ($page - 1);
     $per_sites = array_slice($sites, $star_page, $per_page);
     if (!$sites) {
         $output .= '<div class="top-users"><h3>暂时还没有关注哦</h3>';
     }
     if (!$per_sites) {
         $output .= '<div class="top-users"><h3>此页暂时没有站点</h3>';
     }
     $output .= '<div class="top-users" style="width:90%; max-width:500px">';
     foreach ($per_sites as $user) {
         $site_name = $user['val'];
         $domain_name = $user['key'];
         $is_follow = $user['is'];
         if ($user_id == '' || $user_id == 0) {
             $output .= '<div class=\\"top-fan-row\\"><a href=http://' . $domain_name . '.huiji.wiki class="list-group-item">' . $site_name . '</a>';
         } else {
             if ($is_follow == 'Y') {
                 $output .= '<div class=\\"top-fan-row\\"><a href=http://' . $domain_name . '.huiji.wiki class="list-group-item">' . $site_name . '<span class="badge user-site-follow-from-modal unfollow">取关</span></a>';
             } else {
                 $output .= '<div class=\\"top-fan-row\\"><a href=http://' . $domain_name . '.huiji.wiki class="list-group-item">' . $site_name . '<span class="badge user-site-follow-from-modal">关注</span></a>';
             }
         }
         $output .= '<div class="cleared"></div>';
         $output .= '</div>';
     }
     $output .= '</div><div class="cleared"></div>';
     /**
      * Build next/prev nav
      */
     $total = intval(str_replace(',', '', $total));
     $numofpages = $total / $per_page;
     $pageLink = $this->getPageTitle();
     if ($numofpages > 1) {
         $output .= '<nav class="page-nav pagination">';
         if ($page > 1) {
             $output .= '<li>' . Linker::link($pageLink, '<span aria-hidden="true">&laquo;</span>', array(), array('user' => $user_name, 'user_id' => $user_id, 'target_user_id' => $target_user_id, 'rel_type' => $rel_type, 'page' => $page - 1)) . '</li>';
         }
         if ($total % $per_page != 0) {
             $numofpages++;
         }
         // if ( $numofpages >= 2 && $page < $total ) {
         // 	$numofpages = 2 + $page;
         // }
         // if ( $numofpages >= ( $total / $per_page ) ) {
         // 	$numofpages = ( $total / $per_page ) + 1;
         // }
         for ($i = 1; $i <= $numofpages; $i++) {
             if ($i == $page) {
                 $output .= '<li class="active"><a href="#">' . $i . ' <span class="sr-only">(current)</span></a></li>';
             } else {
                 $output .= '<li>' . Linker::link($pageLink, $i, array(), array('user' => $user_name, 'user_id' => $user_id, 'target_user_id' => $target_user_id, 'rel_type' => $rel_type, 'page' => $i)) . '</li>';
             }
         }
         if ($total - $per_page * $page > 0) {
             $output .= '<li>' . Linker::link($pageLink, '<span aria-hidden="true">&raquo;</span>', array(), array('user' => $user_name, 'user_id' => $user_id, 'target_user_id' => $target_user_id, 'rel_type' => $rel_type, 'page' => $page + 1)) . '</li>';
         }
         $output .= '</nav>';
     }
     $out->addHTML($output);
 }
Ejemplo n.º 12
0
 /**
  * get user Following Sites
  * @param  boolean $expanded      if true, return detail info about the sites 
  * @param  object  $viewPointUser if this is not null, get this user's following site
  * @return array   sites info
  */
 public function getFollowingSites($expanded = false, $viewPointUser = null)
 {
     $this->mFollowingSites = UserSiteFollow::getFullFollowedSites($this->mUser);
     $cache = self::getUserCache();
     $cache->set($this->mUser->getId(), $this);
     if (!$expanded) {
         return $this->mFollowingSites;
     } else {
         if ($viewPointUser != null) {
             $viewPointHuijiUser = self::newFromUser($viewPointUser);
             $vSites = $viewPointHuijiUser->getFollowingSites();
             return UserSiteFollow::sortFollowedSiteWithDetails($this->mUser, $this->mFollowingSites, $vSites);
         } else {
             return UserSiteFollow::sortFollowedSiteWithDetails($this->mUser, $this->mFollowingSites, null);
         }
     }
 }
Ejemplo n.º 13
0
 static function showPage()
 {
     global $wgUser, $wgParser;
     $templateParser = new TemplateParser(__DIR__ . '/View');
     $output = '';
     // Prevent E_NOTICE
     //user login
     if ($wgUser->isLoggedIn()) {
         $login = true;
     } else {
         $login = false;
         $register = Linker::linkKnown(SpecialPage::getTitleFor('Userlogin'), '注册', array(), array('type' => 'signup'));
         $active = 'active';
         $inactive = 'in active';
     }
     // check mobile device
     $mobile = mobiledetect();
     $mobileUser = $mobile && $login;
     if (!$mobileUser) {
         //right data
         $fileCount = AllSitesInfo::getAllUploadFileCount();
         $siteCount = AllSitesInfo::getSiteCountNum();
         $userCount = AllSitesInfo::getUsreCountNum();
         $editCount = AllSitesInfo::getAllSiteEditCount();
         $pageCount = AllSitesInfo::getAllPageCount();
         $userName = $wgUser->getName();
         $usreId = $wgUser->getId();
         $avatar = new wAvatar($usreId, 'l');
         $userAvatar = $avatar->getAvatarURL();
         //level
         $stats = new UserStats($usreId, $userName);
         $stats_data = $stats->getUserStats();
         $user_level = new UserLevel($stats_data['points']);
         $level_link = Title::makeTitle(NS_HELP, wfMessage('user-profile-userlevels-link')->inContentLanguage()->text());
         $levelUrl = htmlspecialchars($level_link->getFullURL());
         $userLevel = $user_level->getLevelName();
         //user info
         $notice = SpecialPage::getTitleFor('ViewFollows');
         $contributions = SpecialPage::getTitleFor('Contributions');
         $userEdit = Linker::link($contributions, $stats_data['edits'], array(), array('target' => $userName, 'contribs' => 'user'));
         $follower = Linker::link($notice, UserUserFollow::getFollowingCount($wgUser), array('id' => 'user-following-count'), array('user' => $userName, 'rel_type' => 1));
         $followee = Linker::link($notice, UserUserFollow::getFollowerCount($wgUser), array('id' => 'user-follower-count'), array('user' => $userName, 'rel_type' => 2));
         //siterank
         $yesterday = date('Y-m-d', strtotime('-1 days'));
         $allSiteRank = AllSitesInfo::getAllSitesRankData('', $yesterday);
         $siteRank = array_slice($allSiteRank, 0, 10);
         $siteInfo = array();
         foreach ($siteRank as $key => $value) {
             $siteRank[$key]['site_prefix'] = HuijiPrefix::prefixToSiteName($value['site_prefix']);
             $siteRank[$key]['site_url'] = HuijiPrefix::prefixToUrl($value['site_prefix']);
             $siteInfo = AllSitesInfo::getPageInfoByPrefix($value['site_prefix']);
             $siteRank[$key]['totalEdits'] = $siteInfo['totalEdits'];
             $siteRank[$key]['totalArticles'] = $siteInfo['totalArticles'];
             $siteRank[$key]['totalPages'] = $siteInfo['totalPages'];
             $siteRank[$key]['totalUsers'] = $siteInfo['totalUsers'];
         }
         //userrank
         $weekRank = UserStats::getUserRank(10, 'week');
         $monthRank = UserStats::getUserRank(20, 'month');
         $totalRank = UserStats::getUserRank(20, 'total');
         //小蓝格
         $ueb = new UserEditBox();
         $editBox = $editData = array();
         $userEditInfo = $ueb->getUserEditInfo($usreId);
         $maxlen = $currentMaxlen = 0;
         //init variables.
         foreach ($userEditInfo as $value) {
             if (is_object($value) && !empty($value->_id) && $value->value > 0) {
                 $editBox[$value->_id] = $value->value;
                 $editData[] = $value->_id;
             }
         }
         $today = date("Y-m-d");
         $yesterday = date("Y-m-d", strtotime("-1 day"));
         $editBox[$today] = UserEditBox::getTodayEdit($usreId);
         if (!empty($editBox[$today])) {
             $editData[] = $today;
         }
         $totalEdit = count($editData);
         if ($totalEdit > 0) {
             $resArr[] = strtotime($editData[0]);
             $maxlen = 1;
         }
         for ($k = 1; $k < count($editData); $k++) {
             if (in_array(strtotime($editData[$k]) - 86400, $resArr)) {
                 $resArr[] = strtotime($editData[$k]);
                 if (count($resArr) > $maxlen) {
                     $maxlen = count($resArr);
                 }
             } else {
                 $resArr = array();
                 $resArr[] = strtotime($editData[$k]);
             }
             if ($resArr[count($resArr) - 1] == strtotime($today) || $resArr[count($resArr) - 1] == strtotime($yesterday)) {
                 $currentMaxlen = count($resArr);
             } else {
                 $currentMaxlen = 0;
             }
         }
         $lange = '<svg width="710" height="110" class=" ">
                  <g transform="translate(20, 20)">';
         $n = 676 / 13;
         $dateArr = array();
         for ($k = 0; $k < 365; $k++) {
             $dateArr[] = date('Y-m-d', strtotime("-{$k} day"));
         }
         $desdateArr = array_reverse($dateArr);
         $translate = array();
         for ($i = 0; $i <= $n; $i++) {
             $trani = $i * 13;
             $lange .= '<g transform="translate(' . $trani . ', 0)">';
             $dayofweek = date('w', strtotime($desdateArr[0]));
             if ($i == 0) {
                 $j = $dayofweek;
                 $start = 0;
                 $m = 7 - $dayofweek;
             } else {
                 $j = 0;
                 $m = 7;
                 $start = $i * 7 - $dayofweek;
             }
             $zoneDate = array_slice($desdateArr, $start, $m);
             foreach ($zoneDate as $val) {
                 $arrDate[$j] = $val;
                 $y = $j * 13;
                 $dataCount = isset($editBox[$val]) ? $editBox[$val] : 0;
                 if ($dataCount == 0) {
                     $color = '#eee';
                 } elseif ($dataCount > 0 && $dataCount <= 8) {
                     $color = '#86beee';
                 } elseif ($dataCount > 8 && $dataCount <= 21) {
                     $color = '#5ea2de';
                 } elseif ($dataCount > 21 && $dataCount <= 55) {
                     $color = '#256fb1';
                 } else {
                     $color = '#0d5493';
                 }
                 $lange .= '<rect class="day" width="11" height="11" y="' . $y . '" fill="' . $color . '" data-count="' . $dataCount . '" data-date="' . $val . '" title="' . $val . ' 编辑' . $dataCount . '次"></rect>';
                 $j = $j >= 7 ? 0 : $j + 1;
             }
             if (!empty($arrDate[0])) {
                 $translate[$arrDate[0]] = $trani;
             }
             $lange .= '</g>';
         }
         $moninit = 1;
         for ($p = 0; $p < 12; $p++) {
             $year = date('Y') - 1;
             $mon = date('m') + $p + 1;
             if ($mon > 12) {
                 $mon = $moninit++;
                 $year = date('Y');
             }
             $sunDay = UserEditBox::getSunday($mon, $year);
             $Stime = strtotime($sunDay);
             $sunDay = date('Y-m-d', $Stime);
             if (!isset($translate[$sunDay])) {
                 $Suntime = strtotime($sunDay);
                 $Sundate = date('Y', $Suntime) - 1;
                 $sunDay = UserEditBox::getSunday($mon, $Sundate);
             }
             foreach ($translate as $key => $value) {
                 if (strtotime($key) == strtotime($sunDay)) {
                     $x = $value;
                 }
             }
             $lange .= '<text x="' . $x . '" y="-5" class="' . $year . '">' . $mon . '月</text>';
         }
         $lange .= ' <text text-anchor="middle" class="wday" dx="-10" dy="9" style="display: none;">S</text>
                  <text text-anchor="middle" class="wday" dx="-10" dy="22">M</text>
                  <text text-anchor="middle" class="wday" dx="-10" dy="35" style="display: none;">T</text>
                  <text text-anchor="middle" class="wday" dx="-10" dy="48">W</text>
                  <text text-anchor="middle" class="wday" dx="-10" dy="61" style="display: none;">T</text>
                  <text text-anchor="middle" class="wday" dx="-10" dy="74">F</text>
                  <text text-anchor="middle" class="wday" dx="-10" dy="87" style="display: none;">S</text>
                </g>
              </svg>';
         //url helpManual huijitramac
         $helpManual = 'http://www.huiji.wiki/wiki/%E5%B8%AE%E5%8A%A9:%E7%BC%96%E8%BE%91%E6%89%8B%E5%86%8C';
         $tarmac = 'http://www.huiji.wiki/wiki/%E7%81%B0%E6%9C%BAwiki:%E7%81%B0%E6%9C%BA%E5%81%9C%E6%9C%BA%E5%9D%AA';
         $contact = 'http://www.huiji.wiki/wiki/%E7%81%B0%E6%9C%BAwiki:%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC';
     }
     if ($login) {
         // follow
         $followUserCount = UserUserFollow::getFollowingCount($wgUser);
         if ($followUserCount >= 5) {
             $userHidden = true;
         } else {
             $userHidden = false;
         }
         $followSiteCount = UserSiteFollow::getFollowingCount($wgUser);
         if ($followSiteCount >= 5) {
             $siteHidden = true;
         } else {
             $siteHidden = false;
         }
         //recommend user $weekRank $monthRank  $totalRank
         $uuf = new UserUserFollow();
         if (count($weekRank) >= 8) {
             $recommend = UserStats::getUserRank(10, 'week');
         } elseif (count($monthRank) >= 8) {
             $recommend = UserStats::getUserRank(20, 'month');
         } else {
             $recommend = UserStats::getUserRank(20, 'total');
         }
         $recommendRes = array();
         $flres = array();
         foreach ($recommend as $value) {
             $tuser = User::newFromName($value['user_name']);
             $isFollow = $uuf->checkUserUserFollow($wgUser, $tuser);
             if (!$isFollow && $value['user_name'] != $userName) {
                 $flres['avatar'] = $value['avatarImage'];
                 $flres['username'] = $value['user_name'];
                 $flres['userurl'] = $value['user_url'];
                 $recommendRes[] = $flres;
             }
         }
         $recommendRes = array_slice($recommendRes, 0, 5);
         //recommend site
         $usf = new UserSiteFollow();
         // $recSite = array_slice($allSiteRank,0 ,5);
         $recommendSite = array();
         foreach ($allSiteRank as $value) {
             $isFollowSite = $usf->checkUserSiteFollow($wgUser, $value['site_prefix']);
             if ($isFollowSite == false) {
                 $fsres['s_name'] = HuijiPrefix::prefixToSiteName($value['site_prefix']);
                 $fsres['s_url'] = HuijiPrefix::prefixToUrl($value['site_prefix']);
                 $fsres['s_prefix'] = $value['site_prefix'];
                 $fsres['s_avatar'] = (new wSiteAvatar($value['site_prefix'], 'l'))->getAvatarHtml();
                 $recommendSite[] = $fsres;
             }
         }
         $recommendSite = array_slice($recommendSite, 0, 5);
         if ($login && !$mobile) {
             $infoHeader = wfMessage('info-header-user')->parseAsBlock();
         } elseif (!$login) {
             $infoHeader = wfMessage('info-header-anon')->parseAsBlock();
         } else {
             $infoHeader = '';
         }
     }
     $output .= $templateParser->processTemplate('frontpage', array('mobileUser' => $mobileUser, 'infoHeader' => $infoHeader, 'fileCount' => $fileCount, 'siteCount' => $siteCount, 'userCount' => $userCount, 'editCount' => $editCount, 'pageCount' => $pageCount, 'userName' => $userName, 'userAvatar' => $userAvatar, 'levelUrl' => $levelUrl, 'userLevel' => $userLevel, 'userEdit' => $userEdit, 'follower' => $follower, 'followee' => $followee, 'siteRank' => $siteRank, 'weekRank' => $weekRank, 'monthRank' => $monthRank, 'totalRank' => $totalRank, 'lange' => $lange, 'login' => $login, 'register' => $register, 'userHidden' => $userHidden, 'siteHidden' => $siteHidden, 'active' => $active, 'inactive' => $inactive, 'recommendSite' => $recommendSite, 'recContent' => $recContent, 'followUserCount' => $followUserCount, 'followSiteCount' => $followSiteCount, 'helpManual' => $helpManual, 'tarmac' => $tarmac, 'contact' => $contact));
     return $output;
 }
Ejemplo n.º 14
0
 /**
  * get site followers
  * @param  boolean $expanded if true return user detail info,eles return simple info
  * @return array
  */
 public function getFollowers($expanded = false)
 {
     if (!$this->mFollowers) {
         // return $this->mFollowers;
         $usf = new UserSiteFollow();
         $this->mFollowers = $usf->getSiteFollowers($this->mPrefix);
         $siteCache = self::getSiteCache();
         $siteCache->set($this->mPrefix, $this);
         //return $this->mFollowers;
     }
     if (!$expanded) {
         return $this->mFollowers;
     } else {
         $request = array();
         foreach ($this->mFollowers as $value) {
             $u_name = $value['user_name'];
             $temp['user'] = $u_name;
             // $temp['user'] = User::getEffectiveGroups($user);
             $userPage = Title::makeTitle(NS_USER, $u_name);
             $userPageURL = htmlspecialchars($userPage->getFullURL());
             $temp['userUrl'] = $userPageURL;
             $user_id = User::idFromName($u_name);
             $temp['userId'] = $user_id;
             $stats = new UserStats($user_id, $u_name);
             $stats_data = $stats->getUserStats();
             $user_level = new UserLevel($stats_data['points']);
             $temp['level'] = $user_level->getLevelName();
             $avatar = new wAvatar($user_id, 'm');
             $temp['url'] = $avatar->getAvatarURL();
             $tuser = User::newFromName($u_name);
             $temp['count'] = UserStats::getSiteEditsCount($tuser, $this->mPrefix);
             // if(in_array($u_name, $follower)){
             // 	$is_follow = 'Y';
             // }else{
             // 	$is_follow = 'N';
             // }
             // $temp['is_follow'] = $is_follow;
             $request[] = $temp;
         }
         foreach ($request as $key => $value) {
             $count[$key] = $value['count'];
         }
         array_multisort($count, SORT_DESC, $request);
         return $request;
     }
 }
Ejemplo n.º 15
0
    /**
     * Show the special page
     *
     * @param $params Mixed: parameter(s) passed to the page or null
     */
    public function execute($params)
    {
        global $wgUser, $wgSitename, $wgHuijiPrefix, $wgUserLevels;
        $lang = $this->getLanguage();
        $out = $this->getOutput();
        $request = $this->getRequest();
        $user = $this->getUser();
        // Set the page title, robot policies, etc.
        $this->setHeaders();
        $output = '<i>' . $this->msg('editranknote')->plain() . '</i>';
        // Add CSS
        // $out->addModuleStyles( 'ext.socialprofile.useruserfollows.css' );
        $out->addModuleStyles('ext.socialprofile.userstats.css');
        // Add JS
        // $out->addModuleScripts( 'ext.socialprofile.useruserfollows.js');
        // $output = '';
        /**
         * Get query string variables
         */
        $user_name = $request->getVal('user');
        $rel_type = $request->getInt('rel_type');
        $page = $request->getInt('page');
        /**
         * Set up config for page / default values
         */
        if (!$page || !is_numeric($page)) {
            $page = 1;
        }
        if (!$rel_type || !is_numeric($rel_type)) {
            $rel_type = 2;
        }
        $per_page = 20;
        $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);
        $target_user = User::newFromId($user_id);
        $userPage = Title::makeTitle(NS_USER, $user_name);
        $sitefollows = UserSiteFollow::getUserFollowSite($target_user, $wgHuijiPrefix);
        $total = count($sitefollows);
        $star_page = $per_page * ($page - 1);
        $result = array_slice($sitefollows, $star_page, $per_page);
        if (!$result) {
            $output .= '<div class="top-users"><h3>此页暂时没有排行</h3>';
        }
        $output .= '<div class="top-users">';
        $x = $star_page + 1;
        foreach ($result as $user) {
            $user_title = Title::makeTitle(NS_USER, $user['user']);
            $commentIcon = $user['url'];
            $output .= "<div class=\"top-fan-row\">\n\t\t\t\t<span class=\"top-fan-num\">{$x}.</span>\n\t\t\t\t<span class=\"top-fan\"><a href='" . $user['userUrl'] . "'>\n\t\t\t\t\t{$commentIcon} </a><a href='" . $user['userUrl'] . "'>" . $user['user'] . '</a><i>' . $user['level'] . '
				</i></span>';
            $output .= '<span class="top-fan-points"><b>' . number_format($user['count']) . '</b> ' . $this->msg('top-fans-times')->plain() . '</span>';
            $output .= '<div class="cleared"></div>';
            $output .= '</div>';
            $x++;
        }
        $output .= '</div><div class="cleared"></div>';
        /**
         * Build next/prev nav
         */
        $total = intval(str_replace(',', '', $total));
        $numofpages = $total / $per_page;
        $pageLink = $this->getPageTitle();
        if ($numofpages > 1) {
            $output .= '<nav class="page-nav pagination">';
            if ($page > 1) {
                $output .= '<li>' . Linker::link($pageLink, '<span aria-hidden="true">&laquo;</span>', array(), array('user' => $user_name, 'rel_type' => $rel_type, 'page' => $page - 1)) . '</li>';
            }
            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 .= '<li class="active"><a href="#">' . $i . ' <span class="sr-only">(current)</span></a></li>';
                } else {
                    $output .= '<li>' . Linker::link($pageLink, $i, array(), array('user' => $user_name, 'rel_type' => $rel_type, 'page' => $i)) . '</li>';
                }
            }
            if ($total - $per_page * $page > 0) {
                $output .= '<li>' . Linker::link($pageLink, '<span aria-hidden="true">&raquo;</span>', array(), array('user' => $user_name, 'rel_type' => $rel_type, 'page' => $page + 1)) . '</li>';
            }
            $output .= '</nav>';
        }
        $out->addHTML($output);
    }
    /**
     * Template filter callback for Bootstrap skin.
     * Takes an associative array of data set from a SkinTemplate-based
     * class, and a wrapper for MediaWiki's localization database, and
     * outputs a formatted page.
     *
     * @access private
     */
    public function execute()
    {
        global $wgRequest, $wgUser, $wgSitename, $wgSitenameshort, $wgCopyrightLink, $wgCopyright, $wgBootstrap, $wgArticlePath, $wgGoogleAnalyticsID, $wgSiteCSS;
        global $wgEnableUploads;
        global $wgLogo, $wgHuijiPrefix, $wgFavicon;
        global $wgTOCLocation;
        global $wgNavBarClasses;
        global $wgSubnavBarClasses;
        global $wgParser, $wgTitle, $wgEmailAuthentication;
        $wgFavicon = (new wSiteAvatar($wgHuijiPrefix, 'l'))->getAvatarImage();
        $this->skin = $this->data['skin'];
        $action = $wgRequest->getText('action');
        $url_prefix = str_replace('$1', '', $wgArticlePath);
        $NS = $wgTitle->getNamespace();
        // Suppress warnings to prevent notices about missing indexes in $this->data
        wfSuppressWarnings();
        $this->html('headelement');
        if ($wgUser->isLoggedIn()) {
            $usf = new UserSiteFollow();
            $followed = $usf->checkUserSiteFollow($wgUser, $wgHuijiPrefix) !== false;
        } else {
            $followed = false;
        }
        ?>
        <!--[if lt IE 8]>
            <p class="alert alert-warning alert-dismissible browsehappy">
              你正在使用一个<strong>过时</strong>的浏览器。请<a class="link" href="http://browsehappy.com">升级你的浏览器</a>以查看此页面。</p>
            </p>
        <![endif]-->
        <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
            ga('create', 'UA-10190882-3', 'auto');
            ga('send', 'pageview');
        </script>
       <!-- <script type="text/javascript" src="/resources/qc/qc_loader.js" data-appid="101264508" charset="utf-8"></script>-->
        <script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=2445834038" type="text/javascript" charset="utf-8"></script>
        <div id="wrapper" class="toggled">
        <script>
            var menutoggle;
            document.domain = "huiji.wiki";
            menutoggle = localStorage.getItem("menu-toggle");
            document.getElementById('wrapper').className = menutoggle;
        </script>
        <?php 
        echo $this->showHeader();
        ?>
        <script>
            var classlst;
            var x = 0;
            classlst = document.getElementById('wrapper').className.split(/\s+/);
            for(x in classlst) {
                if(classlst[x] == 'toggled') {
                    var list = document.getElementById('menu-toggle').className;
                    var blank,added;
                    blank = (list!='')?' ':'';
                    added = list + blank + 'menu-active';
                    document.getElementById('menu-toggle').className = added;
                }
            }
        </script>
        <?php 
        if (($wgHuijiPrefix === 'slx.test' || $wgHuijiPrefix === 'test' || $wgHuijiPrefix === 'zs.test' || $wgHuijiPrefix === 'www') && $this->getSkin()->getTitle()->isMainPage()) {
            include 'View/Sidebar.php';
            echo FrontPage::showPage();
            include 'View/Modal.php';
        } else {
            ?>
            
            <?php 
            include 'View/Sidebar.php';
            ?>

            <div id="wiki-outer-body">

                <div id="content-actions" class="subnav subnav-fixed">
                    <div class="container-fluid">
                        <ul class="nav nav-pills">
                            <li>
                                <a class="navbar-brand logo-wiki-user" href="<?php 
            echo $this->data['nav_urls']['mainpage']['href'];
            ?>
" title="<?php 
            echo $wgSitename;
            ?>
"><?php 
            echo (new wSiteAvatar($wgHuijiPrefix, 'm'))->getAvatarHtml(array('style' => 'height : 1em; padding-bottom:0.2em;'));
            echo '&nbsp;' . ($wgSitenameshort ? $wgSitenameshort : $wgSitename);
            ?>
</a>
                            </li>
                            <li><span id="user-site-follow" class="mw-ui-button <?php 
            echo $followed ? '' : 'mw-ui-progressive';
            echo $followed ? 'unfollow' : '';
            ?>
 "><?php 
            echo $followed ? '取消关注' : '<span class="glyphicon glyphicon-plus"></span>关注';
            ?>
</span> </li>
                            <?php 
            echo $this->nav($this->get_page_links('Bootstrap:Subnav'));
            ?>
                            <li class="site-count"><p><a id="site-article-count" href="<?php 
            echo $url_prefix;
            ?>
Special:AllPages"><?php 
            $result = self::format_nice_number(SiteStats::articles());
            $result2 = self::format_nice_number(SiteStats::edits());
            echo $result;
            ?>
</a>页面<a href="/wiki/Special:RecentChanges"><?php 
            echo $result2;
            ?>
</a>编辑<a id="site-follower-count" data-toggle="modal" data-target=".follow-msg"><?php 
            echo self::format_nice_number(UserSiteFollow::getFollowerCount($wgHuijiPrefix));
            ?>
</a>关注</p></li>
                            <span id="subnav-toggle"><i class="fa fa-ellipsis-h"></i></span>
                        </ul>
                    </div>
                </div>

                <div id="wiki-body" class="container">
                    <div id="content">
                        <div class="row">
                            <nav class="hidden-md hidden-sm hidden-xs hidden-print toc-sidebar" role="complementary navigation"></nav>
                            <section class="col-md-12 wiki-body-section" role="main">



                        <div id="firstHeading" class="pagetitle page-header">
                            <div class="pull-right"><?php 
            if ($this->data['isarticle']) {
                echo $this->getIndicators();
            }
            ?>
 </div>
                            <h1><?php 
            $this->html('title');
            ?>
 
                                <?php 
            if (isset($this->data['content_actions']['edit'])) {
                $isVisualEditorEnabled = $wgUser->getOption('visualeditor-enable', '1');
                $editHref = $this->data['content_actions']['edit']['href'];
                $veHref = $this->data['content_actions']['ve-edit']['href'];
                if ($isVisualEditorEnabled == 1 && isset($this->data['content_actions']['ve-edit'])) {
                    ?>
                                            <div id="huiji-h1-edit-button" class="huiji-h1-edit-button">

                                                <a id="ca-ve-edit" href="<?php 
                    echo $veHref;
                    ?>
" class="icon-pencil" data-toggle="tooltip" data-placement="top" title="使用可视化编辑器"></a>
                                                <span class="mw-editsection-divider"></span>
                                                <a id="ca-edit" href="<?php 
                    echo $editHref;
                    ?>
" class="icon-edit-code " data-toggle="tooltip" data-placement="top" title="使用源代码编辑器"></a>
                                            </div>
                                        <?php 
                } else {
                    ?>
                                            <div id="huiji-h1-edit-button" class="huiji-h1-edit-button">
                                                <a id="ca-edit" href="<?php 
                    echo $editHref;
                    ?>
" class="icon-edit-code" title="<?php 
                    echo wfMsg('bootstrap-mediawiki-view-edit');
                    ?>
"></a>
                                            </div>                                   
                                        <?php 
                }
            }
            ?>
                               
                                <div id="contentSub">
                                    <small>
                                    <?php 
            $this->html('subtitle');
            ?>
                                    <?php 
            if ($this->data['isarticle'] && !$this->getSkin()->getTitle()->isMainPage() && $this->getSkin()->getTitle()->exists()) {
                $revPageId = $this->getSkin()->getTitle()->getArticleId();
                $editinfo = UserStats::getLastEditer($revPageId, $wgHuijiPrefix);
                $userPage = Title::makeTitle(NS_USER, $editinfo['rev_user_text']);
                $userPageURL = htmlspecialchars($userPage->getFullURL());
                $bjtime = strtotime($editinfo['rev_timestamp']) + 8 * 60 * 60;
                $edittime = CommentFunctions::getTimeAgo($bjtime);
                echo '<a class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" href="' . $userPageURL . '">' . $editinfo['rev_user_text'] . '</a>&nbsp于' . $edittime . '前编辑了此页面';
                echo '<div class="bdsharebuttonbox pull-right hidden-sm hidden-xs" data-tag="share_2"><a href="#" class="icon-weixin-share" data-tag="share_2" data-cmd="weixin" title="分享到微信"></a><a href="#" class="icon-weibo-share" data-tag="share_2" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="icon-qqspace-share" data-tag="share_2" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="icon-tieba-share" data-tag="share_2" data-cmd="tieba" title="分享到百度贴吧"></a><a href="#" class="icon-douban-share" data-tag="share_2" data-cmd="douban" title="分享到豆瓣网"></a></div>';
            }
            ?>
                                    </small>
                                </div>
                                
                            </h1>
                        </div>
                        <?php 
            if ($this->data['isarticle']) {
                ?>
<div id="siteSub" class="alert alert-info visible-print-block" role="alert"><?php 
                $this->msg('tagline');
                ?>
</div><?php 
            }
            ?>
                        <!-- ConfirmEmail -->
                        <?php 
            if ($wgUser->isLoggedIn() && !$wgUser->isEmailConfirmed() && !$this->getSkin()->getTitle()->isMainPage()) {
                ?>
                        <div class="alert alert-danger" role="alert">
                            <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
                            <span class="sr-only">Error:</span>
                            只有确认邮件后才能对页面进行编辑&nbsp:)
                            <a href="/wiki/%E7%89%B9%E6%AE%8A:%E7%A1%AE%E8%AE%A4%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6">点此确认</a>&nbsp|&nbsp
                            <a href="/wiki/特殊:修改邮箱地址">修改邮箱地址</a>
                        </div> 
                        <?php 
            }
            ?>
  
                        <!-- /ConfirmEmail -->
                        <?php 
            if ($this->data['undelete']) {
                ?>
                        <!-- undelete -->
                        <div id="contentSub2" class="alert alert-warning alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                            <?php 
                $this->html('undelete');
                ?>
                        </div>
                        <!-- /undelete -->
                        <?php 
            }
            ?>
                        <?php 
            if ($this->data['newtalk']) {
                ?>
                        <!-- newtalk -->
                        <div class="usermessage"><?php 
                $this->html('newtalk');
                ?>
</div>
                        <!-- /newtalk -->
                        <?php 
            }
            ?>
                        <div id="bodyContent" class="body">                     
                        <?php 
            $this->html('bodytext');
            ?>
                        </div>
                        <?php 
            if ($this->data['catlinks']) {
                ?>
                        <div class="category-links">
                        <!-- catlinks -->
                        <?php 
                $this->html('catlinks');
                ?>
                        <!-- /catlinks -->
                        </div>
                        <?php 
            }
            ?>
                        <div class="bdsharebuttonbox pull-right" data-tag="share_1"><a href="#" class="icon-weixin-share hidden-xs hidden-sm" data-tag="share_1" data-cmd="weixin" title="分享到微信"></a><a href="#" class="icon-weibo-share" data-tag="share_1" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="icon-qqspace-share" data-tag="share_1" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="icon-tieba-share" data-tag="share_1" data-cmd="tieba" title="分享到百度贴吧"></a><a href="#" class="icon-douban-share" data-tag="share_1" data-cmd="douban" title="分享到豆瓣网"></a></div>
                        <?php 
            if ($this->data['isarticle'] && !$this->getSkin()->getTitle()->isMainPage() && $this->getSkin()->getTitle()->exists()) {
                $commentHtml = '<div class="clearfix"></div>';
                $wgParser->setTitle($this->getSkin()->getTitle());
                $commentHtml .= CommentsHooks::displayComments('', array(), $wgParser);
                echo $commentHtml;
            }
            ?>
                        <?php 
            if ($this->data['dataAfterContent']) {
                ?>
                        <div class="data-after-content">
                        <!-- dataAfterContent -->
                        <?php 
                $this->html('dataAfterContent');
                ?>
                    
                        <!-- /dataAfterContent -->
                        </div>
                        <?php 
            }
            ?>
                        <?php 
            if ('sidebar' == $wgTOCLocation) {
                ?>
                                </section></section>
                                <?php 
            }
            //end if
            ?>
                    </div>
                </div><!-- container -->
            </div>
            <?php 
            include 'View/Modal.php';
            ?>
            <div class="bottom">
                <div class="container">
                    <?php 
            self::includePage('Bootstrap:Footer');
            ?>
                    <?php 
            if ($this->data['sitenotice']) {
                ?>
                        <div id="siteNotice" class="site-notice">
                            <?php 
                $this->html('sitenotice');
                ?>
                        </div>
                    <?php 
            }
            ?>
                    <footer>
                        <p class="text-center">
                            <a class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" href="http://www.huiji.wiki/wiki/%E7%81%B0%E6%9C%BA%E5%81%9C%E6%9C%BA%E5%9D%AA">灰机停机坪</a> |
                            <a class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" href="http://www.huiji.wiki/wiki/%E7%BB%B4%E5%9F%BA%E5%AE%B6%E5%9B%AD%E8%AE%A1%E5%88%92">维基家园计划</a> |
                            <a class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" href="http://www.huiji.wiki/wiki/%E5%AE%87%E5%AE%99%E5%B0%BD%E5%A4%B4%E7%9A%84%E7%81%B0%E6%9C%BAwiki">关于灰机wiki</a> |
                            <a class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" href="http://www.huiji.wiki/wiki/%E7%81%B0%E6%9C%BAwiki:%E4%BD%BF%E7%94%A8%E6%9D%A1%E6%AC%BE%E5%92%8C%E5%86%85%E5%AE%B9%E5%A3%B0%E6%98%8E">使用条款和声明</a> |
                            <a class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" href="http://www.huiji.wiki/wiki/%E7%81%B0%E6%9C%BAwiki:%E7%94%A8%E6%88%B7%E7%BC%96%E8%BE%91%E6%9D%A1%E6%AC%BE">编辑条款</a><br>Powered by
                            <a class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" href="http://mediawiki.org">MediaWiki</a> <a class="mw-ui-anchor mw-ui-progressive mw-ui-quiet" href="http://www.miitbeian.gov.cn/">京ICP备15015138号</a></p>
                    </footer>
                </div><!-- container -->
            </div><!-- bottom -->
        </div><!-- /#wrapper -->
        <?php 
        }
        ?>
 <!-- mainpage if end -->
        <?php 
        $this->html('bottomscripts');
        /* JS call to runBodyOnloadHook */
        $this->html('reporttime');
        if ($this->data['debug']) {
            ?>
            <!-- Debug output:
            <?php 
            $this->text('debug');
            ?>
            -->
            <?php 
        }
        //end if
        ?>
        <script>
        (function(){
            var bp = document.createElement('script');
            bp.src = '//push.zhanzhang.baidu.com/push.js';
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(bp, s);
        })();
        </script>
        <script>window._bd_share_config={
            "common": {
                "bdSnsKey": {},
                "bdText": "",
                "bdMini": "2",
                "bdMiniList": false,
                "bdPic": "",
                "bdStyle": "2"
            },
            "share": [
                {
                    "tag": "share_1",
                    "bdSize": 32
                },
                {
                    "tag": "share_2",
                    "bdSize": 16
                }
            ]
        };with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>        
        </body>
        </html>
        <?php 
    }