Пример #1
0
    function execute()
    {
        ?>
<div id="userloginForm" class="userloginForm">

	<table border="0" width="100%"><tr><td rowspan="2">
<form name="userlogin" method="post" action="<?php 
        $this->text('action');
        ?>
">
	<div id="userloginprompt"><?php 
        $this->msgWiki('loginprompt');
        ?>
</div>
	<table> 
		<tr>
			<td class="mw-label" style="width:50px"><label for='wpName1'><?php 
        $this->msg('username_or_email');
        ?>
</label></td>
			<td class="mw-input">
				<div style="position:relative">
					<input type='text' class='loginText input_med' name="wpName" id="wpName1"
					value="<?php 
        $this->text('name');
        ?>
" size='20' />
					<?php 
        if ($this->data['messagetype'] == 'error_username') {
            ?>
						<div class="mw-error-bottom mw-error" id="wpName1_error">
							<div class="mw-error-top">
								<?php 
            $this->html('message');
            ?>
							</div>
						</div>
					<?php 
        }
        ?>
					<input type="hidden" id="wpName1_showhide" />
				</div>
			</td>
		</tr>
		<tr>
			<td class="mw-label"><label for='wpPassword1'><?php 
        $this->msg('yourpassword');
        ?>
</label></td>
			<td class="mw-input">
				<div style="position:relative;">
					<input type='password' class='loginPassword input_med' name="wpPassword" id="wpPassword1"
						value="" size='20' />
					<?php 
        if ($this->data['messagetype'] == 'error_password') {
            ?>
						<div class="mw-error-bottom mw-error" id="wpPassword1_error">
							<div class="mw-error-top">
								<?php 
            $this->html('message');
            ?>
							</div>
						</div>
					<?php 
        }
        ?>
					<input type="hidden" id="wpPassword1_showhide" />
				</div>
			</td>
		</tr>
	<?php 
        if ($this->data['usedomain']) {
            $doms = "";
            foreach ($this->data['domainnames'] as $dom) {
                $doms .= "<option>" . htmlspecialchars($dom) . "</option>";
            }
            ?>
		<tr>
			<td class="mw-label"><?php 
            $this->msg('yourdomainname');
            ?>
</td>
			<td class="mw-input">
				<select name="wpDomain" value="<?php 
            $this->text('domain');
            ?>
">
					<?php 
            echo $doms;
            ?>
				</select>
			</td>
		</tr>
	<?php 
        }
        ?>
		<tr>
			<td class="mw-input"></td>
			<td>
			<?php 
        if ($this->data['useemail'] && $this->data['canreset']) {
            ?>
				<a href="/Special:LoginReminder" id="forgot_pwd"><?php 
            global $wgLanguageCode;
            if ($wgLanguageCode == "en") {
                ?>
Forgot password? <?php 
            } else {
                echo wfMsg('forgot_pwd');
            }
            ?>
</a>
			<?php 
        }
        ?>
			</td>
		</tr>
		<tr>
			<td style="vertical-align: bottom;" class="mw-label"><?php 
        if ($this->data['header'] != "") {
            ?>
				<label style="display:block; padding-bottom: 35px">Security</label>
				<?php 
        }
        ?>
			</td>
			<td><?php 
        $this->html('header');
        /* pre-table point for form plugins... */
        ?>
</td>
		</tr>
		<tr>
			<td class="mw-submit"></td>
			<td style="padding-top:5px">
				<table cellpadding="0" cellspacing="0">
					<tr>
						<td>
							<input type='submit' class="button primary submit_button" name="wpLoginattempt" id="wpLoginattempt" value="<?php 
        $this->msg('login');
        ?>
" />
						</td>
						<td>
							<input type='checkbox' name="wpRemember" value="1" id="wpRemember" checked="checked" /> <label for="wpRemember"><?php 
        $this->msg('remembermypassword');
        ?>
</label>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</form>

</td>
<td valign="top">
	<div id="userlogin_alt_logins">
		<div class="headline">Log in via</div>
		<?php 
        echo UserLoginBox::getSocialLogin();
        ?>
	</div>
</td>
</tr>
</table>

</div>
<div id="loginend"><?php 
        $this->msgWiki('loginend');
        ?>
</div>
<?php 
    }
