Example #1
0
        }
        $sql = 'DELETE FROM ' . BLOGS_REPLY_TABLE . ' WHERE reply_id = ' . intval($reply_id);
        $db->sql_query($sql);
        // update the real reply count for the blog
        $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_real_reply_count = blog_real_reply_count - 1 WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
    } else {
        if (blog_data::$reply[$reply_id]['reply_deleted'] == 0) {
            // Remove the search index
            $blog_search->index_remove($blog_id, $reply_id);
            // soft delete the reply
            $sql = 'UPDATE ' . BLOGS_REPLY_TABLE . ' SET reply_deleted = ' . $user->data['user_id'] . ', reply_deleted_time = ' . time() . ' WHERE reply_id = ' . intval($reply_id);
            $db->sql_query($sql);
            // update the reply count for the blog
            $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_reply_count = blog_reply_count - 1 WHERE blog_id = ' . intval($blog_id) . ' AND blog_reply_count > 0';
            $db->sql_query($sql);
            set_config('num_blog_replies', --$config['num_blog_replies'], true);
        }
    }
    handle_blog_cache('delete_reply', $user_id);
    blog_meta_refresh(3, $blog_urls['view_blog']);
    $message = $user->lang['REPLY_DELETED'] . '<br /><br />';
    $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
    if ($user_id == $user->data['user_id']) {
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
    } else {
        $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />';
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
    }
    trigger_error($message);
}
Example #2
0
    }
    // Handle the subscriptions
    add_blog_subscriptions($blog_id, 'subscription_');
    // Insert into the categories list
    if (sizeof($category_ary) > 1 || isset($category_ary[0]) && $category_ary[0] != 0) {
        $category_list = get_blog_categories('category_id');
        foreach ($category_ary as $i => $cat_id) {
            if (!isset($category_list[$cat_id])) {
                unset($category_ary[$i]);
            }
        }
    }
    put_blogs_in_cats($blog_id, $category_ary, blog_data::$blog[$blog_id]['blog_approved'] == 1 || $auth->acl_get('u_blognoapprove') ? true : false);
    // If it needs reapproval...
    if (blog_data::$blog[$blog_id]['blog_approved'] == 0 && !$auth->acl_get('u_blognoapprove')) {
        $sql = 'UPDATE ' . USERS_TABLE . ' SET blog_count = blog_count - 1 WHERE user_id = ' . $user->data['user_id'];
        $db->sql_query($sql);
        set_config('num_blogs', --$config['num_blogs'], true);
        inform_approve_report('blog_approve', $blog_id);
    }
    handle_blog_cache('edit_blog', $user_id);
    $message = (!$sql_data['blog_approved'] ? $user->lang['BLOG_NEED_APPROVE'] . '<br /><br />' : $user->lang['BLOG_EDIT_SUCCESS']) . '<br /><br />';
    $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br /><br />';
    if ($user->data['user_id'] == $user_id) {
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
    } else {
        $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>');
    }
    blog_meta_refresh(3, $blog_urls['view_blog']);
    trigger_error($message);
}
Example #3
0
 /**
  * Move a plugin
  *
  * This is used for the menu order on the User's blog page.
  */
 public static function plugin_move($which, $action)
 {
     global $cache, $db, $blog_plugins_path, $phpEx;
     if (!array_key_exists($which, self::$plugins)) {
         trigger_error('PLUGIN_NOT_INSTALLED');
     }
     $temp = self::$plugins;
     if ($action == 'move_down') {
         $temp = array_reverse($temp);
     }
     $to = $to_id = false;
     foreach ($temp as $plugin_name => $data) {
         if ($plugin_name == $which) {
             break;
         }
         $to_id = $data['plugin_id'];
     }
     if ($to_id) {
         $sql = 'UPDATE ' . BLOGS_PLUGINS_TABLE . ' SET plugin_id = 0 WHERE plugin_name = \'' . $db->sql_escape($which) . '\'';
         $db->sql_query($sql);
         $sql = 'UPDATE ' . BLOGS_PLUGINS_TABLE . ' SET plugin_id = ' . self::$plugins[$which]['plugin_id'] . ' WHERE plugin_id = ' . $to_id;
         $db->sql_query($sql);
         $sql = 'UPDATE ' . BLOGS_PLUGINS_TABLE . ' SET plugin_id = ' . $to_id . ' WHERE plugin_id = 0';
         $db->sql_query($sql);
         handle_blog_cache('plugins');
     }
     unset($temp);
 }
