public function execute()
 {
     global $wgOut, $wgUser, $wgRequest, $wgTitle;
     wfRunHooks('beforeBlogListingForm', array(&$this, $wgRequest->getVal('article')));
     if (!$wgUser->isLoggedIn()) {
         $wgOut->showErrorPage('create-blog-no-login', 'create-blog-login-required', array(wfGetReturntoParam()));
         return;
     }
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     $this->mTitle = Title::makeTitle(NS_SPECIAL, 'CreateBlogListingPage');
     $wgOut->setPageTitle(wfMsg('create-blog-listing-title'));
     if ($wgRequest->wasPosted()) {
         $this->parseFormData();
         if (count($this->mFormErrors) > 0 || !empty($this->mRenderedPreview)) {
             $this->renderForm();
         } else {
             $this->save();
         }
     } else {
         if ($wgRequest->getVal('article') != null) {
             $this->parseTag(urldecode($wgRequest->getVal('article')));
         }
         $this->renderForm();
     }
 }
 /**
  * Modify personal URLs list
  */
 private function setupPersonalUrls()
 {
     global $wgUser;
     // Import the starting set of urls from the skin template
     $this->personal_urls = F::app()->getSkinTemplateObj()->data['personal_urls'];
     if ($wgUser->isAnon()) {
         // add login and register links for anons
         //$skin = RequestContext::getMain()->getSkin();
         // where to redirect after login
         $query = F::app()->wg->Request->getValues();
         if (isset($query['title'])) {
             if (!self::isBlacklisted($query['title'])) {
                 $returnto = $query['title'];
             } else {
                 $returnto = Title::newMainPage()->getPartialURL();
             }
         } else {
             $returnto = Title::newMainPage()->getPartialURL();
         }
         $returnto = wfGetReturntoParam($returnto);
         $this->personal_urls['login'] = array('text' => wfMsg('login'), 'href' => Skin::makeSpecialUrl('UserLogin', $returnto), 'class' => 'ajaxLogin', 'afterText' => Xml::element('img', array('src' => $this->wg->BlankImgUrl, 'class' => 'chevron', 'width' => '0', 'height' => '0'), ''));
         $this->personal_urls['register'] = array('text' => wfMsg('oasis-signup'), 'href' => Skin::makeSpecialUrl('UserSignup'), 'class' => 'ajaxRegister');
     } else {
         // use Mypage message for userpage entry
         $this->personal_urls['userpage']['text'] = wfMsg('mypage');
     }
 }
Пример #3
0
 public function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $out = $this->getOutput();
     $out->disallowUserJs();
     # Prevent hijacked user scripts from sniffing passwords etc.
     $user = $this->getUser();
     if ($user->isAnon()) {
         $out->showErrorPage('prefsnologin', 'prefsnologintext', array(wfGetReturntoParam()));
         return;
     }
     $this->checkReadOnly();
     if ($par == 'reset') {
         $this->showResetForm();
         return;
     }
     $out->addModules('mediawiki.special.preferences');
     /* Wikia change begin - @author: macbre */
     /* Enable custom notifications handling */
     wfRunHooks('SpecialPreferencesOnRender', array(&$this));
     /* Wikia change end */
     if ($this->getRequest()->getCheck('success')) {
         $out->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
     }
     if ($this->getRequest()->getCheck('eauth')) {
         $out->wrapWikiMsg("<div class='error' style='clear: both;'>\n\$1</div>", 'eauthentsent', $user->getName());
     }
     $htmlForm = Preferences::getFormObject($user, $this->getContext());
     $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
     $htmlForm->show();
 }
