function displayCategoryTable()
 {
     global $wgOut;
     $catmap = Categoryhelper::getIconMap();
     ksort($catmap);
     $queryString = WikihowCategoryViewer::getViewModeParam();
     if (!empty($queryString)) {
         $queryString = "?" . $queryString;
     }
     $wgOut->addHTML("<div class='section_text'>");
     foreach ($catmap as $cat => $image) {
         $title = Title::newFromText($image);
         if ($title) {
             $file = wfFindFile($title, false);
             $sourceWidth = $file->getWidth();
             $sourceHeight = $file->getHeight();
             $heightPreference = false;
             if (self::CAT_HEIGHT > self::CAT_WIDTH && $sourceWidth > $sourceHeight) {
                 //desired image is portrait
                 $heightPreference = true;
             }
             $thumb = $file->getThumbnail(self::CAT_WIDTH, self::CAT_HEIGHT, true, true, $heightPreference);
             $category = urldecode(str_replace("-", " ", $cat));
             $catTitle = Title::newFromText("Category:" . $category);
             if ($catTitle) {
                 $wgOut->addHTML("<div class='thumbnail'><a href='{$catTitle->getLocalUrl()}{$queryString}'><img src='" . wfGetPad($thumb->getUrl()) . "' /><div class='text'><p><span>{$category}</span></p></div></a></div>");
             }
         }
     }
     $wgOut->addHTML("<div class='clearall'></div>");
     $wgOut->addHTML("</div><!-- end section_text -->");
 }
 function sendEmail(&$u, &$content)
 {
     global $wgServer;
     wfLoadExtensionMessages('ThumbsEmailNotifications');
     $email = $u->getEmail();
     $userText = $u->getName();
     $semi_rand = md5(time());
     $mime_boundary = "==MULTIPART_BOUNDARY_{$semi_rand}";
     $mime_boundary_header = chr(34) . $mime_boundary . chr(34);
     $userPageLink = self::getUserPageLink($userText);
     $html_text = wfMsg('tn_email_html', wfGetPad(''), $userPageLink, $content);
     $plain_text = wfMsg('tn_email_plain', $userText, $u->getTalkPage()->getFullURL());
     $body = "This is a multi-part message in MIME format.\n\n--{$mime_boundary}\nContent-Type: text/plain; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n{$plain_text}\n\n--{$mime_boundary}\nContent-Type: text/html; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n{$html_text}";
     $from = new MailAddress(wfMsg('aen_from'));
     $subject = "Congratulations! You just got a thumbs up";
     $isDev = false;
     if (strpos($_SERVER['HOSTNAME'], "wikidiy.com") !== false || strpos($wgServer, "wikidiy.com") !== false) {
         wfDebug("AuthorEmailNotification in dev not notifying: TO: " . $userText . ",FROM: {$from_name}\n");
         $isDev = true;
         $subject = "[FROM DEV] {$subject}";
     }
     if (!$isDev) {
         $to = new MailAddress($email);
         UserMailer::send($to, $from, $subject, $body, null, "multipart/alternative;\n" . "     boundary=" . $mime_boundary_header);
     }
     // send one to our test email account for debugging
     /*
     $to = new MailAddress ('*****@*****.**');
     UserMailer::send($to, $from, $subject, $body, null, "multipart/alternative;\n" .
     				"     boundary=" . $mime_boundary_header) ;
     */
     return true;
 }
예제 #3
0
 public static function parserFunction($parser, $vid = null, $img = null)
 {
     global $wgTitle, $wgContLang;
     wfLoadExtensionMessages('WHVid');
     if ($vid === null || $img === null) {
         return '<div class="errorbox">' . wfMsg('missing-params') . '</div>';
     }
     $vid = htmlspecialchars($vid);
     $divId = "whvid-" . md5($vid . mt_rand(1, 1000));
     $vidUrl = self::getVidUrl($vid);
     $imgTitle = Title::newFromURL($img, NS_IMAGE);
     $imgUrl = null;
     if ($imgTitle) {
         $imgFile = RepoGroup::singleton()->findFile($imgTitle);
         $smallImgUrl = '';
         $largeImgUrl = '';
         if ($imgFile) {
             $width = 550;
             $height = 309;
             $thumb = $imgFile->getThumbnail($width, $height);
             $largeImgUrl = wfGetPad($thumb->getUrl());
             $width = 240;
             //$height = 135;
             $thumb = $imgFile->getThumbnail($width);
             $smallImgUrl = wfGetPad($thumb->getUrl());
         }
     }
     return $parser->insertStripItem(wfMsgForContent('embed-html', $divId, $vidUrl, $largeImgUrl, $smallImgUrl));
 }
예제 #4
0
 function execute($par)
 {
     global $wgUser, $wgOut;
     $wgOut->disable();
     header("Content-type: text/plain;");
     header('Expires: ' . gmdate('D, d M Y H:i:s', 0) . ' GMT');
     header("Cache-Control: private, must-revalidate, max-age=0");
     if ($wgUser->getID() == 0) {
         return;
     }
     if (self::isUserBlocked()) {
         self::updateRemote();
         return;
     }
     $avatar = wfGetPad(Avatar::getAvatarURL($wgUser->getName()));
     $result = "";
     $result .= "UniqueID={$wgUser->getID()}\n";
     $result .= "Name={$wgUser->getName()}\n";
     $result .= "Email={$wgUser->getEmail()}\n";
     $result .= "Avatar={$avatar}\n";
     $result .= "CurrentDate=" . date("r") . "\n";
     $result .= "Groups=" . implode(',', $wgUser->getGroups()) . "\n";
     wfDebug("ProxyConnect: returning {$result}\n");
     print $result;
     self::updateRemote();
     return;
 }
 public static function linkCss($fileName, $noCache = false)
 {
     $tmpl = new TwitterReplierTemplate(dirname(__FILE__));
     $timestamp = '';
     if ($noCache) {
         $timestamp = '&nc=' . filemtime(dirname(__FILE__) . '/' . $fileName);
     }
     return '<style type="text/css" media="all">/*<![CDATA[*/ @import "' . wfGetPad('/extensions/min/f/extensions/wikihow/TwitterReplier/' . $fileName . '?rev=') . WH_SITEREV . $timestamp . '"; /*]]>*/</style>' . PHP_EOL;
 }
 private function generateHtml()
 {
     global $wgOut;
     $me = Title::makeTitle(NS_SPECIAL, 'ImageUploadHandler');
     $vars = array();
     $vars['submitUrl'] = $me->getFullUrl() . '?viapage=' . $this->t->getPartialURL();
     $vars['loadingWheel'] = wfGetPad('/extensions/wikihow/rotate.gif');
     return EasyTemplate::html('mobile-image-upload.tmpl.php', $vars);
 }
예제 #7
0
 function getCTAById($ctaId, &$ctaLinks)
 {
     $ctaId = intval($ctaId);
     $ctaIdx = array_search($ctaId, $ctaLinks);
     if ($ctaIdx === FALSE) {
         wfDebug("cta not found with id {$ctaId}");
         return "";
     }
     return '<script>utmx_section("ctaLink")</script><div class="ctaLink" id="' . $ctaId . '"></noscript><a href="' . trim($ctaLinks[$ctaIdx + 1]) . '?ctaconv=true">' . '<img src="' . wfGetPad('extensions/wikihow/ctalinks/cta_img_' . $ctaId . '.png') . '" /></a></div><!--end cta_link-->';
 }
예제 #8
0
 function GrabWidget($widget_name)
 {
     global $wgArticleWidgets;
     $html = '';
     if (isset($wgArticleWidgets[$widget_name])) {
         $widget_height = $wgArticleWidgets[$widget_name];
         $html = '<iframe src="' . wfGetPad('/Special:ArticleWidgets/' . $widget_name) . '" scrolling="no" frameborder="0" class="article_widget" style="height:' . $widget_height . 'px" allowTransparency="true"></iframe>';
         $html = '<div class="widget_br"></div>' . $html . '<div class="widget_br"></div>';
     }
     return $html;
 }
