function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); // 対象のdiary_idを取得 $diary_id = $request->ACSgetParameter('diary_id'); $diary_row = ACSDiary::get_diary_row($diary_id); if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) { $diary_row['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($diary_row['diary_id']); } // ユーザ情報 $user_community_id = $diary_row['user_community_id']; $contents_link_url = $this->getControllerPath('User', 'DiaryComment') . "&diary_id=" . $diary_row['diary_id']; // 足跡登録 $contents_type_name = ACSMsg::get_mst('contents_type_master', 'D21'); $contents_type_arr = ACSDB::get_master_array("contents_type", "contents_type_name='" . $contents_type_name . "'"); $form['community_id'] = $user_community_id; $form['visitor_community_id'] = $acs_user_info_row['user_community_id']; $form['contents_type_code'] = array_search($contents_type_name, $contents_type_arr); $form['contents_title'] = $diary_row['subject']; $form['contents_link_url'] = $contents_link_url; $form['contents_date'] = $diary_row['post_date']; $form['post_date'] = 'now'; $ret = ACSUser::set_footprint($form); header("Location: {$contents_link_url}"); }
function get_execute_privilege(&$controller, &$request, &$user) { // 公開範囲情報取得 $acs_user_info_row = $user->getAttribute('acs_user_info_row'); $diary_file_row = ACSDiaryFile::get_diary_file_row_by_file_id($request->ACSgetParameter('id')); $diary_row = ACSDiary::get_diary_row($diary_file_row['diary_id']); if (!$diary_row) { return false; } $target_user_info_row = ACSUser::get_user_info_row_by_user_community_id($diary_row['community_id']); if ($diary_row['open_level_name'] == ACSMsg::get_mst('open_level_master', 'D05')) { $diary_row['trusted_community_row_array'] = ACSDiary::get_diary_trusted_community_row_array($diary_row['diary_id']); } // アクセス制御判定 $role_array = ACSAccessControl::get_user_community_role_array($acs_user_info_row, $target_user_info_row); $ret = ACSAccessControl::is_valid_user_for_user_community($acs_user_info_row, $role_array, $diary_row); return $ret; }
function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); //削除処理を行う $target_community_id = $request->getParameter('id'); $diary_id = $request->getParameter('diary_id'); //ファイル情報テーブルのデータ削除 $diary_obj = ACSDiary::get_diary_row($diary_id); if (!$diary_obj) { echo "日記が取得できませんでした"; } $ret = ACSDiary::delete_diary($diary_id); if (!$ret) { echo "ERROR: Delete diary failed."; } //表示 $diary_change_url = $this->getControllerPath('User', 'Diary'); $diary_change_url .= '&id=' . $target_community_id; header("Location: {$diary_change_url}"); }
/** * ダイアリーを削除する * * @param $diary_id ダイアリーID * @return 成功(true) / 失敗(false) */ static function delete_diary($diary_id) { // BEGIN // diary コメントの取得 $sub_row_array = ACSDiary::get_diary_comment_row_array($diary_id); $diary_comment_id_array = array(); if (count($sub_row_array) > 0) { foreach ($sub_row_array as $index => $sub_row) { array_push($diary_comment_id_array, $sub_row['diary_comment_id']); } //コメントの削除 $ret = ACSDiary::delete_diary_comment($diary_comment_id_array); if (!$ret) { return false; } } //日記が持っているファイル情報の削除 $diary_row = ACSDiary::get_diary_row($diary_id); $file_id = $diary_row['file_id']; if ($file_id != '') { $ret = ACSDiaryFile::delete_diary_file($file_id, $diary_id); if (!$ret) { echo "ERROR: Delete attached file information failed."; return false; } } //日記の削除(削除フラグ扱い) $sql = "UPDATE diary"; $sql .= " SET diary_delete_flag = 't'"; $sql .= " WHERE diary.diary_id = {$diary_id}"; $ret = ACSDB::_do_query($sql); if (!$ret) { echo "ERROR: Delete parent article failed."; return false; } // COMMIT return true; }