コード例 #1
0
ファイル: index.php プロジェクト: puring0815/OpenKore
OutputPage::setEncodings();
# Not really used yet
# Query string fields
$action = $wgRequest->getVal('action', 'view');
$title = $wgRequest->getVal('title');
#
# Send Ajax requests to the Ajax dispatcher.
#
if ($wgUseAjax && $action == 'ajax') {
    require_once $IP . '/includes/AjaxDispatcher.php';
    $dispatcher = new AjaxDispatcher();
    $dispatcher->performAction();
    $mediaWiki->restInPeace($wgLoadBalancer);
    exit;
}
$wgTitle = $mediaWiki->checkInitialQueries($title, $action, $wgOut, $wgRequest, $wgContLang);
if ($wgTitle == NULL) {
    unset($wgTitle);
}
wfProfileOut('main-misc-setup');
# Setting global variables in mediaWiki
$mediaWiki->setVal('Server', $wgServer);
$mediaWiki->setVal('DisableInternalSearch', $wgDisableInternalSearch);
$mediaWiki->setVal('action', $action);
$mediaWiki->setVal('SquidMaxage', $wgSquidMaxage);
$mediaWiki->setVal('EnableDublinCoreRdf', $wgEnableDublinCoreRdf);
$mediaWiki->setVal('EnableCreativeCommonsRdf', $wgEnableCreativeCommonsRdf);
$mediaWiki->setVal('CommandLineMode', $wgCommandLineMode);
$mediaWiki->setVal('UseExternalEditor', $wgUseExternalEditor);
$mediaWiki->setVal('DisabledActions', $wgDisabledActions);
$wgArticle = $mediaWiki->initialize($wgTitle, $wgOut, $wgUser, $wgRequest);
コード例 #2
0
ファイル: index.php プロジェクト: GodelDesign/Godel
$preIP = dirname(__FILE__);
require_once "{$preIP}/includes/WebStart.php";
# Initialize MediaWiki base class
$mediaWiki = new MediaWiki();
wfProfileIn('main-misc-setup');
OutputPage::setEncodings();
# Not really used yet
$maxLag = $wgRequest->getVal('maxlag');
if (!is_null($maxLag) && !$mediaWiki->checkMaxLag($maxLag)) {
    exit;
}
# Query string fields
$action = $wgRequest->getVal('action', 'view');
$title = $wgRequest->getVal('title');
# Set title from request parameters
$wgTitle = $mediaWiki->checkInitialQueries($title, $action);
if ($wgTitle === null) {
    unset($wgTitle);
}
wfProfileOut('main-misc-setup');
#
# Send Ajax requests to the Ajax dispatcher.
#
if ($wgUseAjax && $action == 'ajax') {
    require_once $IP . '/includes/AjaxDispatcher.php';
    $dispatcher = new AjaxDispatcher();
    $dispatcher->performAction();
    $mediaWiki->restInPeace();
    exit;
}
if ($wgUseFileCache && isset($wgTitle)) {
コード例 #3
0
function GetWikiPage($page, $pID, $namespace = '', $memID = '')
{
    global $wgOut, $wgRequest, $wgContLang, $wgUser, $rev_timestamp, $wgParser;
    #, $wgTitle, $wgTitle;
    #die(print_r($wgOut));
    # name space
    # forum preview
    # adding wiki tabs across the top of the post
    #die("GetWikiPage <br />" . $page);
    $page = str_replace('&lt;wiki&gt;', '<wiki>', $page);
    $page = str_replace('&lt;/wiki&gt;', '</wiki>', $page);
    $ns = null;
    if ($namespace != '') {
        $ns = $namespace;
        $namespace = " AND p.page_namespace={$namespace} ";
    } else {
        $namespace = " AND p.page_namespace=0 ";
    }
    $match = "#<wiki>(.*)<\\/wiki>#siU";
    if (preg_match($match, $page, $found)) {
        $org_page = str_replace($found[0], '<_wiki_temp_page_holder_goes_here_for_replacing_>', $page);
        $title = str_replace(' ', '_', $found[1]);
        #  die($found[1]);
        # $org_page = $wgOut->parse($org_page) ;
        # $org_page = Convert($org_page);
        $dbr = wfGetDB(DB_SLAVE);
        $table_page = $dbr->tableName('page');
        $table_rev = $dbr->tableName('revision');
        $table_text = $dbr->tableName('text');
        $sql = "SELECT t.old_text, r.rev_timestamp\r\r\n                            FROM {$table_page} p\r\r\n                            JOIN {$table_rev} r\r\r\n                                ON p.page_id=r.rev_page\r\r\n                            JOIN {$table_text} t\r\r\n                                ON r.rev_text_id=t.old_id\r\r\n                            WHERE p.page_title = '" . $title . "' {$namespace} ORDER BY r.rev_timestamp DESC LIMIT 1";
        $res = $dbr->query($sql);
        $r = $dbr->fetchRow($res);
        //die($r['rev_timestamp']);
        $rev_timestamp = $r['rev_timestamp'];
        $page = $r['old_text'];
        $dbr->freeResult($res);
        if ($ns == '8') {
            return $page;
        }
        // used for MediaWiki:Edittools
        #die($page);
        $mw = new MediaWiki();
        $action = $wgRequest->getVal('action', 'view');
        $wgTitle = $mw->checkInitialQueries($title, $action, $wgOut, $wgRequest, $wgContLang);
        # $p = new Parser();
        # $p->clearState();
        $options = new ParserOptions();
        #$options->setTidy(false);
        # die($page);
        #  $page = awc_wikipase($page, $wgOut);
        # $out = $wgParser->parse($page, $wgTitle, $options, false, false);
        # $mText = $out->mText;
        $mText = $page;
        #awc_wikipase
        # die(print_r($ns));
        $link = str_replace('index.php/', '', awcsf_wiki_url);
        $link = str_replace('index.php?title=', '', $link);
        if ($ns == 0) {
            $link = $link . 'index.php?title=' . $title;
            $page = '<br /><br /><hr>' . get_awcsforum_word('word_wikipage') . ' <a href="' . $link . '&awc_redirect=' . $pID . '&action=edit">' . get_awcsforum_word('word_editwikipage') . '</a><hr> <br />' . $mText . '<hr><br />';
            $page = str_replace('<_wiki_temp_page_holder_goes_here_for_replacing_>', $page, $org_page);
            $page = str_replace('&amp;action=edit&amp;section=', '&amp;awc_redirect=' . $pID . '&amp;action=edit&amp;section=', $page);
        } else {
            $page = $mText;
            # die($page);
            # $page = str_replace('title=', 'title=User:'******'&amp;action=edit&amp;section=', '&amp;awc_redirect='.$memID.'&amp;action=edit&amp;section=', $page);
            # $page = str_replace('&amp;action=edit&amp;section=', '&amp;awc_mem_redirect='.$title.'&amp;action=edit&amp;section=', $page);
        }
    }
    return $page;
}