Пример #1
0
 function execute($par)
 {
     global $wgUser, $wgOut, $wgRequest, $wgServer, $isDevServer;
     $userGroups = $wgUser->getGroups();
     if ($wgUser->isBlocked() || !in_array('staff', $userGroups)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     if ($wgRequest->wasPosted()) {
         $this->action = $wgRequest->getVal('a');
         $this->slowQuery = $wgRequest->getVal('alts') == 'true';
         $this->introOnly = $wgRequest->getVal('intonly') == 'true';
         switch ($this->action) {
             case 'cats':
                 $this->outputCategoryReport();
                 break;
             case 'articles':
                 $this->outputArticleReport();
                 break;
             case 'ids':
                 $this->outputArticleIdReport();
                 break;
         }
         return;
     }
     $this->action = empty($par) ? 'cats' : strtolower($par);
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('download.jQuery.js'), 'extensions/wikihow/common', false));
     EasyTemplate::set_path(dirname(__FILE__) . '/');
     $vars = array();
     $this->setVars($vars);
     $html = EasyTemplate::html('ArticleData', $vars);
     $wgOut->setPageTitle('Article Stats');
     $wgOut->addHTML($html);
 }
Пример #2
0
 public function execute()
 {
     global $wgRequest, $wgOut, $wgUser;
     $userGroups = $wgUser->getGroups();
     if ($wgUser->isBlocked() || !in_array('staff', $userGroups)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     if ($wgRequest->wasPosted()) {
         $query = $wgRequest->getVal('query');
         ini_set('memory_limit', '1024M');
         //Take up to 4 minutes to download big queries
         set_time_limit(240);
         $this->getQuery();
     } else {
         EasyTemplate::set_path(dirname(__FILE__) . '/');
         $vars = array('fields' => $this->getFields());
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('download.jQuery.js'), 'extensions/wikihow/common', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery.sqlbuilder-0.06.js'), 'extensions/wikihow/titus', false));
         $html = EasyTemplate::html('flaviusquerytool.tmpl.php', $vars);
         $wgOut->addHTML($html);
     }
     return $html;
 }
Пример #3
0
 public function getDefaultVars()
 {
     $vars = parent::getDefaultVars();
     $vars['css'] .= HtmlSnips::makeUrlTags('css', array('babelfish.css'), '/extensions/wikihow/babelfish', false);
     $vars['js'] .= HtmlSnips::makeUrlTags('js', array('babelfish.js'), '/extensions/wikihow/babelfish', false);
     return $vars;
 }
Пример #4
0
 function execute($par)
 {
     global $wgUser, $wgOut, $wgRequest;
     $userGroups = $wgUser->getGroups();
     if ($wgUser->isBlocked() || !in_array('staff', $userGroups)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     if ($wgRequest->wasPosted()) {
         $wgOut->disable();
         $result = array();
         $result['debug'][] = "posted to apiappadmin";
         if ($wgRequest->getVal("action") == "default") {
             $this->testQuery(&$result);
         } else {
             if ($wgRequest->getVal("action") == "getpage") {
                 //nothing yet
             }
         }
         echo json_encode($result);
         return;
     }
     $wgOut->setPageTitle('APIAppAdmin');
     EasyTemplate::set_path(dirname(__FILE__) . '/');
     $vars['css'] = HtmlSnips::makeUrlTags('css', array('apiappadmin.css'), 'extensions/wikihow/apiappsupport', true);
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('apiappadmin.js'), 'extensions/wikihow/apiappsupport', true));
     $html = EasyTemplate::html('APIAppAdmin', $vars);
     $wgOut->addHTML($html);
 }
Пример #5
0
 /**
  * Show the HTML template for adding images to URLs 
  */
 private function showTemplate()
 {
     global $wgOut, $wgActiveLangs;
     EasyTemplate::set_path(dirname(__FILE__));
     $tmpl = EasyTemplate::html("Alfredo.tmpl.php", array('langs' => $this->langs));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('download.jQuery.js'), 'extensions/wikihow/common', false));
     $wgOut->addHTML($tmpl);
 }
Пример #6
0
 function printReport()
 {
     global $wgOut, $wgRequest;
     $vars['results'] = $this->getEdits();
     $vars['days'] = $wgRequest->getVal("days", 30);
     $vars['css'] = HtmlSnips::makeUrlTags('css', array('adminmethodeditor.css'), 'extensions/wikihow/altmethodadder', true);
     $html = EasyTemplate::html('AdminMethodEditor', $vars);
     $wgOut->addHTML($html);
 }
Пример #7
0
 public function addBubbleTipToElement($element, $cookiePrefix, $text)
 {
     global $wgOut;
     $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('tipsbubble.css'), 'extensions/wikihow/interfaceelements', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('interfaceelements/tipsbubble.js', 'common/jquery.cookie.js'), 'extensions/wikihow', false));
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('text' => $text));
     InterfaceElements::addJSVars(array('bubble_target_id' => $element, 'cookieName' => $cookiePrefix . '_b'));
     $wgOut->addHTML($tmpl->execute('TipsBubble.tmpl.php'));
 }
Пример #8
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgParser;
     wfLoadExtensionMessages("MethodGuardian");
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($wgUser->isAnon()) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodguardian", MethodGuardian::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_id");
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod();
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $this->skipTool->skipItem($methodId);
             $this->skipTool->unUseItem($methodId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->deleteMethod($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->keepMethod($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         }
     }
     $wgOut->setHTMLTitle(wfMsg('methodguardian'));
     $wgOut->setPageTitle(wfMsg('methodguardian'));
     $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('methodguardian.css'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('methodguardian.js'), 'extensions/wikihow/altmethodadder', false));
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $wgOut->addHTML($tmpl->execute('MethodGuardian.tmpl.php'));
     $this->displayLeaderboards();
 }
Пример #9
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgParser;
     wfLoadExtensionMessages("TipsPatrol");
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($wgUser->isAnon() || self::isBlockedFromTipsPatrol($wgUser)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("tiptool", "tipsandwarnings", "tw_checkout", "tw_checkout_user", "tw_id");
     if ($wgRequest->wasPosted()) {
         $wgOut->disable();
         $result = array();
         $tipId = $wgRequest->getVal('tipId');
         if ($wgRequest->getVal('coachTip')) {
             $this->coachResult($tipId, &$result);
         } elseif ($tipId != null && $wgRequest->getVal('skipTip')) {
             $this->logTip($tipId, self::TIP_ACTION_SKIP);
             $this->skipTool->skipItem($tipId);
             $this->skipTool->unUseItem($tipId);
         } elseif ($wgRequest->getVal('deleteTip')) {
             $articleId = $wgRequest->getVal('articleId');
             $tip = $wgRequest->getVal('tip');
             $this->deleteTip($tipId, $articleId, $tip);
         } elseif ($wgRequest->getVal('keepTip')) {
             //used to send to keepTip, but now we have an extra step: QG
             $articleId = $wgRequest->getVal('articleId');
             $tip = $wgRequest->getVal('tip');
             $this->logTip($tipId, self::TIP_ACTION_QG, '', $tip);
             $this->addToQG($tipId, $articleId, $tip, $result);
         }
         $this->getNextTip(&$result);
         echo json_encode($result);
         return;
     }
     $wgOut->setHTMLTitle(wfMsg('tipspatrol'));
     $wgOut->setPageTitle(wfMsg('tipspatrol'));
     $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('tipspatrol.css'), 'extensions/wikihow/tipsandwarnings', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('tipspatrol.js'), 'extensions/wikihow/tipsandwarnings', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('mousetrap.min.js,jquery.cookie.js'), 'extensions/wikihow/common', false));
     EasyTemplate::set_path(dirname(__FILE__));
     $vars = array();
     $vars['tip_skip_title'] = wfMsg('tip_skip_title');
     $vars['tip_keep_title'] = wfMsg('tip_keep_title');
     $vars['tip_delete_title'] = wfMsg('tip_delete_title');
     $wgOut->addHTML(EasyTemplate::html('TipsPatrol.tmpl.php', $vars));
     $bubbleText = "Only publish this tip if you can make it helpful, clear, and grammatically correct. Most tips should get deleted.";
     InterfaceElements::addBubbleTipToElement('tip_tip', 'tptrl', $bubbleText);
     $this->displayLeaderboards();
 }
Пример #10
0
 public function getHtml()
 {
     global $wgTitle;
     $html = "";
     if (self::isValidArticle()) {
         $this->setTemplatePath();
         $vars['ar_css'] .= HtmlSnips::makeUrlTags('css', array('jquery.rating.css'), 'extensions/wikihow/mqg/rating', false);
         $vars['ar_js'] .= HtmlSnips::makeUrlTags('js', array('jquery.rating.pack.js', 'jquery.MetaData.js'), 'extensions/wikihow/mqg/rating', false);
         $html = EasyTemplate::html('rating_mobile.tmpl.php', $vars);
     }
     return $html;
 }
Пример #11
0
 public function addBubbleTipToElement($element, $cookiePrefix, $text)
 {
     global $wgOut;
     $wgOut->addJSCode('jqck');
     //jQuery Cookie. Add as JS code so we don't have duplicate includes
     $wgOut->addCSSCode('tbc');
     // Tips Bubble CSS
     InterfaceElements::addJSVars(array('bubble_target_id' => $element, 'cookieName' => $cookiePrefix . '_b'));
     $wgOut->addHTML(HtmlSnips::makeUrlTags('js', array('interfaceelements/tipsbubble.js'), 'extensions/wikihow', false));
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('text' => $text));
     $wgOut->addHTML($tmpl->execute('TipsBubble.tmpl.php'));
 }
Пример #12
0
 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>");
 }
