Ejemplo n.º 1
0
        $deleteids[$did] = (int) $did_var;
    }
    $delete_messages = phorum_db_get_message(array_keys($deleteids), 'message_id', true);
    //print_var($delete_messages);
    foreach ($deleteids as $msgthd_id => $doit) {
        // A hook to allow modules to implement extra or different
        // delete functionality.
        if ($doit && isset($mod_forums[$delete_messages[$msgthd_id]['forum_id']])) {
            $delete_handled = 0;
            if (isset($PHORUM["hooks"]["before_delete"])) {
                list($delete_handled, $msg_ids, $msgthd_id, $delete_messages[$msgthd_id], $delete_mode) = phorum_hook("before_delete", array(0, 0, $msgthd_id, $delete_messages[$msgthd_id], PHORUM_DELETE_MESSAGE));
            }
            // Handle the delete action, unless a module already handled it.
            if (!$delete_handled) {
                // Delete the message from the database.
                phorum_db_delete_message($msgthd_id, PHORUM_DELETE_MESSAGE);
                // Delete the message attachments from the database.
                $files = phorum_db_get_message_file_list($msgthd_id);
                foreach ($files as $file_id => $data) {
                    if (phorum_api_file_check_delete_access($file_id)) {
                        phorum_api_file_delete($file_id);
                    }
                }
            }
            // Run a hook for performing custom actions after cleanup.
            if (isset($PHORUM["hooks"]["delete"])) {
                phorum_hook("delete", array($msgthd_id));
            }
        }
    }
}
Ejemplo n.º 2
0
     } else {
         $msg['parent_id'] = $msg['thread'];
     }
     unset($msg['message_id']);
     unset($msg['modifystamp']);
     phorum_db_post_message($msg, true);
     // Link attached files to the new message id.
     $linked_files = phorum_db_get_message_file_list($oldid);
     foreach ($linked_files as $linked_file) {
         phorum_db_file_link($linked_file["file_id"], $msg["message_id"], PHORUM_LINK_MESSAGE);
     }
     // save the new message-id for later use
     $msgid_translation[$oldid] = $msg['message_id'];
 }
 // deleting messages which are now doubled
 phorum_db_delete_message($_POST['thread'], PHORUM_DELETE_TREE);
 // update message count / stats
 phorum_db_update_forum_stats(true);
 // change forum_id for the following calls to update the right forum
 $PHORUM["forum_id"] = $target['forum_id'];
 // update message count / stats
 phorum_update_thread_info($target['thread']);
 phorum_db_update_forum_stats(true);
 /*
  * [hook]
  *     after_merge
  *
  * [description]
  *     This hook can be used for performing actions on
  *     merging threads
  *