Пример #2
0
    public static function showTopImage()
    {
        global $wgUser, $wgLanguageCode;
        $items = array();
        $dbr = wfGetDB(DB_SLAVE);
        $res = $dbr->select(WikihowHomepageAdmin::HP_TABLE, array('*'), array('hp_active' => 1), __METHOD__, array('ORDER BY' => 'hp_order'));
        $i = 0;
        foreach ($res as $result) {
            $item = new stdClass();
            $title = Title::newFromID($result->hp_page);
            $item->url = $title->getLocalURL();
            $item->text = $title->getText();
            $imageTitle = Title::newFromID($result->hp_image);
            if ($imageTitle) {
                $file = wfFindFile($imageTitle->getText());
                if ($file) {
                    $item->imagePath = wfGetPad($file->getUrl());
                    $item->itemNum = ++$i;
                    $items[] = $item;
                }
            }
        }
        if ($wgLanguageCode == 'en') {
            //using BOSS here only
            $searchTitle = Title::makeTitle(NS_SPECIAL, "LSearch");
            $search = '
			<form id="cse-search-hp" name="search_site" action="/wikiHowTo" method="get">
			<input type="text" class="search_box" name="search" />
			</form>';
        } else {
            //PUNTING FOR NOW
            //INTL: International search just uses Google custom search
            $search = GoogSearch::getSearchBox("cse-search-hp");
        }
        $tmpl = new EasyTemplate(dirname(__FILE__));
        $tmpl->set_vars(array('items' => $items, 'imagePath' => wfGetPad('/skins/owl/images/home1.jpg'), 'login' => $wgUser->getID() == 0 ? UserLoginBox::getLogin() : "", 'search' => $search));
        $html = $tmpl->execute('top.tmpl.php');
        echo $html;
        return true;
    }
Пример #3
0
 function getHeaderMenu($menu)
 {
     global $wgLanguageCode, $wgTitle, $wgUser, $wgForumLink;
     $html = '';
     $menu_css = 'menu';
     $sk = $wgUser->getSkin();
     $isLoggedIn = $wgUser->getID() > 0;
     switch ($menu) {
         case 'edit':
             $html = "<a href='" . $wgTitle->escapeLocalURL($sk->editUrlOptions()) . "'>" . wfMsg('edit-this-article') . "</a>";
             if (!$isLoggedIn) {
                 break;
             }
             $html .= $sk->makeLinkObj(SpecialPage::getTitleFor('Importvideo', $wgTitle->getText()), wfMsg('importvideo'));
             if ($wgLanguageCode == 'en') {
                 $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "RelatedArticle"), wfMsg('manage_related_articles'), "target=" . $wgTitle->getPrefixedURL()) . $sk->makeLinkObj(SpecialPage::getTitleFor("Articlestats", $wgTitle->getText()), wfMsg('articlestats'));
             }
             $html .= "<a href='" . Title::makeTitle(NS_SPECIAL, "Whatlinkshere")->getLocalUrl() . "/" . $wgTitle->getPrefixedURL() . "'>" . wfMsg('whatlinkshere') . "</a>";
             break;
         case 'profile':
             if ($isLoggedIn) {
                 $html = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Mytalk'), wfMsg('mytalkpage'), '#post') . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Mypage'), wfMsg('myauthorpage')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Watchlist'), wfMsg('watchlist')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Drafts'), wfMsg('mydrafts')) . $sk->makeLinkObj(SpecialPage::getTitleFor('Mypages', 'Contributions'), wfMsg('mycontris')) . $sk->makeLinkObj(SpecialPage::getTitleFor('Mypages', 'Fanmail'), wfMsg('myfanmail')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Preferences'), wfMsg('mypreferences')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMsg('logout'));
             } else {
                 $html = UserLoginBox::getLogin(true);
                 $menu_css = 'menu_login';
             }
             break;
         case 'explore':
             $dashboardPage = $wgLanguageCode == 'en' ? Title::makeTitle(NS_SPECIAL, "CommunityDashboard") : Title::makeTitle(NS_PROJECT, wfMsg("community"));
             $html = $sk->makeLinkObj($dashboardPage, wfMsg('community_dashboard'));
             if ($isLoggedIn) {
                 $html .= "<a href='{$wgForumLink}'>" . wfMsg('forums') . "</a>";
             }
             $html .= "<a href='/Special:Randomizer'>" . wfMsg('randompage') . "</a>";
             if (!$isLoggedIn) {
                 $html .= $sk->makeLinkObj(Title::makeTitle(NS_PROJECT, "About-wikiHow"), wfMsg('navmenu_aboutus'));
             }
             $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Categorylisting"), wfMsg('navmenu_categories')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Recentchanges"), wfMsg('recentchanges'));
             if ($isLoggedIn) {
                 $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Specialpages"), wfMsg('specialpages'));
                 $html .= $sk->makeLinkObj(Title::makeTitle(NS_PROJECT_TALK, 'Help-Team'), wfMsg('help'));
             }
             break;
         case 'help':
             $html = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "CreatePage"), wfMsg('Write-an-article'));
             if ($wgLanguageCode == 'en') {
                 $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "RequestTopic"), wfMsg('requesttopic')) . $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "ListRequestedTopics"), wfMsg('listrequtestedtopics'));
             }
             if ($isLoggedIn) {
                 if ($wgLanguageCode == 'en') {
                     $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "TipsPatrol"), wfMsg('navmenu_tipspatrol'));
                 }
                 $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "RCPatrol"), wfMsg('PatrolRC'));
                 if ($wgLanguageCode == 'en') {
                     $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Categorizer"), wfMsg('categorize_articles'));
                 }
             }
             if ($wgLanguageCode == 'en') {
                 $html .= "<a href='/Special:CommunityDashboard'>" . wfMsg('more-ideas') . "</a>";
             } else {
                 $html .= $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, "Uncategorizedpages"), wfMsg('categorize_articles')) . "<a href='/Contribute-to-wikiHow'>" . wfMsg('more-ideas') . "</a>";
             }
             break;
         case 'messages':
             list($html, $this->notifications_count) = Notifications::loadNotifications();
             $menu_css = 'menu_messages';
             break;
     }
     if ($html) {
         $html = '<div class="' . $menu_css . '">' . $html . '</div>';
     }
     return $html;
 }