Пример #13
0
 function setVars(&$vars)
 {
     global $wgUser;
     $vars['js'] = HtmlSnips::makeUrlTags('js', array('fblink.js'), '/extensions/wikihow/fblogin', true);
     $vars['css'] = HtmlSnips::makeUrlTags('css', array('fblink.css'), '/extensions/wikihow/fblogin', true);
     $facebook = $this->facebook;
     $result = $facebook->api('/me');
     $vars['fbName'] = $this->truncate($result['name']);
     $vars['fbEmployer'] = $this->truncate($result['work'][0]['employer']['name']);
     $vars['fbSchool'] = $this->truncate($result['education'][0]['school']['name']);
     $vars['fbEmail'] = $this->truncate($result['email']);
     $vars['fbLocation'] = $this->truncate($result['location']['name']);
     $vars['fbPicUrl'] = FBLogin::getPicUrl($result['id'], 'normal');
     $vars['newAcct'] = $wgUser->getName();
     $vars['whPicUrl'] = wfGetPad(Avatar::getAvatarURL($wgUser->getName()));
     $whId = $this->isAlreadyLinked($result['id']);
     $vars['showWarning'] = $whId ? true : false;
     $vars['oldAcct'] = $this->getUsername($whId);
 }
Пример #14
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser;
     $fname = 'CatSearchUI::execute';
     wfProfileIn($fname);
     $wgOut->setRobotpolicy('noindex,nofollow');
     if ($wgUser->getId() == 0) {
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
     }
     $js = HtmlSnips::makeUrlTags('js', array('catsearchui.js'), '/extensions/wikihow/catsearch?rev=' . WH_SITEREV, CATSEARCH_DEBUG);
     $css = HtmlSnips::makeUrlTags('css', array('catsearchui.css'), '/extensions/wikihow/catsearch?rev=' . WH_SITEREV, CATSEARCH_DEBUG);
     $vars = array('js' => $js, 'css' => $css, 'csui_search_label' => wfMsg('csui_search_label'), 'csui_interests_label' => wfMsg('csui_interests_label'), 'csui_suggested_label' => wfMsg('csui_suggested_label'), 'csui_no_interests' => wfMsg('csui_no_interests'));
     $this->getUserCategoriesHtml($vars);
     EasyTemplate::set_path(dirname(__FILE__) . '/');
     $html = EasyTemplate::html('CatSearchUI', $vars);
     $embedded = intval($wgRequest->getVal('embed'));
     $wgOut->setArticleBodyOnly($embedded);
     $wgOut->addHtml($html);
     wfProfileOut($fname);
 }
Пример #15
0
 protected function getDefaultVars()
 {
     global $wgUser;
     $vars = array();
     $vars['js'] = HtmlSnips::makeUrlTags('js', array('chosen.jquery.min.js'), '/extensions/wikihow/common/chosen', false);
     $vars['js'] .= HtmlSnips::makeUrlTags('js', array('wap.js'), '/extensions/wikihow/wap', false);
     $vars['js'] .= HtmlSnips::makeUrlTags('js', array('jquery.tablesorter.min.js', 'download.jQuery.js'), '/extensions/wikihow/common', false);
     $vars['css'] = HtmlSnips::makeUrlTags('css', array('chosen.css'), '/extensions/wikihow/common/chosen', false);
     $vars['css'] .= HtmlSnips::makeUrlTags('css', array('wap.css'), '/extensions/wikihow/wap', false);
     $vars['userPage'] = $this->config->getUserPageName();
     $vars['adminPage'] = $this->config->getAdminPageName();
     $vars['system'] = $this->config->getSystemName();
     $userClass = $this->config->getUserClassName();
     $cu = $userClass::newFromId($wgUser->getId(), $this->dbType);
     $admin = $cu->isAdmin() ? "<a href='/Special:{$vars['adminPage']}' class='button secondary'>Admin</a> " : "";
     $vars['nav'] = "<div id='wap_nav'>{$admin} <a href='/Special:{$vars['userPage']}' class='button primary'>My Articles</a></div>";
     $linkerClass = $this->config->getLinkerClassName();
     $vars['linker'] = new $linkerClass($this->dbType);
     $vars['langs'] = $this->config->getSupportedLanguages();
     return $vars;
 }
Пример #16
0
 function printDetail()
 {
     global $wgRequest, $wgOut;
     $dbr = wfGetDB(DB_SLAVE);
     $uid = intVal($wgRequest->getVal("uid"));
     $res = $dbr->select(array('rctest_scores', 'rctest_quizzes'), array('rs_timestamp', 'rq_difficulty', 'rs_quiz_id', 'rs_correct', 'rs_response'), array('rq_id = rs_quiz_id', 'rs_user_id' => $uid), "RCTestAdmin::printDetail", array('ORDER BY' => 'rs_timestamp DESC, rq_difficulty, rs_correct'));
     wfLoadExtensionMessages('RCTestGrader');
     $scores = array();
     while ($row = $dbr->fetchObject($res)) {
         $score = get_object_vars($row);
         $score['rs_correct'] = $score['rs_correct'] ? "Yes" : "No";
         $score['rs_response'] = RCTestGrader::getButtonText($score['rs_response']);
         $score['rs_timestamp'] = date('Y-m-d', wfTimestamp(TS_UNIX, $score['rs_timestamp']));
         $scores[] = $score;
     }
     $vars['results'] = $scores;
     $vars['css'] = HtmlSnips::makeUrlTags('css', array('rctestadmin.css'), 'extensions/wikihow/rctest', false);
     $html = EasyTemplate::html('RCTestAdminDetail', $vars);
     $wgOut->setArticleBodyOnly(true);
     $wgOut->addHTML($html);
 }
