コード例 #1
0
ファイル: pm.php プロジェクト: mgs2/kw-forum
             }
             $redirect_message = "PMFolderDeleteSuccess";
             $redirect = true;
             // Invalidate user cache, to update message counts.
             phorum_cache_remove('user', $user_id);
         }
     }
     break;
     // Actions which are triggered from the list interface.
 // Actions which are triggered from the list interface.
 case "list":
     // Delete all checked messages.
     if (isset($_POST["delete"]) && isset($_POST["checked"])) {
         foreach ($_POST["checked"] as $pm_id) {
             if (phorum_db_pm_get($pm_id, $folder_id)) {
                 phorum_db_pm_delete($pm_id, $folder_id);
                 /**
                  * [hook]
                  *     pm_delete
                  *
                  * [availability]
                  *     Phorum 5 >= 5.2.13
                  *
                  * [description]
                  *     This hook can be used for working deletion of a
                  *     private message.
                  *
                  * [category]
                  *     Private message system
                  *
                  * [when]
コード例 #2
0
ファイル: mysql.php プロジェクト: sheldon/dejavu
/**
 * Delete a private message folder for a user. Along with the folder,
 * all contained messages are deleted as well.
 *
 * @param integer $folder_id
 *     The id of the folder to delete.
 *
 * @param mixed $user_id
 *     The user to delete the folder for or NULL to use the active
 *     Phorum user (default).
 */
function phorum_db_pm_delete_folder($folder_id, $user_id = NULL)
{
    $PHORUM = $GLOBALS['PHORUM'];
    if ($user_id === NULL) {
        $user_id = $PHORUM['user']['user_id'];
    }
    settype($user_id, 'int');
    settype($folder_id, 'int');
    // Retrieve the private messages in this folder and delete them.
    $list = phorum_db_pm_list($folder_id, $user_id);
    foreach ($list as $id => $data) {
        phorum_db_pm_delete($id, $folder_id, $user_id);
    }
    // Delete the folder itself.
    phorum_db_interact(DB_RETURN_RES, "DELETE FROM {$PHORUM['pm_folders_table']}\n         WHERE pm_folder_id = {$folder_id} AND\n               user_id      = {$user_id}", NULL, DB_MASTERQUERY);
}
コード例 #3
0
ファイル: postgresql.php プロジェクト: nistormihai/Newscoop
/**
 * This function deletes a folder for a user. Along with the
 * folder, all contained messages are deleted as well.
 * @param folder_id - The id of the folder to delete.
 * @param user_id - The user to delete the folder for or
 *                  NULL to use the current user (default).
 */
function phorum_db_pm_delete_folder($folder_id, $user_id = NULL)
{
    $PHORUM = $GLOBALS["PHORUM"];

    $conn = phorum_db_postgresql_connect();

    if ($user_id == NULL) $user_id = $PHORUM['user']['user_id'];
    settype($user_id, "int");
    settype($folder_id, "int");

    // Get messages in this folder and delete them.
    $list = phorum_db_pm_list($folder_id, $user_id);
    foreach ($list as $id => $data) {
        phorum_db_pm_delete($id, $folder_id, $user_id);
    }

    // Delete the folder itself.
    $sql = "DELETE FROM {$PHORUM['pm_folders_table']} " .
           "WHERE pm_folder_id = $folder_id AND user_id = $user_id";
    $res = pg_query($conn, $sql);
    if ($err = pg_last_error()) phorum_db_pg_last_error("$err: $sql");
    return $res;
}