예제 #9
0
    public function execute($par)
    {
        global $wgOut, $wgRequest;
        wfLoadExtensionMessages('FollowWidget');
        $wgOut->setArticleBodyOnly(true);
        $email = $wgRequest->getVal('getEmailForm');
        if ($email == "1") {
            $form = '<link type="text/css" rel="stylesheet" href="/extensions/wikihow/common/jquery-ui-themes/jquery-ui.css" />
				<form id="ccsfg" name="ccsfg" method="post" action="/extensions/wikihow/common/CCSFG/signup/index.php" style="display:none;">

		<h4>' . wfMessage('fw-head')->text() . '</h4>
		<p style="width:220px; margin-bottom: 23px; font-size:14px;">' . wfMessage('fw-blurb')->text() . '</p>
		<img src="' . wfGetPad('/skins/WikiHow/images/kiwi-small.png') . '" nopin="nopin" style="position:absolute; right:90px; top:68px;" />';
            $form .= <<<EOHTML
\t\t<table>
\t\t
\t\t\t<tr><td colspan="2">
\t\t\t\t\t<!-- ########## Email Address ########## -->
\t\t\t\t\t<label for="EmailAddress">Email Address</label><br />
\t\t\t\t\t<input type="text" name="EmailAddress" value="" id="EmailAddress" style="width:350px; height:25px; font-size:13px;" /><br /><br />
\t\t\t\t</td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t\t<td styel="padding-right:4px;">
\t\t\t\t\t<!-- ########## First Name ########## -->
\t\t\t\t\t<label for="FirstName">First Name (optional):</label><br />
\t\t\t\t\t<input type="text" name="FirstName" value="" id="FirstName" style="width:215px; height:25px; margin-right:10px; font-size:13px;" /><br />
\t\t\t\t</td>
\t\t\t\t<td>
\t\t\t\t\t<!-- ########## Last Name ########## -->
\t\t\t\t\t<label for="LastName">Last Name (optional):</label><br />
\t\t\t\t\t<input type="text" name="LastName" value="" id="LastName" style="width:215px; height:25px; font-size:13px;" /><br />
\t\t\t\t</td>
\t\t\t<tr>
\t\t\t<tr><td colspan="2">
\t\t\t\t<!-- ########## Contact Lists ########## -->
\t\t\t\t<input type="hidden"  checked="checked"  value="General Interest" name="Lists[]" id="list_General Interest" />

\t\t\t\t<input type="submit" name="signup" id="signup" value="Join" class="button primary" />
\t\t\t</td></tr>
\t\t</table>

\t\t</form>\t
EOHTML;
            echo $form;
        } else {
            $wgOut->addHTML($this->getForm());
        }
    }
예제 #10
0
 function mainUploadForm($msg = '')
 {
     global $wgOut, $wgUser;
     global $wgUseCopyrightUpload;
     global $wgStylePath;
     // dont show all of the skin
     $ew = $wgUser->getOption('editwidth');
     if ($ew) {
         $ew = " style=\"width:100%\"";
     } else {
         $ew = '';
     }
     if ('' != $msg) {
         $sub = wfMsgHtml('uploaderror');
         $wgOut->addHTML("<h2>{$sub}</h2>\n" . "<span class='error'>{$msg}</span>\n");
     }
     $sk = $wgUser->getSkin();
     $sourcefilename = wfMsgHtml('sourcefilename');
     $destfilename = wfMsgHtml('destfilename');
     $summary = wfMsg('imagepopup_summary');
     $addtosection = wfMsg('imageuploadsection');
     $cp = wfMsg('imageuploadcaption');
     $licenses = new Licenses();
     $license = wfMsgHtml('license');
     $nolicense = wfMsgHtml('nolicense');
     $licenseshtml = $licenses->getHtml();
     $articlesummary = wfMsg('summary');
     $steps = wfMsg('steps');
     $tips = wfMsg('tips');
     $warnings = wfMsg('warnings');
     $ulb = wfMsgHtml('uploadbtn');
     $titleObj = Title::makeTitle(NS_SPECIAL, 'UploadPopup');
     $action = $titleObj->escapeLocalURL();
     $encDestFile = htmlspecialchars($this->mDestFile);
     $watchChecked = $wgUser->getOption('watchdefault') ? 'checked="checked"' : '';
     $wgOut->addHTML("\n            <script type='text/javascript'>\n                function checkFFBug() {\n                    if ((document.uploadform.wpLicense.value == '' || document.uploadform.wpLicense.value == 'No License' ) \n                        && navigator.userAgent.toLowerCase().indexOf('firefox') >= 0) { \n                        return confirm('" . wfMsg('no_license_selected') . "'); \n                    }\n                    return true;\n            }\n            </script>\n\t<form id='upload' name='uploadform' method='post' enctype='multipart/form-data' action=\"{$action}\" onsubmit='return checkFFBug();'>\n\t\t<table border='0'>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadFile'>{$sourcefilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' " . ($this->mDestFile ? "" : "onchange='fillDestFilename(\"wpUploadFile\")' ") . "size='40' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpDestFile'>{$destfilename}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='40' value=\"{$encDestFile}\" />\n\t\t\t</td>\n\t\t</tr>\n\t      <tr>\n            <td align='right'><label for='wpAddToSection'>{$addtosection}:</label></td>\n            <td align='left'>\n        \t\t<SELECT name=wpAddToSection tabindex='3'>\n       \t\t\t  <OPTION VALUE=summary>{$articlesummary}</OPTION>\n        \t\t\t<OPTION VALUE=steps>{$steps}</OPTION>\n        \t\t\t<OPTION VALUE=tips>{$tips}</OPTION>\n        \t\t\t<OPTION VALUE=warnings>{$warnings}</OPTION>\n        \t\t</SELECT>#:<input type=text size=2 name=wpStepNum>\n            </td>\n        </tr>\n    \t<tr>\n            <td align='right'><label for='wpCaption'>{$cp}:</label></td>\n            <td align='left'>\n        \t\t\t<input tabindex='4' type='text' name=\"wpCaption\" size='40'\"/>\n        \t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right'><label for='wpUploadDescription'>{$summary}</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<input tabindex='5' type='text' name='wpUploadDescription' id='wpUploadDescription' size='40' value=\"" . htmlspecialchars($this->mUploadDescription) . "\" />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>");
     if ($licenseshtml != '') {
         global $wgStylePath;
         $wgOut->addHTML("\n\t\t\t<td align='right'><label for='wpLicense'>{$license}:</label></td>\n\t\t\t<td align='left'>\n\t\t\t\t<script type='text/javascript' src=\"" . wfGetPad('/extensions/min/f/skins/common/upload.js') . "\"></script>\n\t\t\t\t<select name='wpLicense' id='wpLicense' tabindex='6'\n\t\t\t\t\tonchange='licenseSelectorCheck()'>\n\t\t\t\t\t{$licenseshtml}\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t");
     }
     $wgOut->addHtml("\n\t\t<td></td>\n\t\t<td>\n\t\t\t<input tabindex='7' type='checkbox' name='wpWatchthis' id='wpWatchthis' {$watchChecked} value='true' />\n\t\t\t<label for='wpWatchthis'>" . wfMsgHtml('watchthis') . "</label>\n\t\t\t<input tabindex='8' type='checkbox' name='wpIgnoreWarning' id='wpIgnoreWarning' value='true' />\n\t\t\t<label for='wpIgnoreWarning'>" . wfMsgHtml('ignorewarnings') . "</label>\n\t\t</td>\n\t</tr>\n\t<tr>\n\n\t</tr>\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'><input id='gatWPUploadPopup' tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\" /></td>\n\t</tr>\n\n\t<tr>\n\t\t<td></td>\n\t\t<td align='left'>\n\t\t");
     $wgOut->addWikiText(wfMsgForContent('edittools'));
     $wgOut->addHTML("\n\t\t</td>\n\t</tr>\n\n\t</table>\n\t</form>\n\n<script type='text/javascript'>\nvar gaJsHost = (('https:' == document.location.protocol) ? 'https://ssl.' : 'http://www.');\ndocument.write(unescape('%3Cscript src=\\'' + gaJsHost + 'google-analytics.com/ga.js\\' type=\\'text/javascript\\'%3E%3C/script%3E'));    \n\ntry {       \nvar pageTracker = _gat._getTracker('UA-2375655-1'); \npageTracker._setDomainName('.wikihow.com');} catch(err) {}\n\nif (typeof jQuery == 'undefined') {\n\tEvent.observe(window, 'load', gatStartObservers); \n} else {\n\tjQuery(window).load(gatStartObservers);\n}\n</script> ");
 }
 public function getStartLink($showArrow, $widgetStatus)
 {
     if ($widgetStatus == DashboardWidget::WIDGET_ENABLED) {
         $link = "<a href='/Special:Spellchecker' class='comdash-start'>Start";
     } else {
         if ($widgetStatus == DashboardWidget::WIDGET_LOGIN) {
             $link = "<a href='/Special:Userlogin?returnto=Special:Spellchecker' class='comdash-login'>Login";
         } else {
             if ($widgetStatus == DashboardWidget::WIDGET_DISABLED) {
                 $link = "<a href='/Become-a-New-Article-Booster-on-wikiHow' class='comdash-start'>Start";
             }
         }
     }
     if ($showArrow) {
         $link .= " <img src='" . wfGetPad('/skins/owl/images/actionArrow.png') . "' alt=''>";
     }
     $link .= "</a>";
     return $link;
 }