Пример #17
0
 function execute($par)
 {
     global $wgOut, $wgUser, $wgRequest, $isDevHost, $IP, $wgLoadBalancer;
     $user = $wgUser->getName();
     $userGroups = $wgUser->getGroups();
     if (!(IS_SPARE_HOST || IS_CLOUD_SITE || $isDevHost) || $wgUser->isBlocked() || !in_array('staff', $userGroups)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     require_once "{$IP}/extensions/wikihow/titus/Titus.class.php";
     $this->titus = new TitusDB(false);
     if ($wgRequest->wasPosted()) {
         $this->loadExcluded();
         $this->handleQuery();
     } else {
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('download.jQuery.js'), 'extensions/wikihow/common', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery.sqlbuilder-0.06.js'), 'extensions/wikihow/titus', false));
         $wgOut->setPageTitle('Dear Titus...');
         $wgOut->addHtml($this->getToolHtml());
     }
 }
Пример #18
0
 /**
  * cuteCUTE
  **/
 function execute($par)
 {
     global $wgRequest, $wgOut, $wgUser, $wgLang, $wgParser, $efType, $wgTitle;
     $target = isset($par) ? $par : $wgRequest->getVal('target');
     wfLoadExtensionMessages('EditFinder');
     self::setTemplatePath();
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($wgUser->getID() == 0) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->topicMode = strtolower($par) == 'topic' || strtolower($wgRequest->getVal('edittype')) == 'topic';
     if ($wgRequest->getVal('fetchArticle')) {
         $wgOut->setArticleBodyOnly(true);
         echo json_encode($this->getNextArticle());
         return;
     } elseif ($wgRequest->getVal('show-article')) {
         $wgOut->setArticleBodyOnly(true);
         if ($wgRequest->getInt('aid') == '') {
             $catsJs = $this->topicMode ? "editFinder.getThoseInterests();" : "editFinder.getThoseCats();";
             $catsTxt = $this->topicMode ? "interests" : "categories";
             $wgOut->addHTML('<div class="article_inner">No articles found.  <a href="#" onclick="' . $catsJs . '">Select more ' . $catsTxt . '</a> and try again.</div>');
             return;
         }
         $t = Title::newFromID($wgRequest->getInt('aid'));
         $articleTitleLink = $t->getLocalURL();
         $articleTitle = $t->getText();
         //$edittype = $a['edittype'];
         //get article
         $a = new Article($t);
         $r = Revision::newFromTitle($t);
         $popts = $wgOut->parserOptions();
         $popts->setTidy(true);
         $popts->enableLimitReport();
         $parserOutput = $wgParser->parse($r->getText(), $t, $popts, true, true, $a->getRevIdFetched());
         $popts->setTidy(false);
         $popts->enableLimitReport(false);
         $html = WikihowArticleHTML::processArticleHTML($parserOutput->getText(), array('no-ads', 'ns' => NS_MAIN));
         $wgOut->addHTML($html);
         return;
     } elseif ($wgRequest->getVal('edit-article')) {
         // SHOW THE EDIT FORM
         $wgOut->setArticleBodyOnly(true);
         $t = Title::newFromID($wgRequest->getInt('aid'));
         $a = new Article($t);
         $editor = new EditPage($a);
         $editor->edit();
         return;
     } elseif ($wgRequest->getVal('action') == 'submit') {
         $wgOut->setArticleBodyOnly(true);
         $efType = strtolower($wgRequest->getVal('type'));
         $t = Title::newFromID($wgRequest->getInt('aid'));
         $a = new Article($t);
         //log it
         $params = array($efType);
         $log = new LogPage('EF_' . substr($efType, 0, 7), false);
         // false - dont show in recentchanges
         $log->addEntry('', $t, 'Repaired an article -- ' . strtoupper($efType) . '.', $params);
         $text = $wgRequest->getVal('wpTextbox1');
         $sum = $wgRequest->getVal('wpSummary');
         //save the edit
         $a->doEdit($text, $sum, EDIT_UPDATE);
         wfRunHooks("EditFinderArticleSaveComplete", array($a, $text, $sum, $wgUser, $efType));
         return;
     } elseif ($wgRequest->getVal('confirmation')) {
         $wgOut->setArticleBodyOnly(true);
         echo $this->confirmationModal($wgRequest->getVal('type'), $wgRequest->getInt('aid'));
         wfProfileOut(__METHOD__);
         return;
     } elseif ($wgRequest->getVal('cancel-confirmation')) {
         $wgOut->setArticleBodyOnly(true);
         echo $this->cancelConfirmationModal($wgRequest->getInt('aid'));
         wfProfileOut(__METHOD__);
         return;
     } else {
         //default view (same as most of the views)
         $sk = $wgUser->getSkin();
         $wgOut->setArticleBodyOnly(false);
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('mousetrap.min.js', 'jquery.cookie.js'), 'extensions/wikihow/common', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('preview.js'), 'skins/common', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js', 'preview.js'), 'skins/common', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('editfinder.js'), 'extensions/wikihow/editfinder', false));
         $efType = strtolower($target);
         if (strpos($efType, '/') !== false) {
             $efType = substr($efType, 0, strpos($efType, '/'));
         }
         if ($efType == '') {
             //no type specified?  send 'em to format...
             $wgOut->redirect('/Special:EditFinder/Format');
         }
         $wgOut->addHTML('<script>var g_eftype = "' . $target . '";</script>');
         //add main article info
         $vars = array('pagetitle' => wfMsg('app-name') . ': ' . wfMsg($efType), 'question' => wfMsg('editfinder-question'), 'yep' => wfMsg('editfinder_yes'), 'nope' => wfMsg('editfinder_no'), 'helparticle' => wfMsg('help_' . $efType));
         $vars['uc_categories'] = $this->topicMode ? 'Interests' : 'Categories';
         $vars['lc_categories'] = $this->topicMode ? 'interests' : 'categories';
         $vars['editfinder_edit_title'] = wfMsg('editfinder_edit_title');
         $vars['editfinder_skip_title'] = wfMsg('editfinder_skip_title');
         $vars['css'] = HtmlSnips::makeUrlTags('css', array('editfinder.css'), 'extensions/wikihow/editfinder', false);
         $vars['css'] .= HtmlSnips::makeUrlTags('css', array('suggestedtopics.css'), 'extensions/wikihow', false);
         $html = EasyTemplate::html('editfinder_main', $vars);
         $wgOut->addHTML($html);
         $wgOut->setHTMLTitle(wfMsg('app-name') . ': ' . wfMsg($efType) . ' - wikiHow');
         $wgOut->setPageTitle(wfMsg('app-name') . ': ' . wfMsg($efType) . ' - wikiHow');
     }
     $stats = new EditFinderStandingsIndividual($efType);
     $stats->addStatsWidget();
     $standings = new EditFinderStandingsGroup($efType);
     $standings->addStandingsWidget();
 }
Пример #19
0
 /**
  * EXECUTE
  **/
 function execute($par)
 {
     global $wgRequest, $wgOut, $wgUser, $wgLang, $wgParser, $wgHooks, $wgTitle, $wgStarterPages;
     $wgHooks['ShowBreadCrumbs'][] = array($this, 'removeBreadCrumbsCallback');
     //$wgHooks['WrapBodyWithArticleInner'][] = array($this, 'wrapBodyWithArticleInner');
     wfLoadExtensionMessages('StarterTool');
     self::setTemplatePath();
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     $referral = $wgRequest->getVal('ref');
     //get contents
     if ($wgRequest->getVal('edit')) {
         $wgOut->setArticleBodyOnly(true);
         $sentenceNum = $wgRequest->getVal('starter_title');
         $sentence = $this->getSentence($sentenceNum);
         $sentence = preg_replace('@<[/]?(span|[ovwxp]:\\w+)[^>]*?>@', '', $sentence);
         $vars = array('sentence' => $sentence);
         $html = EasyTemplate::html('edit', $vars);
         $wgOut->addHTML($html);
         return;
     } elseif ($wgRequest->getVal('finish')) {
         $finishNum = "Finish-" . $wgRequest->getVal('finish');
         self::logInfo($finishNum);
     } elseif ($wgRequest->getVal('editNum')) {
         $editNum = "Edit-" . $wgRequest->getVal('editNum');
         self::logInfo($editNum);
         if ($wgRequest->getVal('getsome')) {
             $wgOut->setArticleBodyOnly(true);
             $sentence = self::getSentence();
             $wgOut->addHTML($sentence);
             return;
         }
     } elseif ($wgRequest->getVal('getsome')) {
         $wgOut->setArticleBodyOnly(true);
         $sentence = self::getSentence();
         $wgOut->addHTML($sentence);
         return;
     } elseif ($wgRequest->getVal('action') == 'submit') {
         $wgOut->setArticleBodyOnly(true);
         $t = Title::newFromText($wgRequest->getVal('starter-title'));
         $a = new Article($t);
         //internal log
         if ($referral != "") {
             self::logInfo("submit");
         }
         //log it
         $params = array();
         $log = new LogPage('Starter_Tool', false);
         // false - dont show in recentchanges
         $log->addEntry('', $t, 'Fixed a sentence with the Starter Tool.', $params);
         $text = $wgRequest->getVal('wpTextbox1');
         $sum = $wgRequest->getVal('wpSummary');
         //save the edit
         if ($a->doEdit($text, $sum, EDIT_SUPPRESS_RC)) {
             //revert the edit for the next user
             $minRev = self::getFirstArticleRevision($t->getArticleId());
             //don't log rollback for the user
             $oldglobal = $wgUser;
             $wgUser = User::newFromName("MasterSockPuppet421");
             $dbr = wfGetDB(DB_SLAVE);
             $r = Revision::loadFromId($dbr, $minRev);
             $a->doEdit($r->getText(), 'Auto-rollback from Starter Tool.', EDIT_SUPPRESS_RC);
             // reset the wguser var
             $wgUser = $oldglobal;
             wfRunHooks("StarterToolSaveComplete", array($a, $text, $sum, $wgUser, $efType));
         }
         return;
     } else {
         //default; get a sentence
         if ($referral != "") {
             //log that they came in from the specific ad
             self::logInfo("Ad-" . $referral);
             setcookie(StarterTool::COOKIE_NAME, 1, 0);
         }
         $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('starter.css'), 'extensions/wikihow/starter', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('starter.js'), 'extensions/wikihow/starter', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js'), 'skins/common/', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery.cookie.js'), 'extensions/wikihow/common', false));
         $sk = $wgUser->getSkin();
         $wgOut->setArticleBodyOnly(false);
         $vars = array('pagetitle' => wfMsg('app-name'), 'question' => wfMsg('fix-this'), 'yep' => wfMsg('yep'), 'nope' => wfMsg('nope'));
         $html = EasyTemplate::html('starter', $vars);
         $wgOut->addHTML($html);
     }
     $wgOut->setHTMLTitle(wfMsg('pagetitle', wfMsg('app-name')));
 }
Пример #20
0
 /**
  * EXECUTE
  **/
 function execute($par = '')
 {
     global $wgOut, $wgRequest, $wgHooks, $wgCanonical, $wgSquidMaxage;
     $sample = preg_replace('@-@', ' ', $par);
     wfLoadExtensionMessages('DocViewer');
     //no side bar
     $wgHooks['ShowSideBar'][] = array('DocViewer::removeSideBarCallback');
     //no head section
     $wgHooks['ShowHeadSection'][] = array('DocViewer::removeHeadSectionCallback');
     //make a custom canonical url
     self::$wgSampleURL = wfExpandUrl(self::$wgSampleURL . $par);
     $wgHooks['GetFullURL'][] = array('DocViewer::getCanonicalUrl');
     //page title
     $page_title = $this->getPageTitle($par);
     $wgOut->setHTMLTitle(wfMsg('pagetitle', $page_title));
     //the guts
     $wgOut->addCSScode('dvc');
     // css path defined in extensions/min/groupConfig.php
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('docviewer.js'), 'extensions/wikihow/docviewer', false));
     $html = self::displayContainer($par, false);
     if (!$html) {
         //nothin'
         $wgOut->setStatusCode(404);
         $html = '<p>' . wfMsg('dv-no-doc-err') . '</p>';
     } else {
         //http cache headers
         $wgOut->setSquidMaxage($wgSquidMaxage);
         //meta tags
         $wgOut->addMeta('description', "Use our sample '{$page_title}.' Read it or download it for free. Free help from wikiHow.");
         $wgOut->addMeta('keywords', $sample . ', ' . wfMsg('sample_meta_keywords_default'));
         $wgOut->setRobotPolicy('index,follow');
     }
     $wgOut->addHTML($html);
 }
