コード例 #1
0
        $db->update($db_forum_posts, $rmsg, "fp_id={$p}");
        if (!empty($rtopic['ft_title']) && $db->query("SELECT fp_id FROM {$db_forum_posts} WHERE fp_topicid = {$q} ORDER BY fp_id ASC LIMIT 1")->fetchColumn() == $p) {
            if (mb_substr($rtopic['ft_title'], 0, 1) == "#") {
                $rtopic['ft_title'] = str_replace('#', '', $rtopic['ft_title']);
            }
            $rtopic['ft_preview'] = mb_substr(htmlspecialchars($rmsg['fp_text']), 0, 128);
            $db->update($db_forum_topics, $rtopic, "ft_id = {$q}");
        }
        cot_extrafield_movefiles();
    }
    /* === Hook === */
    foreach (cot_getextplugins('forums.editpost.update.done') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_forums_sectionsetlast($rowpost['fp_cat']);
    if ($cache) {
        $cfg['cache_forums'] && $cache->page->clear('forums');
        $cfg['cache_index'] && $cache->page->clear('index');
    }
    cot_redirect(cot_url('forums', "m=posts&q=" . $q . '&d=' . $durl, '#' . $p, true));
}
require_once cot_incfile('forms');
$crumbs = cot_forums_buildpath($s);
$crumbs[] = array(cot_url('forums', "m=posts&p=" . $p, "#" . $p), ($rowt['ft_mode'] == 1 ? '# ' : '') . htmlspecialchars($rowt['ft_title']));
$crumbs[] = array(cot_url('forums', "m=editpost&s={$s}&q=" . $q . "&p=" . $p . "&" . cot_xg()), $L['Edit']);
$toptitle = cot_breadcrumbs($crumbs, $cfg['homebreadcrumb']);
$toptitle .= $usr['isadmin'] ? $R['forums_code_admin_mark'] : '';
$sys['sublocation'] = $structure['forums'][$s]['title'];
$title_params = array('FORUM' => $L['Forums'], 'SECTION' => $structure['forums'][$s]['title'], 'TOPIC' => $rowt['ft_title'], 'EDIT' => $L['Edit']);
$out['subtitle'] = cot_title('{EDIT} - {TOPIC}', $title_params);
コード例 #2
0
        $rmsg['fp_topicid'] = (int) $q;
        $rmsg['fp_posterid'] = (int) $usr['id'];
        $rmsg['fp_postername'] = $usr['name'];
        $rmsg['fp_creation'] = (int) $sys['now'];
        $rmsg['fp_updated'] = (int) $sys['now'];
        $rmsg['fp_posterip'] = $usr['ip'];
        $db->insert($db_forum_posts, $rmsg);
        $p = $db->lastInsertId();
        if ($cfg['forums']['cat_' . $s]['autoprune'] > 0) {
            cot_forums_prunetopics('updated', $s, $cfg['forums']['cat_' . $s]['autoprune']);
        }
        if ($cfg['forums']['cat_' . $s]['countposts']) {
            $sql_forums = $db->query("UPDATE {$db_users} SET user_postcount=user_postcount+1 WHERE user_id='" . $usr['id'] . "'");
        }
        if (!$rtopic['ft_mode']) {
            cot_forums_sectionsetlast($s, "fs_postcount+1", "fs_topiccount+1");
        }
        cot_extrafield_movefiles();
        /* === Hook === */
        foreach (cot_getextplugins('forums.newtopic.newtopic.done') as $pl) {
            include $pl;
        }
        /* ===== */
        if ($cache) {
            $cfg['cache_forums'] && $cache->page->clear('forums');
            $cfg['cache_index'] && $cache->page->clear('index');
        }
        cot_shield_update(45, "New topic");
        cot_redirect(cot_url('forums', "m=posts&q={$q}&n=last", '#bottom', true));
    }
}
コード例 #3
0
ファイル: forums.posts.php プロジェクト: Andreyjktl/Cotonti
            }
            /* === Hook === */
            foreach (cot_getextplugins('forums.posts.emptytopicdel') as $pl) {
                include $pl;
            }
            /* ===== */
            cot_log('Delete topic #' . $q . " (no post left)", 'for');
            cot_forums_sectionsetlast($s, 'fs_postcount-1', 'fs_topiccount-1');
        }
        cot_redirect(cot_url('forums', 'm=topics&s=' . $s, '', true));
    } else {
        // There's at least 1 post left, let's resync
        $sql_forums = $db->query("SELECT fp_id, fp_posterid, fp_postername, fp_updated, fp_topicid FROM {$db_forum_posts}\n\t\t\tWHERE fp_topicid = ? AND fp_cat = ? ORDER BY fp_id DESC LIMIT 1", array($q, $s));
        if ($row = $sql_forums->fetch()) {
            $sql_forums = $db->query("UPDATE {$db_forum_topics} SET\n\t\t\t\tft_postcount=ft_postcount-1, ft_lastposterid=" . (int) $row['fp_posterid'] . ",\n\t\t\t\tft_lastpostername=" . $db->quote($row['fp_postername']) . ", ft_updated=" . (int) $row['fp_updated'] . "\n\t\t\t\tWHERE ft_id = {$q}");
            cot_forums_sectionsetlast($s, 'fs_postcount-1');
            cot_redirect(cot_url('forums', 'm=posts&q=' . $row['fp_topicid'] . '&d=' . $durl, '#' . $row['fp_id'], true));
        }
    }
}
$sql_forums = $db->query("SELECT * FROM {$db_forum_topics} WHERE ft_id= {$q}");
if ($rowt = $sql_forums->fetch()) {
    if ($rowt['ft_mode'] == 1 && !($usr['isadmin'] || $rowt['ft_firstposterid'] == $usr['id'])) {
        cot_die();
    }
} else {
    cot_die(true, true);
}
$sql_forums = $db->query("UPDATE {$db_forum_topics} SET ft_viewcount=ft_viewcount+1 WHERE ft_id = {$q}");
$sql_forums = $db->query("UPDATE {$db_forum_stats} SET fs_viewcount=fs_viewcount+1 WHERE fs_cat = " . $db->quote($s));
$where['topicid'] = "fp_topicid = {$q}";
コード例 #4
0
    $usr['lastvisit'] = $sys['now'];
}
if (!$cot_sections_act) {
    $timeback = $sys['now'] - 604800;
    // 7 days
    $sqltmp = $db->query("SELECT fp_cat, COUNT(*) FROM {$db_forum_posts} WHERE fp_creation > {$timeback} GROUP BY fp_cat");
    while ($tmprow = $sqltmp->fetch()) {
        $cot_sections_act[$tmprow['fp_cat']] = $tmprow['COUNT(*)'];
    }
    $sqltmp->closeCursor();
    $cache && $cache->db->store('cot_sections_act', $cot_sections_act, 'system', 7200);
}
$sql_forums = $db->query("SELECT * FROM {$db_forum_stats} ORDER by fs_cat DESC");
foreach ($sql_forums->fetchAll() as $row) {
    if (!$row['fs_lt_id'] && count(explode('.', $structure['forums'][$row['fs_cat']]['rpath'])) > 1 && $structure['forums'][$row['fs_cat']]['count'] > 0) {
        cot_forums_sectionsetlast($row['fs_cat']);
    }
    $cat_top[$row['fs_cat']] = $row;
    $cat_top[$row['fs_cat']]['topiccount'] = $cat_top[$row['fs_cat']]['fs_topiccount'];
    $cat_top[$row['fs_cat']]['postcount'] = $cat_top[$row['fs_cat']]['fs_postcount'];
    $cat_top[$row['fs_cat']]['viewcount'] = $cat_top[$row['fs_cat']]['fs_viewcount'];
}
$fstlvl = array();
$nxtlvl = array();
$cot_act = array();
foreach ($structure['forums'] as $i => $x) {
    $parents = explode('.', $x['path']);
    $depth = count($parents);
    if (cot_auth('forums', $i, 'R')) {
        if ($depth < 2) {
            $fstlvl[$i] = $i;
コード例 #5
0
ファイル: forums.topics.php プロジェクト: Andreyjktl/Cotonti
        case 'lock':
            $db->update($db_forum_topics, array("ft_state" => 1, "ft_sticky" => 0), "ft_id={$q}");
            cot_log("Locked topic #" . $q, 'for');
            break;
        case 'sticky':
            $db->update($db_forum_topics, array("ft_state" => 0, "ft_sticky" => 1), "ft_id={$q}");
            cot_log("Pinned topic #" . $q, 'for');
            break;
        case 'announcement':
            $db->update($db_forum_topics, array("ft_state" => 1, "ft_sticky" => 1), "ft_id={$q}");
            cot_log("Announcement topic #" . $q, 'for');
            break;
        case 'bump':
            cot_check_xg();
            $db->update($db_forum_topics, array("ft_updated" => $sys['now']), "ft_id={$q}");
            cot_forums_sectionsetlast($s);
            cot_log("Bumped topic #" . $q, 'for');
            break;
        case 'private':
            cot_log("Made topic #" . $q . " private", 'for');
            $db->update($db_forum_topics, array("ft_mode" => 1), "ft_id={$q}");
            break;
        case 'clear':
            cot_log("Resetted topic #" . $q, 'for');
            $db->update($db_forum_topics, array("ft_state" => 0, "ft_sticky" => 0, "ft_mode" => 0), "ft_id={$q}");
            break;
    }
    cot_redirect(cot_url('forums', "m=topics&s=" . $s, '', true));
}
/* === Hook === */
foreach (cot_getextplugins('forums.topics.first') as $pl) {
コード例 #6
0
/**
 * Recounts all counters for a given cat
 *
 * @param string $cat Cat code
 * @return int topiccount
 * @global CotDB $db
 */
function cot_forums_sync($cat)
{
    global $db, $db_forum_topics, $db_forum_posts, $db_forum_stats;
    $num1 = $db->query("SELECT COUNT(*) FROM {$db_forum_topics} WHERE ft_cat=" . $db->quote($cat))->fetchColumn();
    $num = $db->query("SELECT COUNT(*) FROM {$db_forum_posts} WHERE fp_cat=" . $db->quote($cat))->fetchColumn();
    cot_forums_sectionsetlast($cat, $num, $num1);
    return (int) $num1;
}