예제 #12
0
function wfSendRequestNotificationEmail($emails)
{
    wfLoadExtensionMessages('RequestTopic');
    $from = new MailAddress(wfMsg('suggested_notify_email_from'));
    $semi_rand = md5(time());
    $mime_boundary = "==MULTIPART_BOUNDARY_{$semi_rand}";
    $mime_boundary_header = chr(34) . $mime_boundary . chr(34);
    foreach ($emails as $email => $title) {
        $html_text = wfMsg('suggested_notify_email_html', wfGetPad(''), $title->getText(), $title->getFullURL(), $title->getDBKey(), $title->getTalkPage()->getFullURL());
        $plain_text = wfMsg('suggested_notify_email_plain', $title->getText(), $title->getFullURL(), $title->getDBKey(), $title->getTalkPage()->getFullURL());
        $body = "This is a multi-part message in MIME format.\n\n--{$mime_boundary}\nContent-Type: text/plain; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n{$plain_text}\n\n--{$mime_boundary}\nContent-Type: text/html; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\n{$html_text}";
        $subject = wfMsg('suggested_notify_email_subject', $title->getText());
        if (!$title) {
            continue;
        }
        $to = new MailAddress($email);
        UserMailer::send($to, $from, $subject, $body, null, "multipart/alternative;\n" . "     boundary=" . $mime_boundary_header);
    }
    return true;
}
예제 #13
0
 public static function makeUrlTags($type, $files, $path, $debug = false)
 {
     $files = array_unique($files);
     $path = preg_replace('/^\\/(.*)/', '$1', $path);
     $path = preg_replace('/(.*)\\/$/', '$1', $path);
     if ($type == 'css') {
         $fmt = '<link rel="stylesheet" type="text/css" href="%s" />' . "\n";
     } else {
         $fmt = '<script src="%s"></script>' . "\n";
     }
     if (!$debug) {
         $url = wfGetPad('/extensions/min/f/' . join(',', $files) . '&b=' . $path . '&' . WH_SITEREV);
         $ret = sprintf($fmt, $url);
     } else {
         $ret = '';
         foreach ($files as $file) {
             $ret .= sprintf($fmt, '/' . $path . '/' . $file);
         }
     }
     return $ret;
 }
예제 #14
0
 public static function injectCTAs(&$xpath, &$t)
 {
     if (self::isActivePage() && self::isValidTitle($t)) {
         $nodes = $xpath->query('//div[@id="tips"]/ul');
         foreach ($nodes as $node) {
             $newHtml = "Insert new tip here:<br/>";
             $newHtml .= "<textarea class='newtip' style='margin-right:5px; height:35px; width:200px;'></textarea>";
             $newHtml .= "<a href='#' class='addtip button white_button' style='vertical-align:top'>Add</a>";
             $newHtml .= "<img class='tip_waiting' style='display:none' src='" . wfGetPad('/extensions/wikihow/rotate.gif') . "' alt='' />";
             $newNode = $node->ownerDocument->createElement('div', "");
             $newNode->setAttribute('class', 'addTipElement');
             $newNode->innerHTML = $newHtml;
             if ($node->nextSibling !== null) {
                 $node->parentNode->insertBefore($newNode, $node->nextSibling);
             } else {
                 $node->parentNode->appendChild($newNode);
             }
             $i++;
         }
     }
 }
예제 #15
0
 function execute($par)
 {
     global $wgRequest, $wgSitename, $wgLanguageCode;
     global $wgDeferredUpdateList, $wgOut, $wgUser, $wgServer, $wgContLang;
     $fname = "wfRepublish";
     $this->setHeaders();
     $sk = $wgUser->getSkin();
     $target = $par != '' ? $par : $wgRequest->getVal('target');
     if ($target == '') {
         $wgOut->addHTML(wfMsg('articlestats_notitle'));
         return;
     }
     $t = Title::newFromText($target);
     $id = $t->getArticleID();
     if ($id == 0) {
         $wgOut->addHTML(wfMsg("checkquality_titlenonexistant"));
         return;
     }
     $output = Republish::getRepublishText($t);
     $wgOut->addHTML("\n\t\t\t\t<script type='text/javascript' src='" . wfGetPad('/extensions/min/f/skins/WikiHow/sharetab.js?') . WH_SITEREV . "'></script>\n\t\t\t\t<center>\n\t\t\t\t<textarea id='output' style='font-size: 1.0em; width:500px;' rows='8' cols='10'>{$output}</textarea>\n\t\t\t\t</center>" . wfMsg('republish_quicklinks', urlencode($t->getText()), urlencode($t->getFullURL())) . "<br/>" . wfMsg('republish_instructions'));
     $wgOut->addHTML("<br/>\n\t\t\t<style type='text/css'>\n\t\t\t\t#preview h2 {\n\t\t\t\t\tbackground: none;\n\t\t\t\t\tcolor: #000;\n\t\t\t\t\tborder: none;\n\t\t\t\t\tpadding: 0px;\n\t\t\t\t\tmargin-left: 0px;\n\t\t\t\t\tfont-size: 100%;\t\n\t\t\t\t}\n\t\t\t</style>" . "<script type='text/javascript'>\n\t\t\t\tvar txtarea = document.getElementById('output');\n\t\t\t\ttxtarea.focus();\n\t\t\t\ttxtarea.select();\t\n\t\t\t</script>\n\t\t\t");
 }
예제 #16
0
 function getArticleList()
 {
     global $wgMemc, $wgUser;
     $key = wfMemcKey("newarticleslist");
     $cached = $wgMemc->get($key);
     if ($cached) {
         return $cached;
     }
     $skin = $wgUser->getSkin();
     $dbr = wfGetDB(DB_SLAVE);
     $sql = self::getSql() . " ORDER BY value DESC LIMIT 50";
     $res = $dbr->query($sql);
     $html = "";
     $total_num = wfMsg('newarticles_listnum');
     $column_num = ceil($total_num / 3);
     for ($i = 0; $i < $total_num && ($row = $dbr->fetchObject($res));) {
         $title = Title::makeTitle($row->namespace, $row->title);
         $link = $skin->makeKnownLinkObj($title);
         if ($i % $column_num == 0) {
             $html .= "<ul>";
         }
         $html .= "<li>" . $link . "</li>";
         if ($i % $column_num == $column_num - 1) {
             $html .= "</ul>";
         }
         $i++;
     }
     if ($i % $column_num != $column_num) {
         $html .= "</ul>";
     }
     $title = Title::makeTitle(NS_SPECIAL, 'NewHowtoArticles');
     $link = $skin->makeKnownLinkObj($title, wfMsg('more_newarticles'));
     $html .= "<p id='more_newarticles'>" . $link . "<img alt='' src='" . wfGetPad('/skins/WikiHow/images/actionArrow.png') . "' ></p>";
     $wgMemc->set($key, $html, NewHowtoArticles::$cachelen_long);
     return $html;
 }