Пример #21
0
 function printData()
 {
     global $wgOut, $wgRequest;
     $coachEnabled = TipsPatrol::isTPCoachEnabled();
     $vars['disableDisplay'] = $coachEnabled ? "block" : "none";
     $vars['enableDisplay'] = $coachEnabled ? "none" : "block";
     $vars['scores'] = $this->getScores();
     $vars['tests'] = $this->getTests();
     $vars['days'] = $wgRequest->getVal("days", 7);
     $vars['css'] = HtmlSnips::makeUrlTags('css', array('tpcoachadmin.css'), 'extensions/wikihow/tipsandwarnings', true);
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('tpcoachadmin.js'), 'extensions/wikihow/tipsandwarnings', true));
     $html = EasyTemplate::html('TPCoachAdmin', $vars);
     $wgOut->addHTML($html);
 }
 function execute($par)
 {
     global $wgOut, $wgUser, $wgRequest;
     global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview;
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($wgUser->getID() == 0) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     if (!in_array('staff', $wgUser->getGroups())) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->errorFile = "";
     $this->errorTitle = "";
     if ($wgRequest->getVal('delete')) {
         $wgOut->setArticleBodyOnly(true);
         $hpid = str_replace('delete_', '', $wgRequest->getVal('delete'));
         $html = self::deleteHPImage($hpid);
         $wgOut->addHTML($html);
         return;
     }
     $this->postSuccessful = true;
     if ($wgRequest->wasPosted()) {
         if ($wgRequest->getVal("updateActive")) {
             $dbw = wfGetDB(DB_MASTER);
             //first clear them all
             $dbw->update(WikihowHomepageAdmin::HP_TABLE, array('hp_active' => 0, 'hp_order' => 0), '*', __METHOD__);
             $images = $wgRequest->getArray("hp_images");
             $count = 1;
             foreach ($images as $image) {
                 if (!$image) {
                     continue;
                 }
                 $dbw->update(WikihowHomepageAdmin::HP_TABLE, array('hp_active' => 1, 'hp_order' => $count), array('hp_id' => $image));
                 $count++;
             }
         } else {
             $title = WikiPhoto::getArticleTitleNoCheck($wgRequest->getVal('articleName'));
             if (!$title->exists()) {
                 $this->postSuccessful = false;
                 $this->errorTitle = "* That article does not exist.";
             }
             if ($this->postSuccessful) {
                 //keep going
                 $imageTitle = Title::newFromText($wgRequest->getVal('wpDestFile'), NS_IMAGE);
                 $file = new LocalFile($imageTitle, RepoGroup::singleton()->getLocalRepo());
                 $file->upload($wgRequest->getFileTempName('wpUploadFile'), '', '');
                 $filesize = $file->getSize();
                 if ($filesize > 0) {
                     $dbw = wfGetDB(DB_MASTER);
                     $dbw->insert(WikihowHomepageAdmin::HP_TABLE, array('hp_page' => $title->getArticleID(), 'hp_image' => $imageTitle->getArticleID()));
                     $article = new Article($imageTitle);
                     $limit = array();
                     $limit['move'] = "sysop";
                     $limit['edit'] = "sysop";
                     $protectResult = $article->updateRestrictions($limit, "Used on homepage");
                 } else {
                     $this->postSuccessful = false;
                     $this->errorFile = "* We encountered an error uploading that file.";
                 }
             }
         }
     }
     $useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
     $useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview;
     $adc = wfBoolToStr($useAjaxDestCheck);
     $alp = wfBoolToStr($useAjaxLicensePreview);
     $wgOut->setPageTitle('WikiHow Homepage Admin');
     $wgOut->addScript("<script type=\"text/javascript\">\nwgAjaxUploadDestCheck = {$adc};\nwgAjaxLicensePreview = {$alp};\n</script>");
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery-ui-1.8.custom.min.js'), 'extensions/wikihow/common/ui/js', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('wikihowhomepageadmin.js'), 'extensions/wikihow/homepage', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('wikihowhomepageadmin.css'), 'extensions/wikihow/homepage', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('upload.js'), 'skins/common', false));
     $this->displayHomepageData();
     $this->displayForm();
 }
Пример #23
0
 /**
  * Execute special page.  Only available to wikihow staff.
  */
 public function execute()
 {
     global $wgUser, $wgRequest, $wgOut, $wgLang, $wgMemc;
     if (!$this->userAllowed()) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     if ($wgRequest->wasPosted()) {
         switch ($wgRequest->getVal('action')) {
             case 'nextUser':
                 $this->nextUser();
                 break;
             case 'logMessage':
                 $wgOut->disable();
                 $toId = $wgRequest->getVal('toId');
                 $revId = $wgRequest->getVal('revId');
                 $message = $wgRequest->getVal('message');
                 $this->logMessage($wgUser->getId(), $toId, $revId, $message);
                 echo json_encode(array('stats' => $this->getStats()));
                 break;
             case 'switchTab':
                 $this->tabSwitch();
                 break;
             default:
                 break;
         }
         return;
     }
     $target = $wgRequest->getVal('target');
     if ($target) {
         $targetUser = User::newFromName($target);
         if ($targetUser->getId() > 0) {
             InterfaceElements::addJSVars($this->getOutputVariables($targetUser));
         }
     }
     if (!$wgMemc->get($this->cacheOk)) {
         $this->resetCache();
     }
     $wgOut->setPageTitle('Welcome Wagon');
     $wgOut->setHTMLTitle('Welcome Wagon');
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $wgOut->addHTML($tmpl->execute('WelcomeWagon.tmpl.php'));
     $wgOut->addCSScode('diffc');
     $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('welcomewagon.css'), 'extensions/wikihow/WelcomeWagon', false));
     $wgOut->addHTML(HtmlSnips::makeUrlTags('js', array('welcomewagon.js'), 'extensions/wikihow/WelcomeWagon', false));
     InterfaceElements::addBubbleTipToElement('form-header', 'wwagon', 'No matter what happens keep the message positive and personalized.');
     $this->displayLeaderboards();
 }
Пример #24
0
 function showForm($id, $username, $email, $avatar, $error = '')
 {
     global $wgOut;
     $origname = $username;
     //make sure we have a good username
     //$username = $username !== null ? $username : $this->getProposedUsername($username);
     $username = $this->getProposedUsername($username);
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $tmpl->set_vars(array('username' => $username, 'origname' => $origname, 'avatar' => $avatar, 'email' => $email, 'id' => $id, 'error' => $error));
     $html = $tmpl->execute('gplusform.tmpl.php');
     $wgOut->addHeadItem('gpluslogin_css', HtmlSnips::makeUrlTags('css', array('gpluslogin.css'), 'extensions/wikihow/GPlusLogin', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('gpluslogin.js'), 'extensions/wikihow/GPlusLogin', false));
     $wgOut->addHtml($html);
 }
Пример #25
0
 public function getTestHtml()
 {
     // Only add the html if RC Patrol is supposed to show a test
     if (!$this->isTestTime()) {
         return;
     }
     $testInfo = $this->getTestInfo();
     $html = "<div id='rct_data'>" . $testInfo['rq_id'] . "</div>";
     $html .= HtmlSnips::makeUrlTags('js', array('rctest.js'), 'extensions/wikihow/rctest', false);
     $html .= HtmlSnips::makeUrlTags('css', array('rctest.css'), 'extensions/wikihow/rctest', false);
     return $html;
 }
Пример #26
0
 private static function getQuickEdit($title, $result)
 {
     global $wgServer;
     // build the array of users for the quick note link sorted by
     // the # of bytes changed descending, i.e. more is better
     $users = array();
     $sorted = $result['users_len'];
     if (!$sorted) {
         return;
     }
     asort($sorted, SORT_NUMERIC);
     $sorted = array_reverse($sorted);
     foreach ($sorted as $s => $len) {
         $u = User::newFromName($s);
         if (!$u) {
             // handle anons
             $u = new User();
             $u->setName($s);
         }
         $users[] = $u;
     }
     $editURL = Title::makeTitle(NS_SPECIAL, "QuickEdit")->getFullURL() . '?type=editform&target=' . urlencode($title->getFullText());
     $class = "class='button secondary' style='float: left;'";
     $link = "<script type='text/javascript'>var gQuickEditUrl = \"{$editURL}\";</script>";
     $link .= "<a id='qe_button' title='" . wfMsg("rcpatrol_quick_edit_title") . "' href='' {$class} onclick=\"return initPopupEdit(gQuickEditUrl) ;\">" . htmlspecialchars(wfMsg('rcpatrol_quick_edit_button')) . "</a> ";
     $qn = str_replace("href", " title='" . wfMsg("rcpatrol_quick_note_title") . "' {$class} href", QuickNoteEdit::getQuickNoteLinkMultiple($title, $users));
     $link = $qn . $link;
     //make sure we load the clientscript here so we can post load those buttons
     $link .= HtmlSnips::makeUrlTags('js', array('clientscript.js'), 'skins/common', false);
     return $link;
 }
