Esempio n. 1
0
function update_search_index($pid, $msg)
{
    global $db;
    $words = split_into_words($msg, true);
    $db->query('DELETE FROM `#^search_index` WHERE post_id=' . $pid) or error('Failed to delete existing search stuff', __FILE__, __LINE__, $db->error());
    $q = array();
    $locations = array();
    foreach ($words as $key => $word) {
        if (isset($locations[$word])) {
            $locations[$word][] = $key;
        } else {
            $locations[$word] = array($key);
        }
    }
    foreach ($locations as $word => $curlocs) {
        if (trim($word) != '') {
            $q[] = '(' . $pid . ',\'' . $db->escape(strtolower($word)) . '\',\'' . $db->escape(implode(',', $curlocs)) . '\')';
        }
    }
    if (!empty($q)) {
        $query = new DBMassInsert('search_index', array('post_id', 'word', 'locations'), $q, 'Failed to insert search engine data');
        $query->commit();
    }
}
Esempio n. 2
0
$lang_insert_data[] = '(\'English\',\'' . $db->escape('maintenancedesc') . '\',\'' . $db->escape('From this page, you can run the various maintenance utilities necessary to help keep your forum working.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('rebuildsearch') . '\',\'' . $db->escape('Rebuild search index') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('rebuildsearchdesc') . '\',\'' . $db->escape('If there are problems searching, you can rebuild the search index.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('deleteorphans') . '\',\'' . $db->escape('Delete orphaned topics') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('deleteorphansdesc') . '\',\'' . $db->escape('If you are ever getting a message saying a topic has no posts in it, run this utility to remove all of them.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('updatelastpost') . '\',\'' . $db->escape('Update topic/forum last post data') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('updatelastpostdesc') . '\',\'' . $db->escape('If the last post data in topics and forums appears to be invalid, run this tool to fix it.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('reparse') . '\',\'' . $db->escape('Reparse') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('reparsedesc') . '\',\'' . $db->escape('This forum pre-parses BBCode, meaning that the BBCode is converted into HTML at the time of posting/editing the post. This means that any changes to BBCode will not affect old posts. If you have added new BBCode and want to apply it on old posts, you should run this utility.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('reparseposts') . '\',\'' . $db->escape('Reparse all posts') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('reparsesigs') . '\',\'' . $db->escape('Reparse all signatures') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('updatecounts') . '\',\'' . $db->escape('Update counts') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('updateuserpostcounts') . '\',\'' . $db->escape('Update user post counts') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('updateforumpostcounts') . '\',\'' . $db->escape('Update forum post counts') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('updateforumtopiccounts') . '\',\'' . $db->escape('Update forum topic counts') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('updatetopicpostcounts') . '\',\'' . $db->escape('Update topic post counts') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('defaultusergroup') . '\',\'' . $db->escape('Default user group:') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('newusergroup') . '\',\'' . $db->escape('Create new user group') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('groupname') . '\',\'' . $db->escape('Group name') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('groupnamedesc') . '\',\'' . $db->escape('This is the title of the group itself.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('usertitle') . '\',\'' . $db->escape('User title') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('usertitledesc') . '\',\'' . $db->escape('This will show up under a user's username in their posts.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('editpostsdesc') . '\',\'' . $db->escape('This option allows users to edit their own posts.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('deletepostsdesc') . '\',\'' . $db->escape('This option allows users to delete their own posts.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('modprivs') . '\',\'' . $db->escape('Moderator privileges') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('modprivsdesc') . '\',\'' . $db->escape('This option gives users access to the moderator tools, which include being able to edit and delete everybody's posts, ban users, and view deleted posts.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('adminprivs') . '\',\'' . $db->escape('Administrator privileges') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('adminprivsdesc') . '\',\'' . $db->escape('This option gives users access to the complete admin panel.') . '\',\'' . $db->escape('admin') . '\')';
$lang_insert_data[] = '(\'English\',\'' . $db->escape('noextdir') . '\',\'' . $db->escape('The directory app_config/extensions does not exist or is not writable. Please fix this to enable installing extensions.') . '\',\'' . $db->escape('admin') . '\')';
$q = new DBMassInsert('language', array('language', 'langkey', 'value', 'category'), $lang_insert_data, 'Failed to insert language data');
$q->commit();