Beispiel #1
0
 $pid = $db->insert_id();
 //Thema und Forum aktualisieren
 thread_update_cache($threadinfo['threadid'], 1);
 forum_update_cache($foruminfo['forumid'], 1);
 //Postingzahl des Benutzers erhöhen
 if ($user->info['userid'] && $foruminfo['countposts']) {
     $db->query("UPDATE " . PRE . "_user SET forum_posts=forum_posts+1 WHERE userid='" . $user->info['userid'] . "' LIMIT 1");
 }
 //Anhänge hinzufügen
 if (forum_access_addattachment($foruminfo)) {
     $db->query("UPDATE " . PRE . "_forum_attachments SET postid='" . $pid . "' WHERE hash='" . addslashes($_POST['hash']) . "' AND time>'" . (time() - 3600) . "'");
 }
 //Index aktualisieren
 if ($foruminfo['searchable']) {
     update_index($_POST['text'], $threadinfo['threadid'], $pid);
     update_index($_POST['title'], $threadinfo['threadid'], $pid, true);
 }
 //Abonnements
 if (isset($_POST['subscription']) && $user->info['userid']) {
     if (!$_POST['subscription']) {
         $db->query("DELETE FROM " . PRE . "_forum_subscriptions WHERE ( userid='" . $user->info['userid'] . "' AND type='thread' AND source='" . $threadinfo['threadid'] . "' ) LIMIT 1");
     } elseif (in_array($_POST['subscription'], array('none', 'instant', 'daily', 'weekly'))) {
         $notify = $_POST['subscription'];
         list($subexists) = $db->first("SELECT id FROM " . PRE . "_forum_subscriptions WHERE ( userid='" . $user->info['userid'] . "' AND type='thread' AND source='" . $threadinfo['threadid'] . "' ) LIMIT 1");
         if ($subexists) {
             $db->query("UPDATE " . PRE . "_forum_subscriptions SET notification='" . $notify . "' WHERE id='" . $subexists . "' LIMIT 1");
         } else {
             $db->query("INSERT INTO " . PRE . "_forum_subscriptions (userid,type,source,notification) VALUES ('" . $user->info['userid'] . "','thread','" . $threadinfo['threadid'] . "','" . $notify . "')");
         }
     }
 }