Пример #27
0
 function showEditForm($formCallback = null)
 {
     global $wgOut, $wgLanguageCode, $wgRequest, $wgTitle, $wgUser, $wgLang;
     $whow = null;
     // conflict resolution
     if (!$wgRequest->wasPosted()) {
         EditPage::showEditForm();
     }
     $wgOut->clearHTML();
     //echo $this->textbox1; exit;
     wfRunHooks('EditPage::showEditForm:initial', array(&$this));
     // are we called with just action=edit and no title?
     $newArticle = false;
     if (($wgRequest->getVal("title") == "" || $wgTitle->getArticleID() == 0) && !$this->preview) {
         $newArticle = true;
     }
     $sk = $wgUser->getSkin();
     if (!$this->mTitle->getArticleID() && !$this->preview) {
         # new article
         $wgOut->addHTML(wfMsg("newarticletext"));
     }
     // do we have a new article? if so, format the title if it's English
     $wgRequest->getVal("new_article");
     if ($new_article && $wgLanguageCode == "en") {
         $title = $this->mTitle->getText();
         $old_title = $title;
         $title = $this->formatTitle($title);
         $titleObj = Title::newFromText($title);
         $this->mTitle = $titleObj;
         $this->mArticle = new Article($titleObj);
     }
     $conflictWikiHow = null;
     $conflictTitle = false;
     if ($this->isConflict) {
         $s = wfMsg("editconflict", $this->mTitle->getPrefixedText());
         $wgOut->setPageTitle($s);
         if ($new_article) {
             $wgOut->addHTML("<b><font color=red>" . wfMsg('page-name-exists') . "</b></font><br/><br/>");
             $conflictTitle = true;
         } else {
             $this->edittime = $this->mArticle->getTimestamp();
             $wgOut->addHTML(wfMsg("explainconflict"));
             // let the advanced editor handle the situation
             if ($this->isConflict) {
                 EditPage::showEditForm();
                 return;
             }
         }
         $this->textbox2 = $this->textbox1;
         $conflictWikiHow = WikihowArticleEditor::newFromText($this->textbox1);
         $this->textbox1 = $this->mArticle->getContent(true, true);
         $this->edittime = $this->mArticle->getTimestamp();
     } else {
         if ($this->mTitle->getArticleID() == 0) {
             $s = wfMsg('creating', "\"" . wfMsg('howto', $this->mTitle->getPrefixedText()) . "\"");
         } else {
             $s = wfMsg('editing', "\"" . wfMsg('howto', $this->mTitle->getPrefixedText()) . "\"");
         }
         if ($this->section != "") {
             if ($this->section == "new") {
                 $s .= wfMsg("commentedit");
             } else {
                 $s .= wfMsg("sectionedit");
             }
             if (!$this->preview) {
                 $sectitle = preg_match("/^=+(.*?)=+/mi", $this->textbox1, $matches);
                 if (!empty($matches[1])) {
                     $this->summary = "/* " . trim($matches[1]) . " */ ";
                 }
             }
         }
         $wgOut->setPageTitle($s);
         if ($this->oldid) {
             $this->mArticle->setOldSubtitle($this->oldid);
             $wgOut->addHTML(wfMsg("editingold"));
         }
     }
     if (wfReadOnly()) {
         $wgOut->addHTML("<strong>" . wfMsg("readonlywarning") . "</strong>");
     } elseif ($isCssJsSubpage and "preview" != $formtype) {
         $wgOut->addHTML(wfMsg("usercssjsyoucanpreview"));
     }
     if (!$newArticle && $this->mTitle->isProtected('edit')) {
         if ($this->mTitle->isSemiProtected()) {
             $notice = wfMsg('semiprotectedpagewarning');
             if (wfEmptyMsg('semiprotectedpagewarning', $notice) || $notice == '-') {
                 $notice = '';
             }
         } else {
             $notice = wfMsg('protectedpagewarning');
         }
         $wgOut->addHTML("<div class='article_inner'>\n ");
         $wgOut->addWikiText($notice);
         $wgOut->addHTML("</div>\n");
     }
     $q = "action=submit2&override=yes";
     #if ( "no" == $redirect ) { $q .= "&redirect=no"; }
     $action = $this->mTitle->escapeLocalURL($q);
     if ($newArticle) {
         $main = str_replace(' ', '-', wfMsg('mainpage'));
         $action = str_replace("&title=" . $main, "", $action);
     }
     $summary = wfMsg("summary");
     $subject = wfMsg("subject");
     $minor = wfMsg("minoredit");
     $watchthis = wfMsg("watchthis");
     $save = wfMsg("savearticle");
     $prev = wfMsg("showpreview");
     $cancel = $sk->makeKnownLink($this->mTitle->getPrefixedText(), wfMsg("cancel"));
     $edithelpurl = Skin::makeInternalOrExternalUrl(wfMsgForContent('edithelppage'));
     $edithelp = '<a target="helpwindow" href="' . $edithelpurl . '">' . htmlspecialchars(wfMsg('edithelp')) . '</a> ' . htmlspecialchars(wfMsg('newwindow'));
     $copywarn = wfMsg("copyrightwarning", $sk->makeKnownLink(wfMsg("copyrightpage")));
     $minoredithtml = '';
     if ($wgUser->isAllowed('minoredit')) {
         $minoredithtml = "<input tabindex='11' type='checkbox' value='1' name='wpMinoredit'" . ($this->minoredit ? " checked='checked'" : "") . " accesskey='" . wfMsg('accesskey-minoredit') . "' id='wpMinoredit' />\n" . "<label for='wpMinoredit' title='" . wfMsg('tooltip-minoredit') . "'>{$minor}</label>\n";
     }
     $watchhtml = '';
     if ($wgUser->isLoggedIn()) {
         $watchhtml = "<input tabindex='12' type='checkbox' name='wpWatchthis'" . ($this->watchthis ? " checked='checked'" : "") . " accesskey=\"" . htmlspecialchars(wfMsg('accesskey-watch')) . "\" id='wpWatchthis'  />\n" . "<label for='wpWatchthis' title=\"" . htmlspecialchars(wfMsg('tooltip-watch')) . "\">{$watchthis}</label>\n";
     }
     $checkboxhtml = $minoredithtml . $watchhtml;
     $tabindex = 14;
     $buttons = $this->getEditButtons($tabindex);
     $footerbuttons = "";
     $buttons['preview'] = "<span id='gatGuidedPreview'>{$buttons['preview']}</span>";
     if ($wgUser->getOption('hidepersistantsavebar', 0) == 0) {
         $footerbuttons .= "<span id='gatPSBSave'>{$buttons['save']}</span>";
         $footerbuttons .= "<span id='gatPSBPreview'>{$buttons['preview']}</span>";
     }
     $saveBtn = str_replace('accesskey="s"', "", $buttons['save']);
     $buttons['save'] = "<span id='gatGuidedSave'>{$saveBtn}</span>";
     $buttonshtml = implode($buttons, "\n");
     # if this is a comment, show a subject line at the top, which is also the edit summary.
     # Otherwise, show a summary field at the bottom
     $summarytext = htmlspecialchars($wgLang->recodeForEdit($this->summary));
     # FIXME
     $editsummary1 = "";
     if ($wgRequest->getVal('suggestion')) {
         $summarytext .= ($summarytext == "" ? "" : ", ") . wfMsg('suggestion_edit_summary');
     }
     if ($this->section == "new") {
         $commentsubject = "{$subject}: <input tabindex='1' type='text' value=\"{$summarytext}\" name=\"wpSummary\" id='wpSummary' maxlength='200' size='60' />";
         $editsummary = "";
     } else {
         $commentsubject = "";
         if ($wgTitle->getArticleID() == 0 && $wgTitle->getNamespace() == NS_MAIN && $summarytext == "") {
             $summarytext = wfMsg('creating_new_article');
         }
         $editsummary = "<input tabindex='10' type='text' value=\"{$summarytext}\" name=\"wpSummary\" id='wpSummary' maxlength='200' size='60' /><br />";
         $editsummary1 = "<input tabindex='10' type='text' value=\"{$summarytext}\" name=\"wpSummary1\" id='wpSummary1' maxlength='200' size='60' /><br />";
     }
     // create the wikiHow
     if ($conflictWikiHow == null) {
         if ($this->textbox1 != "") {
             $whow = WikihowArticleEditor::newFromText($this->textbox1);
         } else {
             $whow = WikihowArticleEditor::newFromArticle($this->mArticle);
         }
     } else {
         $whow = $conflictWikiHow;
     }
     //********** SETTING UP THE FORM
     //
     //
     //
     //
     $confirm = "window.onbeforeunload = confirmExit;";
     if ($wgUser->getOption('disablewarning') == '1') {
         $confirm = "";
     }
     $wgOut->addHTML("<script language=\"JavaScript\">\n\t\t\t\tvar isGuided = true;\n\t\t\t\tvar needToConfirm = false;\n\t\t\t\tvar checkMinLength = true;\n\t\t\t\t{$confirm}\n\t\t\t\tfunction confirmExit() {\n\t\t\t\t\tif (needToConfirm)\n\t\t\t\t\t\treturn \"" . wfMsg('all-changes-lost') . "\";\n\t\t\t\t}\n\t\t\t\tfunction addrows(element) {\n\t\t\t\t\tif (element.rows < 32)  {\n\t\t\t\t\t\telement.rows += 4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction removerows(element) {\n\t\t\t\t\tif (element.rows > 4)  {\n\t\t\t\t\t\telement.rows -= 4;\n\t\t\t\t\t} else {\n\t\t\t\t\t\telement.rows = 4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfunction saveandpublish() {\n\t\t\t\t\twindow.onbeforeunload = null;\n\t\t\t\t\tdocument.editform.submit();\n\t\t\t\t}\n\t\t\t\t(function (\$) {\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('.button').click(function () {\n\t\t\t\t\t\t\tvar button = \$(this).not('.submit_button');\n\t\t\t\t\t\t\tif (button.length) {\n\t\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\$('textarea').focus(function () {\n\t\t\t\t\t\t\tneedToConfirm = true;\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\t\$('#ep_cat').live('click', function(e) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\tvar title = 'Categorize ' + wgTitle;\n\t\t\t\t\t\tif (title.length > 54) {\n\t\t\t\t\t\t\ttitle = title.substr(0, 54) + '...';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tjQuery('#dialog-box').html('');\n\t\t\t\t\t\t\n\t\t\t\t\t\tjQuery('#dialog-box').load('/Special:Categorizer?a=editpage&id=' + wgArticleId, function() {\n\t\t\t\t\t\t\tjQuery('#dialog-box').dialog({\n\t\t\t\t\t\t\t\twidth: 673,\n\t\t\t\t\t\t\t\theight: 600,\n\t\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t\t\t\tcloseText: 'Close',\t\n\t\t\t\t\t\t\t\tdialogClass: 'modal2',\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\treCenter = function() {\n\t\t\t\t\t\t\t\tjQuery('#dialog-box').dialog('option', 'position', 'center');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetTimeout('reCenter()', 100);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$.getScript('/extensions/wikihow/cattool/categorizer.js');\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t})(jQuery);\n\t\t\t</script>\n\t\t\t<script type=\"text/javascript\" src=\"" . wfGetPad('/extensions/min/f/skins/common/clientscript.js,/skins/common/ac.js,/extensions/wikihow/video/importvideo.js&rev=') . WH_SITEREV . "\"></script>\n\n\t\t");
     if (!$this->preview) {
         # Don't select the edit box on preview; this interferes with seeing what's going on.
         $wgOut->setOnloadHandler("document.editform.title.focus(); load_cats();");
     }
     $title = "";
     //$wgOut->setOnloadHandler( "' onbeforeunload='return confirm(\"Are you sure you want to navigate away from this page? All changes will be lost!\");" );
     $suggested_title = "";
     if (isset($_GET["requested"])) {
         $t = Title::makeTitle(NS_MAIN, $_GET["requested"]);
         $suggested_title = $t->getText();
     }
     if ($wgRequest->getVal('title', null) == null || $conflictTitle || $suggested_title != "") {
         $title = "<div id='title'><h3>" . wfMsg('title') . "</h3><br/>" . wfMsg('howto', '') . " &nbsp;&nbsp;&nbsp;\n\t\t\t<input autocomplete=\"off\" size=60 type=\"text\" name=\"title\" id=category tabindex=\"1\" value=\"{$suggested_title}\"></div>";
     }
     $steps = htmlspecialchars($wgLang->recodeForEdit($whow->getSteps(true)), ENT_QUOTES);
     $video = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('video'))));
     $tips = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('tips'))));
     $warns = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('warnings'))));
     $related_text = htmlspecialchars($wgLang->recodeForEdit($whow->getSection(wfMsg('relatedwikihows'))));
     $summary = htmlspecialchars($wgLang->recodeForEdit($whow->getSummary()));
     if ($newArticle || $whow->mIsNew) {
         if ($steps == "") {
             $steps = "#  ";
         }
         if ($tips == "") {
             $tips = "*  ";
         }
         if ($warns == "") {
             $warns = "*  ";
         }
         if ($ingredients == "") {
             $ingredients = "*  ";
         }
     }
     $cat = $whow->getCategoryString();
     $advanced = "";
     $cat_array = explode("|", $whow->getCategoryString());
     $i = 0;
     $cat_string = "";
     foreach ($cat_array as $cat) {
         if ($cat == "") {
             continue;
         }
         if ($i != 0) {
             $cat_string .= "," . $cat;
         } else {
             $cat_string = $cat;
         }
         $i++;
     }
     $removeButton = "";
     $cat_advisory = "";
     if ($cat_string != "") {
         $removeButton = "<input type=\"button\" name=\"change_cats\" onclick=\"removeCategories();\" value=\"" . wfMsg('remove-categories') . "\">";
     } else {
         $cat_advisory = wfMsg('categorization-optional');
     }
     //$cat_string = str_replace("|", ", ", $whow->getCategoryString());
     //$cat_string = implode(", ", $raa);
     if (!$newArticle && !$whow->mIsNew && !$conflictTitle) {
         $oldparameters = "";
         if ($wgRequest->getVal("oldid") != "") {
             $oldparameters = "&oldid=" . $wgRequest->getVal("oldid");
         }
         if (!$this->preview) {
             $advanced = "<a class='' href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true{$oldparameters}'>" . wfMsg('advanced-editing') . "</a>";
         }
     } elseif ($newArticle && $wgRequest->getVal('title', null) != null) {
         $t = Title::newFromText("CreatePage", NS_SPECIAL);
         //$advanced = str_replace("href=", "class='guided-button' href=", $sk->makeLinkObj($t, wfMsg('advanced-editing'))) . " |";
         //$advanced = "<a href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true$oldparameters';\">".wfMsg('advanced-editing')."</a>";
         $advanced = "<a class='button secondary' style='float:left;' href='{$wgScript}?title=" . $wgTitle->getPrefixedURL() . "&action=edit&advanced=true{$oldparameters}'>" . wfMsg('advanced-editing') . "</a>";
     }
     $section_class = 'minor_section';
     // MODIFIED FOR POPUP
     $categoryHTML = "";
     if ($wgUser->getID() > 0) {
         $ctitle = $this->mTitle->getText();
         $css = HtmlSnips::makeUrlTags('css', array('categoriespopup.css'), 'extensions/wikihow', false);
         if ($wgLanguageCode == 'en') {
             $editCatMore = "<a href=\"{$wgScriptPath}/Writer%27s-Guide?section=2#" . wfMsg('more-info-categorization') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>";
             $editCatHtml = "<a href='#' id='ep_cat'>[" . wfMsg('editcategory') . "]</a><strong>{$editCatLink}</strong>";
         }
         $categoryHTML = "\n\t\t\t\t{$css}\n\t\t\t\t<div id='categories'>\n\t\t\t\t\t<h5>" . wfMsg('add-optional-categories') . "{$editCatMore}</h5>\n\t\t\t\t\t<div id='option_cats'>\n\t\t\t\t\t{$editCatHtml}" . Categoryhelper::getCategoryOptionsForm2($cat_string, $whow->mCategories) . "\t</div>\n\t\t\t\t</div>";
     }
     $requested = "";
     if (isset($_GET['requested'])) {
         $requested = $_GET['requested'];
     }
     $related_vis = "hide";
     $related_checked = "";
     $relatedHTML = "";
     if ($whow->getSection(wfMsg('relatedwikihows')) != "") {
         $related_vis = "show";
         $relatedHTML = $whow->getSection(wfMsg('relatedwikihows'));
         $relatedHTML = str_replace("*", "", $relatedHTML);
         $relatedHTML = str_replace("[[", "", $relatedHTML);
         $relatedHTML = str_replace("]]", "", $relatedHTML);
         $lines = split("\n", $relatedHTML);
         $relatedHTML = "";
         foreach ($lines as $line) {
             $xx = strpos($line, "|");
             if ($xx !== false) {
                 $line = substr($line, 0, $xx);
             }
             // Google+ hack.  We don't normally allow + but will for the Goog
             if (false === stripos($line, 'Google+')) {
                 $line = trim(urldecode($line));
             }
             if ($line == "") {
                 continue;
             }
             $relatedHTML .= "<OPTION VALUE=\"" . htmlspecialchars($line) . "\">{$line}</OPTION>\n";
         }
         $related_checked = " CHECKED ";
     }
     $vidpreview_vis = "hide";
     $vidbtn_vis = "show";
     $vidpreview = "<img src='" . wfGetPad('/extensions/wikihow/rotate.gif') . "'/>";
     if ($whow->getSection(wfMsg('video')) != "") {
         $vidpreview_vis = "show";
         $vidbtn_vis = "hide";
         try {
             #$vt = Title::makeTitle(NS_VIDEO, $this->mTitle->getText());
             #$r = Revision::newFromTitle($vt);
             $vidtext = $whow->getSection(wfMsg('video'));
             $vidpreview = $wgOut->parse($vidtext);
         } catch (Exception $e) {
             $vidpreview = "Sorry, preview is currently not available.";
         }
     } else {
         $vidpreview = wfMsg('video_novideoyet');
     }
     $video_disabled = "";
     $vid_alt = "";
     $video_msg = "";
     $video_button = "<a id='gatVideoImportEdit' type='button' onclick=\"changeVideo('" . urlencode($wgTitle->getDBKey()) . "'); return false;\" href='#' id='show_preview_button' class='button secondary'  >" . wfMsg('video_change') . "</a>";
     if ($wgUser->getID() == 0) {
         $video_disabled = "disabled";
         $video_alt = "<input type='hidden' name='video' value=\"" . htmlspecialchars($video) . "\"/>";
         $video_msg = wfMsg('video_loggedin');
         $video_button = "";
     }
     $things_vis = "hide";
     $things = "*  ";
     $things_checked = "";
     $tyn = $whow->getSection(wfMsg("thingsyoullneed"));
     if ($tyn != '') {
         $things_vis = "show";
         $things = $tyn;
         $things_checked = " CHECKED ";
     }
     $ingredients_vis = "hide";
     $section = $whow->getSection(wfMsg("ingredients"));
     $ingredients_checked = "";
     if ($section != '') {
         $ingredients_vis = "show";
         $ingredients = $section;
         $ingredients_checked = " CHECKED ";
     }
     $sources_vis = "hide";
     $sources = "*  ";
     $sources_checked = "";
     $sources = $whow->getSection(wfMsg("sources"));
     $sources = str_replace('<div class="references-small"><references/></div>', '', $sources);
     $sources = str_replace('{{reflist}}', '', $sources);
     if ($sources != "") {
         $sources_vis = "show";
         $sources_checked = " CHECKED ";
     }
     $new_field = "";
     if ($newArticle || $new_article) {
         $new_field = "<input type=hidden name=new_article value=true>";
     }
     $lang_links = htmlspecialchars($whow->getLangLinks());
     $vt = Title::makeTitle(NS_VIDEO, $this->mTitle->getText());
     $vp = SpecialPage::getTitleFor("Previewvideo", $vt->getFullText());
     $newArticleWarn = '<script type="text/javascript" src="' . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.js?') . WH_SITEREV . '"></script>';
     $popup = Title::newFromText("UploadPopup", NS_SPECIAL);
     if ($wgUser->isLoggedIn()) {
         $token = htmlspecialchars($wgUser->editToken());
     } else {
         $token = EDIT_TOKEN_SUFFIX;
     }
     if ('preview' == $this->formtype) {
         $previewOutput = $this->getPreviewText();
         $this->showPreview($previewOutput);
         $show_weave = true;
     } else {
         $wgOut->addHTML('<div id="wikiPreview"></div>');
     }
     if ('diff' == $this->formtype) {
         $this->showDiff();
         $show_weave = true;
     }
     if ($show_weave) {
         $relBtn = $wgLanguageCode == 'en' ? PopBox::getGuidedEditorButton() : '';
         $relHTML = PopBox::getPopBoxJSGuided() . PopBox::getPopBoxDiv() . PopBox::getPopBoxCSS();
         $weave_links = $relHTML . '<div class="wh_block editpage_sublinks">' . $relBtn . '</div>';
     }
     $undo = '';
     if ($wgRequest->getVal('undo', null) != null) {
         $undo_id = $wgRequest->getVal('undo', null);
         $undo = "\n<input type='hidden' value=\"{$undo_id}\" name=\"wpUndoEdit\" />\n";
     }
     $wgOut->addHTML(Easyimageupload::getUploadBoxJS());
     $wgOut->addHTML("\t\n{$newArticleWarn}\n\n<div id='editpage'>\n<form id=\"editform\" name=\"editform\" method=\"post\" action=\"{$action}\"\nenctype=\"application/x-www-form-urlencoded\"  onSubmit=\"return checkForm();\">\t\t");
     if (is_callable($formCallback)) {
         call_user_func_array($formCallback, array(&$wgOut));
     }
     $hidden_cats = "";
     if (!$wgUser->isLoggedIn()) {
         $hidden_cats = "<input type=\"hidden\" name=\"categories22\" value=\"{$cat_string}\">";
     }
     $token1 = md5($wgUser->getName() . $this->mTitle->getArticleID() . time());
     wfTrackEditToken($wgUser, $token1, $this->mTitle, $this instanceof EditPageWrapper);
     $wgOut->addHTML("\n\t\t{$new_field}\n\t\t{$hidden_cats}\n\t\t<input type='hidden' value=\"{$this->starttime}\" name=\"wpStarttime\" />\n\n\t\t<input type=\"hidden\" name=\"requested\" value=\"{$requested}\">\n\t\t<input type=\"hidden\" name=\"langlinks\" value=\"{$lang_links}\">\n\t\t<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n\n\n\t\t{$commentsubject}\n\t\t{$title}\n\t\t<br clear='all'/>\n<script language='javascript'>\n\tvar vp_URL = '{$vp->getLocalUrl()}';\n</script>\n<script language='javascript' src='" . wfGetPad('/extensions/min/f/extensions/wikihow/previewvideo.js?rev=') . "'></script>\n<style type='text/css' media='all'>/*<![CDATA[*/ @import '" . wfGetPad('/extensions/min/f/extensions/wikihow/editpagewrapper.css,/extensions/wikihow/winpop.css,/extensions/wikihow/video/importvideo.css,/extensions/wikihow/cattool/categorizer.css,/extensions/wikihow/cattool/categorizer_editpage.css&rev=') . WH_SITEREV . "'; /*]]>*/</style>\n\n\t{$weave_links}\n\n\t<div id='introduction' class='{$section_class}'>\n\t\t<h2>" . wfMsg('introduction') . "\n\t\t\t<div class='head_details'>" . wfMsg('summaryinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('introduction-url') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea rows='4' cols='100' name='summary' id='summary' tabindex=\"2\" wrap=virtual>{$summary}</textarea>\n\t\t<!--a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"intro\"); return false;'>" . wfMsg('eiu-add-image-to-introduction') . "</a-->\n\t\t<div class='clearall'></div>\n\t</div>\n\n\n\t<div id='ingredients' class='{$ingredients_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('ingredients') . "\n\t\t\t<div class='head_details'>" . wfMsg('ingredients_tooltip') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('ingredients') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='ingredients' rows='4' cols='100' onKeyUp=\"addStars(event, document.editform.ingredients);\" tabindex='3' id='ingredients_text'>{$ingredients}</textarea>\n\t\t<a href='#' class='button secondary add_image_button'  onclick='easyImageUpload.doEIUModal(\"ingredients\"); return false;'>" . wfMsg('eiu-add-image-to-ingredients') . "</a>\n\t</div>\n\n\t<div id='steps' class='{$section_class}'>\n\t\t<h2>" . wfMsg('steps') . "\n\t\t\t<div class='head_details'>" . wfMsg('stepsinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('steps') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='steps' rows='{$wgRequest->getVal('txtarea_steps_text', 12)}' cols='100' wrap='virtual' onKeyUp=\"addNumToSteps(event);\" tabindex='4' id='steps_text'>{$steps}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"steps\", 0); return false;'>" . wfMsg('eiu-add-image-to-steps') . "</a>\n\t</div>");
     $wgOut->addHTML("<div id='video' class='{$section_class}'>\n\t\t<h2>" . wfMsg('video') . "\n\t\t\t<div class='head_details'>" . wfMsg('videoinfo') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('video') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t{$video_alt}\n\t\t<input type='text' name='video{$video_disabled}' size='60' id='video_text' style='float:left;' value=\"{$video}\" {$video_disabled}/><br />\n\t\t{$video_button}\n\t\t<a href='javascript:showHideVideoPreview();' id='show_preview_button' class='button secondary {$vidbtn_vis}'>" . wfMsg('show_preview') . "</a>\n\t\t{$video_msg}\n\t</div>\n\t<div id='viewpreview' class='{$vidpreview_vis} {$section_class}' style='text-align: center; margin-top: 5px;'>\n\t\t<center><a onclick='showHideVideoPreview();'>" . wfMsg('ep_hide_preview') . "</a></center><br/>\n\t\t<div id='viewpreview_innards'>{$vidpreview}</div>\n\t</div>\n\n\t<div id='tips' class='{$section_class}'>\n\t\t<h2>" . wfMsg('tips') . "\n\t\t\t<div class='head_details'>" . wfMsg('listhints') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('tips') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='tips' rows='{$wgRequest->getVal('txtarea_tips_text', 12)}' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.tips);' tabindex='5' id='tips_text'>{$tips}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"tips\"); return false;'>" . wfMsg('eiu-add-image-to-tips') . "</a>\n\t</div>\n\n\t<div id='warnings' class='{$section_class}'>\n\t\t<h2>" . wfMsg('warnings') . "\n\t\t\t<div class='head_details'>" . wfMsg('optionallist') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=3#" . wfMsg('warnings') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='warnings' rows='{$wgRequest->getVal('txtarea_warnings_text', 4)}' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.warnings);' id='warnings_text' tabindex=\"6\" id='warnings_text'>{$warns}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"warnings\"); return false;'>" . wfMsg('eiu-add-image-to-warnings') . "</a>\n\t</div>\n\n\t<div id='thingsyoullneed' class='{$things_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('thingsyoullneed') . "\n\t\t\t<div class='head_details'>" . wfMsg('items') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=4#" . wfMsg('thingsyoullneed') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='thingsyoullneed' rows='4' cols='65' wrap='virtual' onKeyUp='addStars(event, document.editform.thingsyoullneed);' tabindex='7' id='thingsyoullneed_text'>{$things}</textarea>\n\t\t<a href='#' class='button secondary add_image_button' onclick='easyImageUpload.doEIUModal(\"thingsyoullneed\"); return false;'>" . wfMsg('eiu-add-image-to-thingsyoullneed') . "</a>\n\t</div>\n\n\t<div id='relatedwikihows' class='{$related_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('relatedarticlestext') . "\n\t\t\t<div class='head_details'>" . wfMsg('relatedlist') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=5#" . wfMsg('related-wikihows-url') . "\" target=\"new\">" . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<div id='related_buttons'>\n\t\t\t<a href='#'  class='button secondary' onclick='moveRelated(true);return false;' >" . wfMsg('epw_move_up') . "</a>\n\t\t\t<a href='#' class='button secondary' onclick='moveRelated(false);return false;'>" . wfMsg('epw_move_down') . "</a>\n\t\t\t<a href='#' class='button red' onclick='removeRelated(); return false;'>" . wfMsg('epw_remove') . "</a>\n\t\t\t<br />\n\t\t\t<br />\n\t\t</div>\n\t\t<input type=hidden value=\"\" name=\"related_list\">\n\t\t<select size='4' name='related' id='related_select' ondblclick='viewRelated();'>\n\t\t\t{$relatedHTML}\n\t\t</select>\n\t\t<br />\n\t\t<br />\n\t\t<br class='clearall'/>\n\t\t<div>\n\t\t\t<b>" . wfMsg('addtitle') . "</b><br />\n\t\t\t<input type='text' autocomplete=\"off\" maxLength='256' name='q' value='' onKeyPress=\"return keyxxx(event);\" tabindex='8'>\n\t\t</div>\n\t\t<a href='#' id='add_button' class='button secondary' onclick='add_related();return false;'>" . wfMsg('epw_add') . "</a>\n\t\t<br class='clearall'/>\n\t</div>\n\n<script language=\"JavaScript\">\n\tvar js_enabled = document.getElementById('related');\n\t\t if (js_enabled != null) {\n\t\t\t\t js_enabled.className = 'display';\n\t\t\t}\n\t</script>\n\t<noscript>\n\t\t<input type='hidden' name='no_js' value='true'>\n\t\t<div id='related'>\n\t\t\t<textarea name='related_no_js' rows='4' cols='65' wrap='virtual' onKeyUp='addStars(event, document.editform.related_no_js);' id='related_no_js' tabindex='8'>{$related_text}</textarea>\n\t\t</div>\n\t</noscript>\n\n\t<div id='sources' class='{$sources_vis} {$section_class}'>\n\t\t<h2>" . wfMsg('sources') . "\n\t\t\t<div class='head_details'>" . wfMsg('linkstosites') . "</div>\n\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('sources-links-url') . "\" target=\"new\"> " . wfMsg('moreinfo') . "</a>\n\t\t</h2>\n\t\t<textarea name='sources' rows='3' cols='100' wrap='virtual' onKeyUp='addStars(event, document.editform.sources);' id='sources' tabindex='9'>{$sources}</textarea>\n\t</div>\n\n\t<div class='{$section_class}'>\n\t\t<h2>" . wfMsg('optional_options') . "</h2>\n\t\t{$categoryHTML}\n\n\t\t<div id='optional_sections'>\n\t\t\t<h5>" . wfMsg('optionalsections') . "</h5>\n\t\t\t<ul>\n\t\t\t\t<li><input type='checkbox' id='thingsyoullneed_checkbox' name='thingsyoullneed_checkbox' onclick='showhiderow(\"thingsyoullneed\", \"thingsyoullneed_checkbox\");' {$things_checked} /> <label for='thingsyoullneed_checkbox'>" . wfMsg('thingsyoullneed') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='related_checkbox' name='related_checkbox' onclick='showhiderow(\"relatedwikihows\", \"related_checkbox\");' {$related_checked} > <label for='related_checkbox'>" . wfMsg('relatedwikihows') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='sources_checkbox' name='sources_checkbox' onclick='showhiderow(\"sources\", \"sources_checkbox\");' {$sources_checked} > <label for='sources_checkbox'>" . wfMsg('sources') . "</label></li>\n\t\t\t\t<li><input type='checkbox' id='ingredients_checkbox' name='ingredients_checkbox' onclick='showhiderow(\"ingredients\", \"ingredients_checkbox\");' {$ingredients_checked} > <label for='ingredients_checkbox'>" . wfMsg('ingredients_checkbox') . "</label></li>\n\t\t\t</ul>\n\t\t</div>\n\t</div>\n\t\n\t<div class='{$section_class}'>\n\t\t<div class='editOptions'>\n\t\t\t<h2>" . wfMsg('editdetails') . "\n\t\t\t\t<div class='head_details'>" . wfMsg('summaryedit') . "</div>\n\t\t\t\t<a href=\"{$wgScriptPath}/" . wfMsg('writers-guide-url') . "?section=2#" . wfMsg('summary') . "\" target=\"new\"> " . wfMsg('moreinfo') . "</a>\n\t\t\t</h2>\n\t\t\t{$editsummary}\n\t\t\t{$checkboxhtml}\n\t\t\t{$undo}\n\t\t\t<input type='hidden' value=\"{$token}\" name=\"wpEditToken\" />\n\t\t\t<input type='hidden' value=\"{$token1}\" name=\"wpEditTokenTrack\" />\n\t\t\t<div class='editButtons'>\n\t\t\t\t<a href=\"javascript:history.back()\" id=\"wpCancel\" class=\"button secondary\">" . wfMsg('cancel') . "</a>\n\t\t\t\t{$buttonshtml}\n\t\t\t</div>\n\t\t\t{$copywarn}\n\t\t</div>\n\t</div>\n\t<input type='hidden' value=\"" . htmlspecialchars($this->section) . "\" name=\"wpSection\" />\n\t<input type='hidden' value=\"{$this->edittime}\" name=\"wpEdittime\" />\n");
     if ($this->isConflict) {
         require_once "DifferenceEngine.php";
         $wgOut->addHTML("<h2>" . wfMsg("yourdiff") . "</h2>\n");
         DifferenceEngine::showDiff($this->textbox2, $this->textbox1, wfMsg("yourtext"), wfMsg("storedversion"));
     }
     if ($wgUser->getOption('hidepersistantsavebar', 0) == 0) {
         $wgOut->addHTML(" <div id='edit_page_footer'>\n\t\t\t\t<table class='edit_footer'><tr><td class='summary'>\n\t\t\t\t" . wfMsg('editsummary') . ": &nbsp; {$editsummary1}</td>\n\t\t\t\t<td class='buttons'>{$footerbuttons}</td></tr></table>\n\t\t\t\t</div> ");
     }
     $wgOut->addHTML("</form></div>\n");
 }
 public function execute()
 {
     global $wgRequest, $wgUser, $wgOut;
     $userGroups = $wgUser->getGroups();
     if (!in_array('staff', $userGroups)) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $urls = $wgRequest->getVal('urls');
     if ($urls) {
         header("Content-Type: text/tsv");
         header('Content-Disposition: attachment; filename="output.xls"');
         $urls = preg_split("@[\r\n]@", urldecode($urls));
         foreach ($urls as $url) {
             print $url . "\t";
             if (preg_match("@http://www.wikihow.com/([^?]+)(\\?|\$)@", $url, $matches)) {
                 $t = Title::newFromText($matches[1]);
                 if (!$t || !$t->exists()) {
                     $t = Title::newFromText(urldecode($matches[1]));
                 }
                 if (!$t || !$t->exists()) {
                     print "Not found";
                 } else {
                     print self::isArticleEnabled($t) ? "1" : "0";
                 }
             } else {
                 print "Not found";
             }
             print "\n";
         }
         exit(0);
     } else {
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('download.jQuery.js'), 'extensions/wikihow/common', false));
         $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery.sqlbuilder-0.06.js'), 'extensions/wikihow/titus', false));
         EasyTemplate::set_path(dirname(__FILE__) . '/');
         $wgOut->addHTML(EasyTemplate::html('optimizelytool.tmpl.php'));
     }
 }