예제 #17
0
function wfShowFollowUpOnCreation()
{
    global $wgTitle, $wgRequest, $wgOut, $wgUser, $wgCookiePrefix, $wgCookiePath, $wgCookieDomain, $wgCookieSecure;
    try {
        $t = $wgTitle;
        if (!$t || $t->getNamespace() != NS_MAIN) {
            return true;
        }
        $article = new Article($t);
        // short circuit the database look ups because they are frigging slow
        if (isset($_COOKIE[$wgCookiePrefix . 'ArticlesCreated'])) {
            $ids = explode(",", $_COOKIE[$wgCookiePrefix . 'ArticlesCreated']);
        } else {
            // they didn't create any articles
            return true;
        }
        if (!in_array($t->getArticleID(), $ids)) {
            // they didn't create this article
            return true;
        }
        // all of this logic could be cleaned up and HTML moved to a template
        $dbr = wfGetDB(DB_SLAVE);
        $num_revisions = $dbr->selectField('revision', 'count(*)', array('rev_page=' . $article->getId()));
        if ($num_revisions > 1) {
            return true;
        }
        $user_name = $dbr->selectField('revision', 'rev_user_text', array('rev_page=' . $article->getId()));
        if ((strpos($_SERVER['HTTP_REFERER'], 'action=edit') !== false || strpos($_SERVER['HTTP_REFERER'], 'action=submit2') !== false) && $wgUser->getName() == $user_name && !isset($_SESSION["aen_dialog"][$article->getId()])) {
            print '<script type="text/javascript" language="javascript" src="' . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.js?rev=') . WH_SITEREV . '"></script>
								<script type="text/javascript" language="javascript" src="' . wfGetPad('/extensions/min/f/extensions/wikihow/authors/authoremails.js?rev=') . WH_SITEREV . '"></script>
						 <link rel="stylesheet" href="' . wfGetPad('/extensions/min/f/extensions/wikihow/winpop.css?rev=') . WH_SITEREV . '" type="text/css" />
						 <link rel="stylesheet" href="' . wfGetPad('/extensions/min/f/extensions/wikihow/createpage/createpage.css?rev=') . WH_SITEREV . '" type="text/css" />';
            if ($wgUser->getID() == 0) {
                setcookie('aen_anon_newarticleid', $article->getId(), time() + 3600, $wgCookiePath, $wgCookieDomain, $wgCookieSecure);
                setcookie('aen_dialog_check', $article->getId(), time() + 3600);
                print '
					<script type="text/javascript">
						var whNewLoadFunc = function() {
							if ( getCookie("aen_dialog_check") != "" ) {
								var url = "/extensions/wikihow/common/jquery-ui-slider-dialog-custom/jquery-ui-1.8.13.custom.min.js";
								$.getScript(url, function() {
									$("#dialog-box").load("/Special:CreatepageFinished");
									$("#dialog-box").dialog({
										width: 600,
										height: 600,
										modal: true,
										closeText: "Close",
										title: "' . wfMsg('createpage_congratulations') . '"
									});
									deleteCookie("aen_dialog_check");
								});
							}
						};
						// during move to jquery...
						if (typeof document.observe == "function") {
							document.observe("dom:loaded", whNewLoadFunc);
						} else {
							$(document).ready(whNewLoadFunc);
						}
					</script>
				';
            } else {
                if ($wgUser->getOption('enableauthoremail') != '1') {
                    setcookie('aen_dialog_check', $article->getId(), time() + 3600);
                    print '
						<script type="text/javascript">
						var whNewLoadFunc = function() {
							if ( getCookie("aen_dialog_check") != "" ) {
							
								var url = "/extensions/wikihow/common/jquery-ui-slider-dialog-custom/jquery-ui-1.8.13.custom.min.js";
								$.getScript(url, function() {
									$("#dialog-box").load("/Special:CreatepageFinished");
									$("#dialog-box").dialog({
										width: 600,
										height: 600,
										modal: true,
										closeText: "Close",
										title: "' . wfMsg('createpage_congratulations') . '"
									});
									deleteCookie("aen_dialog_check");
								});
							}
						};
						// during move to jquery...
						if (typeof document.observe == "function") {
							document.observe("dom:loaded", whNewLoadFunc);
						} else {
							$(document).ready(whNewLoadFunc);
						}
						</script>
					';
                }
            }
            $_SESSION["aen_dialog"][$article->getId()] = 1;
        }
    } catch (Exception $e) {
    }
    return true;
}
예제 #18
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Volume of a Sphere</title>
<style type="text/css" media="all">/*<![CDATA[*/ @import "<?php 
echo wfGetPad('/extensions/min/f/extensions/wikihow/ArticleWidgets/common/css/style.css,/extensions/wikihow/ArticleWidgets/SPHEREVOL/css/styles.css,/extensions/wikihow/ArticleWidgets/components/whUpDownDropDown/wh.updowndropdown.css,/extensions/wikihow/ArticleWidgets/components/whLabel/wh.label.css&') . WH_SITEREV;
?>
"; /*]]>*/</style>
<script type="text/javascript" src="<?php 
echo wfGetPad('/extensions/min/f/extensions/wikihow/common/jquery-1.4.1.min.js,/extensions/wikihow/ArticleWidgets/common/js/tabs.js,/extensions/wikihow/ArticleWidgets/components/whUpDownDropDown/jq.wh.updowndropdown.js,/extensions/wikihow/ArticleWidgets/components/whLabel/jq.wh.label.js,/extensions/wikihow/ArticleWidgets/libs/wh.geometry.js&') . WH_SITEREV;
?>
"></script>
</head>
<body>
	<div id="wrapper">
    	<div id="header">
        	<h1>The Volume of a Sphere</h1>
			<div class="corner_left"></div>
			<div class="corner_right"></div>
            <ul class="tabs">
                <li><a href="#tab1"><p>Imperial</p></a></li>
                <li><a href="#tab2"><p>Metric</p></a></li>
            </ul>
        </div><!--end header-->
        	<div id="content">
            	<div class="tab_container">
    				<div id="tab1" class="tab_content">
        				<div class="left">
                        	<h1>Radius</h1>
                            <div class="form form_uk" id="uk">