Example #4
0
    $template->set_filenames(array('body' => 'blog/blog_posting_layout.html'));
} else {
    // insert array, not all of these really need to be inserted, since some are what the fields are as default, but I want it this way. :P
    $sql_data = array('blog_id' => $blog_id, 'user_id' => $user->data['user_id'], 'user_ip' => $user->data['user_ip'], 'reply_time' => time(), 'reply_subject' => $reply_subject, 'reply_text' => $message_parser->message, 'reply_checksum' => md5($message_parser->message), 'reply_approved' => $auth->acl_get('u_blogreplynoapprove') ? 1 : 0, 'enable_bbcode' => $post_options->enable_bbcode, 'enable_smilies' => $post_options->enable_smilies, 'enable_magic_url' => $post_options->enable_magic_url, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'reply_edit_reason' => '', 'reply_attachment' => sizeof($blog_attachment->attachment_data) ? 1 : 0);
    blog_plugins::plugin_do_ref('reply_add_sql', $sql_data);
    $sql = 'INSERT INTO ' . BLOGS_REPLY_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data);
    $db->sql_query($sql);
    $reply_id = $db->sql_nextid();
    $blog_search->index('add', $blog_id, $reply_id, $message_parser->message, $reply_subject, $user->data['user_id']);
    // update the URLS to include the new reply_id
    generate_blog_urls();
    $blog_attachment->update_attachment_data(false, $reply_id);
    blog_plugins::plugin_do_arg('reply_add_after_sql', $reply_id);
    // Handle the subscriptions
    add_blog_subscriptions($blog_id, 'subscription_');
    handle_blog_cache('add_reply', $user_id);
    // update the reply count for the blog
    if ($sql_data['reply_approved']) {
        $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_reply_count = blog_reply_count + 1, blog_real_reply_count = blog_real_reply_count + 1 WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
        set_config('num_blog_replies', ++$config['num_blog_replies'], true);
        handle_subscription('new_reply', censor_text($reply_subject), 0, $blog_id, $reply_id);
    } else {
        $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_real_reply_count = blog_real_reply_count + 1 WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
        inform_approve_report('reply_approve', $reply_id);
    }
    $message = (!$sql_data['reply_approved'] ? $user->lang['REPLY_NEED_APPROVE'] : $user->lang['REPLY_SUBMIT_SUCCESS']) . '<br /><br />';
    $message .= '<a href="' . $blog_urls['view_reply'] . '">' . $user->lang['VIEW_REPLY'] . '</a><br />';
    $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
    if ($user_id == $user->data['user_id']) {
Example #5
0
        put_blogs_in_cats($blog_id, array(), true, 'soft_delete');
        // Remove the search index
        $blog_search->index_remove($blog_id);
        // soft delete the blog
        $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_deleted = ' . $user->data['user_id'] . ', blog_deleted_time = ' . time() . ' WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
        // Update the blog_count for the user
        $sql = 'UPDATE ' . USERS_TABLE . ' SET blog_count = blog_count - 1 WHERE user_id = ' . intval($user_id) . ' AND blog_count > 0';
        $db->sql_query($sql);
        set_config('num_blogs', --$config['num_blogs'], true);
        set_config('num_blog_replies', $config['num_blog_replies'] - blog_data::$blog[$blog_id]['blog_real_reply_count'], true);
        // Update the blog_count for all the categories it is in.
        $sql = 'SELECT category_id FROM ' . BLOGS_IN_CATEGORIES_TABLE . ' WHERE blog_id = ' . intval($blog_id);
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $sql = 'UPDATE ' . BLOGS_CATEGORIES_TABLE . ' SET blog_count = blog_count - 1 WHERE category_id = ' . $row['category_id'] . ' AND blog_count > 0';
            $db->sql_query($sql);
        }
        $db->sql_freeresult($result);
    }
    handle_blog_cache('delete_blog', $user_id);
    blog_meta_refresh(3, $blog_urls['view_user']);
    $message = $user->lang['BLOG_DELETED'];
    if ($user->data['user_id'] == $user_id) {
        $message .= '<br /><br />' . sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
    } else {
        $message .= '<br /><br />' . sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', $username, '</a>');
        $message .= '<br />' . sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
    }
    trigger_error($message);
}
Example #6
0
			SET blog_approved = 1
			WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
        // Update the blog_count for the user
        $sql = 'UPDATE ' . USERS_TABLE . ' SET blog_count = blog_count + 1 WHERE user_id = ' . intval($user_id);
        $db->sql_query($sql);
        set_config('num_blogs', ++$config['num_blogs'], true);
        // Update the blog_count for all the categories it is in.
        $category_ids = array();
        $sql = 'SELECT category_id FROM ' . BLOGS_IN_CATEGORIES_TABLE . ' WHERE blog_id = ' . intval($blog_id);
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            $category_ids[] = $row['category_id'];
        }
        put_blogs_in_cats($blog_id, $category_ids, true, 'approve');
        handle_blog_cache('approve_blog', $user_id);
        handle_subscription('new_blog', censor_text(blog_data::$blog[$blog_id]['blog_subject']));
        blog_meta_refresh(3, $blog_urls['view_blog']);
        $message = $user->lang['APPROVE_BLOG_SUCCESS'];
        $message .= '<br /><br /><a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
        if ($user_id == $user->data['user_id']) {
            $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
        } else {
            $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />';
            $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
        }
        trigger_error($message);
    } else {
        confirm_box(false, 'APPROVE_BLOG');
    }
} else {
Example #7
0
    // the update query
    $sql = 'UPDATE ' . BLOGS_REPLY_TABLE . '
		SET ' . $db->sql_build_array('UPDATE', $sql_data) . '
		WHERE reply_id = ' . intval($reply_id);
    $db->sql_query($sql);
    $blog_attachment->update_attachment_data(false, $reply_id, $reply_user_id);
    blog_plugins::plugin_do_arg('reply_edit_after_sql', $reply_id);
    unset($message_parser, $sql_data, $blog_search);
    // Handle the subscriptions
    add_blog_subscriptions($blog_id, 'subscription_');
    $message = (!$auth->acl_get('u_blogreplynoapprove') ? $user->lang['REPLY_NEED_APPROVE'] : $user->lang['REPLY_EDIT_SUCCESS']) . '<br /><br />';
    $message .= '<a href="' . $blog_urls['view_reply'] . '">' . $user->lang['VIEW_REPLY'] . '</a><br />';
    // If it needs reapproval...
    if (blog_data::$reply[$reply_id]['reply_approved'] == 0 && !$auth->acl_get('u_blogreplynoapprove')) {
        $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_reply_count = blog_reply_count - 1 WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
        set_config('num_blog_replies', --$config['num_blog_replies'], true);
        inform_approve_report('reply_approve', $reply_id);
    }
    handle_blog_cache('edit_reply', $user_id);
    // redirect
    blog_meta_refresh(3, $blog_urls['view_reply']);
    $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
    if ($user_id == $user->data['user_id']) {
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
    } else {
        $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />';
        $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
    }
    trigger_error($message);
}
Example #8
0
        }
        trigger_error($message);
    } else {
        confirm_box(false, 'CLOSE_REPORT');
    }
} else {
    if (confirm_box(true)) {
        // we are making it look like the user can report the reply even if it has already been reported...but if it already has reported we can skip the extra SQL query
        if (!blog_data::$reply[$reply_id]['reply_reported']) {
            $sql = 'UPDATE ' . BLOGS_REPLY_TABLE . '
				SET reply_reported = \'1\'
				WHERE reply_id = ' . $reply_id;
            $db->sql_query($sql);
        }
        inform_approve_report('reply_report', $reply_id);
        handle_blog_cache('report_reply', $user_id);
        blog_meta_refresh(3, $blog_urls['view_reply']);
        $message = $user->lang['POST_REPORTED_SUCCESS'] . '<br /><br />';
        $message .= '<a href="' . $blog_urls['view_reply'] . '">' . $user->lang['VIEW_REPLY'] . '</a><br />';
        $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
        if ($user_id == $user->data['user_id']) {
            $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
        } else {
            $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />';
            $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
        }
        trigger_error($message);
    } else {
        confirm_box(false, 'REPLY_REPORT');
    }
}
Example #9
0
 // Handle the subscriptions
 add_blog_subscriptions($blog_id, 'subscription_');
 // Insert into the categories list
 if (sizeof($category_ary) > 1 || isset($category_ary[0]) && $category_ary[0] != 0) {
     $category_list = get_blog_categories('category_id');
     foreach ($category_ary as $i => $cat_id) {
         if (!isset($category_list[$cat_id])) {
             unset($category_ary[$i]);
         }
     }
     put_blogs_in_cats($blog_id, $category_ary, $auth->acl_get('u_blognoapprove') ? true : false);
 }
 // regenerate the urls to include the blog_id
 generate_blog_urls();
 blog_plugins::plugin_do_arg('blog_add_after_sql', $blog_id);
 handle_blog_cache('new_blog', $user->data['user_id']);
 if ($sql_data['blog_approved']) {
     // Update the blog_count for the user
     $sql = 'UPDATE ' . USERS_TABLE . ' SET blog_count = blog_count + 1 WHERE user_id = ' . $user->data['user_id'];
     $db->sql_query($sql);
     set_config('num_blogs', ++$config['num_blogs'], true);
     handle_subscription('new_blog', censor_text($blog_subject), $user->data['user_id'], $blog_id);
 } else {
     inform_approve_report('blog_approve', $blog_id);
 }
 $message = !$sql_data['blog_approved'] ? $user->lang['BLOG_NEED_APPROVE'] : $user->lang['BLOG_SUBMIT_SUCCESS'];
 $message .= '<br /><br /><a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
 $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
 if (!$sql_data['blog_approved']) {
     blog_meta_refresh(3, $blog_urls['view_user_self']);
 } else {
Example #10
0
        blog_plugins::plugin_do('blog_report_confirm');
        $sql = 'UPDATE ' . BLOGS_TABLE . '
			SET blog_reported = 0
			WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
        handle_blog_cache('report_blog', $user_id);
        blog_meta_refresh(3, $blog_urls['view_blog']);
        $message = $user->lang['REPORT_CLOSED_SUCCESS'];
        $message .= '<br /><br /><a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a>';
        trigger_error($message);
    } else {
        confirm_box(false, 'CLOSE_REPORT');
    }
} else {
    if (confirm_box(true)) {
        if (!blog_data::$blog[$blog_id]['blog_reported']) {
            $sql = 'UPDATE ' . BLOGS_TABLE . '
				SET blog_reported = 1
				WHERE blog_id = ' . intval($blog_id);
            $db->sql_query($sql);
        }
        inform_approve_report('blog_report', $blog_id);
        handle_blog_cache('report_blog', $user_id);
        blog_meta_refresh(3, $blog_urls['view_blog']);
        $message = $user->lang['POST_REPORTED_SUCCESS'] . '<br /><br /><a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a>';
        trigger_error($message);
    } else {
        confirm_box(false, 'BLOG_REPORT');
    }
}
blog_meta_refresh(0, $blog_urls['view_blog']);
Example #11
0
blog_plugins::plugin_do('reply_approve');
// Generate the breadcrumbs
generate_blog_breadcrumbs($user->lang['APPROVE_REPLY']);
if (blog_data::$reply[$reply_id]['reply_approved'] == 0) {
    if (confirm_box(true)) {
        blog_plugins::plugin_do('reply_approve_confirm');
        $sql = 'UPDATE ' . BLOGS_REPLY_TABLE . '
			SET reply_approved = 1
			WHERE reply_id = ' . intval($reply_id);
        $db->sql_query($sql);
        // update the reply count for the blog
        $sql = 'UPDATE ' . BLOGS_TABLE . ' SET blog_reply_count = blog_reply_count + 1 WHERE blog_id = ' . intval($blog_id);
        $db->sql_query($sql);
        set_config('num_blog_replies', ++$config['num_blog_replies'], true);
        handle_subscription('new_reply', censor_text(blog_data::$reply[$reply_id]['reply_subject']), 0, 0, $reply_id);
        handle_blog_cache('approve_reply', $user_id);
        blog_meta_refresh(3, $blog_urls['view_reply']);
        $message = $user->lang['APPROVE_REPLY_SUCCESS'] . '<br /><br />';
        $message .= '<a href="' . $blog_urls['view_reply'] . '">' . $user->lang['VIEW_REPLY'] . '</a><br />';
        $message .= '<a href="' . $blog_urls['view_blog'] . '">' . $user->lang['VIEW_BLOG'] . '</a><br />';
        if ($user_id == $user->data['user_id']) {
            $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user'] . '">', '</a>');
        } else {
            $message .= sprintf($user->lang['RETURN_BLOG_MAIN'], '<a href="' . $blog_urls['view_user'] . '">', blog_data::$user[$user_id]['username'], '</a>') . '<br />';
            $message .= sprintf($user->lang['RETURN_BLOG_OWN'], '<a href="' . $blog_urls['view_user_self'] . '">', '</a>');
        }
        trigger_error($message);
    } else {
        confirm_box(false, 'APPROVE_REPLY');
    }
} else {