Пример #4
0
 public function execute($par)
 {
     if (!$this->user->isLoggedIn()) {
         $this->out->showErrorPage('create-blog-no-login', 'create-blog-login-required', array(wfGetReturntoParam()));
         return;
     }
     if ($this->user->isBlocked()) {
         throw new UserBlockedError($this->user->mBlock);
     }
     if (wfReadOnly()) {
         $this->out->readOnlyPage();
         return;
     }
     parent::execute($par);
     /* bugId::34933 Actions::getActionName() assumes every Special page is a view.  Forcing a wgAction override for this page */
     RequestContext::getMain()->getOutput()->addJsConfigVars('wgAction', 'edit');
 }
	/**
	 * Modify personal URLs list
	 */
	private function setupPersonalUrls() {
		global $wgUser, $wgComboAjaxLogin;

		// Import the starting set of urls from the skin template
		$this->personal_urls = F::app()->getSkinTemplateObj()->data['personal_urls'];
		if ($wgUser->isAnon()) {
			// add login and register links for anons
			//$skin = RequestContext::getMain()->getSkin();

			// where to redirect after login
			$returnto = wfGetReturntoParam();

			if(empty($wgComboAjaxLogin)) {
				$signUpHref = Skin::makeSpecialUrl('UserLogin', $returnto);
			} else {
				$signUpHref = Skin::makeSpecialUrl('Signup', $returnto);
			}
			$this->personal_urls['login'] = array(
				'text' => wfMsg('login'),
				'href' => $signUpHref . "&type=login",
				'class' => 'ajaxLogin',
				'afterText' => Xml::element('img', array(
					'src' => $this->wg->BlankImgUrl,
					'class' => 'chevron',
					'width' => '0',
					'height' => '0',
				), ''),
			);

			$this->personal_urls['register'] = array(
				'text' => wfMsg('oasis-signup'),
				'href' => $signUpHref . "&type=signup",
				'class' => 'ajaxRegister'
			);
		}
		else {
			// use Mypage message for userpage entry
			$this->personal_urls['userpage']['text'] = wfMsg('mypage');
		}
	}
Пример #6
0
 /**
  * Check action permissions not already checked in checkQuickPermissions
  *
  * @param $action String the action to check
  * @param $user User to check
  * @param $errors Array list of current errors
  * @param $doExpensiveQueries Boolean whether or not to perform expensive queries
  * @param $short Boolean short circuit on first error
  *
  * @return Array list of errors
  */
 private function checkActionPermissions($action, $user, $errors, $doExpensiveQueries, $short)
 {
     global $wgDeleteRevisionsLimit, $wgLang;
     if ($action == 'protect') {
         if (count($this->getUserPermissionsErrorsInternal('edit', $user, $doExpensiveQueries, true))) {
             // If they can't edit, they shouldn't protect.
             $errors[] = array('protect-cantedit');
         }
     } elseif ($action == 'create') {
         $title_protection = $this->getTitleProtection();
         if ($title_protection) {
             if ($title_protection['pt_create_perm'] == 'sysop') {
                 $title_protection['pt_create_perm'] = 'protect';
                 // B/C
             }
             if ($title_protection['pt_create_perm'] == '' || !$user->isAllowed($title_protection['pt_create_perm'])) {
                 $errors[] = array('titleprotected', User::whoIs($title_protection['pt_user']), $title_protection['pt_reason']);
             }
         }
     } elseif ($action == 'move') {
         // Check for immobile pages
         if (!MWNamespace::isMovable($this->mNamespace)) {
             // Specific message for this case
             $errors[] = array('immobile-source-namespace', $this->getNsText());
         } elseif (!$this->isMovable()) {
             // Less specific message for rarer cases
             $errors[] = array('immobile-source-page');
         }
     } elseif ($action == 'move-target') {
         if (!MWNamespace::isMovable($this->mNamespace)) {
             $errors[] = array('immobile-target-namespace', $this->getNsText());
         } elseif (!$this->isMovable()) {
             $errors[] = array('immobile-target-page');
         }
     } elseif ($action == 'delete') {
         if ($doExpensiveQueries && $wgDeleteRevisionsLimit && !$this->userCan('bigdelete', $user) && $this->isBigDeletion()) {
             $errors[] = array('delete-toobig', $wgLang->formatNum($wgDeleteRevisionsLimit));
         }
     } elseif ($action == 'edit') {
         if (!$user->isAllowed('edit')) {
             $errors[] = $user->isAnon() ? array('editnologintext', wfGetReturntoParam()) : array('editnotallowed');
         }
     }
     # end change by wikia
     return $errors;
 }
