Ejemplo n.º 1
0
         $db->query('UPDATE `#^forums` SET url=\'' . $db->escape($name) . '\' WHERE id=' . $id) or error('Failed to update forum URL', __FILE__, __LINE__, $db->error());
     }
     header('Refresh: 2; url=' . $base_config['baseurl'] . '/mass_import?import&part=createtopicurls');
     break;
 case 'createtopicurls':
     if (isset($_GET['startid'])) {
         $startid = intval($_GET['startid']);
     } else {
         $startid = 0;
     }
     $r1 = $db->query('SELECT id,subject FROM `#^topics` ORDER BY id ASC LIMIT ' . $startid . ',300') or error('Failed to get topic list', __FILE__, __LINE__, $db->error());
     if (!$db->num_rows($r1)) {
         redirect($base_config['baseurl'] . '/mass_import/done');
     }
     while (list($id, $fname) = $db->fetch_row($r1)) {
         $name = URLEngine::make_friendly($fname);
         $base_name = $name;
         //check for forums with the same URL
         $result = $db->query('SELECT url FROM `#^topics` 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)) {
                 $add_num++;
                 $name = $base_name . '-' . $add_num;
                 $ok = false;
Ejemplo n.º 2
0
    httperror(403);
}
//page header stuff
$breadcrumbs = array(translate('index') => '', $cur_topic['forum_name'] => $cur_topic['forum_url'], $cur_topic['subject'] => $cur_topic['forum_url'] . '/' . $cur_topic['url']);
$page_title = $cur_topic['subject'] . ' - ' . $cur_topic['forum_name'];
$other_head_stuff = array('<link rel="alternate" type="application/rss+xml" href="' . $base_config['baseurl'] . '/rss/' . htmlspecialchars($dirs[1]) . '/' . htmlspecialchars($dirs[2]) . '" title="' . translate('rssfeed') . '" />');
if ($cur_topic['redirect_id'] != null) {
    $result = $db->query('SELECT t.url AS turl,f.url AS furl FROM `#^topics` AS t LEFT JOIN `#^forums` AS f ON f.id=t.forum_id WHERE t.id=' . $cur_topic['redirect_id']) or error('Failed to get redirect info', __FILE__, __LINE__, $db->error());
    list($turl, $furl) = $db->fetch_row($result);
    redirect($base_config['baseurl'] . '/' . $furl . '/' . $turl);
    return;
}
if ($futurebb_user['g_mod_privs'] && isset($dirs[3]) && $dirs[3] == 'move') {
    if (isset($_POST['form_sent'])) {
        if (isset($_POST['redirect'])) {
            $name = URLEngine::make_friendly($cur_topic['subject']);
            $base_name = $name;
            //check for forums with the same URL
            $result = $db->query('SELECT url FROM `#^topics` 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)) {
                    $add_num++;
                    $name = $base_name . '-' . $add_num;
                    $ok = false;
Ejemplo n.º 3
0
 $q = new DBSelect('forums', array('c.name AS cat_name', 'c.sort_position AS cat_sort_position', 'f.id', 'f.cat_id', 'f.sort_position', 'f.name AS forum_name', 'f.url AS furl'), 'c.id IS NOT NULL', 'Failed to get forum list');
 $q->table_as('f');
 $q->set_order('c.sort_position,f.sort_position');
 $q->add_join(new DBLeftJoin('categories', 'c', 'c.id=f.cat_id'));
 $result = $q->commit();
 while ($forum = $db->fetch_assoc($result)) {
     $id = $forum['id'];
     if ($forum['sort_position'] != $_POST['sort_order'][$id]) {
         $q = new DBUpdate('forums', array('sort_position' => intval($_POST['sort_order'][$id])), 'id=' . $id, 'Failed to update sort order');
         $q->commit();
     }
     $title = $forum['forum_name'];
     if (isset($_POST['title'][$id]) && $_POST['title'][$id] != $title && $_POST['title'][$id] != '') {
         //make redirect forum
         $furl = $forum['furl'];
         $base_name = URLEngine::make_friendly($_POST['title'][$id]);
         $name = $base_name;
         $add_num = 0;
         $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;
         while (!$ok) {
             $ok = true;
             if (in_array($name, $urllist)) {
                 $add_num++;
                 $name = $base_name . $add_num;
                 $ok = false;
             }
Ejemplo n.º 4
0
include FORUM_ROOT . '/app_resources/includes/search.php';
if (isset($_POST['form_sent']) || isset($_POST['preview'])) {
    $errors = array();
    if ($futurebb_config['enable_bbcode']) {
        BBCodeController::error_check($_POST['content'], $errors);
    }
    if ($can_edit_subject && trim($_POST['subject']) == '') {
        $errors[] = translate('blanksubject');
    }
    if (trim($_POST['content']) == '') {
        $errors[] = translate('blankcontent');
    }
    if (empty($errors) && !isset($_POST['preview'])) {
        if ($can_edit_subject && isset($_POST['subject']) && $_POST['subject'] != $cur_post['subject']) {
            //change topic subject
            $name = URLEngine::make_friendly($_POST['subject']);
            $base_name = $name;
            $result = $db->query('SELECT url FROM `#^topics` 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)) {
                    $add_num++;
                    $name = $base_name . '-' . $add_num;
                    $ok = false;
                }
Ejemplo n.º 5
0
function create_forum($category, $fname, $view, $topics, $replies, $sort = 0)
{
    global $db;
    //make new forum
    $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)) {
            $add_num++;
            $name = $base_name . $add_num;
            $ok = false;
        }
    }
    $db->query('INSERT INTO `#^forums`(url,name,cat_id,sort_position,view_groups,topic_groups,reply_groups) VALUES(\'' . $db->escape($name) . '\',\'' . $db->escape($fname) . '\',' . intval($category) . ',' . intval($sort) . ',\'-' . implode('-', $view) . '-\',\'-' . implode('-', $topics) . '-\',\'-' . implode('-', $replies) . '-\')') or error('Failed to create new category', __FILE__, __LINE__, $db->error());
}