Beispiel #2
0
    }
    if (!forum_access_recoverthread($foruminfo, $threadinfo)) {
        tmessage('noright', array(), false, false);
    }
    //AKTION AUSFÜHREN
    if ($_POST['send'] && $_POST['id']) {
        //Thema wiederherstellen
        $db->query("UPDATE " . PRE . "_forum_threads SET del=0 WHERE threadid='" . $threadinfo['threadid'] . "' LIMIT 1");
        //Themenzahl und Beitragszahl im Forum erhöhen UND letztes Posting neu festlegen
        forum_update_cache($foruminfo['forumid'], $threadinfo['posts'], 1);
        //Wörter wieder in den Index eintragen
        if ($foruminfo['searchable']) {
            $data = $db->fetch("\n\t\t\t\tSELECT postid, text, title\n\t\t\t\tFROM " . PRE . "_forum_posts\n\t\t\t\tWHERE threadid='" . $threadinfo['threadid'] . "' AND del=0\n\t\t\t\tORDER BY time ASC\n\t\t\t");
            foreach ($data as $postinfo) {
                update_index($postinfo['text'], $threadinfo['threadid'], $postinfo['postid']);
                update_index($postinfo['title'], $threadinfo['threadid'], $postinfo['postid'], true);
            }
        }
        //Zur Themenübersicht gehen
        $goto = mkrellink('forum.php?id=' . $foruminfo['forumid'], 'forum,' . $foruminfo['forumid'] . ',1' . urlformat($foruminfo['title']) . '.html');
        message($apx->lang->get('MSG_RECOVERTHREAD_OK'), $goto);
    } else {
        $apx->tmpl->assign('ID', $threadinfo['threadid']);
        tmessage('recoverthread');
    }
} elseif ($_REQUEST['action'] == 'closethread') {
    $apx->lang->drop('admin');
    $_REQUEST['id'] = (int) $_REQUEST['id'];
    if (!$_REQUEST['id']) {
        die('missing thread-ID!');
    }
Beispiel #3
0
 //Thema und Forum aktualisieren
 //thread_update_cache($tid, 0, true);
 $db->query("UPDATE " . PRE . "_forum_threads SET firstpost='" . $pid . "', lastpost='" . $pid . "' WHERE threadid='" . $tid . "' LIMIT 1");
 forum_update_cache($foruminfo['forumid'], 1, 1);
 //Postingzahl des Benutzers erhöhen
 if ($user->info['userid'] && $foruminfo['countposts']) {
     $db->query("UPDATE " . PRE . "_user SET forum_posts=forum_posts+1 WHERE userid='" . $user->info['userid'] . "' LIMIT 1");
 }
 //Anhänge hinzufügen
 if (forum_access_addattachment($foruminfo)) {
     $db->query("UPDATE " . PRE . "_forum_attachments SET postid='" . $pid . "' WHERE hash='" . addslashes($_POST['hash']) . "' AND time>'" . (time() - 3600) . "'");
 }
 //Index aktualisieren
 if ($foruminfo['searchable']) {
     update_index($_POST['text'], $tid, $pid);
     update_index($_POST['title'], $tid, $pid, true);
 }
 //Abonnements
 if ($user->info['userid']) {
     if (in_array($_POST['subscription'], array('none', 'instant', 'daily', 'weekly'))) {
         $notify = $_POST['subscription'];
         $db->query("INSERT INTO " . PRE . "_forum_subscriptions (userid,type,source,notification) VALUES ('" . $user->info['userid'] . "','thread','" . $tid . "','" . $notify . "')");
     }
 }
 //Thema als gelesen markieren
 thread_isread($tid);
 //Weiterleiten zum Thema
 $forwarder = mkrellink('thread.php?id=' . $tid . '#p' . $pid, 'thread,' . $tid . ',1' . urlformat($_POST['title']) . '.html#p' . $pid);
 message($apx->lang->get('MSG_THREAD_ADD_OK'), $forwarder);
 require 'lib/_end.php';
 require '../lib/_end.php';
Beispiel #4
0
/**
 * The screen you'll see after submitting an entry. It stores the entry, updates the indices (pivot's
 * content indices, and the search index), rebuilds the frontpage and XML & Atom feeds, and then it
 * displays a list of the latest entries.
 *
 */
function entrysubmit_screen()
{
    global $db, $config_array, $Pivot_Vars, $entry, $Cfg, $Users, $Paths, $Weblogs, $filtered_words;
    // check against unauthorised direct access.
    check_csrf();
    $db = new db();
    $entry = get_entry_from_post();
    if (!$entry['title'] == "" || !$entry['introduction'] == "" || !$entry['user'] == "") {
        // in this part, we remove the entry from the categories in which
        // the current user is not allowed to post entries
        foreach ($entry['category'] as $my_cat) {
            $allowed = explode("|", $Cfg['cat-' . $my_cat]);
            if (in_array($Pivot_Vars['user'], $allowed)) {
                $allowed_cats[] = $my_cat;
            } else {
                $message .= '<br />';
                $message .= sprintf(lang('entries', 'entry_catnopost'), $m_cat);
                debug("not in category: " . $my_cat);
            }
        }
        $entry['category'] = $allowed_cats;
        $db->set_entry($entry);
        if ($db->save_entry(TRUE)) {
            $message = sprintf(lang('entries', 'entry_saved_ok') . $message, '<i>' . trimtext($entry['title'], 25) . '</i>');
        } else {
            $message = sprintf(lang('entries', 'entry_saved_ok'), '<i>' . trimtext($entry['title'], 25) . '</i>');
        }
        // only trigger the ping if it's a new entry..
        if ($entry['code'] == ">" && $entry['status'] == "publish") {
            $ping = TRUE;
        } else {
            $ping = FALSE;
        }
        // only notify if entry is published, and is either new or status changed to publish.
        if ($entry['status'] == "publish") {
            if ($entry['code'] == ">" || $entry['oldstatus'] != "publish") {
                $notified = notify_new('entry', $db->entry);
                $notified = "<br /><br />" . $notified;
            }
        }
        // if the global index as they are made var is set - can continue
        if ('1' == $Cfg['search_index']) {
            /*
            			2004/10/16 =*=*= JM
            			an entry should only be indexed if both are true:
            			 - 'publish'==$entry['status']
            			 - current date is at least equal to $entry['publish_date']
            			I lie, there is another case...
            			it is conceivable that this is a timed publish AND the time has come
            			I will leave this to timed publish routines - if I can find them...
            			-> pvLib ... it's flagged
            and of course, providing that there is at least one
            			category where it would be indexed...
            something else that can't be tested... if the user changes a normal
            			publish to a timed-publish, or puts on hold when it was previously
            			normal. user should reindex in this case
            */
            // check status and date
            if ('publish' == $entry['status'] || 'timed' == $entry['status'] && $entry['publish_date'] <= date('Y-m-d-H-i')) {
                // categories...
                if (can_search_cats(cfg_cat_nosearchindex(), $entry['category'])) {
                    include_once 'modules/module_search.php';
                    update_index($db->entry);
                    debug('update search index: ' . $db->entry['code']);
                }
            }
        }
        // perhaps send a trackback ping.
        if ($Pivot_Vars['tb_url'] != "" && $entry['status'] == "publish") {
            debug("tburl: " . $Pivot_Vars['tb_url']);
            require_once 'includes/send_trackback.php';
            $weblogs = find_weblogs_with_cat($db->entry['category']);
            if (isset($Weblogs[$weblogs[0]])) {
                $my_url = $Paths['host'] . make_filelink($db->entry['code'], $weblogs[0], '');
                $weblog_title = $Weblogs[$weblogs[0]]['name'];
                debug("TRACKBACK ping: {$my_url}");
                $message .= '<br />';
                $message .= sprintf(lang('entries', 'entry_ping_sent'), $Pivot_Vars['tb_url']);
                $tb_urls = explode("\n", $Pivot_Vars['tb_url']);
                // make the contents of what to send with the trackback..
                $tb_contents = parse_step4($entry['introduction']);
                if ($Pivot_Vars['convert_lb'] == 2) {
                    $tb_contents = pivot_textile($tb_contents);
                } else {
                    if ($Pivot_Vars['convert_lb'] == 3 || $Pivot_Vars['convert_lb'] == 4) {
                        $tb_contents = pivot_markdown($tb_contents, $Pivot_Vars['convert_lb']);
                    }
                }
                $tb_contents = trimtext(strip_tags($tb_contents), 255);
                foreach ($tb_urls as $tb_url) {
                    $tb_url = trim($tb_url);
                    if (isurl($tb_url)) {
                        trackback_send($Pivot_Vars['tb_url'], $my_url, $entry['title'], $weblog_title, $tb_contents);
                    }
                }
            }
        }
        // Update the tags for this entry if it's published and remove the old tags if not
        if ($db->entry['status'] == 'publish') {
            writeTags($db->entry['keywords'], $_POST['f_keywords_old'], $db->entry['code']);
        } else {
            deleteTags($_POST['f_keywords_old'], $db->entry['code']);
        }
    }
    generate_pages($db->entry['code'], TRUE, TRUE, TRUE, $ping);
    entries_screen($message . $notified);
}
 * other free or open source software licenses.
 * See COPYRIGHT.php for copyright notices and details.
 */
// initilizing platform for self-contained objects
platform_launch_initialize();
//e("PLATFORM_INDEXER::LOAD<br/>", true);
e('<div class="content">');
$indexes = PLATFORM_SANDBOX_SYSTEM_CACHES_PATH . DS . "indexes.db";
$found = 0;
$files = find_all($_REQUEST['search'], APPLICATION_BASE_PATH);
$threshold = 216000;
if (count($files)) {
    e('<h3>Found ' . count($files) . ' files</h3>');
    if (count($files) > $threshold) {
        e('Updating index...');
        update_index();
    }
    foreach ($files as $file) {
        if ($found < 10) {
            $uri_array = explode(APPLICATION_BASE_PATH, $file);
            $file_url = $uri_array[1];
            e('&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . $file_url . '">' . basename($file) . "</a><br />");
        } else {
            e('<br /><br /><a href="#">View more results...</a>');
            break;
        }
        ++$found;
    }
} else {
    e("No results found for search criteria " . $_REQUEST['search']);
}
Beispiel #6
0
function __write_index_forward_seek($idxid, $dbid, $dbres)
{
    // increment index by random value
    $rnd = mt_rand(0, _SKIP_MAX);
    if ($rnd > 0) {
        write_blank_record($idxid, $rnd);
    }
    // write record to index
    $idxres = update_index($idxid, $dbid, $dbres[0], $dbres[1]);
    return $idxres;
}
Beispiel #7
0
function timedpublishcheck()
{
    global $serialize_cache, $Cfg, $Paths;
    $temp_db = new db();
    if (isset($Cfg['check_for_timed_publish']) && $Cfg['check_for_timed_publish'] > 0) {
        $amount = $Cfg['check_for_timed_publish'];
    } else {
        $amount = 10;
    }
    $entries = $temp_db->getlist(-$amount, 0, "", "", false, "date");
    $date = date("Y-m-d-H-i", get_current_date());
    $regen = false;
    foreach ($entries as $entry) {
        if ($entry['status'] == "timed") {
            $entry = $temp_db->read_entry($entry['code']);
            if ($entry['publish_date'] <= $date) {
                debug("toggle");
                $entry['date'] = $entry['publish_date'];
                $entry['status'] = "publish";
                $temp_db->set_entry($entry);
                $temp_db->save_entry(TRUE);
                notify_new('entry', $entry);
                $regen = TRUE;
                // 2004/10/17 =*=*= JM
                // can only do this if we know Cfg['search_index'] status...
                if (isset($Cfg)) {
                    // if the global index as they are made var is set - can continue
                    // the rest is copied from 'entrysubmit_screen()' in pv_core.php
                    if ('1' == $Cfg['search_index'] && can_search_cats(cfg_cat_nosearchindex(), $entry['category'])) {
                        include_once 'modules/module_search.php';
                        update_index($temp_db->entry);
                        debug('update search index: ' . $temp_db->entry['code']);
                    }
                }
            }
        }
    }
    if ($regen) {
        buildfrontpage_function();
        return TRUE;
    } else {
        return FALSE;
    }
}