예제 #19
0
 public static function listDrafts(&$title = null, $user = null)
 {
     global $wgOut, $wgRequest, $wgUser, $wgLang;
     //added twice?
     $wgOut->addScript('<style type="text/css" media="all">/*<![CDATA[*/ @import "' . wfGetPad('/extensions/min/f/extensions/Drafts/Drafts.css?rev=') . WH_SITEREV . '"; /*]]>*/</style>');
     // Get draftID
     $currentDraft = Draft::newFromID($wgRequest->getIntOrNull('draft'));
     //based on user preference
     $adv = $wgUser->getOption('defaulteditor', '') == 'advanced' ? '&advanced=true' : '';
     // Output HTML for list of drafts
     $drafts = Draft::getDrafts($title, $user);
     if (count($drafts) > 0) {
         global $egDraftsLifeSpan;
         // Internationalization
         wfLoadExtensionMessages('Drafts');
         // Add a summary, on Special:Drafts only
         if (!$title || $title->getNamespace() == NS_SPECIAL) {
             $wgOut->wrapWikiMsg('<div class="mw-drafts-summary">$1</div>', array('drafts-view-summary', $wgLang->formatNum($egDraftsLifeSpan)));
         }
         // Build XML
         $wgOut->addHTML(Xml::openElement('table', array('cellpadding' => 5, 'cellspacing' => 0, 'border' => 0, 'id' => 'drafts-list-table', 'class' => 'section_text', 'style' => 'margin-top:15px')));
         $wgOut->addHTML(Xml::openElement('tr'));
         $wgOut->addHTML(Xml::element('th', array('align' => 'left', 'nowrap' => 'nowrap', 'style' => 'text-align:center;'), wfMsg('drafts-view-article')));
         $wgOut->addHTML(Xml::element('th', array('align' => 'left', 'nowrap' => 'nowrap', 'style' => 'text-align:center;'), wfMsg('drafts-view-saved')));
         $wgOut->addHTML(Xml::element('th', array(), wfMsg('edit')));
         $wgOut->addHTML(Xml::element('th', array(), wfMsg('discard')));
         $wgOut->addHTML(Xml::closeElement('tr'));
         // Add existing drafts for this page and user
         $index = 0;
         foreach ($drafts as $draft) {
             // Get article title text
             $htmlTitle = $draft->getTitle()->getEscapedText();
             // Build Article Load link
             if ($draft->getHTML5()) {
                 $params = 'h5e=true&draft=' . urlencode($draft->getID());
                 if ($draft->getTitle()->getArticleID() == 0) {
                     $params .= "&create-new-article=true";
                 }
                 $urlLoad = $draft->getTitle()->getFullUrl($params);
             } else {
                 $urlLoad = $draft->getTitle()->getFullUrl('action=edit' . $adv . '&draft=' . urlencode($draft->getID()));
             }
             // Build discard link
             $urlDiscard = sprintf('%s?discard=%s&token=%s', SpecialPage::getTitleFor('Drafts')->getFullUrl(), urlencode($draft->getID()), urlencode($wgUser->editToken()));
             // If in edit mode, return to editor
             if ($wgRequest->getText('action') == 'edit' || $wgRequest->getText('action') == 'submit') {
                 $urlDiscard .= '&returnto=' . urlencode('edit');
             }
             // Append section to titles and links
             if ($draft->getSection() !== null) {
                 // Detect section name
                 $lines = explode("\n", $draft->getText());
                 // If there is any content in the section
                 if (count($lines) > 0) {
                     $htmlTitle .= '#' . htmlspecialchars(trim(trim(substr($lines[0], 0, 255), '=')));
                 }
                 // Modify article link and title
                 $urlLoad .= '&section=' . urlencode($draft->getSection());
                 $urlDiscard .= '&section=' . urlencode($draft->getSection());
             }
             // Build XML
             if ($index % 2 == 1) {
                 $wgOut->addHTML(Xml::openElement('tr', array('style' => 'background: #eee;')));
             } else {
                 $wgOut->addHTML(Xml::openElement('tr', array('style' => '')));
             }
             $wgOut->addHTML(Xml::openElement('td', array('align' => 'left', 'class' => 'draftpage')));
             $wgOut->addHTML(Xml::element('a', array('href' => $urlLoad, 'style' => 'font-weight:' . ($currentDraft->getID() == $draft->getID() ? 'bold' : 'normal')), $htmlTitle));
             $wgOut->addHTML(Xml::closeElement('td'));
             $wgOut->addHTML(Xml::element('td', array('align' => 'left', 'nowrap' => 'nowrap', 'class' => 'draftsaved'), $wgLang->timeanddate($draft->getSaveTime(), true)));
             // edit link
             $wgOut->addHTML(Xml::openElement('td', array('align' => 'left', 'nowrap' => 'nowrap', 'class' => 'draftedit')));
             $wgOut->addHTML(Xml::element('a', array('href' => $urlLoad), wfMsg('edit')));
             $wgOut->addHTML(Xml::closeElement('td'));
             $wgOut->addHTML(Xml::openElement('td', array('align' => 'left', 'nowrap' => 'nowrap', 'class' => 'draftdiscard')));
             $wgOut->addHTML(Xml::element('a', array('href' => $urlDiscard, 'onclick' => "if( true || !wgAjaxSaveDraft.insync ) return confirm('" . Xml::escapeJsString(wfMsgHTML('drafts-discard-warn', $draft->getTitle()->getText())) . "')"), wfMsg('drafts-view-discard')));
             $wgOut->addHTML(Xml::closeElement('td'));
             $wgOut->addHTML(Xml::closeElement('tr'));
             $index++;
         }
         $wgOut->addHTML(Xml::closeElement('table'));
         // Return number of drafts
         return count($drafts);
     }
     return 0;
 }
예제 #20
0
 static function onThumbnailBeforeProduceHTML($thumbnailImage, $attribs, $linkAttribs)
 {
     if ($attribs && is_array($attribs) && !empty($attribs['src'])) {
         $attribs['src'] = wfGetPad($attribs['src']);
     }
     return true;
 }
예제 #21
0
 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('');
 }
 function execute($par)
 {
     global $wgServer, $wgRequest, $wgOut, $wgUser;
     wfLoadExtensionMessages('AuthorEmailNotification');
     $fname = 'AuthorEmailNotification';
     if ($wgUser->isBlocked()) {
         $wgOut->blockedPage();
         return;
     }
     if ($wgUser->getID() == 0) {
         $wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
         return;
     }
     $target = isset($par) ? $par : $wgRequest->getVal('target');
     $action = $wgRequest->getVal('action');
     $me = Title::makeTitle(NS_SPECIAL, "AuthorEmailNotification");
     if ($action == 'Save') {
         $articles = array();
         $articlecount = $wgRequest->getVal('articlecount');
         for ($i = 1; $i <= $articlecount + 1; $i++) {
             $item = $wgRequest->getVal('articles-' . $i);
             if ($item != '' && $item != 0) {
                 array_push($articles, $item);
             }
         }
         $this->addUserWatchBulk($articles);
     } else {
         if ($action == 'update') {
             $watch = 1;
             $watch = $wgRequest->getVal('watch');
             if ($target != "") {
                 $this->addUserWatch($target, $watch);
             } else {
                 wfDebug('Ajax call for AuthorEmailNotifications with improper parameters.');
             }
             return;
         } else {
             if ($action == 'addNotification') {
                 $email = '';
                 $email = $wgRequest->getVal('email');
                 $this->addNotification($target, $email);
                 return;
             } else {
                 if ($action == 'updatePreferences') {
                     wfDebug("AEN DEBUG in updatepreferences\n");
                     if ($wgRequest->getVal('dontshow') == 1) {
                         wfDebug("AEN DEBUG in dontshow\n");
                         $wgUser->setOption('enableauthoremail', 1);
                         wfDebug("AEN DEBUG in settingoption\n");
                         $wgUser->saveSettings();
                     }
                     return;
                 } else {
                     if ($action == 'testsend') {
                         //FOR TESTING
                         $subject = "";
                         $body = "";
                         $title = "Help Your Dog Lose Weight";
                         $titlelink = "<a href='{$wgServer}/Help-Your-Dog-Lose-Weight'>Help Your Dog Lose Weight</a>";
                         switch ($target) {
                             case 'rs':
                                 $subject = wfMsg('aen_rs_subject', $title);
                                 $body = wfMsg('aen_rs_body', $wgUser->getName(), $titlelink);
                                 break;
                             case 'mod':
                                 $subject = wfMsg('aen_mod_subject', $title);
                                 $body = wfMsg('aen_mod_body', $wgUser->getName(), $titlelink);
                                 break;
                             case 'featured':
                                 $subject = wfMsg('aen_featured_subject', $title);
                                 $body = wfMsg('aen_featured_body', $wgUser->getName(), $titlelink);
                                 break;
                             case 'viewership':
                                 $subject = wfMsg('aen_viewership_subject', $title, '12768');
                                 $body = wfMsg('aen_viewership_body', $wgUser->getName(), $titlelink, '12768');
                                 break;
                         }
                         if ($wgUser->getEmail() != '') {
                             $from_name = wfMsg('aen_from');
                             $this->notify($wgUser, $from_name, $subject, $body);
                         }
                         return;
                     }
                 }
             }
         }
     }
     $wgOut->addHTML("\n\t\t\t<script type='text/javascript' src='" . wfGetPad('/extensions/wikihow/authors/authoremails.js?rev=') . WH_SITEREV . "'></script>\n\t\t");
     $wgOut->addHTML(wfMsg('emailn_title') . "<br/><br/>");
     $this->showUser();
     return;
 }
