Esempio n. 1
0
define('ROBOTS_NOINDEX', true);
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include IP_ROOT_PATH . 'common.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT;
if (!class_exists('class_mcp')) {
    include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
}
if (empty($class_mcp)) {
    $class_mcp = new class_mcp();
}
@(include_once IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT);
$class_topics = new class_topics();
// Init common vars: forum_id, topic_id, post_id, etc.
$class_topics->var_init(true);
$confirm = true;
// Continue var definitions
$start = request_var('start', 0);
$start = $start < 0 ? 0 : $start;
// session id check
$sid = request_var('sid', '');
// Obtain relevant data
if (!empty($topic_id)) {
    $sql = "SELECT f.forum_id, f.forum_name, f.forum_topics\n\t\tFROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f\n\t\tWHERE t.topic_id = " . $topic_id . "\n\t\t\tAND f.forum_id = t.forum_id";
    $db->sql_return_on_error(true);
// Load default header
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './../');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
require 'pagestart.' . PHP_EXT;
include IP_ROOT_PATH . 'includes/def_auth.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/functions_selects.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/functions_admin_forums.' . PHP_EXT;
if (!class_exists('class_mcp')) {
    include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
}
if (empty($class_mcp)) {
    $class_mcp = new class_mcp();
}
// Constants
define('POST_FLINK_URL', 'l');
// fields in forums table, except auths ones:
//		table_field => form_field
$forums_fields_list = array('forum_id' => 'id', 'forum_type' => 'forum_type', 'parent_id' => 'main_id', 'main_type' => 'main_type', 'forum_order' => 'order', 'forum_name' => 'name', 'forum_name_clean' => 'name_clean', 'forum_desc' => 'desc', 'forum_status' => 'status', 'forum_likes' => 'forum_likes', 'forum_limit_edit_time' => 'forum_limit_edit_time', 'forum_similar_topics' => 'forum_similar_topics', 'forum_topic_views' => 'forum_topic_views', 'forum_tags' => 'forum_tags', 'forum_sort_box' => 'forum_sort_box', 'forum_kb_mode' => 'forum_kb_mode', 'forum_index_icons' => 'forum_index_icons', 'forum_notify' => 'forum_notify', 'forum_postcount' => 'forum_postcount', 'forum_rules_switch' => 'forum_rules_switch', 'forum_rules' => 'forum_rules', 'forum_rules_custom_title' => 'forum_rules_custom_title', 'forum_rules_display_title' => 'forum_rules_display_title', 'forum_rules_in_viewforum' => 'forum_rules_in_viewforum', 'forum_rules_in_viewtopic' => 'forum_rules_in_viewtopic', 'forum_rules_in_posting' => 'forum_rules_in_posting', 'forum_recurring_first_post' => 'forum_recurring_first_post', 'prune_enable' => 'prune_enable', 'forum_link' => 'link', 'forum_link_internal' => 'link_internal', 'forum_link_hit_count' => 'link_hit_count', 'forum_link_hit' => 'link_hit', 'icon' => 'icon');
// fields in categories table:
//		table_field => form_field
$categories_fields_list = array('forum_id' => 'id', 'forum_type' => 'forum_type', 'parent_id' => 'main_id', 'main_type' => 'main_type', 'forum_order' => 'order', 'forum_name' => 'name', 'forum_name_clean' => 'name_clean', 'forum_desc' => 'desc', 'icon' => 'icon');
// type of the form fields
$fields_type = array('type' => 'VARCHAR', 'id' => 'INTEGER', 'main_id' => 'INTEGER', 'main_type' => 'VARCHAR', 'order' => 'INTEGER', 'name' => 'HTML', 'name_clean' => 'VARCHAR', 'desc' => 'HTML', 'icon' => 'HTML', 'status' => 'INTEGER', 'forum_likes' => 'INTEGER', 'forum_limit_edit_time' => 'INTEGER', 'forum_sort_box' => 'INTEGER', 'forum_kb_mode' => 'INTEGER', 'forum_index_icons' => 'INTEGER', 'forum_notify' => 'INTEGER', 'forum_rules_switch' => 'INTEGER', 'forum_rules' => 'HTML', 'forum_rules_custom_title' => 'VARCHAR', 'forum_rules_display_title' => 'INTEGER_CB', 'forum_rules_in_viewforum' => 'INTEGER_CB', 'forum_rules_in_viewtopic' => 'INTEGER_CB', 'forum_rules_in_posting' => 'INTEGER_CB', 'forum_recurring_first_post' => 'INTEGER', 'forum_postcount' => 'INTEGER', 'enable' => 'INTEGER', 'link' => 'HTML', 'link_internal' => 'INTEGER', 'link_hit_count' => 'INTEGER', 'link_hit' => 'INTEGER');
$zero_array = array('forum_rules_in_viewforum', 'forum_rules_in_viewtopic', 'forum_rules_in_posting');
// list for pull down menu and check of values :
//		value => lang key entry
$forum_type_list = array(POST_CAT_URL => 'Category', POST_FORUM_URL => 'Forum', POST_FLINK_URL => 'Forum_link');
Esempio n. 3
0
*
*/

