• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wfAppendToArrayIfNotDefault函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wfAppendToArrayIfNotDefault函数的典型用法代码示例。如果您正苦于以下问题:PHP wfAppendToArrayIfNotDefault函数的具体用法?PHP wfAppendToArrayIfNotDefault怎么用?PHP wfAppendToArrayIfNotDefault使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wfAppendToArrayIfNotDefault函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute($par)
 {
     global $wgRequest, $wgLang;
     $shownavigation = is_object($this->specialPage) && !$this->specialPage->including();
     $defaults = array('hideliu' => false, 'hidepatrolled' => false, 'hidebots' => false, 'namespace' => "0", 'username' => '', 'offset' => 0, 'limit' => 50);
     $options = $defaults;
     if ($par) {
         $bits = preg_split('/\\s*,\\s*/', trim($par));
         foreach ($bits as $bit) {
             if ('shownav' == $bit) {
                 $shownavigation = true;
             }
             if ('hideliu' === $bit) {
                 $options['hideliu'] = true;
             }
             if ('hidepatrolled' == $bit) {
                 $options['hidepatrolled'] = true;
             }
             if ('hidebots' == $bit) {
                 $options['hidebots'] = true;
             }
             if (is_numeric($bit)) {
                 $options['limit'] = intval($bit);
             }
             $m = array();
             if (preg_match('/^limit=(\\d+)$/', $bit, $m)) {
                 $options['limit'] = intval($m[1]);
             }
             if (preg_match('/^offset=(\\d+)$/', $bit, $m)) {
                 $options['offset'] = intval($m[1]);
             }
             if (preg_match('/^namespace=(.*)$/', $bit, $m)) {
                 $ns = $wgLang->getNsIndex($m[1]);
                 if ($ns !== false) {
                     $options['namespace'] = $ns;
                 }
             }
         }
     }
     // Override all values from requests, if specified
     foreach ($defaults as $v => $t) {
         if (is_bool($t)) {
             $options[$v] = $wgRequest->getBool($v, $options[$v]);
         } elseif (is_int($t)) {
             $options[$v] = $wgRequest->getInt($v, $options[$v]);
         } elseif (is_string($t)) {
             $options[$v] = $wgRequest->getText($v, $options[$v]);
         }
     }
     // Validate limit and offset params
     if ($options['limit'] <= 0) {
         $options['limit'] = $defaults['limit'];
     }
     if ($options['offset'] < 0) {
         $options['offset'] = $defaults['offset'];
     }
     $nondefaults = array();
     foreach ($options as $v => $t) {
         if ($v === 'offset') {
             continue;
         }
         # Reset offset if parameters change
         wfAppendToArrayIfNotDefault($v, $t, $defaults, $nondefaults);
     }
     # bind to class
     $this->options = $options;
     $this->nondefaults = $nondefaults;
     if (!$this->doFeed($wgRequest->getVal('feed'), $options['limit'])) {
         $this->doQuery($options['offset'], $options['limit'], $shownavigation);
     }
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:71,代码来源:SpecialNewpages.php


示例2: wfSpecialWatchlist


//.........这里部分代码省略.........
            $wgOut->addHTML($cache_s);
            return;
        }
    }
    $dbr =& wfGetDB(DB_SLAVE);
    extract($dbr->tableNames('page', 'revision', 'watchlist', 'recentchanges'));
    $sql = "SELECT COUNT(*) AS n FROM {$watchlist} WHERE wl_user={$uid}";
    $res = $dbr->query($sql, $fname);
    $s = $dbr->fetchObject($res);
    #	Patch *** A1 *** (see A2 below)
    #	adjust for page X, talk:page X, which are both stored separately, but treated together
    $nitems = floor($s->n / 2);
    #	$nitems = $s->n;
    if ($nitems == 0) {
        $wgOut->addWikiText(wfMsg('nowatchlist'));
        return;
    }
    if (is_null($days) || !is_numeric($days)) {
        $big = 1000;
        /* The magical big */
        // WERELATE - don't change default; pages don't change that often
        //		if($nitems > $big) {
        # Set default cutoff shorter
        //			$days = $defaults['days'] = (12.0 / 24.0); # 12 hours...
        //		} else {
        $days = $defaults['days'];
        # default cutoff for shortlisters
        //		}
    } else {
        $days = floatval($days);
    }
    // Dump everything here
    $nondefaults = array();
    wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideOwn', (int) $hideOwn, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideBots', (int) $hideBots, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('namespace', $nameSpace, $defaults, $nondefaults);
    if ($days <= 0) {
        $docutoff = '';
        $cutoff = false;
        $npages = wfMsg('watchlistall1');
    } else {
        $docutoff = "AND rev_timestamp > '" . ($cutoff = $dbr->timestamp(time() - intval($days * 86400))) . "'";
        /*
        $sql = "SELECT COUNT(*) AS n FROM $page, $revision  WHERE rev_timestamp>'$cutoff' AND page_id=rev_page";
        $res = $dbr->query( $sql, $fname );
        $s = $dbr->fetchObject( $res );
        $npages = $s->n;
        */
        $npages = 40000 * $days;
    }
    /* Edit watchlist form */
    if ($wgRequest->getBool('edit') || $par == 'edit') {
        $wgOut->addWikiText(wfMsg('watchlistcontains', $wgLang->formatNum($nitems)) . "\n\n" . wfMsg('watcheditlist'));
        $wgOut->addHTML('<form action=\'' . $specialTitle->escapeLocalUrl('action=submit') . "' method='post'>\n");
        #		Patch A2
        #		The following was proposed by KTurner 07.11.2004 to T.Gries
        #		$sql = "SELECT distinct (wl_namespace & ~1),wl_title FROM $watchlist WHERE wl_user=$uid";
        $sql = "SELECT wl_namespace, wl_title, page_is_redirect FROM {$watchlist} LEFT JOIN {$page} ON wl_namespace = page_namespace AND wl_title = page_title WHERE wl_user={$uid}";
        $res = $dbr->query($sql, $fname);
        # Batch existence check
        $linkBatch = new LinkBatch();
        while ($row = $dbr->fetchObject($res)) {
            $linkBatch->addObj(Title::makeTitleSafe($row->wl_namespace, $row->wl_title));
        }
        $linkBatch->execute();
开发者ID:k-hasan-19,项目名称:wiki,代码行数:67,代码来源:SpecialWatchlist.php


示例3: wfSpecialRecentchanges


//.........这里部分代码省略.........
    $ft = $featured ? " AND page_is_featured = 1 " : "";
    // This is the big thing!
    $uid = $wgUser->getID();
    //XXCHANGED
    // Perform query
    $forceclause = $dbr->useIndexClause("rc_timestamp");
    $sql2 = "SELECT * FROM {$recentchanges} {$forceclause}" . ($uid ? "LEFT OUTER JOIN {$watchlist} ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . " LEFT OUTER JOIN page ON page_title=rc_title AND page_namespace=rc_namespace " . "WHERE rc_timestamp >= '{$cutoff}' {$hidem} {$ft} " . "ORDER BY rc_timestamp {$order} ";
    $sql2 = $dbr->limitResult($sql2, $limit, 0);
    $res = $dbr->query($sql2, $fname);
    // Fetch results, prepare a batch link existence check query
    $rows = array();
    $batch = new LinkBatch();
    while ($row = $dbr->fetchObject($res)) {
        $rows[] = $row;
        if (!$feedFormat) {
            // User page and talk links
            $batch->add(NS_USER, $row->rc_user_text);
            $batch->add(NS_USER_TALK, $row->rc_user_text);
        }
    }
    $dbr->freeResult($res);
    if ($feedFormat) {
        rcOutputFeed($rows, $feedFormat, $limit, $hideminor, $lastmod);
    } else {
        # Web output...
        // Run existence checks
        $batch->execute();
        $any = $wgRequest->getBool('categories_any', $defaults['categories_any']);
        // Output header
        if (!$specialPage->including()) {
            $wgOut->addWikiText('<div class="minor_text">' . wfMsgForContentNoTrans("recentchangestext") . '<br /></div>');
            // Dump everything here
            $nondefaults = array();
            wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('limit', $limit, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hideminor', $hideminor, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hidebots', $hidebots, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hideanons', $hideanons, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hideliu', $hideliu, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hidepatrolled', $hidepatrolled, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hidemyself', $hidemyself, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('from', $from, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('namespace', $namespace, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('invert', $invert, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('categories_any', $any, $defaults, $nondefaults);
            // Add end of the texts
            $wgOut->addHTML('<div class="rcoptions">' . rcOptionsPanel($defaults, $nondefaults) . "\n");
            //XXCHANGED
            $wgOut->addHTML(rcNamespaceForm($namespace, $invert, $reverse, $featured, $nondefaults, $any) . '</div>' . "\n");
            //XXADDED
            global $wgLanguageCode;
            if ($wgUser->getID() > 0 && $wgLanguageCode == 'en') {
                $sk = $wgUser->getSkin();
                $url = $wgRequest->getRequestURL();
                if ($wgRequest->getVal('refresh', null) != null) {
                    $url = str_replace("&refresh=1", "", $url);
                    $url = str_replace("?refresh=1", "", $url);
                    $wgOut->addHTML("<a href='{$url}' class='button secondary'>" . wfMsg('rc_turn_refresh_off') . "</a>");
                } else {
                    if (strpos($url, "?") !== false) {
                        $url .= "&refresh=1";
                    } else {
                        $url .= "?refresh=1";
                    }
                    $wgOut->addHTML("<a href='{$url}' class='button secondary'>" . wfMsg('rc_turn_refresh_on') . "</a>");
                }
开发者ID:ErdemA,项目名称:wikihow,代码行数:67,代码来源:SpecialRecentchanges.php


示例4: execute


//.........这里部分代码省略.........
     # Get namespace value, if supplied, and prepare a WHERE fragment
     $nameSpace = $wgRequest->getIntOrNull('namespace');
     $invert = $wgRequest->getIntOrNull('invert');
     if (!is_null($nameSpace)) {
         $nameSpace = intval($nameSpace);
         if ($invert && $nameSpace !== 'all') {
             $nameSpaceClause = "integration_rc_namespace != {$nameSpace}";
         } else {
             $nameSpaceClause = "integration_rc_namespace = {$nameSpace}";
         }
     } else {
         $nameSpace = '';
         $nameSpaceClause = '';
     }
     $dbr = wfGetDB(DB_SLAVE, 'integration_watchlist');
     $recentchanges = $dbr->tableName('integration_recentchanges');
     $nitems = $this->countItems();
     if (is_null($days) || !is_numeric($days)) {
         $big = 1000;
         /* The magical big */
         if ($nitems > $big) {
             # Set default cutoff shorter
             $days = $defaults['days'] = 12.0 / 24.0;
             # 12 hours...
         } else {
             $days = $defaults['days'];
             # default cutoff for shortlisters
         }
     } else {
         $days = floatval($days);
     }
     // Dump everything here
     $nondefaults = array();
     wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hideMinor', (int) $hideMinor, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hideBots', (int) $hideBots, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hideAnons', (int) $hideAnons, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hideLiu', (int) $hideLiu, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hideOwn', (int) $hideOwn, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('namespace', $nameSpace, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hidePatrolled', (int) $hidePatrolled, $defaults, $nondefaults);
     if ($nitems == 0) {
         $wgOut->addWikiMsg('nowatchlist');
         return;
     }
     # Possible where conditions
     $conds = array();
     if ($days <= 0) {
         $andcutoff = '';
     } else {
         $conds[] = "integration_rc_timestamp > '" . $dbr->timestamp(time() - intval($days * 86400)) . "'";
     }
     # If the watchlist is relatively short, it's simplest to zip
     # down its entirety and then sort the results.
     # If it's relatively long, it may be worth our while to zip
     # through the time-sorted page list checking for watched items.
     # Up estimate of watched items by 15% to compensate for talk pages...
     # Toggles
     if ($hideOwn) {
         $conds[] = "integration_rc_user != {$uid}";
     }
     if ($hideBots) {
         $conds[] = 'integration_rc_bot = 0';
     }
     if ($hideMinor) {
         $conds[] = 'integration_rc_minor = 0';
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:67,代码来源:SpecialInterwikiWatchlist.php


示例5: wfSpecialRecentchanges


//.........这里部分代码省略.........
    } else {
        $from = $defaults['from'];
    }
    # 10 seconds server-side caching max
    $wgOut->setSquidMaxage(10);
    # Get last modified date, for client caching
    # Don't use this if we are using the patrol feature, patrol changes don't update the timestamp
    $lastmod = $dbr->selectField('recentchanges', 'MAX(rc_timestamp)', false, $fname);
    if ($feedFormat || !$wgUseRCPatrol) {
        if ($lastmod && $wgOut->checkLastModified($lastmod)) {
            # Client cache fresh and headers sent, nothing more to do.
            return;
        }
    }
    $hidem = $hideminor ? 'AND rc_minor=0' : '';
    $hidem .= $hidebots ? ' AND rc_bot=0' : '';
    $hidem .= $hideliu ? ' AND rc_user=0' : '';
    $hidem .= $hidepatrolled ? ' AND rc_patrolled=0' : '';
    $hidem .= is_null($namespace) ? '' : ' AND rc_namespace' . ($invert ? '!=' : '=') . $namespace;
    // This is the big thing!
    $uid = $wgUser->getID();
    // Perform query
    if ($wgRCShowCurrentRevisionOnly && $wgUser->getOption('rccurrevonly')) {
        $sql2 = "SELECT {$recentchanges}.*" . ($uid ? ",wl_user,wl_notificationtimestamp,wl_lastvisitedrevision" : "") . " FROM {$recentchanges},{$page} " . ($uid ? "LEFT OUTER JOIN {$watchlist} ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . "WHERE rc_timestamp > '{$cutoff}' {$hidem} AND rc_this_oldid=page_latest " . "ORDER BY rc_timestamp DESC LIMIT {$limit}";
    } else {
        $sql2 = "SELECT {$recentchanges}.*" . ($uid ? ",wl_user,wl_notificationtimestamp,wl_lastvisitedrevision" : "") . " FROM {$recentchanges} " . ($uid ? "LEFT OUTER JOIN {$watchlist} ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . "WHERE rc_timestamp > '{$cutoff}' {$hidem} " . "ORDER BY rc_timestamp DESC LIMIT {$limit}";
    }
    $res = $dbr->query($sql2, $fname);
    // Fetch results, prepare a batch link existence check query
    $rows = array();
    $batch = new LinkBatch();
    while ($row = $dbr->fetchObject($res)) {
        $rows[] = $row;
        // User page link
        $title = Title::makeTitleSafe(NS_USER, $row->rc_user_text);
        $batch->addObj($title);
        // User talk
        $title = Title::makeTitleSafe(NS_USER_TALK, $row->rc_user_text);
        $batch->addObj($title);
    }
    $dbr->freeResult($res);
    // Run existence checks
    $batch->execute($wgLinkCache);
    if ($feedFormat) {
        rcOutputFeed($rows, $feedFormat, $limit, $hideminor, $lastmod);
    } else {
        # Web output...
        // Output header
        if (!$specialPage->including()) {
            $wgOut->addWikiText(wfMsgForContent("recentchangestext"));
            // Dump everything here
            $nondefaults = array();
            wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('limit', $limit, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hideminor', $hideminor, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hidebots', $hidebots, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hideliu', $hideliu, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('hidepatrolled', $hidepatrolled, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('from', $from, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('namespace', $namespace, $defaults, $nondefaults);
            wfAppendToArrayIfNotDefault('invert', $invert, $defaults, $nondefaults);
            // Add end of the texts
            $wgOut->addHTML('<div class="rcoptions">' . rcOptionsPanel($defaults, $nondefaults));
            $wgOut->addHTML(rcNamespaceForm($namespace, $invert, $nondefaults) . '</div>');
        }
        // And now for the content
        $sk = $wgUser->getSkin();
        $wgOut->setSyndicated(true);
        $list =& new ChangesList($sk);
        $s = $list->beginRecentChangesList();
        $counter = 1;
        foreach ($rows as $obj) {
            if ($limit == 0) {
                break;
            }
            if (!($hideminor && $obj->rc_minor) && !($hidepatrolled && $obj->rc_patrolled)) {
                $rc = RecentChange::newFromRow($obj);
                $rc->counter = $counter++;
                if ($wgShowUpdatedMarker && $wgUser->getOption('showupdated') && !empty($obj->wl_notificationtimestamp) && $obj->rc_timestamp >= $obj->wl_notificationtimestamp) {
                    $rc->notificationtimestamp = true;
                } else {
                    $rc->notificationtimestamp = false;
                }
                if ($wgRCShowWatchingUsers && $wgUser->getOption('shownumberswatching')) {
                    $sql3 = "SELECT COUNT(*) AS n FROM {$watchlist} WHERE wl_title='" . $dbr->strencode($obj->rc_title) . "' AND wl_namespace={$obj->rc_namespace}";
                    $res3 = $dbr->query($sql3, 'wfSpecialRecentChanges');
                    $x = $dbr->fetchObject($res3);
                    $rc->numberofWatchingusers = $x->n;
                } else {
                    $rc->numberofWatchingusers = 0;
                }
                $rc->lastvisitedrevision = $uid ? $obj->wl_lastvisitedrevision : 0;
                $s .= $list->recentChangesLine($rc, !empty($obj->wl_user));
                --$limit;
            }
        }
        $s .= $list->endRecentChangesList();
        $wgOut->addHTML($s);
    }
}
开发者ID:BackupTheBerlios,项目名称:enotifwiki,代码行数:101,代码来源:SpecialRecentchanges.php


示例6: wfSpecialWatchlist

/**
 * Constructor
 *
 * @param $par Parameter passed to the page
 */
function wfSpecialWatchlist($par)
{
    global $wgUser, $wgOut, $wgLang, $wgRequest;
    global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker;
    global $wgEnotifWatchlist;
    $skin = $wgUser->getSkin();
    $specialTitle = SpecialPage::getTitleFor('Watchlist');
    $wgOut->setRobotPolicy('noindex,nofollow');
    # Anons don't get a watchlist
    if ($wgUser->isAnon()) {
        $wgOut->setPageTitle(wfMsg('watchnologin'));
        $llink = $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Userlogin'), wfMsgHtml('loginreqlink'), 'returnto=' . $specialTitle->getPrefixedUrl());
        $wgOut->addHTML(wfMsgWikiHtml('watchlistanontext', $llink));
        return;
    }
    $wgOut->setPageTitle(wfMsg('watchlist'));
    $sub = wfMsgExt('watchlistfor', 'parseinline', $wgUser->getName());
    $sub .= '<br />' . WatchlistEditor::buildTools($wgUser->getSkin());
    $wgOut->setSubtitle($sub);
    if (($mode = WatchlistEditor::getMode($wgRequest, $par)) !== false) {
        $editor = new WatchlistEditor();
        $editor->execute($wgUser, $wgOut, $wgRequest, $mode);
        return;
    }
    $uid = $wgUser->getId();
    if (($wgEnotifWatchlist || $wgShowUpdatedMarker) && $wgRequest->getVal('reset') && $wgRequest->wasPosted()) {
        $wgUser->clearAllNotifications($uid);
        $wgOut->redirect($specialTitle->getFullUrl());
        return;
    }
    $defaults = array('days' => floatval($wgUser->getOption('watchlistdays')), 'hideMinor' => (int) $wgUser->getBoolOption('watchlisthideminor'), 'hideBots' => (int) $wgUser->getBoolOption('watchlisthidebots'), 'hideAnons' => (int) $wgUser->getBoolOption('watchlisthideanons'), 'hideLiu' => (int) $wgUser->getBoolOption('watchlisthideliu'), 'hidePatrolled' => (int) $wgUser->getBoolOption('watchlisthidepatrolled'), 'hideOwn' => (int) $wgUser->getBoolOption('watchlisthideown'), 'namespace' => 'all', 'invert' => false);
    extract($defaults);
    # Extract variables from the request, falling back to user preferences or
    # other default values if these don't exist
    $prefs['days'] = floatval($wgUser->getOption('watchlistdays'));
    $prefs['hideminor'] = $wgUser->getBoolOption('watchlisthideminor');
    $prefs['hidebots'] = $wgUser->getBoolOption('watchlisthidebots');
    $prefs['hideanons'] = $wgUser->getBoolOption('watchlisthideanon');
    $prefs['hideliu'] = $wgUser->getBoolOption('watchlisthideliu');
    $prefs['hideown'] = $wgUser->getBoolOption('watchlisthideown');
    $prefs['hidepatrolled'] = $wgUser->getBoolOption('watchlisthidepatrolled');
    # Get query variables
    $days = $wgRequest->getVal('days', $prefs['days']);
    $hideMinor = $wgRequest->getBool('hideMinor', $prefs['hideminor']);
    $hideBots = $wgRequest->getBool('hideBots', $prefs['hidebots']);
    $hideAnons = $wgRequest->getBool('hideAnons', $prefs['hideanons']);
    $hideLiu = $wgRequest->getBool('hideLiu', $prefs['hideliu']);
    $hideOwn = $wgRequest->getBool('hideOwn', $prefs['hideown']);
    $hidePatrolled = $wgRequest->getBool('hidePatrolled', $prefs['hidepatrolled']);
    # Get namespace value, if supplied, and prepare a WHERE fragment
    $nameSpace = $wgRequest->getIntOrNull('namespace');
    $invert = $wgRequest->getIntOrNull('invert');
    if (!is_null($nameSpace)) {
        $nameSpace = intval($nameSpace);
        if ($invert && $nameSpace !== 'all') {
            $nameSpaceClause = "rc_namespace != {$nameSpace}";
        } else {
            $nameSpaceClause = "rc_namespace = {$nameSpace}";
        }
    } else {
        $nameSpace = '';
        $nameSpaceClause = '';
    }
    $dbr = wfGetDB(DB_SLAVE, 'watchlist');
    list($page, $watchlist, $recentchanges) = $dbr->tableNamesN('page', 'watchlist', 'recentchanges');
    $watchlistCount = $dbr->selectField('watchlist', 'COUNT(*)', array('wl_user' => $uid), __METHOD__);
    // Adjust for page X, talk:page X, which are both stored separately,
    // but treated together
    $nitems = floor($watchlistCount / 2);
    if (is_null($days) || !is_numeric($days)) {
        $big = 1000;
        /* The magical big */
        if ($nitems > $big) {
            # Set default cutoff shorter
            $days = $defaults['days'] = 12.0 / 24.0;
            # 12 hours...
        } else {
            $days = $defaults['days'];
            # default cutoff for shortlisters
        }
    } else {
        $days = floatval($days);
    }
    // Dump everything here
    $nondefaults = array();
    wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideMinor', (int) $hideMinor, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideBots', (int) $hideBots, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideAnons', (int) $hideAnons, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideLiu', (int) $hideLiu, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideOwn', (int) $hideOwn, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('namespace', $nameSpace, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hidePatrolled', (int) $hidePatrolled, $defaults, $nondefaults);
    if ($nitems == 0) {
        $wgOut->addWikiMsg('nowatchlist');
//.........这里部分代码省略.........
开发者ID:amjadtbssm,项目名称:website,代码行数:101,代码来源:SpecialWatchlist.php


示例7: setup

 protected function setup($parameters)
 {
     $defaults = array('module' => '', 'language' => $this->getUser()->getOption('language'), 'export' => false, 'savetodb' => false);
     /**
      * Place where all non default variables will end.
      */
     $nondefaults = array();
     /**
      * Temporary store possible values parsed from parameters.
      */
     $options = $defaults;
     $request = $this->getRequest();
     foreach ($options as $v => $t) {
         if (is_bool($t)) {
             $r = $request->getBool($v, $options[$v]);
         } elseif (is_int($t)) {
             $r = $request->getInt($v, $options[$v]);
         } elseif (is_string($t)) {
             $r = $request->getText($v, $options[$v]);
         }
         if (!isset($r)) {
             throw new MWException('$r was not set');
         }
         wfAppendToArrayIfNotDefault($v, $r, $defaults, $nondefaults);
     }
     $this->defaults = $defaults;
     $this->nondefaults = $nondefaults;
     $this->options = $nondefaults + $defaults;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:29,代码来源:SpecialMagic.php


示例8: execute


//.........这里部分代码省略.........
        $hideBots = $wgRequest->getBool('hideBots', $prefs['hidebots']);
        $hideAnons = $wgRequest->getBool('hideAnons', $prefs['hideanons']);
        $hideLiu = $wgRequest->getBool('hideLiu', $prefs['hideliu']);
        $hideOwn = $wgRequest->getBool('hideOwn', $prefs['hideown']);
        $hideListUser = $wgRequest->getBool('hideListUser', $prefs['hidelistuser']);
        $hidePatrolled = $wgRequest->getBool('hidePatrolled', $prefs['hidepatrolled']);
        $filterTags = implode('|', $tagFilter);
        $invertTags = $wgRequest->getBool('invertTags', $prefs['invertTags']);
        # Get collabwatchlist value, if supplied, and prepare a WHERE fragment
        $collabWatchlist = $wgRequest->getIntOrNull('collabwatchlist');
        if (!is_null($collabWatchlist) && $collabWatchlist !== 'all') {
            $collabWatchlist = intval($collabWatchlist);
        }
        if (array_key_exists($collabWatchlist, $listIdsAndNames)) {
            $wgOut->addHTML(Xml::element('h2', null, $listIdsAndNames[$collabWatchlist]));
        }
        if (($mode = CollabWatchlistEditor::getMode($wgRequest, $par)) !== false) {
            $editor = new CollabWatchlistEditor();
            $editor->execute($collabWatchlist, $listIdsAndNames, $wgOut, $wgRequest, $mode);
            return;
        }
        if (!$collabWatchlist) {
            return;
        }
        $dbr = wfGetDB(DB_SLAVE, 'watchlist');
        $recentchanges = $dbr->tableName('recentchanges');
        $nitems = $dbr->selectField('collabwatchlistcategory', 'COUNT(*)', $collabWatchlist == 0 ? array() : array('cw_id' => $collabWatchlist), __METHOD__);
        if ($nitems == 0) {
            $wgOut->addWikiMsg('nowatchlist');
            return;
        }
        // Dump everything here
        $nondefaults = array();
        wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('hideMinor', (int) $hideMinor, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('hideBots', (int) $hideBots, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('hideAnons', (int) $hideAnons, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('hideLiu', (int) $hideLiu, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('hideOwn', (int) $hideOwn, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('hideListUser', (int) $hideListUser, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('collabwatchlist', $collabWatchlist, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('hidePatrolled', (int) $hidePatrolled, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('filterTags', $filterTags, $defaults, $nondefaults);
        wfAppendToArrayIfNotDefault('invertTags', $invertTags, $defaults, $nondefaults);
        if ($days <= 0) {
            $andcutoff = '';
        } else {
            $andcutoff = "rc_timestamp > '" . $dbr->timestamp(time() - intval($days * 86400)) . "'";
        }
        # If the watchlist is relatively short, it's simplest to zip
        # down its entirety and then sort the results.
        # If it's relatively long, it may be worth our while to zip
        # through the time-sorted page list checking for watched items.
        # Up estimate of watched items by 15% to compensate for talk pages...
        # Toggles
        $andHideOwn = $hideOwn ? "rc_user != {$uid}" : '';
        $andHideBots = $hideBots ? "rc_bot = 0" : '';
        $andHideMinor = $hideMinor ? "rc_minor = 0" : '';
        $andHideLiu = $hideLiu ? "rc_user = 0" : '';
        $andHideAnons = $hideAnons ? "rc_user != 0" : '';
        $andHideListUser = $hideListUser ? $this->wlGetFilterClauseListUser($collabWatchlist) : '';
        $andHidePatrolled = $wgUser->useRCPatrol() && $hidePatrolled ? "rc_patrolled != 1" : '';
        # Toggle watchlist content (all recent edits or just the latest)
        if ($wgUser->getOption('extendwatchlist')) {
            $andLatest = '';
            $limitWatchlist = intval($wgUser->getOption('wllimit'));
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:67,代码来源:SpecialCollabWatchlist.php


示例9: execute


//.........这里部分代码省略.........
         $bool_op = $invert ? 'AND' : 'OR';
         $nameSpace = intval($nameSpace);
         // paranioa
         if (!$associated) {
             $nameSpaceClause = "rc_namespace {$eq_op} {$nameSpace}";
         } else {
             $associatedNS = MWNamespace::getAssociated($nameSpace);
             $nameSpaceClause = "rc_namespace {$eq_op} {$nameSpace} " . $bool_op . " rc_namespace {$eq_op} {$associatedNS}";
         }
     } else {
         $nameSpace = '';
         $nameSpaceClause = '';
     }
     $values['namespace'] = $nameSpace;
     $values['invert'] = $invert;
     $values['associated'] = $associated;
     if (is_null($values['days']) || !is_numeric($values['days'])) {
         $big = 1000;
         /* The magical big */
         if ($nitems > $big) {
             # Set default cutoff shorter
             $values['days'] = $defaults['days'] = 12.0 / 24.0;
             # 12 hours...
         } else {
             $values['days'] = $defaults['days'];
             # default cutoff for shortlisters
         }
     } else {
         $values['days'] = floatval($values['days']);
     }
     // Dump everything here
     $nondefaults = array();
     foreach ($defaults as $name => $defValue) {
         wfAppendToArrayIfNotDefault($name, $values[$name], $defaults, $nondefaults);
     }
     if (($wgEnotifWatchlist || $wgShowUpdatedMarker) && $request->getVal('reset') && $request->wasPosted()) {
         $user->clearAllNotifications();
         $output->redirect($this->getTitle()->getFullUrl($nondefaults));
         return;
     }
     $dbr = wfGetDB(DB_SLAVE, 'watchlist');
     # Possible where conditions
     $conds = array();
     if ($values['days'] > 0) {
         $conds[] = "rc_timestamp > '" . $dbr->timestamp(time() - intval($values['days'] * 86400)) . "'";
     }
     # If the watchlist is relatively short, it's simplest to zip
     # down its entirety and then sort the results.
     # If it's relatively long, it may be worth our while to zip
     # through the time-sorted page list checking for watched items.
     # Up estimate of watched items by 15% to compensate for talk pages...
     # Toggles
     if ($values['hideOwn']) {
         $conds[] = 'rc_user != ' . $user->getId();
     }
     if ($values['hideBots']) {
         $conds[] = 'rc_bot = 0';
     }
     if ($values['hideMinor']) {
         $conds[] = 'rc_minor = 0';
     }
     if ($values['hideLiu']) {
         $conds[] = 'rc_user = 0';
     }
     if ($values['hideAnons']) {
         $conds[] = 'rc_user != 0';
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:67,代码来源:SpecialWatchlist.php


示例10: wfSpecialWatchlist

/**
 * Constructor
 *
 * @param $par Parameter passed to the page
 */
function wfSpecialWatchlist($par)
{
    global $wgUser, $wgOut, $wgLang, $wgRequest;
    global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker;
    global $wgEnotifWatchlist;
    $fname = 'wfSpecialWatchlist';
    $skin = $wgUser->getSkin();
    $specialTitle = SpecialPage::getTitleFor('Watchlist');
    $wgOut->setRobotPolicy('noindex,nofollow');
    # Anons don't get a watchlist
    if ($wgUser->isAnon()) {
        $wgOut->setPageTitle(wfMsg('watchnologin'));
        $llink = $skin->makeKnownLinkObj(SpecialPage::getTitleFor('Userlogin'), wfMsgHtml('loginreqlink'), 'returnto=' . $specialTitle->getPrefixedUrl());
        $wgOut->addHtml(wfMsgWikiHtml('watchlistanontext', $llink));
        return;
    }
    $wgOut->setPageTitle(wfMsg('watchlist'));
    $sub = wfMsgExt('watchlistfor', 'parseinline', $wgUser->getName());
    $sub .= '<br />' . WatchlistEditor::buildTools($wgUser->getSkin());
    $wgOut->setSubtitle($sub);
    if (($mode = WatchlistEditor::getMode($wgRequest, $par)) !== false) {
        $editor = new WatchlistEditor();
        $editor->execute($wgUser, $wgOut, $wgRequest, $mode);
        return;
    }
    $uid = $wgUser->getId();
    if ($wgEnotifWatchlist && $wgRequest->getVal('reset') && $wgRequest->wasPosted()) {
        $wgUser->clearAllNotifications($uid);
        $wgOut->redirect($specialTitle->getFullUrl());
        return;
    }
    $defaults = array('days' => floatval($wgUser->getOption('watchlistdays')), 'hideOwn' => (int) $wgUser->getBoolOption('watchlisthideown'), 'hideBots' => (int) $wgUser->getBoolOption('watchlisthidebots'), 'hideMinor' => (int) $wgUser->getBoolOption('watchlisthideminor'), 'namespace' => 'all');
    extract($defaults);
    # Extract variables from the request, falling back to user preferences or
    # other default values if these don't exist
    $prefs['days'] = floatval($wgUser->getOption('watchlistdays'));
    $prefs['hideown'] = $wgUser->getBoolOption('watchlisthideown');
    $prefs['hidebots'] = $wgUser->getBoolOption('watchlisthidebots');
    $prefs['hideminor'] = $wgUser->getBoolOption('watchlisthideminor');
    # Get query variables
    $days = $wgRequest->getVal('days', $prefs['days']);
    $hideOwn = $wgRequest->getBool('hideOwn', $prefs['hideown']);
    $hideBots = $wgRequest->getBool('hideBots', $prefs['hidebots']);
    $hideMinor = $wgRequest->getBool('hideMinor', $prefs['hideminor']);
    # Get namespace value, if supplied, and prepare a WHERE fragment
    $nameSpace = $wgRequest->getIntOrNull('namespace');
    if (!is_null($nameSpace)) {
        $nameSpace = intval($nameSpace);
        $nameSpaceClause = " AND rc_namespace = {$nameSpace}";
    } else {
        $nameSpace = '';
        $nameSpaceClause = '';
    }
    $dbr = wfGetDB(DB_SLAVE, 'watchlist');
    list($page, $watchlist, $recentchanges) = $dbr->tableNamesN('page', 'watchlist', 'recentchanges');
    $sql = "SELECT COUNT(*) AS n FROM {$watchlist} WHERE wl_user={$uid}";
    $res = $dbr->query($sql, $fname);
    $s = $dbr->fetchObject($res);
    #	Patch *** A1 *** (see A2 below)
    #	adjust for page X, talk:page X, which are both stored separately, but treated together
    $nitems = floor($s->n / 2);
    #	$nitems = $s->n;
    if ($nitems == 0) {
        $wgOut->addWikiText(wfMsg('nowatchlist'));
        return;
    }
    if (is_null($days) || !is_numeric($days)) {
        $big = 1000;
        /* The magical big */
        if ($nitems > $big) {
            # Set default cutoff shorter
            $days = $defaults['days'] = 12.0 / 24.0;
            # 12 hours...
        } else {
            $days = $defaults['days'];
            # default cutoff for shortlisters
        }
    } else {
        $days = floatval($days);
    }
    // Dump everything here
    $nondefaults = array();
    wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideOwn', (int) $hideOwn, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideBots', (int) $hideBots, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('hideMinor', (int) $hideMinor, $defaults, $nondefaults);
    wfAppendToArrayIfNotDefault('namespace', $nameSpace, $defaults, $nondefaults);
    if ($days <= 0) {
        $andcutoff = '';
    } else {
        $andcutoff = "AND rc_timestamp > '" . $dbr->timestamp(time() - intval($days * 86400)) . "'";
        /*
        $sql = "SELECT COUNT(*) AS n FROM $page, $revision  WHERE rev_timestamp>'$cutoff' AND page_id=rev_page";
        $res = $dbr->query( $sql, $fname );
        $s = $dbr->fetchObject( $res );
//.........这里部分代码省略.........
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:101,代码来源:SpecialWatchlist.php


示例11: prepare

 public function prepare()
 {
     global $wgUser, $wgRequest, $wgShowUpdatedMarker;
     $fname = 'Watchlist::prepare';
     $defaults = array('days' => floatval($wgUser->getGlobalPreference('watchlistdays')), 'hideOwn' => (int) $wgUser->getGlobalPreference('watchlisthideown'), 'hideBots' => (int) $wgUser->getGlobalPreference('watchlisthidebots'), 'hideMinor' => (int) $wgUser->getGlobalPreference('watchlisthideminor'), 'namespace' => 'all');
     extract($defaults);
     # Extract variables from the request, falling back to user preferences or
     # other default values if these don't exist
     $prefs['days'] = floatval($wgUser->getGlobalPreference('watchlistdays'));
     $prefs['hideown'] = (bool) $wgUser->getGlobalPreference('watchlisthideown');
     $prefs['hidebots'] = (bool) $wgUser->getGlobalPreference('watchlisthidebots');
     $prefs['hideminor'] = (bool) $wgUser->getGlobalPreference('watchlisthideminor');
     # Get query variables
     $days = $wgRequest->getVal('days', $prefs['days']);
     $hideOwn = $wgRequest->getBool('hideOwn', $prefs['hideown']);
     $hideBots = $wgRequest->getBool('hideBots', $prefs['hidebots']);
     $hideMinor = $wgRequest->getBool('hideMinor', $prefs['hideminor']);
     # Get namespace value, if supplied, and prepare a WHERE fragment
     $nameSpace = $wgRequest->getIntOrNull('namespace');
     if (!is_null($nameSpace)) {
         $nameSpace = intval($nameSpace);
         $nameSpaceClause = " AND rc_namespace = {$nameSpace}";
     } else {
         $nameSpace = '';
         $nameSpaceClause = '';
     }
     $this->mDbr = wfGetDB(DB_SLAVE, 'watchlist');
     list($page, $watchlist, $recentchanges) = $this->mDbr->tableNamesN('page', 'watchlist', 'recentchanges');
     $uid = $wgUser->getId();
     $watchlistCount = $this->mDbr->selectField('watchlist', 'COUNT(*)', array('wl_user' => $uid), __METHOD__);
     // Adjust for page X, talk:page X, which are both stored separately,
     // but treated together
     $nitems = floor($watchlistCount / 2);
     if (is_null($days) || !is_numeric($days)) {
         $big = 1000;
         /* The magical big */
         if ($nitems > $big) {
             # Set default cutoff shorter
             $days = $defaults['days'] = 12.0 / 24.0;
             # 12 hours...
         } else {
             $days = $defaults['days'];
             # default cutoff for shortlisters
         }
     } else {
         $days = floatval($days);
     }
     // Dump everything here
     $nondefaults = array();
     wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hideOwn', (int) $hideOwn, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hideBots', (int) $hideBots, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('hideMinor', (int) $hideMinor, $defaults, $nondefaults);
     wfAppendToArrayIfNotDefault('namespace', $nameSpace, $defaults, $nondefaults);
     $hookSql = "";
     if (!wfRunHooks('BeforeWatchlist', array($nondefaults, $wgUser, &$hookSql))) {
         return;
     }
     if ($days <= 0) {
         $andcutoff = '';
     } else {
         $andcutoff = "AND rc_timestamp > '" . $this->mDbr->timestamp(time() - intval($days * 86400)) . "'";
         /*
         $sql = "SELECT COUNT(*) AS n FROM $page, $revision  WHERE rev_timestamp>'$cutoff' AND page_id=rev_page";
         $this->mChanges = $this->mDbr->query( $sql, $fname );
         $s = $this->mDbr->fetchObject( $this->mChanges );
         $npages = $s->n;
         */
     }
     # If the watchlist is relatively short, it's simplest to zip
     # down its entirety and then sort the results.
     # If it's relatively long, it may be worth our while to zip
     # through the time-sorted page list checking for watched items.
     # Up estimate of watched items by 15% to compensate for talk pages...
     # Toggles
     $andHideOwn = $hideOwn ? "AND (rc_user <> {$uid})" : '';
     $andHideBots = $hideBots ? "AND (rc_bot = 0)" : '';
     $andHideMinor = $hideMinor ? 'AND rc_minor = 0' : '';
     # Toggle watchlist content (all recent edits or just the latest)
     if ($wgUser->getGlobalPreference('extendwatchlist')) {
         $andLatest = '';
         $limitWatchlist = 'LIMIT ' . intval($wgUser->getGlobalPreference('wllimit'));
     } else {
         # Top log Ids for a page are not stored
         $andLatest = 'AND (rc_this_oldid=page_latest OR rc_type=' . RC_LOG . ') ';
         $limitWatchlist = '';
     }
     if ($wgShowUpdatedMarker) {
         $wltsfield = ", {$watchlist}.wl_notificationtimestamp ";
     } else {
         $wltsfield = '';
     }
     $sql = "SELECT {$recentchanges}.* {$wltsfield}\n\t\t  FROM {$watchlist},{$recentchanges}\n\t\t  LEFT JOIN {$page} ON rc_cur_id=page_id\n\t\t  WHERE wl_user={$uid}\n\t\t  AND wl_namespace=rc_namespace\n\t\t  AND wl_title=rc_title\n\t\t  {$andcutoff}\n\t\t  {$andLatest}\n\t\t  {$andHideOwn}\n\t\t  {$andHideBots}\n\t\t  {$andHideMinor}\n\t\t  {$nameSpaceClause}\n\t\t  {$hookSql}\n\t\t  ORDER BY rc_timestamp DESC\n\t\t  {$limitWatchlist}";
     $this->mChanges = $this->mDbr->query($sql, $fname);
     $numRows = $this->mDbr->numRows($this->mChanges);
     # If there's nothing to show, stop here
     if ($numRows == 0) {
         return;
     }
     // Do link batch query - NOTE: I don't know what this section does or wheter it's needed - SWC 20081127
//.........这里部分代码省略.........
开发者ID:Tjorriemorrie,项目名称:app,代码行数:101,代码来源:Special_WatchlistFeed.body.php


示例12: buildRssWatch

 public function buildRssWatch($par)
 {
     // TODO SU (04.07.11 10:35): Globals
     global $wgUser, $wgOut, $wgRequest, $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker, $wgEnotifWatchlist, $wgSitename;
     $skin = RequestContext::getMain()->getSkin();
     $specialTitle = SpecialPage::getTitleFor('Watchlist');
     $wgOut->setRobotPolicy('noindex,nofollow');
     # Anons don't get a watchlist
     if ($wgUser->isAnon()) {
         $_user = $wgRequest->getVal('u', '');
         $user = User::newFromName($_user);
         $_hash = $wgRequest->getVal('h', '');
         if (!($user && $_hash == md5($_user . $user->getToken() . $user->getId())) || $user->isAnon()) {
             $oTitle = SpecialPage::getTitleFor('Userlogin');
             $sLink = Linker::link($oTitle, wfMessage('loginreqlink')->plain(), array(), array('returnto' => $specialTitle->getLocalUrl()));
             throw new ErrorPageError('bs-rssstandards-watchnologin', 'watchlistanontext', array($sLink));
         }
     } else {
         $user = $wgUser;
     }
     $wgOut->setPageTitle(wfMessage('bs-rssstandards-watchlist')->plain());
     $sub = wfMessage('watchlistfor', $user->getName())->parse();
     $sub .= '<br />' . WatchlistEditor::buildTools($user->getSkin());
     $wgOut->setSubtitle($sub);
     if (($mode = WatchlistEditor::getMode($wgRequest, $par)) !== false) {
         $editor = new WatchlistEditor();
         $editor->execute($user, $wgOut, $wgRequest, $mode);
         return;
     }
     $uid = $user->getId();
     if (($wgEnotifWatchlist || $wgShowUpdatedMarker) && $wgRequest->getVal('reset') && $wgRequest->wasPosted()) {
         $user->clearAllNotifications($uid);
         $wgOut->redirect($specialTitle->getFullUrl());
         return;
     }
     $defaults = array('days' => floatval($user->getOption('watchlistdays')), 'hideOwn' => (int) $user->getBoolOption('watchlisthideown'), 'hideBots' => (int) $user->getBoolOption('watchlisthidebots'), 'hideMinor' => (int) $user->getBoolOption('watchlisthideminor'), 'namespace' => 'all');
     extract($defaults);
     # Extract variables from the request, falling back to user preferences or
     # other default values if these don't exist
     $prefs['days'] = floatval($user->getOption('watchlistdays'));
     $prefs['hideown'] = $user->getBoolOption('watchlisthideown');
     $prefs['hidebots'] = $user->getBoolOption('watchlisthidebots');
     $prefs['hideminor'] = $user->getBoolOption('watchlisthideminor');
     # Get query variables
     $days = $wgRequest->getVal('days', $prefs['days']);
     $hideOwn = $wgRequest->getBool('hideOwn', $prefs['hideown']);
     $hideBots = $wgRequest->getBool('hideBots', $prefs['hidebots']);
     $hideMinor = $wgRequest->getBool('hideMinor', $prefs['hideminor']);
     # Get namespace value, if supplied, and prepare a WHERE fragment
     $nameSpace = $wgRequest->getIntOrNull('namespace');
     if (!is_null($nameSpace)) {
         $nameSpace = intval($nameSpace);
         $nameSpaceClause = " AND rc_namespace = {$nameSpace}";
     } else {
         $nameSpace = '';
         $nameSpaceClause = '';
     }
     $dbr = wfGetDB(DB_SLAVE, 'watchlist');
     list($page, $watchlist, $recentchanges) = $dbr->tableNamesN('page', 'watchlist', 'recentchanges');
     $watchlistCount = $dbr->selectField('watchlist', 'COUNT(*)', array('wl_user' => $uid), __METHOD__);
     // Adjust for page X, talk:page X, which are both stored separately,
     // but treated together
     $nitems = floor($watchlistCount / 2);
     if (is_null($days) || !is_numeric($days)) {
         $big = 1000;
         /* The magical big */
         if ($nitems > $big) {
             # Set default cutoff shorter
             $days = $defaults['days'] = 12.0 / 24.0;
             # 12 hours...
         } else {
             $days = $defaults['days'];
             # default cutoff for shortlisters
         }
     

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wfArrayDiff2函数代码示例发布时间:2022-05-23
下一篇:
PHP wfAppendQuery函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap