############################################################## ## MOD Title: Post move instead deleting - ADD-On for AJAX Features 1.0.6 ## MOD Author: oxpus < webmaster@oxpus.de > (Karsten Ude) http://www.oxpus.de ## MOD Description: Add the functions into the delete routine from the AJAX features ## MOD Version: 1.0.0 ## ## Installation Level: Intermediate ## Installation Time: 2 min ## Files To Edit: 1 ## ajax.php ## ## Included Files: n/a ## ## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2 ############################################################## ## For security purposes, please check: http://www.phpbb.com/mods/ ## for the latest version of this MOD. Although MODs are checked ## before being allowed in the MODs Database there is no guarantee ## that there are no security problems within the MOD. No support ## will be given for MODs not found within the MODs Database which ## can be found at http://www.phpbb.com/mods/ ############################################################## ## Author Notes: ## ############################################################## ## MOD History: ## ## 2006-08-09 - Version 1.0.0 ## - First release ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ OPEN ]------------------------------------------ # ajax.php # #-----[ FIND ]------------------------------------------ # else if ($mode == 'delete_topic') { // Get post_id if (isset($HTTP_POST_VARS[POST_TOPIC_URL]) || isset($HTTP_GET_VARS[POST_TOPIC_URL])) { $topic_id = (isset($HTTP_POST_VARS[POST_TOPIC_URL])) ? intval($HTTP_POST_VARS[POST_TOPIC_URL]) : intval($HTTP_GET_VARS[POST_TOPIC_URL]); } else { $topic_id = 0; } if (!empty($topic_id)) { # #-----[ AFTER, ADD ]------------------------------------------ # if (intval($board_config['delete_post_forum']) != 0) { $sql = "SELECT * FROM " . FORUMS_TABLE . " WHERE forum_id = " . $board_config['delete_post_forum']; if (!$result = $db->sql_query($sql)) { $result_ar = array( 'result' => AJAX_ERROR, 'error_msg' => 'This topic does not exist' ); } $forum_count = $db->sql_numrows($result); $db->sql_freeresult($result); $forum_check = ($forum_count != 0) ? TRUE : 0; } else { $forum_check = 0; } # #-----[ FIND ]------------------------------------------ # $sql = "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = $topic_id OR topic_moved_id = $topic_id"; if ( !$db->sql_query($sql, BEGIN_TRANSACTION) ) { $result_ar = array( 'result' => AJAX_ERROR, 'error_msg' => 'Could not delete topics' ); } if ( $post_id_sql != '' ) # #-----[ REPLACE WITH ]------------------------------------------ # if ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD && $board_config['mod_allow_delete_post'] == 1)) { $sql = "DELETE FROM " . TOPICS_TABLE . " WHERE topic_id = $topic_id OR topic_moved_id = $topic_id"; if (!$db->sql_query($sql)) { $result_ar = array( 'result' => AJAX_ERROR, 'error_msg' => 'Could not delete topics' ); } } else if ($forum_check == TRUE) { $sql = "UPDATE " . TOPICS_TABLE . " SET forum_id = " . $board_config['delete_post_forum'] . " WHERE topic_id = $topic_id"; if (!$db->sql_query($sql)) { $result_ar = array( 'result' => AJAX_ERROR, 'error_msg' => 'Could not delete topics' ); } $sql = "UPDATE " . POSTS_TABLE . " SET forum_id = " . $board_config['delete_post_forum'] . " WHERE topic_id = $topic_id"; if ( !$db->sql_query($sql) ) { $result_ar = array( 'result' => AJAX_ERROR, 'error_msg' => 'Could not delete topics' ); } } if ( $post_id_sql != '' && ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD && $board_config['mod_allow_delete_post'] == 1))) # #-----[ FIND ]------------------------------------------ # if ( $vote_id_sql != '' ) # #-----[ REPLACE WITH ]------------------------------------------ # if ( $vote_id_sql != '' && ($userdata['user_level'] == ADMIN || ($userdata['user_level'] == MOD && $board_config['mod_allow_delete_post'] == 1))) # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM