示例#1
0
 function execute($requests)
 {
     if (!OPENPNE_USE_ALBUM) {
         handle_kengen_error();
     }
     $target_c_album_id = $requests['target_c_album_id'];
     $album = db_album_get_c_album4c_album_id($target_c_album_id);
     if (!$album) {
         admin_client_redirect('edit_album_list', '指定されたアルバムは存在しません');
     }
     db_album_delete_c_album($target_c_album_id);
     admin_client_redirect('edit_album_list', 'アルバムを削除しました');
 }
 function execute($requests)
 {
     if (!OPENPNE_USE_ALBUM) {
         handle_kengen_error();
     }
     $id_ary = split(":", $requests['target_c_album_ids']);
     foreach ($id_ary as $id) {
         $album = db_album_get_c_album4c_album_id($id);
         if (!$album) {
             admin_client_redirect('edit_album_list', '指定されたアルバムは存在しません');
         }
     }
     foreach ($id_ary as $id) {
         db_album_delete_c_album($id);
     }
     admin_client_redirect('edit_album_list', 'アルバムを削除しました');
 }
 function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_album_id = $requests['target_c_album_id'];
     // ----------
     //--- 権限チェック
     $c_album = db_album_get_c_album4c_album_id($target_c_album_id);
     if ($c_album['c_member_id'] != $u) {
         handle_kengen_error();
     }
     //---
     db_album_delete_c_album($target_c_album_id);
     $p = array('target_c_member_id' => $u);
     openpne_redirect('ktai', 'page_fh_album_list', $p);
 }
 function execute($requests)
 {
     if (!OPENPNE_USE_ALBUM) {
         handle_kengen_error();
     }
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_album_id = $requests['target_c_album_id'];
     // ----------
     //--- 権限チェック
     $c_album = db_album_get_c_album4c_album_id($target_c_album_id);
     if ($c_album['c_member_id'] != $u) {
         handle_kengen_error();
     }
     //---
     db_album_delete_c_album($target_c_album_id);
     $p = array('target_c_member_id' => $u);
     openpne_redirect('pc', 'page_fh_album_list', $p);
 }
示例#5
0
/**
 * SNSメンバー退会
 *
 * @param int $c_member_id
 */