// Added to optimize memory for attachments
define('ATTACH_POSTING', true);
define('ATTACH_DISPLAY', true);
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
include_once(IP_ROOT_PATH . 'includes/bbcode.' . PHP_EXT);
include_once(IP_ROOT_PATH . 'includes/functions_selects.' . PHP_EXT);
include_once(IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT);

if (!class_exists('class_mcp')) include(IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT);
if (empty($class_mcp)) $class_mcp = new class_mcp();

@include_once(IP_ROOT_PATH . 'includes/class_topics.' . PHP_EXT);
$class_topics = new class_topics();

// Init common vars: forum_id, topic_id, post_id, etc.
$class_topics->var_init(true);

$confirm = ($_POST['confirm']) ? true : 0;
$confirm_recycle = true;

$selected_id = request_var('selected_id', '');
if (!empty($selected_id))
{
	$type = substr($selected_id, 0, 1);
	$id = intval(substr($selected_id, 1));
Esempio n. 4
0
			{
				message_die(GENERAL_MESSAGE, $error_msg);
			}
			if (!class_exists('class_mcp')) include(IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT);
			if (empty($class_mcp)) $class_mcp = new class_mcp();
			$class_mcp->post_delete($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id);
			break;
	}

	if ($error_msg == '')
	{
		if ($mode != 'editpost')
		{
			$user_id = (($mode == 'reply') || ($mode == 'newtopic')) ? $user->data['user_id'] : $post_data['poster_id'];
			if (!class_exists('class_mcp')) include(IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT);
			if (empty($class_mcp)) $class_mcp = new class_mcp();
			$class_mcp->sync_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $user_id);
		}
		$attachment_mod['posting']->insert_attachment($post_id);

		if (($error_msg == '') && ($mode != 'poll_delete'))
		{
			// Forum Notification - BEGIN
			if (!class_exists('class_notifications'))
			{
				include(IP_ROOT_PATH . 'includes/class_notifications.' . PHP_EXT);
				$class_notifications = new class_notifications();
			}
			$post_data['subject'] = $subject;
			$post_data['username'] = ($user->data['user_id'] == ANONYMOUS) ? $username : $user->data['username'];
			$post_data['message'] = $message;
Esempio n. 5
0
function auto_prune($forum_id = 0)
{
    global $db, $lang, $class_mcp;
    $sql = "SELECT *\n\t\tFROM " . PRUNE_TABLE . "\n\t\tWHERE forum_id = {$forum_id}";
    $result = $db->sql_query($sql);
    if ($row = $db->sql_fetchrow($result)) {
        if ($row['prune_freq'] && $row['prune_days']) {
            $prune_date = time() - $row['prune_days'] * 86400;
            $next_prune = time() + $row['prune_freq'] * 86400;
            if (!class_exists('class_mcp')) {
                include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
            }
            if (empty($class_mcp)) {
                $class_mcp = new class_mcp();
            }
            prune($forum_id, $prune_date);
            $class_mcp->sync('forum', $forum_id);
            $sql = "UPDATE " . FORUMS_TABLE . "\n\t\t\t\tSET prune_next = {$next_prune}\n\t\t\t\tWHERE forum_id = {$forum_id}";
            $db->sql_query($sql);
        }
    }
    return;
}
Esempio n. 6
0
} else {
    $forum_rows = array();
    $forum_id = '';
    $forum_sql = '';
}
// Check for submit to be equal to Prune. If so then proceed with the pruning.
if (isset($_POST['doprune'])) {
    $prunedays = request_post_var('prunedays', 0);
    // Convert days to seconds for timestamp functions...
    $prunedate = time() - $prunedays * 86400;
    $template->set_filenames(array('body' => ADM_TPL . 'forum_prune_result_body.tpl'));
    if (!class_exists('class_mcp')) {
        include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
    }
    if (empty($class_mcp)) {
        $class_mcp = new class_mcp();
    }
    for ($i = 0; $i < sizeof($forum_rows); $i++) {
        $p_result = prune($forum_rows[$i]['forum_id'], $prunedate);
        $class_mcp->sync('forum', $forum_rows[$i]['forum_id']);
        $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
        $template->assign_block_vars('prune_results', array('ROW_CLASS' => $row_class, 'FORUM_NAME' => get_object_lang(POST_FORUM_URL . $forum_rows[$i]['forum_id'], 'name'), 'FORUM_TOPICS' => $p_result['topics'], 'FORUM_POSTS' => $p_result['posts']));
    }
    $template->assign_vars(array('L_FORUM_PRUNE' => $lang['Forum_Prune'], 'L_FORUM' => $lang['Forum'], 'L_TOPICS_PRUNED' => $lang['Topics_pruned'], 'L_POSTS_PRUNED' => $lang['Posts_pruned'], 'L_PRUNE_RESULT' => $lang['Prune_success']));
} else {
    // If they haven't selected a forum for pruning yet then display a select box to use for pruning.
    if (empty($_POST[POST_FORUM_URL])) {
        // Output a selection table if no forum id has been specified.
        $template->set_filenames(array('body' => ADM_TPL . 'forum_prune_select_body.tpl'));
        $select_list = ip_make_forum_select(POST_FORUM_URL, false, '', true);
        $template->assign_vars(array('L_FORUM_PRUNE' => $lang['Forum_Prune'], 'L_SELECT_FORUM' => $lang['Select_a_Forum'], 'L_LOOK_UP' => $lang['Look_up_Forum'], 'S_FORUMPRUNE_ACTION' => append_sid('admin_forum_prune.' . PHP_EXT), 'S_FORUMS_SELECT' => $select_list));
Esempio n. 7
0
{
	$row_id = intval($forum_topic_data['topic_replies']) % intval($config['posts_per_page']);
	if ($postrow[$row_id]['post_id'] != $forum_topic_data['topic_last_post_id'] || $start + sizeof($postrow) < $forum_topic_data['topic_replies'])
	{
		$resync = true;
	}
}
elseif (sizeof($postrow) < $config['posts_per_page'])
{
	$resync = true;
}

if ($resync)
{
	if (!class_exists('class_mcp')) include(IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT);
	if (empty($class_mcp)) $class_mcp = new class_mcp();
	$class_mcp->sync('topic', $topic_id);

	$sql = 'SELECT COUNT(post_id) AS total FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . $topic_id;
	$result = $db->sql_query($sql);
	$row = $db->sql_fetchrow($result);
	$total_replies = $row['total'];
}

// Mighty Gorgon - Multiple Ranks - BEGIN
$ranks_array = $cache->obtain_ranks(false);
// Mighty Gorgon - Multiple Ranks - END

$topic_title = censor_text($topic_title);

// Was a highlight request part of the URI?
function delete_item($old, $new = '', $topic_dest = '')
{
    global $db;
    // no changes
    if ($old == $new) {
        return;
    }
    // old type and id
    $old_type = substr($old, 0, 1);
    $old_id = intval(substr($old, 1));
    // new type and id
    $new_type = substr($new, 0, 1);
    $new_id = intval(substr($new, 1));
    if ($new_id == 0 || !in_array($new_type, array(POST_FORUM_URL, POST_CAT_URL))) {
        $new_type = POST_CAT_URL;
        $new_id = 0;
    }
    // topic dest
    $dst_type = substr($topic_dest, 0, 1);
    $dst_id = intval(substr($topic_dest, 1));
    if ($dst_id == 0 || $dst_type != POST_FORUM_URL) {
        $topic_dest = '';
    }
    // re-attach all the content to the new id
    if (!empty($new)) {
        $sql = "UPDATE " . FORUMS_TABLE . "\n\t\t\t\t\tSET main_type = '{$new_type}', parent_id = {$new_id}\n\t\t\t\t\tWHERE main_type = '{$old_type}' AND parent_id = {$old_id}";
        $db->sql_query($sql);
    }
    // topics move
    if (!empty($topic_dest) && $dst_type == POST_FORUM_URL) {
        if ($dst_type == POST_FORUM_URL && $old_type == POST_FORUM_URL) {
            // topics
            $sql = "UPDATE " . TOPICS_TABLE . " SET forum_id = {$dst_id} WHERE forum_id = {$old_id}";
            $db->sql_query($sql);
            // posts
            $sql = "UPDATE " . POSTS_TABLE . " SET forum_id = {$dst_id} WHERE forum_id = {$old_id}";
            $db->sql_query($sql);
            if (!class_exists('class_mcp')) {
                include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
            }
            if (empty($class_mcp)) {
                $class_mcp = new class_mcp();
            }
            $class_mcp->sync('forum', $dst_id);
        }
    }
    // all what is attached to a forum
    if ($old_type == POST_FORUM_URL) {
        // read current moderators for the old forum
        $sql = "SELECT ug.user_id FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug\n\t\t\t\t\tWHERE a.forum_id = {$old_id}\n\t\t\t\t\t\tAND a.auth_mod = 1\n\t\t\t\t\t\tAND ug.group_id = a.group_id";
        $result = $db->sql_query($sql);
        $user_ids = array();
        while ($row = $db->sql_fetchrow($result)) {
            $user_ids[] = $row['user_id'];
        }
        $db->sql_freeresult($result);
        // remove moderator status for those ones
        if (!empty($user_ids)) {
            $old_moderators = implode(', ', $user_ids);
            // check which ones remain moderators
            $sql = "SELECT ug.user_id FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug\n\t\t\t\t\t\tWHERE a.forum_id <> {$old_id}\n\t\t\t\t\t\t\tAND a.auth_mod = 1\n\t\t\t\t\t\t\tAND ug.group_id = a.group_id\n\t\t\t\t\t\t\tAND ug.user_id IN ({$old_moderators})";
            $result = $db->sql_query($sql);
            $user_ids = array();
            while ($row = $db->sql_fetchrow($result)) {
                $user_ids[] = $row['user_id'];
            }
            $new_moderators = empty($user_ids) ? '' : implode(', ', $user_ids);
            // update users status
            $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\t\tSET user_level = " . USER . "\n\t\t\t\t\t\tWHERE user_id IN ({$old_moderators})\n\t\t\t\t\t\t\tAND user_level NOT IN (" . JUNIOR_ADMIN . ", " . ADMIN . ")";
            $db->sql_query($sql);
            if (!empty($new_moderators)) {
                $sql = "UPDATE " . USERS_TABLE . "\n\t\t\t\t\t\t\tSET user_level = " . MOD . "\n\t\t\t\t\t\t\tWHERE user_id IN ({$new_moderators})\n\t\t\t\t\t\t\t\tAND user_level NOT IN (" . JUNIOR_ADMIN . ", " . ADMIN . ")";
                $db->sql_query($sql);
            }
        }
        // remove auth for the old forum
        $sql = "DELETE FROM " . AUTH_ACCESS_TABLE . " WHERE forum_id = {$old_id}";
        $db->sql_query($sql);
        // prune table
        $sql = "DELETE FROM " . PRUNE_TABLE . " WHERE forum_id = {$old_id}";
        $db->sql_query($sql);
        // polls
        $sql = "SELECT t.topic_id FROM " . TOPICS_TABLE . " t\n\t\t\t\t\tWHERE t.forum_id = {$old_id}";
        $result = $db->sql_query($sql);
        $topic_ids = array();
        while ($row = $db->sql_fetchrow($result)) {
            $topic_ids[] = $row['topic_id'];
        }
        if (!empty($topic_ids)) {
            if (!class_exists('class_mcp')) {
                include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
            }
            if (empty($class_mcp)) {
                $class_mcp = new class_mcp();
            }
            $class_mcp->topic_poll_delete($topic_ids);
        }
        // topics
        prune($old_id, 0, true);
        // Delete everything from forum
    }
    // delete the old one
    $sql = "DELETE FROM " . FORUMS_TABLE . " WHERE forum_id = {$old_id}";
    $db->sql_query($sql);
}
Esempio n. 9
0
*
*/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include IP_ROOT_PATH . 'common.' . PHP_EXT;
include_once IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT;
if (!class_exists('class_mcp')) {
    include IP_ROOT_PATH . 'includes/class_mcp.' . PHP_EXT;
}
if (empty($class_mcp)) {
    $class_mcp = new class_mcp();
}
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
if ($user->data['user_level'] != ADMIN) {
    message_die(GENERAL_MESSAGE, $lang['Not_Authorized']);
}
// Get the needes values from post
$submit = '';
$post_id = 0;
$topic_id = 0;
$edit_post_time = '';
$s_days = '';