Пример #1
0
function wfArticleSaveComplete($article, $user, $p2, $p3, $p5, $p6, $p7)
{
    global $wgMemc;
    if ($article) {
        updateSearchIndex($article->getTitle(), null);
    }
    wfMarkUndoneEditAsPatrolled();
    // In WikiHowSkin.php we cache the info for the author line. we want to
    // remove this if that article was edited so that old info isn't cached.
    if ($article && class_exists('SkinWikihowskin')) {
        $cachekey = ArticleAuthors::getLoadAuthorsCachekey($article->getID());
        $wgMemc->delete($cachekey);
    }
    return true;
}
Пример #2
0
$optionsWithArgs = array('s', 'e', 'p');
require_once 'commandLine.inc';
require_once 'updateSearchIndex.inc';
if (isset($options['p'])) {
    $posFile = $options['p'];
} else {
    $posFile = 'searchUpdate.pos';
}
if (isset($options['e'])) {
    $end = $options['e'];
} else {
    $end = wfTimestampNow();
}
if (isset($options['s'])) {
    $start = $options['s'];
} else {
    $start = @file_get_contents($posFile);
    if (!$start) {
        $start = wfTimestamp(TS_MW, time() - 86400);
    }
}
if (isset($options['l'])) {
    $lockTime = $options['l'];
} else {
    $lockTime = 20;
}
$quiet = (bool) @$options['q'];
updateSearchIndex($start, $end, $lockTime, $quiet);
$file = fopen($posFile, 'w');
fwrite($file, $end);
fclose($file);
Пример #3
0
/**
 * Edit a page in the mobile interface.
 */
function pagem_editpage()
{
    global $PIVOTX;
    $PIVOTX['session']->minLevel(PIVOTX_UL_NORMAL);
    if ($_GET['uid'] == "") {
        $PIVOTX['template']->assign('title', __('Write a new Page'));
    } else {
        $PIVOTX['template']->assign('title', __('Edit Page'));
    }
    $currentuser = $PIVOTX['users']->getUser($PIVOTX['session']->currentUsername());
    if (!empty($_GET['uid'])) {
        // Editing a page.. Get it from the DB..
        $page = $PIVOTX['pages']->getPage($_GET['uid']);
        $PIVOTX['events']->add('edit_entry', intval($_GET['uid']), $entry['title']);
        if (!$PIVOTX['users']->allowEdit('page', $page['user'])) {
            $PIVOTX['template']->assign('heading', __("PivotX encountered an error"));
            $PIVOTX['template']->assign('html', "<p>" . __("You are not allowed to edit this entry.") . "</p>");
            renderTemplate('mobile/generic.tpl');
            return;
        }
        // Make sure we tweak the </textarea> in the intro or body text (since
        // that would break our own textarea, if we didn't)..
        $page['introduction'] = str_replace("<textarea", "&lt;textarea", $page['introduction']);
        $page['introduction'] = str_replace("</textarea", "&lt;/textarea", $page['introduction']);
        $page['body'] = str_replace("<textarea", "&lt;textarea", $page['body']);
        $page['body'] = str_replace("</textarea", "&lt;/textarea", $page['body']);
        // If the entry was written in  'markdown', and is now
        // being edited in the mobile editor, we must convert it.
        if ($page['convert_lb'] == "3") {
            $page['introduction'] = parse_intro_or_body($page['introduction'], false, $page['convert_lb'], true);
            $page['body'] = parse_intro_or_body($page['body'], false, $page['convert_lb'], true);
        }
        // Otherwise, if the entry was written in 'Plain XHTML' or 'WYSIWYG', and is now
        // being edited, there is not much more we
        // can do than strip out the <p> and <br/> tags to replace with linebreaks.
        if ($page['convert_lb'] == "0" || $page['convert_lb'] == "5") {
            $page['introduction'] = unparse_intro_or_body($page['introduction']);
            $page['body'] = unparse_intro_or_body($page['body']);
        }
        list($page['link'], $page['link_end']) = explode($page['uri'], $page['link']);
    } else {
        // Make a new entry.
        $page = array();
        if ($_GET['chapter'] != "") {
            $page['chapter'] = intval($_GET['chapter']);
        }
        $user = $PIVOTX['session']->currentUser();
        $page['user'] = $user['username'];
        $page['sortorder'] = 10;
        if ($PIVOTX['config']->get('default_post_status') != "") {
            $page['status'] = $PIVOTX['config']->get('default_post_status');
        }
        $page['link'] = makePagelink("xxx");
        list($page['link'], $page['link_end']) = explode('xxx', $page['link']);
    }
    $templates = templateOptions(templateList(), 'page', array('_sub_', '_aux_'));
    if ($_SERVER['REQUEST_METHOD'] == "GET") {
        // Show the screen..
        // Show the screen..
        $PIVOTX['template']->assign('templates', $templates);
        $PIVOTX['template']->assign('page', $page);
        $PIVOTX['template']->assign('chapters', $PIVOTX['pages']->getIndex());
        $PIVOTX['template']->assign('pivotxsession', $PIVOTX['session']->getCSRF());
        $PIVOTX['template']->assign('users', $PIVOTX['users']->getUsers());
        $PIVOTX['template']->assign('pageuser', $PIVOTX['users']->getUser($entry['user']));
        $PIVOTX['template']->assign("active", "pages");
        renderTemplate('mobile/editpage.tpl');
    } else {
        if ($_POST['code'] != $_GET['uid']) {
            $PIVOTX['events']->add('fatal_error', intval($_GET['uid']), "Tried to fake editing an entry");
            echo "Code is wrong! B0rk!";
            die;
        }
        // Make sure the current user is properly logged in, and that the request is legitimate
        $PIVOTX['session']->checkCSRF($_POST['pivotxsession']);
        // Sanitize the $_POST into an entry we can store
        $page = sanitizePostedPage($page);
        $page['convert_lb'] = "2";
        // Make sure it's processed as 'Textile'
        $PIVOTX['extensions']->executeHook('page_edit_beforesave', $page);
        $new_id = $PIVOTX['pages']->savePage($page);
        $PIVOTX['extensions']->executeHook('page_edit_aftersave', $page);
        $PIVOTX['messages']->addMessage(sprintf(__('Your page "%s" was successfully saved.'), '<em>' . trimText($page['title'], 25) . '</em>'));
        // Remove the frontpages and entrypages from the cache.
        if ($PIVOTX['config']->get('smarty_cache')) {
            $PIVOTX['template']->clear_cache();
        }
        // Update the search index for this page, but only if we're using flat files.
        if ($PIVOTX['db']->db_type == "flat") {
            $page['code'] = $page['uid'] = $new_id;
            updateSearchIndex($page, 'p');
        }
        pagem_Pages();
    }
}
Пример #4
0
 /**
  * Checks if any entries set to 'timed publish' should be published.
  *
  * @return void
  */
 function checkTimedPublish()
 {
     global $PIVOTX;
     $date = date("Y-m-d-H-i", getCurrentDate());
     $entries = $this->read_entries(array('full' => true, 'status' => 'timed'));
     foreach ($entries as $entry) {
         if ($entry['publish_date'] <= $date) {
             $entry['date'] = $entry['publish_date'];
             $entry['status'] = "publish";
             $this->set_entry($entry);
             $this->save_entry(TRUE);
             if (!$PIVOTX['config']->get('disable_new_entry_notifications')) {
                 sendMailNotification('entry', $this->entry);
             }
             writeTags($this->entry['keywords'], '', $this->entry['code']);
             updateSearchIndex($this->entry);
         }
     }
 }