예제 #23
0
 function execute($par)
 {
     global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgDBname, $wgScriptPath;
     global $wgRequest, $wgSitename, $wgLanguageCode;
     global $wgScript;
     $fname = "wfSpecialEmailLink";
     if ($wgRequest->getVal('fromajax')) {
         $wgOut->setArticleBodyOnly(true);
     }
     $this->setHeaders();
     $me = Title::makeTitle(NS_SPECIAL, "EmailLink");
     $action = $me->getFullURL();
     $fc = new FancyCaptcha();
     $pass_captcha = true;
     $name = $from = $r1 = $r2 = $r3 = $m = "";
     if ($wgRequest->wasPosted()) {
         $pass_captcha = $fc->passCaptcha();
         $email = $wgRequest->getVal("email");
         $name = $wgRequest->getVal("name");
         $recipient1 = $wgRequest->getVal('recipient1');
         $recipient2 = $wgRequest->getVal('recipient2');
         $recipient3 = $wgRequest->getVal('recipient3');
         if (preg_match("@kittens683\\@aol.com@", $recipient1) || preg_match("@kittens683\\@aol.com@", $recipient2) || preg_match("@kittens683\\@aol.com@", $recipient3)) {
             return;
         }
         $message = $wgRequest->getVal('message');
     }
     if (!$wgRequest->wasPosted() || !$pass_captcha) {
         if ($wgUser->getID() > 0 && !$wgUser->canSendEmail()) {
             $userEmail = $wgUser->getEmail();
             // If there is no verification time stamp and no email on record, show initial message to have a user input a valid email address
             if (empty($userEmail)) {
                 wfDebug("User can't send.\n");
                 $wgOut->errorpage("mailnologin", "mailnologintext");
             } else {
                 // When user does have an email on record, but has not verified it yet
                 wfDebug("User can't send without verification.\n");
                 $wgOut->errorpage("mailnologin", "mailnotverified");
             }
             return;
         }
         $titleKey = isset($par) ? $par : $wgRequest->getVal('target');
         if ($titleKey == "") {
             $wgOut->addHTML("<br/></br><font color=red>" . wfMsg('error-no-title') . "</font>");
             return;
         }
         $titleObj = Title::newFromURL($titleKey);
         if (!$titleObj) {
             $titleObj = Title::newFromURL(urldecode($titleKey));
         }
         if (!$titleObj || $titleObj->getArticleID() < 0) {
             $wgOut->addHTML("<br/></br><font color=red>" . wfMsg('error-article-not-found') . "</font>");
             return;
         } else {
             $titleKey = $titleObj->getDBKey();
         }
         $articleObj = new Article($titleObj);
         $subject = $titleObj->getText();
         $titleText = $titleObj->getText();
         if (WikihowArticleEditor::articleIsWikiHow($articleObj)) {
             $subject = wfMsg('howto', $subject);
             $titleText = wfMsg('howto', $titleText);
         }
         $subject = wfMsg('wikihow-article-subject', $subject);
         if ($titleObj->getText() == wfMsg('mainpage')) {
             $subject = wfMsg('wikihow-article-subject-main-page');
         }
         // add the form HTML
         $article_title = wfMsg('article') . ":";
         if ($titleObj->getNamespace() == NS_ARTICLE_REQUEST) {
             $wgOut->addHTML("<br/><br/>" . wfMsg('know-someone-answer-topic-request'));
             $article_title = wfMsg('topic-requested') . ":";
         }
         if ($titleObj->getNamespace() != NS_MAIN && $titleObj->getNamespace() != NS_ARTICLE_REQUEST && $titleObj->getNamespace() != NS_PROJECT) {
             $wgOut->errorPage('emaillink', 'emaillink_invalidpage');
             return;
         }
         if ($titleObj->getText() == "Books For Africa") {
             $message = wfMsg('friend-sends-article-email-africa-body');
         }
         $titleKey = urlencode($titleKey);
         $token = $this->getToken1();
         $wgOut->addHTML("\n<link type='text/css' rel='stylesheet' href='" . wfGetPad('/extensions/wikihow/common/jquery-ui-themes/jquery-ui.css?rev=' . WH_SITEREV) . "' />\n<form id=\"emaillink\" method=\"post\" action=\"{$action}\">\n<input type=\"hidden\" name=\"target\" value=\"{$titleKey}\">\n<input type=\"hidden\" name=\"token\" value=\"{$token}\">\n<table border=\"0\">\n<tr>\n<td valign=\"top\" colspan=\"1\" class='mw-label'>{$article_title}</td>\n<td valign=\"top\" colspan=\"2\">{$titleText}</td>\n</tr>\n");
         if ($wgUser->getID() <= 0) {
             $wgOut->addHTML("\n<tr>\n<td valign=\"top\" colspan=\"1\" class='mw-label'>" . wfMsg('your-name') . ":</td>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"name\" value=\"{$name}\" class='input_med'></td>\n</tr>\n<tr>\n<td valign=\"top\" colspan=\"1\" class='mw-label'>" . wfMsg('your-email') . ":</td>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"email\" value=\"{$email}\" class='input_med'></td>\n</tr>");
         }
         $wgOut->addHTML("\n<tr>\n<td valign=\"top\" width=\"300px\" colspan=\"1\" rowspan='3' class='mw-label'>" . wfMsg('recipient-emails') . ":</td>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"recipient1\" value=\"{$recipient1}\" class='input_med'></td>\n</tr>\n<tr>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"recipient2\" value=\"{$recipient2}\" class='input_med'></td>\n</tr>\n<tr>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"recipient3\" value=\"{$recipient3}\" class='input_med'></td>\n</tr>\n<!--<tr>\n<td valign=\"top\" colspan=\"1\">" . wfMsg('emailsubject') . ":</td>\n<td valign=\"top\" colspan=\"2\"><input type=text size=\"40\" name=\"subject\" value=\"{$subject}\" class='input_med'></td>\n</tr>-->\n<tr>\n<td colspan=\"1\" valign=\"top\" class='mw-label'>" . wfMsg('emailmessage') . ":</td>\n<td colspan=\"2\"><TEXTAREA rows=\"5\" cols=\"55\" name=\"message\">{$message}</TEXTAREA></td>\n</tr>\n<tr>\n<TD>&nbsp;</TD>\n<TD colspan=\"2\"><br/>\n" . wfMsgWikiHTML('emaillink_captcha') . "\n" . ($pass_captcha ? "" : "<br><br/><font color='red'>Sorry, that phrase was incorrect, try again.</font><br/><br/>") . "\n" . $fc->getForm('') . "\n</TD>\n</tr>\n<tr>\n<TD>&nbsp;</TD>\n<TD colspan=\"2\"><br/>\n<input type='submit' name=\"wpEmaiLinkSubmit\" value=\"" . wfMsg('submit') . "\" class=\"button primary\" />\n</td>\n</tr>\n<tr>\n<TD colspan=\"3\">\n<br/><br/>\n" . wfMsg('share-message-three-friends') . "\n</TD>\n</TR>\n\n");
         // do this if the user isn't logged in
         $wgOut->addHTML("</table> </form>");
     } else {
         if ($wgUser->pingLimiter('emailfriend')) {
             $wgOut->rateLimited();
             wfProfileOut("{$fname}-checks");
             wfProfileOut($fname);
             return false;
         }
         $usertoken = $wgRequest->getVal('token');
         $token1 = $this->getToken1();
         $token2 = $this->getToken2();
         if ($usertoken != $token1 && $usertoken != $token2) {
             $this->reject();
             echo "token {$usertoken} {$token1} {$token2}\n";
             exit;
             return;
         }
         // check referrer
         $good_referer = Title::makeTitle(NS_SPECIAL, "EmailLink")->getFullURL();
         $referer = $_SERVER["HTTP_REFERER"];
         if (strpos($refer, $good_referer) != 0) {
             $this->reject();
             echo "referrer bad\n";
             exit;
         }
         // this is a post, accept the POST data and create the Request article
         $recipient1 = $_POST['recipient1'];
         $recipient2 = $_POST['recipient2'];
         $recipient3 = $_POST['recipient3'];
         $titleKey = $_POST['target'];
         $message = $_POST['message'];
         if ($titleKey == "Books-For-Africa") {
             $titleKey = "wikiHow:" . $titleKey;
         }
         $titleKey = urldecode($titleKey);
         $titleObj = Title::newFromDBKey($titleKey);
         if ($titleObj->getArticleID() <= 0) {
             $this->reject();
             echo "no article id\n";
             exit;
         }
         $dbkey = $titleObj->getDBKey();
         $articleObj = new Article($titleObj);
         $subject = $titleObj->getText();
         $how_to = $subject;
         if (WikihowArticleEditor::articleIsWikiHow($articleObj)) {
             $subject = wfMsg("howto", $subject);
         }
         $how_to = $subject;
         if ($titleObj->getNamespace() == NS_ARTICLE_REQUEST) {
             $subject = wfMsg('subject-requested-howto') . ": " . wfMsg("howto", $subject);
         } else {
             if ($titleObj->getNamespace() == NS_PROJECT) {
                 $subject = wfMsg('friend-sends-article-email-africa-subject');
             } else {
                 $subject = wfMsg('wikihow-article-subject', $subject);
             }
         }
         if ($titleObj->getNamespace() != NS_MAIN && $titleObj->getNamespace() != NS_ARTICLE_REQUEST && $titleObj->getNamespace() != NS_PROJECT) {
             $wgOut->errorPage('emaillink', 'emaillink_invalidpage');
             return;
         }
         // for the body of the email
         $titleText = $titleObj->getText();
         if ($titleText != wfMsg('mainpage')) {
             $summary = Article::getSection($articleObj->getContent(true), 0);
             // trip out all MW and HTML tags
             $summary = ereg_replace("<.*>", "", $summary);
             $summary = ereg_replace("\\[\\[.*\\]\\]", "", $summary);
             $summary = ereg_replace("\\{\\{.*\\}\\}", "", $summary);
         }
         $url = $titleObj->getFullURL();
         $from_name = "";
         $validEmail = "";
         if ($wgUser->getID() > 0) {
             $from_name = $wgUser->getName();
             $real_name = $wgUser->getRealName();
             if ($real_name != "") {
                 $from_name = $real_name;
             }
             $email = $wgUser->getEmail();
             if ($email != "") {
                 $validEmail = $email;
                 $from_name .= "<{$email}>";
             } else {
                 $from_name .= "<*****@*****.**>";
             }
         } else {
             $email = $wgRequest->getVal("email");
             $name = $wgRequest->getVal("name");
             if ($email == "") {
                 $email = "*****@*****.**";
             } else {
                 $validEmail = $email;
             }
             $from_name = "{$name} <{$email}>";
         }
         if (strpos($email, "\n") !== false || strpos($recipient1, "\n") !== false || strpos($recipient2, "\n") !== false || strpos($recipient3, "\n") !== false || strpos($title, "\n") !== false) {
             echo "reciep\n";
             exit;
             $this->reject();
             return;
         }
         $r_array = array();
         $num_recipients = 0;
         if ($recipient1 != "") {
             $num_recipients++;
             $x = split(";", $recipient1);
             $r_array[] = $x[0];
         }
         if ($recipient2 != "") {
             $num_recipients++;
             $x = split(";", $recipient2);
             $r_array[] = $x[0];
         }
         if ($recipient3 != "") {
             $num_recipients++;
             $x = split(";", $recipient3);
             $r_array[] = $x[0];
         }
         if ($titleObj->getNamespace() == NS_PROJECT) {
             $r_array[] = '*****@*****.**';
         }
         if ($validEmail != "" && !in_array($validEmail, $r_array)) {
             $num_recipients++;
             $r_array[] = $validEmail;
         }
         if ($titleObj->getNamespace() == NS_ARTICLE_REQUEST) {
             $body = "{$message}\n\n----------------\n\n\t" . wfMsg('article-request-email', $how_to, "http://www.wikihow.com/index.php?title2={$dbkey}&action=easy&requested={$dbkey}", "http://www.wikihow.com/Request:{$dbkey}", "http://www.wikihow.com/" . wfMsg('writers-guide-url'), "http://www.wikihow.com/" . wfMsg('about-wikihow-url') . "");
         } else {
             if ($titleObj->getText() == wfMsg('mainpage')) {
                 $body = "{$message}\n\n----------------\n\n\t" . wfMsg('friend-sends-article-email-main-page') . "\n\n\t";
             } else {
                 if ($titleObj->getNamespace() == NS_PROJECT) {
                     $body = "{$message}";
                 } else {
                     $body = "{$message}\n\n----------------\n\n" . wfMsg('friend-sends-article-email', $how_to, $summary, $url) . "\n\n\t";
                 }
             }
         }
         $from = new MailAddress($email);
         foreach ($r_array as $address) {
             $address = preg_replace("@,.*@", "", $address);
             $to = new MailAddress($address);
             $sbody = $body;
             if ($address == $validEmail) {
                 $sbody = wfMsg('copy-email-from-yourself') . "\n\n" . $sbody;
             }
             if (!userMailer($to, $from, $subject, $sbody, false)) {
                 //echo "got an en error\n";
             }
         }
         SiteStatsUpdate::addLinksEmailed($num_recipients);
         $this->thanks();
     }
 }