Пример #7
0
	/**
	 * Generate links for user menu - depends on if user is logged in or not
	 *
	 * @return array
	 * @author Inez Korczynski <*****@*****.**>
	 */
	private function getUserLinks($tpl) {
		wfProfileIn( __METHOD__ );
		global $wgUser, $wgTitle;

		$data = array();

		if(!$wgUser->isLoggedIn()) {
			$returnto = wfGetReturntoParam();

			$signUpHref = Skin::makeSpecialUrl( 'Signup', $returnto );
			$data['login'] = array(
				'text' => wfMsg('login'),
				'href' => $signUpHref . "&type=login"
				);

			$data['register'] = array(
				'text' => wfMsg('nologinlink'),
				'href' => $signUpHref . "&type=signup"
				);

		} else {

			$data['userpage'] = array(
				'text' => $wgUser->getName(),
				'href' => $tpl->data['personal_urls']['userpage']['href']
				);

			$data['mytalk'] = array(
				'text' => $tpl->data['personal_urls']['mytalk']['text'],
				'href' => $tpl->data['personal_urls']['mytalk']['href']
				);

			$data['watchlist'] = array(
				/*'text' => $tpl->data['personal_urls']['watchlist']['text'],*/
				'text' => wfMsg('prefs-watchlist'),
				'href' => $tpl->data['personal_urls']['watchlist']['href']
				);

			// In some cases, logout will be removed explicitly (such as when it is replaced by fblogout).
			if(isset($tpl->data['personal_urls']['logout'])){
				$data['logout'] = array(
					'text' => $tpl->data['personal_urls']['logout']['text'],
					'href' => $tpl->data['personal_urls']['logout']['href']
				);
			}


			$data['more']['userpage'] = array(
				'text' => wfMsg('mypage'),
				'href' => $tpl->data['personal_urls']['userpage']['href']
				);

			if(isset($tpl->data['personal_urls']['userprofile'])) {
				$data['more']['userprofile'] = array(
					'text' => $tpl->data['personal_urls']['userprofile']['text'],
					'href' => $tpl->data['personal_urls']['userprofile']['href']
					);
			}

			$data['more']['mycontris'] = array(
				'text' => wfMsg('mycontris'),
				'href' => $tpl->data['personal_urls']['mycontris']['href']
				);

			$data['more']['widgets'] = array(
				'text' => wfMsg('manage_widgets'),
				'href' => '#'
				);

			$data['more']['preferences'] = array(
				'text' => $tpl->data['personal_urls']['preferences']['text'],
				'href' => $tpl->data['personal_urls']['preferences']['href']
				);
		}

		// This function ignores anything from PersonalUrls hook which it doesn't expect.  This
		// loops lets it expect anything starting with "fb*" (because we need that for facebook connect).
		// Perhaps we should have some system to let PersonalUrls hook work again on its own?
		// - Sean Colombo

		foreach($tpl->data['personal_urls'] as $urlName => $urlData){
			if(strpos($urlName, "fb") === 0){
				$data[$urlName] = $urlData;
			}
		}

		wfProfileOut( __METHOD__ );
		return $data;
	}
Пример #8
0
 public function execute()
 {
     global $wgOut, $wgUser, $wgRequest, $wgTitle;
     if (!$wgUser->isLoggedIn()) {
         $wgOut->showErrorPage('create-blog-no-login', 'create-blog-login-required', array(wfGetReturntoParam()));
         return;
     }
     if ($wgUser->isBlocked()) {
         throw new UserBlockedError($this->getUser()->mBlock);
     }
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return;
     }
     //nAndy: bugId:9804
     $pageId = intval($wgRequest->getVal('pageId'));
     $this->mTitle = $pageId > 0 ? Title::newFromId($pageId) : Title::makeTitle(NS_SPECIAL, 'CreateBlogPage');
     // force CategorySelect initialisation if available
     if (function_exists('CategorySelectInitializeHooks') && $wgUser->getOption('disablecategoryselect', false) == false) {
         $this->mCategorySelectEnabled = true;
         $wgRequest->setVal('action', 'edit');
         CategorySelectInit(true);
         CategorySelectInitializeHooks(null, null, $this->mTitle, null, null, null);
     }
     $wgOut->setPageTitle(wfMsg("create-blog-post-title"));
     if ($wgRequest->wasPosted()) {
         // BugId:954 - check for "show changes"
         $isShowDiff = !is_null($wgRequest->getVal('wpDiff'));
         $this->parseFormData();
         if (count($this->mFormErrors) > 0 || !empty($this->mPreviewTitle)) {
             $this->renderForm();
         } else {
             if ($isShowDiff) {
                 // watch out! there be dragons (temporary workaround)
                 $this->mEditPage->diff = true;
                 $this->mEditPage->edittime = null;
                 $this->renderForm();
             } else {
                 $this->save();
             }
         }
     } else {
         if ($wgRequest->getVal('article') != null) {
             $this->parseArticle(urldecode($wgRequest->getVal('article')));
         } else {
             if ($wgRequest->getText('preload') != null) {
                 // TOR: added preload functionality
                 $preloadTitle = Title::newFromText($wgRequest->getText('preload'));
                 if (!is_null($preloadTitle)) {
                     $preloadArticle = new Article($preloadTitle);
                     $text = $preloadArticle->getContent();
                     $this->createEditPage($text);
                 }
             } else {
                 if ($pageId > 0) {
                     //nAndy: bugId:9804 Owen: bugId:11432
                     $preloadTitle = Title::newFromId($pageId);
                     if (!is_null($preloadTitle)) {
                         $this->parseArticle($preloadTitle->getDBKey());
                     }
                 } else {
                     $this->createEditPage('');
                 }
             }
         }
         $this->renderForm();
     }
 }