Пример #4
0
 function getHeaderMenu($menu)
 {
     global $wgLanguageCode, $wgTitle, $wgUser, $wgForumLink;
     $html = '';
     $menu_css = 'menu';
     $sk = $this->getSkin();
     $isLoggedIn = $wgUser->getID() > 0;
     switch ($menu) {
         case 'edit':
             $html = "<a href='" . $wgTitle->getLocalURL($sk->editUrlOptions()) . "'>" . wfMessage('edit-this-article')->text() . "</a>";
             if (!$isLoggedIn) {
                 break;
             }
             $html .= Linker::link(SpecialPage::getTitleFor('Importvideo', $wgTitle->getText()), wfMessage('importvideo')->text());
             if ($wgLanguageCode == 'en') {
                 $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "RelatedArticle"), wfMessage('manage_related_articles')->text(), array(), array("target" => $wgTitle->getPrefixedURL())) . Linker::link(SpecialPage::getTitleFor("Articlestats", $wgTitle->getText()), wfMessage('articlestats')->text());
             }
             $html .= "<a href='" . Title::makeTitle(NS_SPECIAL, "Whatlinkshere")->getLocalUrl() . "/" . $wgTitle->getPrefixedURL() . "'>" . wfMessage('whatlinkshere')->text() . "</a>";
             break;
         case 'profile':
             if ($isLoggedIn) {
                 $html = Linker::link(Title::makeTitle(NS_SPECIAL, 'Mytalk', 'post'), wfMessage('mytalkpage')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Mypage'), wfMessage('myauthorpage')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Notifications'), wfMessage('mynotifications')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Watchlist'), wfMessage('watchlist')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Drafts'), wfMessage('mydrafts')->text()) . Linker::link(SpecialPage::getTitleFor('Mypages', 'Contributions'), wfMessage('mycontris')->text()) . Linker::link(SpecialPage::getTitleFor('Mypages', 'Fanmail'), wfMessage('myfanmail')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Preferences'), wfMessage('mypreferences')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, 'Userlogout'), wfMessage('logout')->text());
             } else {
                 $html = UserLoginBox::getLogin(true);
                 $menu_css = 'menu_login';
             }
             break;
         case 'explore':
             $dashboardPage = $wgLanguageCode == 'en' ? Title::makeTitle(NS_SPECIAL, "CommunityDashboard") : Title::makeTitle(NS_PROJECT, wfMessage("community")->text());
             $html = Linker::link($dashboardPage, wfMessage('community_dashboard')->text());
             if ($isLoggedIn) {
                 $html .= "<a href='{$wgForumLink}'>" . wfMessage('forums')->text() . "</a>";
             }
             $html .= "<a href='/Special:Randomizer'>" . wfMessage('randompage')->text() . "</a>";
             if (!$isLoggedIn) {
                 $html .= Linker::link(Title::makeTitle(NS_PROJECT, "About-wikiHow"), wfMessage('navmenu_aboutus')->text());
             }
             $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "Categorylisting"), wfMessage('navmenu_categories')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, "Recentchanges"), wfMessage('recentchanges')->text());
             if ($isLoggedIn) {
                 $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "Specialpages"), wfMessage('specialpages')->text());
                 $html .= Linker::link(Title::makeTitle(NS_PROJECT_TALK, 'Help-Team'), wfMessage('help')->text());
             }
             break;
         case 'help':
             $html = Linker::link(Title::makeTitle(NS_SPECIAL, "CreatePage"), wfMessage('Write-an-article')->text());
             if ($wgLanguageCode == 'en') {
                 $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "RequestTopic"), wfMessage('requesttopic')->text()) . Linker::link(Title::makeTitle(NS_SPECIAL, "ListRequestedTopics"), wfMessage('listrequtestedtopics')->text());
             }
             if ($isLoggedIn) {
                 if ($wgLanguageCode == 'en') {
                     $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "TipsPatrol"), wfMessage('navmenu_tipspatrol')->text());
                 }
                 $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "RCPatrol"), wfMessage('PatrolRC')->text());
                 if ($wgLanguageCode == 'en') {
                     $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "Categorizer"), wfMessage('categorize_articles')->text());
                 }
             }
             if ($wgLanguageCode == 'en') {
                 $html .= "<a href='/Special:CommunityDashboard'>" . wfMessage('more-ideas')->text() . "</a>";
             } else {
                 $html .= Linker::link(Title::makeTitle(NS_SPECIAL, "Uncategorizedpages"), wfMessage('categorize_articles')->text()) . "<a href='/Contribute-to-wikiHow'>" . wfMessage('more-ideas')->text() . "</a>";
             }
             break;
         case 'messages':
             if (class_exists('EchoEvent') && $wgUser->hasCookies()) {
                 $maxNotesShown = 5;
                 $notif = ApiEchoNotifications::getNotifications($wgUser, 'html', $maxNotesShown);
                 if ($notif) {
                     //show those notifications
                     foreach ($notif as $note) {
                         $this_note = $note['*'];
                         //unread?
                         if (!isset($note['read'])) {
                             $this_note = str_replace('mw-echo-state', 'mw-echo-state mw-echo-unread', $this_note);
                         }
                         $html .= $this_note;
                     }
                     //get the unread count
                     $notifUser = MWEchoNotifUser::newFromUser($wgUser);
                     $this->notifications_count = $notifUser->getNotificationCount();
                     if ($this->notifications_count > $maxNotesShown) {
                         $unshown = '<br /><a href="/Special:Notifications">(' . ($this->notifications_count - $maxNotesShown) . ' unread)</a>';
                     } else {
                         $unshown = '';
                     }
                     //add view all link
                     $html .= '<div class="menu_message_morelink"><a href="/Special:Notifications">' . wfMessage('more-notifications-link')->text() . '</a>' . $unshown . '</div>';
                 } else {
                     //no notifications
                     $html .= '<div class="menu_message_morelink">' . wfMessage('no-notifications')->parse() . '</div>';
                 }
             } else {
                 //old school
                 $ret = Notifications::loadNotifications();
                 if (is_array($ret)) {
                     list($html, $this->notifications_count) = $ret;
                 }
             }
             $menu_css = 'menu_messages';
             break;
     }
     if ($html) {
         $html = '<div class="' . $menu_css . '">' . $html . '</div>';
     }
     return $html;
 }
