function execute($par) { global $wgOut, $wgMemc, $wgRequest; $target = isset($par) ? $par : $wgRequest->getVal('target'); if (isset($target) && $target != '') { $dbr = wfGetDB(DB_MASTER); $sql = "INSERT INTO `badge_views` (bv_referrer, bv_size, bv_count) VALUES (" . $dbr->addQuotes($_SERVER['HTTP_REFERER']) . ", " . intval($target) . ", 1) ON DUPLICATE KEY UPDATE bv_count = bv_count + 1"; $dbr->query($sql); $wgOut->redirect(wfGetPad("/skins/WikiHow/images/wikiHow_badge_" . $target . ".png")); //not used right now /*$wgOut->setArticleBodyOnly(true); $cacheValue = $wgMemc->get(wfMemcKey("iheartwikihow_" . $target)); if($cacheValue){ $wgOut->addHTML($cacheValue); return; } $image = file_get_contents(wfGetPad("/skins/WikiHow/images/wikiHow_badge_" . $target . ".png")); $wgOut->addHTML($image); $wgMemc->set(wfMemcKey(wfMemcKey("iheartwikihow_" . $target)), $image);*/ } else { $wgOut->setPageTitle(wfMsg('iheartwikihow_title')); if (class_exists('WikihowCSSDisplay')) { WikihowCSSDisplay::setSpecialBackground(true); } $wgOut->addHTML("<div class='undoArticleInner' style='padding: 18px 27px 15px 23px;'>"); $this->showBadges(); $wgOut->addHTML("</div>"); } }
function execute($par) { global $wgOut; wfLoadExtensionMessages('ProfileBadges'); if (class_exists('WikihowCSSDisplay')) { WikihowCSSDisplay::setSpecialBackground(true); } $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('ProfileBadges.css'), 'extensions/wikihow', false)); $wgOut->setPageTitle(wfMsg('ab-title')); $wgOut->addHTML("<div class='undoArticleInner'>"); $wgOut->addHTML(ProfileBadges::getBadge('admin')); $wgOut->addHTML(ProfileBadges::getBadge('nab')); $wgOut->addHTML(ProfileBadges::getBadge('fa')); $wgOut->addHTML(ProfileBadges::getBadge('welcome')); $wgOut->addHTML("</div>"); }
function execute() { global $wgOut; // XXCHANGED $wgOut->addScript('<script type="text/javascript" src="' . wfGetPad('/extensions/min/f/extensions/wikihow/LoginReminder.js?rev=') . WH_SITEREV . '"></script>'); if (class_exists('WikihowCSSDisplay')) { WikihowCSSDisplay::setSpecialBackground(true); } if (!is_null($this->mCookieCheck)) { $this->onCookieRedirectCheck($this->mCookieCheck); return; } else { if ($this->mPosted) { if ($this->mCreateaccount) { return $this->addNewAccount(); } else { if ($this->mCreateaccountMail) { return $this->addNewAccountMailPassword(); } else { if ($this->mMailmypassword) { return $this->mailPassword(); } else { if ('submitlogin' == $this->mAction || $this->mLoginattempt) { return $this->processLogin(); } } } } } elseif ($this->mAutoRedirect != "") { $title = Title::newFromText($this->mAutoRedirect); if ($this->shouldFollow($title)) { $wgOut->redirect($title->getFullURL()); } } } $this->mainLoginForm(''); }
public static function setSpecialBackground($isSpecial) { self::$specialBackground = $isSpecial; }
/** * Calls the WikihowCSSDisplay class to determine whether or * not to display a "special" background. */ static function isSpecialBackground() { if (class_exists('WikihowCSSDisplay')) { return WikihowCSSDisplay::isSpecialBackground(); } else { return false; } }
/** * Special:LSearch page entry point */ public function execute($par = '') { global $wgUser, $wgOut, $wgScriptPath, $wgRequest, $wgServer; global $wgLanguageCode, $wgUseLucene, $IP, $wgHooks; // Added this hack to test whether we can stop some usertype:logged(in|out) // queries can be removed from index. Remove this code eventually, say 6 mos. // from now. Added by Reuben originally on July 30, 2012. $queryString = @$_SERVER['REQUEST_URI']; if (strpos($queryString, 'usertype') !== false) { header('HTTP/1.0 404 Not Found'); print "Page not found"; exit; } $wgHooks['ShowBreadCrumbs'][] = array($this, 'removeBreadCrumbsCallback'); $wgHooks['WrapBodyWithArticleInner'][] = array($this, 'wrapBodyWithArticleInner'); $this->mStart = $wgRequest->getVal('start', 0); $this->mQ = $wgRequest->getVal('search'); // special case search term filtering if (strtolower($this->mQ) == 'sat') { // searching for SAT, not sitting $this->mQ = "\"SAT\""; } $enc_q = htmlspecialchars($this->mQ); $wgOut->setRobotPolicy('noindex,nofollow'); // Logged out search test if ($wgRequest->getVal('lo', 0)) { $wgHooks['ShowSideBar'][] = array($this, 'removeSideBarCallback'); // We want to cache results of searches for 6 hours at the Varnish level // since logged out search receives a high volume of queries $wgHooks['AllowMaxageHeaders'][] = array($this, 'allowMaxageHeadersCallback'); $this->setMaxageHeaders(); $this->loggedOutSearch(); $wgOut->setHTMLTitle(wfMsg('lsearch_title_q', $enc_q)); $wgOut->addStyle(wfGetPad('/extensions/min/?f=/skins/owl/searchresults.css&' . WH_SITEREV)); $wgOut->addHtml($this->getLoggedOutSearchHtml()); return; } if ($wgLanguageCode != 'en' || !$wgUseLucene) { require_once "{$IP}/includes/SpecialSearch.php"; wfSpecialSearch(); return; } if ($wgRequest->getVal('rss') == 1) { $results = $this->googleSearchResultTitles($wgRequest->getVal('search'), $this->mStart, self::RESULTS_PER_PAGE, 0, self::SEARCH_RSS); $wgOut->disable(); $pad = " "; header("Content-type: text/xml;"); echo '<GSP VER="3.2"> <TM>0.083190</TM> <Q>' . htmlspecialchars($q) . '</Q> <PARAM name="filter" value="0" original_value="0"/> <PARAM name="num" value="16" original_value="30"/> <PARAM name="access" value="p" original_value="p"/> <PARAM name="entqr" value="0" original_value="0"/> <PARAM name="start" value="0" original_value="0"/> <PARAM name="output" value="xml" original_value="xml"/> <PARAM name="sort" value="date:D:L:d1" original_value="date%3AD%3AL%3Ad1"/> <PARAM name="site" value="main_en" original_value="main_en"/> <PARAM name="ie" value="UTF-8" original_value="UTF-8"/> <PARAM name="client" value="internal_frontend" original_value="internal_frontend"/> <PARAM name="q" value="' . htmlspecialchars($q) . '" original_value="' . htmlspecialchars($q) . '"/> <PARAM name="ip" value="192.168.100.100" original_value="192.168.100.100"/> <RES SN="1" EN="' . sizeof($results) . '"> <M>' . sizeof($results) . '</M> <XT/>'; $count = 1; foreach ($results as $r) { echo "<R N=\"{$count}\">\n\t\t\t\t\t<U>{$r->getFullURL()}</U>\n\t\t\t\t\t<UE>{$r->getFullURL()}</UE>\n\t\t\t\t\t<T>How to " . htmlspecialchars($r->getFullText()) . "{$pad}</T>\n\t\t\t\t\t<RK>10</RK>\n\t\t\t\t\t<HAS></HAS>\n\t\t\t\t\t<LANG>en</LANG>\n\t\t\t</R>"; $count++; } echo "</RES>\n</GSP>"; return; } //show the gray article image at the bottom if (class_exists('WikihowCSSDisplay')) { WikihowCSSDisplay::setSpecialBackground(true); } $fname = "wfSpecialSearch"; $me = Title::makeTitle(NS_SPECIAL, "LSearch"); $sk = $wgUser->getSkin(); if ($wgRequest->getVal('raw') == true) { $contents = $this->googleSearchResultTitles($this->mQ, $this->mStart, self::RESULTS_PER_PAGE, 0, self::SEARCH_RAW); header("Content-type: text/plain"); $wgOut->disable(true); foreach ($contents as $t) { echo "{$t->getFullURL()}\n"; } return; } if ($wgRequest->getVal('mobile') == true) { $this->mobileSearch($this->mQ, $this->mStart, $wgRequest->getVal('limit', 20)); return; } // Logged in search is only for logged in users /*if ($wgUser->isAnon()) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext'); return; }*/ $contents = $this->googleSearchResults($this->mQ, $this->mStart, self::RESULTS_PER_PAGE, self::SEARCH_LOGGED_IN); if ($contents == null) { return; } wfLoadExtensionMessages('LSearch'); $wgOut->setHTMLTitle(wfMsg('lsearch_title_q', $enc_q)); $me = Title::makeTitle(NS_SPECIAL, "LSearch"); $sk = $wgUser->getSkin(); $suggestionLink = $this->getSpellingSuggestion($me->getPartialUrl()); $results = $this->mResults['results'] ? $this->mResults['results'] : array(); $results = $this->makeTitlesUniform($results); $results = $this->supplementResults($results); $mw = Title::makeTitle(NS_SPECIAL, "Search"); $specialPageURL = $mw->getFullURL(); $total = $this->mResults['totalresults']; $start = $this->mStart; $last = $this->mLast; $max_results = self::RESULTS_PER_PAGE; $q = $this->mQ; //buttons // - next $disabled = !($total > $start + $max_results && $last == $start + $max_results); $next_url = '/' . $me . '?search=' . urlencode($q) . '&start=' . ($start + $max_results); $next_button = '<a href="' . $next_url . '" class="button buttonright ' . ($disabled ? 'disabled' : '') . '" ' . ($disabled ? 'onClick="return false;"' : '') . '>' . wfMsg("lsearch_next") . '</a>'; // - previous $disabled = !($start - $max_results >= 0); $prev_url = '/' . $me . '?search=' . urlencode($q) . ($start - $max_results !== 0 ? '&start=' . ($start - $max_results) : ''); $prev_button = '<a href="' . $prev_url . '" class="button buttonleft ' . ($disabled ? 'disabled' : '') . '" ' . ($disabled ? 'onClick="return false;"' : '') . '>' . wfMsg("lsearch_previous") . '</a>'; $vars = array('q' => $q, 'enc_q' => $enc_q, 'sk' => $sk, 'me' => $me, 'max_results' => $max_results, 'start' => $start, 'first' => $start + 1, 'last' => $last, 'suggestionLink' => $suggestionLink, 'results' => $results, 'specialPageURL' => $specialPageURL, 'total' => $total, 'BASE_URL' => $wgServer, 'next_button' => $next_button, 'prev_button' => $prev_button); EasyTemplate::set_path(dirname(__FILE__) . '/'); $html = EasyTemplate::html('search-results.tmpl.php', $vars); $wgOut->addStyle(wfGetPad('/extensions/min/?f=/skins/owl/searchresults.css&' . WH_SITEREV)); $wgOut->addHTML($html); }
function execute($par) { global $wgOut, $wgRequest, $wgUser, $wgParser; if ($wgUser->isBlocked()) { $wgOut->blockedPage(); return; } if ($wgUser->getID() == 0) { $wgOut->setRobotpolicy('noindex,nofollow'); $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext'); return; } if (class_exists('WikihowCSSDisplay')) { WikihowCSSDisplay::setSpecialBackground(true); } if ($wgRequest->getVal('fetchReviewersTable')) { $wgOut->setArticleBodyOnly(true); echo $this->getReviewersTable(); return; } wfLoadExtensionMessages('Importvideo'); wfLoadExtensionMessages("Videoadder"); $target = isset($par) ? $par : $wgRequest->getVal('target'); $cat = htmlspecialchars($wgRequest->getVal('cat')); // get just the HTML for the Ajax call for the next video // used even on the initial page load if ($target == 'getnext') { $wgOut->setArticleBodyOnly(true); // process any skipped videos if ($wgRequest->getVal('va_page_id') && !preg_match("@[^0-9]@", $wgRequest->getVal('va_page_id'))) { $dbw = wfGetDB(DB_MASTER); $vals = array('va_vid_id' => $wgRequest->getVal('va_vid_id'), 'va_user' => $wgUser->getID(), 'va_user_text' => $wgUser->getName(), 'va_timestamp' => wfTimestampNow(), 'va_inuse' => null, 'va_src' => 'youtube'); $va_skip = $wgRequest->getVal('va_skip'); if ($va_skip < 2) { $vals['va_skipped_accepted'] = $va_skip; } $dbw->update('videoadder', $vals, array('va_page' => $wgRequest->getVal('va_page_id'))); if ($wgRequest->getVal('va_skip') == 0) { // import the video $tx = Title::newFromID($wgRequest->getVal('va_page_id')); $ipv = new ImportvideoYoutube(); $text = $ipv->loadVideoText($wgRequest->getVal('va_vid_id')); $vid = Title::makeTitle(NS_VIDEO, $tx->getText()); Importvideo::updateVideoArticle($vid, $text, wfMessage('va_addingvideo')->text()); Importvideo::updateMainArticle($tx, wfMessage('va_addingvideo')->text()); wfRunHooks("VAdone", array()); $wgOut->redirect(''); } else { if ($wgRequest->getVal('va_skip') == 2) { // the user has skipped it and not rejected this one, don't show it to them again self::skipArticle($wgRequest->getVal('va_page_id')); wfRunHooks("VAskipped", array()); } } } $results = self::getNext(); if (empty($results)) { $wgOut->addHTML("Something went wrong. Refresh."); return; } $title = $results[0]; $vid = $results[1]; $id = str_replace("http://gdata.youtube.com/feeds/api/videos/", "", $vid['ID']); if (!$title) { $wgOut->addHTML("Something went wrong. Refresh."); return; } $revision = Revision::newFromTitle($title); $popts = $wgOut->parserOptions(); $popts->setTidy(true); $parserOutput = $wgOut->parse($revision->getText(), $title, $popts); $magic = WikihowArticleHTML::grabTheMagic($revision->getText()); $html = WikihowArticleHTML::processArticleHTML($parserOutput, array('no-ads' => true, 'ns' => NS_MAIN, 'magic-word' => $magic)); $result['guts'] = "<div id='va_buttons'><a href='#' onclick='va_skip(); return false;' class='button secondary ' style='float:left;'>Skip</a>\n<a id='va_yes' href='#' class='button primary disabled buttonright'>Yes, it does</a>\n<a id='va_no' href='#' class='button secondary buttonright'>No, it doesn't</a><div class='clearall'></div></div>\n<div id='va_title'><a href='{$title->getFullURL()}' target='new'>" . wfMsg("howto", $title->getText()) . "</a></div>\n\t\t\t\t\t<div id='va_video' class='section_text'>\n\t<p id='va_notice'>" . wfMsg('va_notice') . "</p>\n<object width='480' height='385'><param name='movie' value='http://www.youtube.com/v/{$id}&hl=en_US&fs=1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/{$id}&hl=en_US&fs=1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='480' height='385'></embed></object>\n\t\t\t\t\t<input type='hidden' id='va_vid_id' value='{$id}'/>\n\t\t\t\t\t<input type='hidden' id='va_page_id' value='{$title->getArticleID()}'/>\n\t\t\t\t\t<input type='hidden' id='va_page_title' value='" . htmlspecialchars($title->getText()) . "'/>\n\t\t\t\t\t<input type='hidden' id='va_page_url' value='" . htmlspecialchars($title->getFullURL()) . "'/>\n\t\t\t\t\t<input type='hidden' id='va_skip' value='0'/>\n\t\t\t\t\t<input type='hidden' id='va_src' value='youtube'/>\n\t\t\t\t\t</div>\n\n\t\t\t</div>\n\t\t\t"; $result['article'] = $html; $dropdown = wfMsg('va_browsemsg') . " " . self::getCategoryDropDown(); $result['options'] = "<div id='va_browsecat'>" . $dropdown . "</div>"; $result['cat'] = $cat; print_r(json_encode($result)); return; } // add the layer of the page $this->setHeaders(); $this->setSideWidgets(); $wgOut->addJScode('vcooj'); $wgOut->addJScode('vaddj'); $wgOut->addCSScode('vaddc'); $wgOut->addHTML("<div class='tool_header tool'><h1>" . wfMessage('va_question') . "<span id='va_instructions'>" . wfMessage('va_instructions') . "</span></h1>"); $wgOut->addHTML("<div id='va_guts'>\n\t\t\t\t\t<center><img src='/extensions/wikihow/rotate.gif'/></center>\n\t\t\t\t</div>"); $wgOut->addHTML("</div>"); $wgOut->addHTML("<input type='hidden' id='va_cat' value='{$cat}' />"); $wgOut->addHTML("<div id='va_article'></div>"); $langKeys = array('va_congrats', 'va_check'); $js = Wikihow_i18n::genJSMsgs($langKeys); $wgOut->addHTML($js); return; }
function execute($par) { global $wgRequest, $wgUser, $wgOut, $wgHooks; $wgOut->setHTMLTitle('Login Via Facebook - wikiHow'); $wgHooks['BeforeTabsLine'][] = array('LoginFacebook::topContent'); if (class_exists('WikihowCSSDisplay')) { WikihowCSSDisplay::setSpecialBackground(true); } $titleObj = SpecialPage::getTitleFor('Userlogin'); $link = '<a href="' . htmlspecialchars($titleObj->getLocalUrl('type=signup')) . '">'; $link .= wfMsgHtml('nologinlink'); $link .= '</a>'; $linkLogin = '******' . htmlspecialchars($titleObj->getLocalUrl('type=login')) . '">'; $linkLogin .= wfMsgHtml('gotaccountlink'); $linkLogin .= '</a>'; $form = "<div id='userloginForm'>\n\n\t\t\t<table border='0' width='100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td style='text-align:center;'>" . wfMsg('facebook_account_login', $linkLogin, $link) . "</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\n\t\t</div>"; $wgOut->addHTML($form); wfRunHooks('FBLoginForm', array()); }