Пример #9
0
 private function outputPageList($groups)
 {
     global $wgMiserMode, $wgSpecialPagesRequiredLogin;
     $out = $this->getOutput();
     $includesRestrictedPages = false;
     $includesCachedPages = false;
     foreach ($groups as $group => $sortedPages) {
         $middle = ceil(count($sortedPages) / 2);
         $total = count($sortedPages);
         $count = 0;
         $out->wrapWikiMsg("<h2 class=\"mw-specialpagesgroup\" id=\"mw-specialpagesgroup-{$group}\">\$1</h2>\n", "specialpages-group-{$group}");
         $out->addHTML(Html::openElement('table', array('style' => 'width:100%;', 'class' => 'mw-specialpages-table')) . "\n" . Html::openElement('tr') . "\n" . Html::openElement('td', array('style' => 'width:30%;vertical-align:top')) . "\n" . Html::openElement('ul') . "\n");
         $user = $this->getUser();
         $sk = $user->getSkin();
         foreach ($sortedPages as $desc => $specialpage) {
             list($title, $restricted, $expensive) = $specialpage;
             $pageClasses = array();
             if ($expensive && $wgMiserMode) {
                 $includesCachedPages = true;
                 $pageClasses[] = 'mw-specialpagecached';
             }
             if ($restricted) {
                 $includesRestrictedPages = true;
                 $pageClasses[] = 'mw-specialpagerestricted';
             }
             $link = Linker::linkKnown($title, htmlspecialchars($desc));
             /* Wikia change begin - @author: Marooned */
             /* Redirect to login page instead of showing error, see Login friction project */
             if ($user->isAnon()) {
                 list($name, ) = SpecialPageFactory::resolveAlias($title->getDBkey());
                 if (is_array($wgSpecialPagesRequiredLogin) && in_array($name, $wgSpecialPagesRequiredLogin)) {
                     $link = $sk->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Signup'), htmlspecialchars($desc), wfGetReturntoParam($title->getPrefixedDBkey()));
                 }
             }
             /* Wikia change end */
             $out->addHTML(Html::rawElement('li', array('class' => implode(' ', $pageClasses)), $link) . "\n");
             # Split up the larger groups
             $count++;
             if ($total > 3 && $count == $middle) {
                 $out->addHTML(Html::closeElement('ul') . Html::closeElement('td') . Html::element('td', array('style' => 'width:10%'), '') . Html::openElement('td', array('style' => 'width:30%')) . Html::openElement('ul') . "\n");
             }
         }
         $out->addHTML(Html::closeElement('ul') . Html::closeElement('td') . Html::element('td', array('style' => 'width:30%'), '') . Html::closeElement('tr') . Html::closeElement('table') . "\n");
     }
     if ($includesRestrictedPages || $includesCachedPages) {
         $out->wrapWikiMsg("<div class=\"mw-specialpages-notes\">\n\$1\n</div>", 'specialpages-note');
     }
 }
    function execute($par)
    {
        wfProfileIn(__METHOD__);
        global $wgOut, $wgUser, $wgBlankImgUrl;
        $this->setHeaders();
        // not available for skins different than Oasis
        if (!F::app()->checkSkin('oasis')) {
            $wgOut->addWikiMsg('myhome-switch-to-monaco');
            wfProfileOut(__METHOD__);
            return;
        }
        // choose default view (RT #68074)
        if ($wgUser->isLoggedIn()) {
            $this->defaultView = MyHome::getDefaultView();
            if ($par == '') {
                $par = $this->defaultView;
            }
        } else {
            $this->defaultView = false;
        }
        // watchlist feed
        if ($par == 'watchlist') {
            $this->classWatchlist = "selected";
            // not available for anons
            if ($wgUser->isAnon()) {
                if (get_class(RequestContext::getMain()->getSkin()) == 'SkinOasis') {
                    $wgOut->wrapWikiMsg('<div class="latest-activity-watchlist-login" >$1</div>', array('oasis-activity-watchlist-login', wfGetReturntoParam()));
                } else {
                    $wgOut->wrapWikiMsg('<div id="myhome-log-in">$1</div>', array('myhome-log-in', wfGetReturntoParam()));
                }
                //oasis-activity-watchlist-login
                // RT #23970
                $wgOut->addInlineScript(<<<JS
\$(function() {
\t\$('#myhome-log-in').find('a').click(function(ev) {
\t\topenLogin(ev);
\t});
});
JS
);
                wfProfileOut(__METHOD__);
                return;
            } else {
                $this->feedSelected = 'watchlist';
                $feedProxy = new WatchlistFeedAPIProxy();
                $feedRenderer = new WatchlistFeedRenderer();
            }
        } else {
            //for example: wiki-domain.com/wiki/Special:WikiActivity
            $this->feedSelected = 'activity';
            $feedProxy = new ActivityFeedAPIProxy();
            $feedRenderer = new ActivityFeedRenderer();
        }
        $feedProvider = new DataFeedProvider($feedProxy);
        global $wgJsMimeType, $wgExtensionsPath;
        $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/MyHome/WikiActivity.js\"></script>\n");
        $wgOut->addExtensionStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/MyHome/oasis.scss'));
        wfRunHooks('SpecialWikiActivityExecute', array($wgOut, $wgUser));
        $data = $feedProvider->get(50);
        // this breaks when set to 60...
        // FIXME: do it in AchievementsII extension
        global $wgEnableAchievementsInActivityFeed, $wgEnableAchievementsExt;
        if (!empty($wgEnableAchievementsInActivityFeed) && !empty($wgEnableAchievementsExt)) {
            $wgOut->addExtensionStyle("{$wgExtensionsPath}/wikia/AchievementsII/css/achievements_sidebar.css");
        }
        // use message from MyHome as special page title
        $wgOut->setPageTitle(wfMsg('oasis-activity-header'));
        $template = new EasyTemplate(dirname(__FILE__) . '/templates');
        $template->set('data', $data['results']);
        $showMore = isset($data['query-continue']);
        if ($showMore) {
            $template->set('query_continue', $data['query-continue']);
        }
        if (empty($data['results'])) {
            $template->set('emptyMessage', wfMsgExt("myhome-activity-feed-empty", array('parse')));
        }
        $template->set_vars(array('showMore' => $showMore, 'type' => $this->feedSelected, 'wgBlankImgUrl' => $wgBlankImgUrl));
        $wgOut->addHTML($template->render('activityfeed.oasis'));
        // page header: replace subtitle with navigation
        global $wgHooks;
        $wgHooks['PageHeaderIndexAfterExecute'][] = array(&$this, 'addNavigation');
        wfProfileOut(__METHOD__);
    }
	/**
	 * @param extraReturntoquery is a string which will be urlencoded and appended to the returntoquery. eg: "action=edit".
	 */
	public function createLoginURL($extraReturntoquery='') {
		global $wgTitle;

		/** create login URL **/
		$returnto = wfGetReturntoParam(null, $extraReturntoquery);

		//$signUpHref = Skin::makeSpecialUrl('Signup', $returnto);
		$signUpHref = $returnto;
		$signUpHref .= "&type=login";
		//$this->loginTitle = Skin::makeSpecialUrl('Signup'); // the linker just expects a page-name here.
		return $signUpHref;
	}
 /**
  * Modify personal URLs list.
  */
 private function setupPersonalUrls()
 {
     $this->personalUrls = F::app()->getSkinTemplateObj()->data['personal_urls'];
     if ($this->isAnon) {
         $query = F::app()->wg->Request->getValues();
         if (isset($query['title']) && !self::isBlacklisted($query['title'])) {
             $returnto = wfUrlencode($query['title']);
         } else {
             $returnto = Title::newMainPage()->getPartialURL();
         }
         $returnto = wfGetReturntoParam($returnto);
         $this->personalUrls['login'] = ['title' => wfMessage('login')->text(), 'href' => Skin::makeSpecialUrl('UserLogin', $returnto), 'class' => 'ajaxLogin table-cell'];
         $this->personalUrls['register'] = ['text' => wfMessage('oasis-signup')->text(), 'href' => Skin::makeSpecialUrl('UserSignup'), 'class' => 'ajaxRegister'];
     } else {
         $this->personalUrls['userpage'] = ['title' => $this->username . ' - ' . wfMessage('mypage')->text(), 'href' => AvatarService::getUrl($this->username), 'class' => 'ajaxLogin table-cell'];
     }
 }