예제 #24
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Your Target Heart Rate</title>
<style type="text/css" media="all">/*<![CDATA[*/ @import "<?php 
echo wfGetPad('/extensions/min/f/extensions/wikihow/ArticleWidgets/common/css/style.css,/extensions/wikihow/ArticleWidgets/HEARTRATE/css/styles.css,/extensions/wikihow/ArticleWidgets/components/whUpDown/wh.updown.css,/extensions/wikihow/ArticleWidgets/components/whLabel/wh.label.css&') . WH_SITEREV;
?>
"; /*]]>*/</style>
<script type="text/javascript" src="<?php 
echo wfGetPad('/extensions/min/f/extensions/wikihow/common/jquery-1.4.1.min.js,/extensions/wikihow/ArticleWidgets/components/whUpDown/jq.wh.updown.js,/extensions/wikihow/ArticleWidgets/components/whLabel/jq.wh.label.js,/extensions/wikihow/ArticleWidgets/libs/wh.health.js&') . WH_SITEREV;
?>
"></script>
</head>
<body>
	<div id="wrapper">
    	<div id="header">
        	<h1>Your Target Heart Rate</h1>
			<div class="corner_left"></div>
			<div class="corner_right"></div>
        </div><!--end header-->
        	<div id="content" class="thr">
            	<div class="tab_container">
    				<div id="tab1" class="tab_content">
        				<div class="left">
                        	<h1>My Personal Info</h1>
                        	<div class="label label_first">Current Age is</div>
                            <div class="form" id="age"></div><!--end form-->
                            <div class="line"></div>
                            
                            <p>Find your resting heart rate<br />
예제 #25
0
    public function execute($par)
    {
        global $wgOut, $wgRequest;
        $socialNet = $wgRequest->getVal('soc', '');
        $wgOut->setArticleBodyOnly(true);
        $wgOut->setSquidMaxage(5 * 60);
        // 5 minutes in varnish
        if ($socialNet == 'pinterest') {
            $pins = self::getPinterestArticles();
            $pinterest_follow = wfGetPad('/skins/WikiHow/images/pinterest-test/pinterest_follow_box.jpg');
            $html = <<<EOHTML
<style>
#pin-head-cta {
\tbackground-color: #FFF;
\twidth: 1050px;
\tmargin: 85px auto -72px auto;
\tborder: 1px solid #e5e5e5;
\tborder-radius: 4px;
\t-moz-border-radius: 4px;
\t-webkit-border-radius: 4px;
}

#pin-head-cta td { width: 25%; }

.pin-head-pin {
\tpadding: 13px;
\tborder: 1px solid #DCD5CC;
\tmargin: 7px 7px 7px 7px;
}
.pin-head-pin p { 
\tmargin: 1em 0 .5em 0; 
\tfont-size: .9em;
}
.pin-head-pin p a { color: #000; }

#pin-head-cta-follow {
\tpadding: 12px;
}
</style>
<div id="pin-head-cta">
<table>
<tr>
{$pins}
<td><a href="http://pinterest.com/wikihow/"><img src="{$pinterest_follow}" border="0" id="pin-head-cta-follow" /></a></td>
</tr>
</div>
EOHTML;
            $wgOut->addHTML($html);
        }
    }