Пример #5
0
    function execute()
    {
        global $wgCookieExpiration;
        $expirationDays = ceil($wgCookieExpiration / (3600 * 24));
        ?>
<div id="userlogin_alt_logins">
	<div class="headline">Log in via</div>
	<?php 
        echo UserLoginBox::getSocialLogin();
        ?>
</div>
	
<div class="mw-ui-container">
	<?php 
        if ($this->haveData('languages')) {
            ?>
		<div id="languagelinks">
			<p><?php 
            $this->html('languages');
            ?>
</p>
		</div>
	<?php 
        }
        ?>
	
	<div id="userloginForm" class="userloginform">
		<div id="userloginprompt"><?php 
        $this->msgWiki('loginprompt');
        ?>
</div>
		<form name="userlogin" class="mw-ui-vform" method="post" action="<?php 
        $this->text('action');
        ?>
">
			<?php 
        if ($this->data['loggedin']) {
            ?>
				<div class="warningbox">
					<?php 
            echo $this->getMsg('userlogin-loggedin')->params($this->data['loggedinuser'])->parse();
            ?>
				</div>
			<?php 
        }
        ?>
			<section class="mw-form-header">
				<?php 
        $this->html('header');
        /* extensions such as ConfirmEdit add form HTML here */
        ?>
			</section>

			<div>
				<label for='wpName1' class='userlogin_label'>
					<?php 
        $this->msg('usernameoremail');
        ?>
				</label>
				<?php 
        $extraAttrs = array();
        echo Html::input('wpName', $this->data['name'], 'text', array('class' => 'loginText input_med', 'id' => 'wpName1', 'tabindex' => '1', 'size' => '20', 'required' => true, 'autofocus' => !$this->data['name']));
        ?>
					
				<?php 
        if (in_array('username', $this->data['errorlist'])) {
            ?>
					<div class="mw-error-bottom mw-error" id="wpName1_error">
						<div class="mw-error-top">
							<?php 
            $this->html('message');
            ?>
						</div>
					</div>
				<?php 
        }
        ?>
			</div>

			<div>
				<label for='wpPassword1'>
					<?php 
        $this->msg('userlogin-yourpassword');
        ?>
				</label>
				<?php 
        echo Html::input('wpPassword', null, 'password', array('class' => 'loginPassword input_med', 'id' => 'wpPassword1', 'tabindex' => '2', 'size' => '20', 'autofocus' => (bool) $this->data['name']));
        ?>
				<?php 
        if (in_array('password', $this->data['errorlist'])) {
            ?>
					<div class="mw-error-bottom mw-error" id="wpPassword1_error">
						<div class="mw-error-top">
							<?php 
            $this->html('message');
            ?>
						</div>
					</div>
				<?php 
        }
        ?>
			</div>
			<div id="forgot_pwd">
				<?php 
        if ($this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true) {
            echo ' ' . Linker::link(SpecialPage::getTitleFor('PasswordReset'), $this->getMsg('forgot_pwd')->parse(), array('class' => 'mw-ui-flush-right'));
        }
        ?>
			</div>
			<br /><br />
			<?php 
        if (isset($this->data['usedomain']) && $this->data['usedomain']) {
            $select = new XmlSelect('wpDomain', false, $this->data['domain']);
            $select->setAttribute('tabindex', 3);
            foreach ($this->data['domainnames'] as $dom) {
                $select->addOption($dom);
            }
            ?>
				<div id="mw-user-domain-section">
					<label for='wpDomain'><?php 
            $this->msg('yourdomainname');
            ?>
</label>
					<?php 
            echo $select->getHTML();
            ?>
				</div>
			<?php 
        }
        ?>

			<?php 
        if ($this->haveData('extrafields')) {
            echo $this->data['extrafields'];
        }
        ?>

			<div class="remember_pwd">
				<?php 
        if ($this->data['canremember']) {
            ?>
					<label class="mw-ui-checkbox-label">
						<input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
							<?php 
            if ($this->data['remember']) {
                echo 'checked="checked"';
            }
            ?>
						>
						<?php 
            echo $this->getMsg('rememberme')->numParams($expirationDays)->escaped();
            ?>
					</label>
				<?php 
        }
        ?>
			</div>

			<div>
				<?php 
        echo Html::input('wpLoginAttempt', $this->getMsg('login')->text(), 'submit', array('id' => 'wpLoginAttempt', 'tabindex' => '6', 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive button primary submit_button'));
        ?>
			</div>

			<?php 
        if ($this->haveData('uselang')) {
            ?>
<input type="hidden" name="uselang" value="<?php 
            $this->text('uselang');
            ?>
" /><?php 
        }
        ?>
			<?php 
        if ($this->haveData('token')) {
            ?>
<input type="hidden" name="wpLoginToken" value="<?php 
            $this->text('token');
            ?>
" /><?php 
        }
        ?>
			<?php 
        if ($this->data['cansecurelogin']) {
            ?>
<input type="hidden" name="wpForceHttps" value="<?php 
            $this->text('stickhttps');
            ?>
" /><?php 
        }
        ?>
		</form>
	</div>
</div>
<?php 
    }