function db_common_delete_c_member($c_member_id)
{
    //function cache削除
    cache_drop_c_member($c_member_id);
    //// --- 双方向パターン
    $double = array(intval($c_member_id), intval($c_member_id));
    // c_access_block
    $sql = 'DELETE FROM c_access_block WHERE c_member_id = ? OR c_member_id_block = ?';
    db_query($sql, $double);
    // c_bookmark
    $sql = 'DELETE FROM c_bookmark WHERE c_member_id_from = ? OR c_member_id_to = ?';
    db_query($sql, $double);
    // c_friend
    $sql = 'DELETE FROM c_friend WHERE c_member_id_from = ? OR c_member_id_to = ?';
    db_query($sql, $double);
    // c_friend_confirm
    $sql = 'DELETE FROM c_friend_confirm WHERE c_member_id_from = ? OR c_member_id_to = ?';
    db_query($sql, $double);
    //// --- 単一パターン
    $single = array(intval($c_member_id));
    // c_ktai_address_pre
    $sql = 'DELETE FROM c_ktai_address_pre WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_member_ktai_pre
    $sql = 'DELETE FROM c_member_ktai_pre WHERE c_member_id_invite = ?';
    db_query($sql, $single);
    // c_pc_address_pre
    $sql = 'DELETE FROM c_pc_address_pre WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_review_clip
    $sql = 'DELETE FROM c_review_clip WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_review_comment
    $sql = 'DELETE FROM c_review_comment WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_rss_cache
    $sql = 'DELETE FROM c_rss_cache WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_schedule
    $sql = 'DELETE FROM c_schedule WHERE c_member_id = ?';
    db_query($sql, $single);
    //// --- 特殊パターン
    ///コミュニティ関連
    // c_commu_member
    $sql = 'DELETE FROM c_commu_member WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_commu.c_member_id_sub_admin
    $data = array('c_member_id_sub_admin' => 0);
    $where = array('c_member_id_sub_admin' => intval($c_member_id));
    db_update('c_commu', $data, $where);
    // c_commu (画像)
    $sql = 'SELECT * FROM c_commu WHERE c_member_id_admin = ?';
    $c_commu_list = db_get_all($sql, $single, 'main');
    foreach ($c_commu_list as $c_commu) {
        $sql = 'SELECT COUNT(*) FROM c_commu_member WHERE c_commu_id = ?';
        $count = db_get_one($sql, array(intval($c_commu['c_commu_id'])), 'main');
        if (!$count) {
            // コミュニティ削除
            db_common_delete_c_commu($c_commu['c_commu_id'], $c_member_id);
        } else {
            // 管理者交代
            //     副管理者がいる場合:副管理者に交代
            //     副管理者がいない場合:参加日時が一番古い人に交代
            $new_admin_id = 0;
            if (empty($c_commu['c_member_id_sub_admin'])) {
                $sql = 'SELECT c_member_id FROM c_commu_member WHERE c_commu_id = ?' . ' ORDER BY r_datetime';
                $params = array(intval($c_commu['c_commu_id']));
                $new_admin_id = db_get_one($sql, $params, 'main');
            } else {
                $new_admin_id = $c_commu['c_member_id_sub_admin'];
            }
            do_common_send_mail_c_commu_admin_change($new_admin_id, $c_commu['c_commu_id']);
            $data = array('c_member_id_admin' => intval($new_admin_id), 'c_member_id_sub_admin' => 0);
            $where = array('c_commu_id' => intval($c_commu['c_commu_id']));
            db_update('c_commu', $data, $where);
        }
    }
    // c_commu_admin_confirm
    $sql = 'DELETE FROM c_commu_admin_confirm WHERE c_member_id_to = ?';
    db_query($sql, $single);
    // c_commu_member_confirm
    $sql = 'DELETE FROM c_commu_member_confirm WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_commu_review
    $sql = 'DELETE FROM c_commu_review WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_event_member
    $sql = 'DELETE FROM c_event_member WHERE c_member_id = ?';
    db_query($sql, $single);
    ///日記関連
    db_diary_delete4c_member_id($c_member_id);
    // c_diary (画像)
    $sql = 'SELECT * FROM c_diary WHERE c_member_id = ?';
    $c_diary_list = db_get_all($sql, $single, 'main');
    foreach ($c_diary_list as $c_diary) {
        db_image_data_delete($c_diary['image_filename_1'], $c_member_id);
        db_image_data_delete($c_diary['image_filename_2'], $c_member_id);
        db_image_data_delete($c_diary['image_filename_3'], $c_member_id);
        // アルバム
        db_album_delete4c_member_id($c_member_id);
        // c_diary_comment
        $sql = 'SELECT * FROM c_diary_comment WHERE c_diary_id = ?';
        $params = array(intval($c_diary['c_diary_id']));
        $c_diary_comment_list = db_get_all($sql, $params, 'main');
        foreach ($c_diary_comment_list as $c_diary_comment) {
            db_image_data_delete($c_diary_comment['image_filename_1'], $c_member_id);
            db_image_data_delete($c_diary_comment['image_filename_2'], $c_member_id);
            db_image_data_delete($c_diary_comment['image_filename_3'], $c_member_id);
        }
        $sql = 'DELETE FROM c_diary_comment WHERE c_diary_id = ?';
        db_query($sql, $params);
    }
    $sql = 'DELETE FROM c_diary WHERE c_member_id = ?';
    db_query($sql, $single);
    ///アルバム関連
    $sql = 'SELECT c_album_id FROM c_album WHERE c_member_id = ?';
    $c_album_id_list = db_get_col($sql, $single, 'main');
    foreach ($c_album_id_list as $c_album_id) {
        db_album_delete_c_album($c_album_id, $c_member_id);
    }
    ///メンバー関連
    // c_member_pre
    $sql = 'SELECT * FROM c_member_pre WHERE c_member_id_invite = ?';
    $c_member_pre_list = db_get_all($sql, $single, 'main');
    foreach ($c_member_pre_list as $c_member_pre) {
        // c_member_pre_profile
        $sql = 'DELETE FROM c_member_pre_profile WHERE c_member_pre_id = ?';
        $params = array(intval($c_member_pre['c_member_pre_id']));
        db_query($sql, $params);
    }
    $sql = 'DELETE FROM c_member_pre WHERE c_member_id_invite = ?';
    db_query($sql, $single);
    // c_member_profile
    $sql = 'DELETE FROM c_member_profile WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_member_secure
    $sql = 'DELETE FROM c_member_secure WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_member (画像)
    $sql = 'SELECT image_filename_1, image_filename_2, image_filename_3' . ' FROM c_member WHERE c_member_id = ?';
    $c_member = db_get_row($sql, $single, 'main');
    db_image_data_delete($c_member['image_filename_1'], $c_member_id);
    db_image_data_delete($c_member['image_filename_2'], $c_member_id);
    db_image_data_delete($c_member['image_filename_3'], $c_member_id);
    // c_member (メンバー情報)
    $sql = 'DELETE FROM c_member WHERE c_member_id = ?';
    db_query($sql, $single);
    // c_username
    $sql = 'DELETE FROM c_username WHERE c_member_id = ?';
    db_query($sql, $single);
    ///グループ関連
    // biz_group_member
    $sql = 'DELETE FROM biz_group_member ' . 'WHERE c_member_id = ? ';
    db_query($sql, $single);
    $sql = 'SELECT * FROM biz_group ' . 'WHERE admin_id = ? ';
    $biz_group_list = db_get_all($sql, $single, 'main');
    foreach ($biz_group_list as $biz_group) {
        // 管理者交代
        // biz_group_member_idが一番早い人に交代
        $sql = 'SELECT c_member_id FROM biz_group_member ' . 'WHERE biz_group_id = ? ' . 'ORDER BY biz_group_member_id ';
        $params = array(intval($biz_group['biz_group_id']));
        $new_admin_id = db_get_one($sql, $params, 'main');
        if ($new_admin_id) {
            if (USE_BIZ_DIR) {
                do_common_send_mail_biz_group_admin_change($new_admin_id, $biz_group['biz_group_id']);
            }
            $data = array('admin_id' => intval($new_admin_id));
            $where = array('biz_group_id' => intval($biz_group['biz_group_id']));
            db_update('biz_group', $data, $where);
        } else {
            require_once OPENPNE_MODULES_BIZ_DIR . '/biz/lib/mysql_functions.php';
            biz_deleteGroup($biz_group['biz_group_id'], $c_member_id);
        }
    }
    // 画像容量管理テーブルから情報を削除
    db_image_delete_c_image_size4c_member_id($c_member_id);
}
示例#6
0
/**
 * メンバーのアルバムを削除する
 *
 * @param int $c_member_id
 */
function db_album_delete4c_member_id($c_member_id)
{
    $sql = 'SELECT c_album_id FROM c_album WHERE c_member_id = ?';
    $params = array(intval($c_member_id));
    $c_album_id_list = db_get_col($sql, $params, 'main');
    foreach ($c_album_id_list as $c_album_id) {
        db_album_delete_c_album($c_album_id);
    }
}