예제 #26
0
 function getMtv()
 {
     $s = "";
     $s = "<div class='wh_ad'><div class='side_ad'>";
     $s .= "<a href='http://mtvcasting.wufoo.com/forms/mtvs-online-relationship-show-now-casting' target='_blank'>";
     $s .= "<img src='" . wfGetPad('/skins/WikiHow/images/mtv_ad.jpg?1') . "' alt='MTV' /></a>";
     $s .= "</div></div>";
     return $s;
 }
예제 #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");
 }
예제 #28
0
 public function execute($par)
 {
     global $wgTitle, $wgOut, $wgRequest, $wgUser;
     $target = isset($par) ? $par : $wgRequest->getVal('target');
     $wgOut->setHTMLTitle('New Article Boost Status - wikiHow');
     $sk = $wgUser->getSkin();
     $dbr = wfGetDB(DB_SLAVE);
     $wgOut->addHTML('<style type="text/css" media="all">/*<![CDATA[*/ @import "' . wfGetPad('/extensions/min/f/extensions/wikihow/nab/newarticleboost.css&' . Newarticleboost::REVISION) . '"; /*]]>*/</style>');
     $wgOut->addHTML(wfMsg('nap_statusinfo'));
     $wgOut->addHTML("<br/><center>");
     $days = $wgRequest->getVal('days', 1);
     if ($days == 1) {
         $wgOut->addHTML(" [" . wfMsg('nap_last1day') . "] ");
         $wgOut->addHTML(" [" . $sk->makeLinkObj($wgTitle, wfMsg('nap_last7day'), "days=7") . "] ");
         $wgOut->addHTML(" [" . $sk->makeLinkObj($wgTitle, wfMsg('nap_last30day'), "days=30") . "] ");
     } else {
         if ($days == 7) {
             $wgOut->addHTML(" [" . $sk->makeLinkObj($wgTitle, wfMsg('nap_last1day'), "days=1") . "] ");
             $wgOut->addHTML(" [" . wfMsg('nap_last7day') . "] ");
             $wgOut->addHTML(" [" . $sk->makeLinkObj($wgTitle, wfMsg('nap_last30day'), "days=30") . "] ");
         } else {
             if ($days == 30) {
                 $wgOut->addHTML(" [" . $sk->makeLinkObj($wgTitle, wfMsg('nap_last1day'), "days=1") . "] ");
                 $wgOut->addHTML(" [" . $sk->makeLinkObj($wgTitle, wfMsg('nap_last7day'), "days=7") . "] ");
                 $wgOut->addHTML(" [" . wfMsg('nap_last30day') . "] ");
             }
         }
     }
     $days_ago = wfTimestamp(TS_MW, time() - 60 * 60 * 24 * $days);
     $boosted = $dbr->selectField(array('newarticlepatrol', 'page'), array('count(*)'), array('page_id=nap_page', 'page_is_redirect=0', 'nap_patrolled=1', "nap_timestamp_ci > '{$days_ago}'"), __METHOD__);
     $newarticles = $dbr->selectField(array('newarticlepatrol'), array('count(*)'), array("nap_timestamp > '{$days_ago}'"), __METHOD__);
     $na_boosted = $dbr->selectField(array('newarticlepatrol'), array('count(*)'), array("nap_timestamp > '{$days_ago}'", "nap_patrolled" => 1), __METHOD__);
     $boosted = number_format($boosted, 0, "", ",");
     $newarticles = number_format($newarticles, 0, "", ",");
     $na_boosted = number_format($na_boosted, 0, "", ",");
     $per_boosted = $newarticles > 0 ? number_format($na_boosted / $newarticles * 100, 2) : 0;
     $wgOut->addHTML("<br/><br/><div>\n\t\t\t\t<table width='50%' align='center' class='status'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . wfMsg('nap_totalboosted') . "</td>\n\t\t\t\t\t\t<td>{$boosted}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . wfMsg('nap_numnewboosted') . "</td>\n\t\t\t\t\t\t<td>{$na_boosted}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td>" . wfMsg('nap_numarticles') . "</td>\n\t\t\t\t\t\t<td>{$newarticles}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . wfMsg('nap_perofnewbosted') . "</td>\n\t\t\t\t\t\t<td>{$per_boosted}%</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t</div>");
     $wgOut->addHTML("</center>");
     $wgOut->addHTML("<br/>" . wfMsg('nap_userswhoboosted') . "<br/><br/><center>\n\t\t\t<table width='500px' align='center' class='status'>");
     $total = $dbr->selectField('logging', 'count(*)', array('log_type' => 'nap', "log_timestamp>'{$days_ago}'"), __METHOD__);
     $sql = "SELECT log_user, count(*) AS C\n\t\t\t\t  FROM logging WHERE log_type = 'nap'\n\t\t\t\t    AND log_timestamp > '{$days_ago}'\n\t\t\t\t  GROUP BY log_user\n\t\t\t\t  ORDER BY C DESC\n\t\t\t\t  LIMIT 20";
     $res = $dbr->query($sql, __METHOD__);
     $index = 1;
     $wgOut->addHTML("<tr>\n\t\t\t<td></td>\n\t\t\t\t<td>User</td>\n\t\t\t\t<td  align='right'>" . wfMsg('nap_numboosted') . "</td>\n\t\t\t\t<td align='right'>" . wfMsg('nap_perboosted') . "</td>\n\t\t\t\t</tr>");
     while (($row = $dbr->fetchObject($res)) != null) {
         $user = User::newFromID($row->log_user);
         $percent = $total == 0 ? "0" : number_format($row->C / $total * 100, 0);
         $count = number_format($row->C, 0, "", ',');
         $log = $sk->makeLinkObj(Title::makeTitle(NS_SPECIAL, 'Log'), $count, 'type=nap&user='******'right'>{$log}</td>\n\t\t\t\t<td align='right'> {$percent} % </td>\n\t\t\t\t</tr>\n\t\t\t");
         $index++;
     }
     $dbr->freeResult($res);
     $wgOut->addHTML("</table></center>");
 }
예제 #29
0
	<div id='mqg_eml_box' class='mqg_rounded'>
		<div class = "mqg_eml_txt">
			<img src="<?php 
echo wfGetPad('/skins/WikiHow/images/mqg_eml.png');
?>
"></img>
			<?php 
echo wfMsg('mqg_eml_txt');
?>
</div>
		<div class="mqg_eml_input">Email Address: <input type='text' id='mqg_eml'></input></div>
		<div class="mqg_eml_buttons"><a id="mqg_dismiss" href="#">No, thanks</a> <a id="mqg_ok" href="#" class="button button52">OK</a></div>
	</div>
	<div id="mqg_spinner">
		<img src="<?php 
echo wfGetPad('/extensions/wikihow/rotate.gif');
?>
" alt=" "></img>
	</div>
	<div id='mqg_body'>
	</div>
	<script type="text/javascript">
		var _gaq = _gaq || [];
		_gaq.push(['_setAccount', 'UA-2375655-1']);
		_gaq.push(['_setDomainName', '.wikihow.com']);
		_gaq.push(['_trackPageview']);
		(function() {
			var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
			ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		})();
 function getHomepageData()
 {
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select(WikihowHomepageAdmin::HP_TABLE, '*', '', __METHOD__, array('ORDER BY' => 'hp_active DESC,hp_order'));
     $results = array();
     foreach ($res as $item) {
         $item->title = Title::newFromID($item->hp_page);
         $imageTitle = Title::newFromID($item->hp_image);
         if ($imageTitle) {
             $file = wfFindFile($imageTitle->getText());
             if ($file) {
                 $thumb = $file->getThumbnail(81, 54, true, true, true);
                 $item->file = wfGetPad($thumb->getUrl());
                 $results[] = $item;
             }
         }
     }
     return $results;
 }