Exemple #1
0
function cache_pages()
{
    global $db;
    $q = new DBSelect('pages', array('*'), '', 'Failed to get pages');
    $result = $q->commit();
    $pages = array();
    $pagessubdirs = array();
    while ($cur_page = $db->fetch_assoc($result)) {
        $page = array('file' => $cur_page['file'], 'template' => $cur_page['template'] ? true : false, 'admin' => $cur_page['admin'] ? true : false, 'mod' => $cur_page['moderator'] ? true : false);
        if (isset($cur_page['nocontentbox']) && $cur_page['nocontentbox']) {
            $page['nocontentbox'] = $cur_page['nocontentbox'] ? true : false;
        }
        if ($cur_page['subdirs']) {
            $pagessubdirs[$cur_page['url']] = $page;
        } else {
            $pages[$cur_page['url']] = $page;
        }
    }
    file_put_contents(FORUM_ROOT . '/app_config/cache/pages.php', '<?php' . "\n" . '$pages = ' . var_export($pages, true) . ';' . "\n" . '$pagessubdirs = ' . var_export($pagessubdirs, true) . ';');
}
Exemple #2
0
function cache_language()
{
    global $db, $base_config;
    $q = new DBSelect('language', array('*'), '', 'Failed to get language entries');
    $result = $q->commit();
    $lang = array();
    while ($lang_entry = $db->fetch_assoc($result)) {
        if (!isset($lang[$lang_entry['language']])) {
            $lang[$lang_entry['language']] = array();
        }
        if (!isset($lang[$lang_entry['language']][$lang_entry['category']])) {
            $lang[$lang_entry['language']][$lang_entry['category']] = array();
        }
        $lang[$lang_entry['language']][$lang_entry['category']][$lang_entry['langkey']] = $lang_entry['value'];
    }
    foreach ($lang as $language => $categories) {
        if (!file_exists(FORUM_ROOT . '/app_config/cache/language')) {
            mkdir(FORUM_ROOT . '/app_config/cache/language');
        }
        if (!file_exists(FORUM_ROOT . '/app_config/cache/language/' . $language)) {
            mkdir(FORUM_ROOT . '/app_config/cache/language/' . $language);
        }
        foreach ($categories as $category => $lang_entries) {
            $lang_subset = array();
            foreach ($lang_entries as $key => $val) {
                $lang_subset[$key] = str_replace('$baseurl$', $base_config['baseurl'], $val);
            }
            $out = '<?php' . "\n";
            if ($category == 'main') {
                $out .= '$lang = ';
            } else {
                $out .= '$lang_addl = ';
            }
            $out .= var_export($lang_subset, true) . ';';
            file_put_contents(FORUM_ROOT . '/app_config/cache/language/' . $language . '/' . $category . '.php', $out);
        }
    }
}
Exemple #3
0
	<description><$description></description>	
	<link>' . $base_config['baseurl'] . '/messages</link>
	<generator>FutureBB</generator>';
if (!isset($dirs[2])) {
    httperror(404);
}
$q = new DBSelect('users', array('username', 'id'), 'rss_token=\'' . $db->escape($dirs[2]) . '\'', 'Failed to find users');
$result = $q->commit();
if (!$db->num_rows($result)) {
    httperror(404);
}
list($username, $id) = $db->fetch_row($result);
$q = new DBSelect('notifications', array('type', 'send_time', 'contents', 'arguments'), 'user='******'Failed to get notification list');
$q->set_order('send_time DESC');
$q->set_limit('20');
$result = $q->commit();
$title = translate('notifsfor', $username);
while ($notif = $db->fetch_assoc($result)) {
    switch ($notif['type']) {
        case 'warning':
            $type = 'Warning';
            break;
        case 'msg':
            $type = 'Message';
            break;
        case 'notification':
            $type = 'Notification';
            break;
        default:
            echo '<img src="' . $base_config['baseurl'] . '/static/img/msg_msg.png" alt="message" width="22" />';
    }
Exemple #4
0
    echo $base_config['baseurl'];
    ?>
/admin/interface/pages">No</a></p>
	</form>
	<?php 
    return;
}
$q = new DBSelect('pages', array('*'), '', 'Failed to get page list');
$result = $q->commit();
if (isset($_POST['form_sent_b'])) {
    if (futurebb_hash($_POST['confirmpwd']) == $futurebb_user['password']) {
        foreach ($_POST as $key => $val) {
            if (ctype_digit((string) $key)) {
                //insert history entry
                $select = new DBSelect('pages', array('*'), 'id=' . intval($key), 'Failed to get old value');
                $result = $select->commit();
                $element = $db->fetch_assoc($result);
                $lines = array();
                foreach ($element as $db_key => $db_val) {
                    $lines[] = $db_key . '=>' . $db_val;
                }
                $insertquery = new DBInsert('interface_history', array('action' => 'edit', 'area' => 'pages', 'field' => intval($key), 'user' => $futurebb_user['id'], 'time' => time(), 'old_value' => base64_encode(implode("\n", $lines))), 'Failed to insert history entry');
                $insertquery->commit();
                foreach ($val as $field => $field_value) {
                    //update the field
                    $updatequery = new DBUpdate('pages', array($field => $field_value), 'id=' . intval($key), 'Failed to update page entry');
                    $updatequery->commit();
                }
            }
        }
        CacheEngine::CachePages();
Exemple #5
0
     $q->commit();
     $cats_xml = $xml->categories;
     foreach ($cats_xml->category as $val) {
         $fields = array();
         foreach ($val as $field => $data) {
             $fields[(string) $field] = (string) $data;
         }
         $q = new DBInsert('categories', $fields, 'Failed to insert category');
         $q->commit();
     }
     echo '<p>Categories completed!</p>';
     header('Refresh: 2; url=' . $base_config['baseurl'] . '/mass_import?import&part=createforumurls');
     break;
 case 'createforumurls':
     $q = new DBSelect('forums', array('id', 'name'), '1=1', 'Failed to get forum list');
     $r1 = $q->commit();
     while (list($id, $fname) = $db->fetch_row($r1)) {
         $base_name = URLEngine::make_friendly($fname);
         $name = $base_name;
         $add_num = 0;
         //check for forums with the same URL
         $result = $db->query('SELECT url FROM `#^forums` WHERE url LIKE \'' . $db->escape($name) . '%\'') or error('Failed to check for similar URLs', __FILE__, __LINE__, $db->error());
         $urllist = array();
         while (list($url) = $db->fetch_row($result)) {
             $urllist[] = $url;
         }
         $ok = false;
         $add_num = 0;
         while (!$ok) {
             $ok = true;
             if (in_array($name, $urllist)) {