function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); if (!$this->get_execute_privilege()) { $controller->forward(SECURE_MODULE, SECURE_ACTION); return; } //削除処理を行う $target_community_id = $request->getParameter('community_id'); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); $bbs_id = $request->getParameter('bbs_id'); $bbs_res_id = $request->getParameter('bbs_res_id'); $post_date = $request->getParameter('post_date'); //返信情報テーブルのデータ削除 $ret = ACSBBS::delete_bbs_res(array($bbs_res_id)); if (!$ret) { echo "ERROR: delete reply-article failed"; } //表示 $bbs_change_url = $this->getControllerPath('Community', 'BBSRes'); $bbs_change_url .= '&community_id=' . $target_community_id . '&bbs_id=' . $bbs_id; header("Location: {$bbs_change_url}"); }
/** * 掲示板の親記事を削除する * * @param 親記事ID * @return 成功(true) / 失敗(false) */ static function delete_bbs($bbs_obj) { $bbs_id = $bbs_obj['bbs_id']; ACSDB::_do_query("BEGIN"); //サブ記事の取得 $sub_row_array = ACSBBS::get_bbs_res_row_array($bbs_id); $bbs_res_id_array = array(); if (count($sub_row_array) > 0) { foreach ($sub_row_array as $index => $sub_row) { array_push($bbs_res_id_array, $sub_row['bbs_res_id']); } //サブ記事の削除設定 $ret = ACSBBS::delete_bbs_res($bbs_res_id_array); if (!$ret) { ACSDB::_do_query("ROLLBACK"); echo ACSMsg::get_mdmsg(__FILE__, 'M001'); return false; } } //親記事が持っているファイル情報の削除 $bbs_row = ACSBBSFile::select_bbs_file_row($bbs_id); $file_id = $bbs_row['file_id']; if ($file_id != '') { $ret = ACSBBSFile::delete_bbs_file($file_id, $bbs_id); if (!$ret) { ACSDB::_do_query("ROLLBACK"); echo ACSMsg::get_mdmsg(__FILE__, 'M002'); return false; } } //親記事の削除(削除フラグ扱い) $sql = "UPDATE bbs"; $sql .= " SET bbs_delete_flag = 't'"; $sql .= " WHERE bbs.bbs_id = {$bbs_id}"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); echo ACSMsg::get_mdmsg(__FILE__, 'M003'); return false; } ACSDB::_do_query("COMMIT"); return true; }