Пример #29
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgParser;
     wfLoadExtensionMessages("MethodEditor");
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if (!($wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()))) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $this->skipTool = new ToolSkip("methodeditor", MethodEditor::TABLE_NAME, "ama_checkout", "ama_checkout_user", "ama_id");
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         $result = $this->getNextMethod();
         echo json_encode($result);
         return;
     } else {
         if ($wgRequest->getVal('skipMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $this->skipTool->skipItem($methodId);
             $this->skipTool->unUseItem($methodId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('deleteMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $method = $wgRequest->getVal('method');
             $this->deleteMethod($methodId, $articleId, $method);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('keepMethod')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $altMethod = $wgRequest->getVal('method');
             $altSteps = $wgRequest->getVal('steps');
             $this->keepMethod($methodId, $articleId, $altMethod, $altSteps);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('quickEdit')) {
             $wgOut->disable();
             $methodId = $wgRequest->getVal('methodId');
             $articleId = $wgRequest->getVal('articleId');
             $this->quickEditRecord($methodId, $articleId);
             $result = $this->getNextMethod();
             echo json_encode($result);
             return;
         } elseif ($wgRequest->getVal('clearSkip')) {
             $wgOut->disable();
             $this->skipTool->clearSkipCache();
             echo "Skip cache has been cleared";
             return;
         }
     }
     $wgOut->setHTMLTitle(wfMsg('methodeditor'));
     $wgOut->setPageTitle(wfMsg('methodeditor'));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js'), 'skins/common', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('css', array('methodeditor.css'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('methodeditor.js'), 'extensions/wikihow/altmethodadder', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('jquery.cookie.js'), 'extensions/wikihow/common', false));
     $wgOut->addHTML(PopBox::getPopBoxJSAdvanced());
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $wgOut->addHTML($tmpl->execute('MethodEditor.tmpl.php'));
     $this->displayLeaderboards();
     $wgOut->addHTML(QuickNoteEdit::displayQuickEdit());
 }
Пример #30
0
 function execute($par)
 {
     global $wgOut, $wgRequest, $wgUser, $wgHooks;
     $wgHooks['getBreadCrumbs'][] = array('Spellchecker::getBreadCrumbsCallback');
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($wgUser->getID() == 0) {
         $wgOut->setRobotpolicy('noindex,nofollow');
         $wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     //start temp code for taking down tool
     /*
     		wfLoadExtensionMessages("Spellchecker");
     		
     		$wgOut->setHTMLTitle(wfMsg('spellchecker'));
     		$wgOut->setPageTitle(wfMsg('spellchecker'));
     		
     		$wgOut->addWikiText("This tool is temporarily down for maintenance. Please check out the [[Special:CommunityDashboard|Community Dashboard]] for other ways to contribute while we iron out a few issues with this tool. Happy editing!");
     		return;
     */
     //end temp code
     /*if ( !($wgUser->isSysop() || in_array( 'newarticlepatrol', $wgUser->getRights()) ) ) {
     			$wgOut->setRobotpolicy( 'noindex,nofollow' );
     			$wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
     			return;
     		}*/
     wfLoadExtensionMessages("Spellchecker");
     $this->skipTool = new ToolSkip("spellchecker", "spellchecker", "sc_checkout", "sc_checkout_user", "sc_page");
     if ($wgRequest->getVal('getNext')) {
         $wgOut->disable();
         if ($wgRequest->getVal('articleName')) {
             $articleName = $wgRequest->getVal('articleName');
         } else {
             $articleName = "";
         }
         $result = self::getNextArticle($articleName);
         print_r(json_encode($result));
         return;
     } else {
         if ($wgRequest->getVal('edit')) {
             $wgOut->disable();
             $id = $wgRequest->getVal('id');
             $result = $this->getArticleEdit($id);
             print_r(json_encode($result));
             return;
         } else {
             if ($wgRequest->getVal('skip')) {
                 $wgOut->disable();
                 $id = $wgRequest->getVal('id');
                 $this->skipTool->skipItem($id);
                 $this->skipTool->unUseItem($id);
                 $result = self::getNextArticle();
                 print_r(json_encode($result));
                 return;
             } else {
                 if ($wgRequest->getVal('cache')) {
                     $this->skipTool->clearSkipCache();
                 } else {
                     if ($wgRequest->getVal('addWord')) {
                         $wgOut->setArticleBodyOnly(true);
                         $result->success = wikiHowDictionary::addWordToDictionary($wgRequest->getVal('word'));
                         print_r(json_encode($result));
                         return;
                     } else {
                         if ($wgRequest->getVal('addWords')) {
                             $wgOut->setArticleBodyOnly(true);
                             $result->success = wikiHowDictionary::addWordsToDictionary($wgRequest->getArray('words'));
                             print_r(json_encode($result));
                             return;
                         } else {
                             if ($wgRequest->wasPosted()) {
                                 $wgOut->setArticleBodyOnly(true);
                                 if ($wgRequest->getVal('submitEditForm')) {
                                     //user has edited the article from within the Spellchecker tool
                                     $wgOut->disable();
                                     $this->submitEdit();
                                     $result = self::getNextArticle();
                                     print_r(json_encode($result));
                                     return;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $wgOut->setHTMLTitle(wfMsg('spellchecker'));
     $wgOut->setPageTitle(wfMsg('spellchecker'));
     $wgOut->addHTML(HtmlSnips::makeUrlTags('css', array('spellchecker.css'), 'extensions/wikihow/spellchecker', false));
     $wgOut->addScript(HtmlSnips::makeUrlTags('js', array('spellchecker.js'), 'extensions/wikihow/spellchecker', false));
     $tmpl = new EasyTemplate(dirname(__FILE__));
     $setVars = $wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights());
     $tmpl->set_vars(array('addWords' => $setVars));
     $wgOut->addHTML($tmpl->execute('Spellchecker.tmpl.php'));
     // add standings widget
     $group = new SpellcheckerStandingsGroup();
     $indi = new SpellcheckerStandingsIndividual();
     $indi->addStatsWidget();
     $group->addStandingsWidget();
 }