function execute($requests)
 {
     //<PCKTAI
     if (OPENPNE_AUTH_MODE == 'slavepne' || !((OPENPNE_REGIST_FROM & OPENPNE_REGIST_FROM_KTAI) >> 1)) {
         openpne_redirect('ktai', 'page_o_login', array('msg' => 42));
     }
     //>
     // --- リクエスト変数
     $ses = $requests['ses'];
     $aff_id = $requests['aff_id'];
     // ----------
     // セッションが有効かどうか
     if (!($pre = db_member_c_member_ktai_pre4session($ses))) {
         // 無効の場合、login へリダイレクト
         openpne_redirect('ktai', 'page_o_login', array('msg' => 42));
     }
     // メールアドレスが登録できるかどうか
     if (!util_is_regist_mail_address($pre['ktai_address'])) {
         openpne_redirect('ktai', 'page_o_login', array('msg' => 42));
     }
     $this->set('SNS_NAME', SNS_NAME);
     $this->set('ses', $ses);
     $this->set('c_profile_pref_list', p_regist_prof_c_profile_pref_list4null());
     $v['month_list'] = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
     $v['day_list'] = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
     $public_flags = array('public' => '全員に公開', 'friend' => WORD_MY_FRIEND_HALF . 'まで公開', 'private' => '公開しない');
     $this->set('public_flags', $public_flags);
     $this->set('password_query_list', p_common_c_password_query4null());
     $this->set('profile_list', db_member_c_profile_list());
     $this->set('aff_id', $aff_id);
     $this->set($v);
     return 'success';
 }
 function execute($requests)
 {
     $v = array();
     $target_c_commu_topic_ids = $requests['target_c_commu_topic_ids'];
     // トピックが選択されていない場合はエラー
     if (!$target_c_commu_topic_ids) {
         admin_client_redirect('topic_list', "トピックが選択されていません");
     }
     $id_ary = split(":", $target_c_commu_topic_ids);
     $v = array();
     $topic_list = array();
     foreach ($id_ary as $id) {
         $topic = db_commu_c_topic4c_commu_topic_id_2($id);
         if (!$topic) {
             admin_client_redirect('topic_list', '指定されたトピック・イベントは存在しません');
         }
         $member = db_member_c_member4c_member_id($topic['c_member_id']);
         $topic['count_comments'] = _db_count_c_commu_topic_comments4c_commu_topic_id($topic['c_commu_topic_id']);
         $commu = db_commu_c_commu4c_commu_id($topic['c_commu_id']);
         $topic['commu_name'] = $commu['name'];
         $topic['c_member'] = $member;
         $topic['original_filename'] = db_file_original_filename4filename($topic['filename']);
         array_push($topic_list, $topic);
     }
     $this->set('topic_list', $topic_list);
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $this->set('target_c_commu_topic_ids', $target_c_commu_topic_ids);
     $v['SNS_NAME'] = SNS_NAME;
     $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     $this->set($v);
     return 'success';
 }
Beispiel #3
0
 function execute($requests)
 {
     $v = array();
     $page = $requests['page'];
     $keyword = $requests['keyword'];
     $target_c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $page_size = 20;
     if ($target_c_commu_topic_id) {
         list($topic_list, $prev, $next, $total_num, $total_page_num) = monitor_topic_list4target_c_commu_topic_id($target_c_commu_topic_id, $page_size, $page);
     } else {
         list($topic_list, $prev, $next, $total_num, $total_page_num) = monitor_topic_list($keyword, $page_size, $page);
     }
     $this->set('topic_list', $topic_list);
     $this->set('page', $page);
     $this->set('prev', $prev);
     $this->set('next', $next);
     $this->set('keyword_encode', urlencode($keyword));
     $this->set('keyword', $keyword);
     $this->set('target_c_commu_topic_id', $target_c_commu_topic_id);
     $this->set('total_num', $total_num);
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     for ($i = $page - 10 < 1 ? 1 : $page - 10; $i <= $total_page_num && $i < $page + 10; $i++) {
         $page_list[] = $i;
     }
     $this->set('page_list', $page_list);
     $this->set('start_num', ($page - 1) * $page_size + 1);
     $this->set('end_num', ($page - 1) * $page_size + count($topic_list));
     $v['SNS_NAME'] = SNS_NAME;
     $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     $this->set($v);
     return 'success';
 }
Beispiel #4
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $year = intval($requests['year']);
     $month = intval($requests['month']);
     // ----------
     if (!$year) {
         $year = date('Y');
     }
     if (!$month) {
         $month = date('n');
     }
     if ($year == date('Y') && $month == date('n')) {
         $is_curr = true;
         $curr_day = date('d');
     }
     if ($year < date('Y') || $year > intval(date('Y')) + 1) {
         $this->set('add_schedule', false);
     } else {
         $this->set('add_schedule', true);
     }
     $this->set('inc_navi', fetch_inc_navi('h'));
     // イベント
     $event_list = db_schedule_event4c_member_id($year, $month, $u);
     // 誕生日
     $birth_list = db_schedule_birth4c_member_id($month, $u);
     include_once 'Calendar/Month/Weekdays.php';
     $Month = new Calendar_Month_Weekdays($year, $month, 0);
     $Month->build();
     $calendar = array();
     $i = 0;
     while ($Day = $Month->fetch()) {
         if ($Day->isFirst()) {
             $i++;
         }
         if ($Day->isEmpty()) {
             $calendar[$i][] = array();
         } else {
             $day = $Day->thisDay();
             $item = array('day' => $day, 'now' => false, 'birth' => $birth_list[$day], 'event' => $event_list[$day], 'schedule' => db_schedule_c_schedule_list4date($year, $month, $day, $u), 'holiday' => db_c_holiday_list4date($month, $day));
             $item['day'] = $day;
             if ($is_curr && $item['day'] == $curr_day) {
                 $item['now'] = true;
             }
             $calendar[$i][] = $item;
         }
     }
     $ym = array('year_disp' => $year, 'month_disp' => $month, 'year_prev' => date('Y', $Month->prevMonth(true)), 'month_prev' => date('n', $Month->prevMonth(true)), 'year_next' => date('Y', $Month->nextMonth(true)), 'month_next' => date('n', $Month->nextMonth(true)));
     $this->set("ym", $ym);
     $this->set("year", $year);
     $this->set("month", $month);
     $this->set("calendar", $calendar);
     $c_member = db_member_c_member4c_member_id($u);
     $this->set("pref_list", p_regist_prof_c_profile_pref_list4null());
     $this->set("c_member", $c_member);
     return 'success';
 }
 function execute($requests)
 {
     $this->set('SNS_NAME', SNS_NAME);
     $this->set('c_profile_pref_list', p_regist_prof_c_profile_pref_list4null());
     $v['month_list'] = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
     $v['day_list'] = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
     $public_flags = array('public' => '全員に公開', 'friend' => WORD_MY_FRIEND_HALF . 'まで公開', 'private' => '公開しない');
     $this->set('public_flags', $public_flags);
     $this->set('profile_list', db_member_c_profile_list());
     $this->set($v);
     return 'success';
 }
Beispiel #6
0
 function execute($requests)
 {
     $v = array();
     $target_c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $v = array();
     $topic = db_commu_c_topic4c_commu_topic_id_2($target_c_commu_topic_id);
     if (!$topic) {
         admin_client_redirect('topic_list', '指定されたトピック・イベントは存在しません');
     }
     $member = db_member_c_member4c_member_id($topic['c_member_id']);
     $topic['count_comments'] = _db_count_c_commu_topic_comments4c_commu_topic_id($topic['c_commu_topic_id']);
     $commu = db_commu_c_commu4c_commu_id($topic['c_commu_id']);
     $topic['commu_name'] = $commu['name'];
     $topic['c_member'] = $member;
     $topic['original_filename'] = db_file_original_filename4filename($topic['filename']);
     $this->set('topic', $topic);
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $v['SNS_NAME'] = SNS_NAME;
     $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     $this->set($v);
     return 'success';
 }
Beispiel #7
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_id = $requests['target_c_commu_id'];
     $err_msg = $requests['err_msg'];
     // ----------
     //--- 権限チェック
     $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id);
     switch ($c_commu['is_topic']) {
         case 'public':
             //誰でも作成可能
             break;
         case 'member':
             //コミュニティメンバー
             if (!db_commu_is_c_commu_member($c_commu_id, $u)) {
                 handle_kengen_error();
             }
             break;
         case 'admin_only':
             //管理者のみ
             if (!db_commu_is_c_commu_admin($c_commu_id, $u)) {
                 handle_kengen_error();
             }
     }
     //---
     $this->set('inc_navi', fetch_inc_navi('c', $c_commu_id));
     $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id));
     $this->set("year", db_commu_year4null());
     $this->set('month', p_regist_prof_c_profile_month_list4null());
     $this->set('day', p_regist_prof_c_profile_day_list4null());
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $this->set('event', p_c_event_add_confirm_event4request());
     $this->set('err_msg', $err_msg);
     // 許可されている拡張子のリスト
     $this->set('allowed_extensions', util_get_file_allowed_extensions('string'));
     return 'success';
 }
Beispiel #8
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $c_commu_id = $requests['target_c_commu_id'];
     $err_msg = $requests['err_msg'];
     // ----------
     //--- 権限チェック
     $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id);
     switch ($c_commu['is_topic']) {
         case 'public':
             //誰でも作成可能
             break;
         case 'member':
             //コミュニティメンバー
             if (!db_commu_is_c_commu_member($c_commu_id, $u)) {
                 handle_kengen_error();
             }
             break;
         case 'admin_only':
             //トピック作成権限チェック
             if (!db_commu_is_c_commu_admin($c_commu_id, $u)) {
                 handle_kengen_error();
             }
             break;
     }
     //---
     $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id));
     $this->set("year", db_commu_year4null());
     $this->set('month', p_regist_prof_c_profile_month_list4null());
     $this->set('day', p_regist_prof_c_profile_day_list4null());
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $this->set('event', p_c_event_add_confirm_event4request());
     $this->set('err_msg', $err_msg);
     return 'success';
 }
Beispiel #9
0
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $err_msg = $requests['err_msg'];
     // ----------
     $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
     $c_commu_id = $c_topic['c_commu_id'];
     //--- 権限チェック
     if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if (!db_commu_is_c_topic_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id);
     if ($c_commu['is_topic'] == 'admin_only' && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if ($c_commu['is_topic'] == 'member' && !db_commu_is_c_commu_member($c_commu_id, $u)) {
         handle_kengen_error();
     }
     //---
     if (!$c_topic['event_flag']) {
         openpne_redirect('ktai', 'page_c_topic_edit', array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id']));
     }
     $this->set("c_commu", db_commu_c_commu4c_commu_id2($c_commu_id));
     $this->set("year", db_commu_year4null());
     $this->set('month', p_regist_prof_c_profile_month_list4null());
     $this->set('day', p_regist_prof_c_profile_day_list4null());
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $this->set('err_msg', $err_msg);
     //編集確認画面でエラーがでたときここに戻ってくる。そのときのためにrequestから取得
     //保留
     if ($err_msg) {
         $c_topic_temp = p_c_event_add_confirm_event4request();
         $c_topic['name'] = $c_topic_temp['title'];
         $c_topic['body'] = $c_topic_temp['detail'];
         $c_topic['open_date_comment'] = $c_topic_temp['open_date_comment'];
         $c_topic['open_pref_id'] = $c_topic_temp['open_pref_id'];
         $c_topic['open_pref_comment'] = $c_topic_temp['open_pref_comment'];
         $c_topic['open_date_year'] = $c_topic_temp['open_date_year'];
         $c_topic['open_date_month'] = $c_topic_temp['open_date_month'];
         $c_topic['open_date_day'] = $c_topic_temp['open_date_day'];
         $c_topic['invite_period_year'] = $c_topic_temp['invite_period_year'];
         $c_topic['invite_period_month'] = $c_topic_temp['invite_period_month'];
         $c_topic['invite_period_day'] = $c_topic_temp['invite_period_day'];
     } else {
         $open_date_arr = explode("-", $c_topic['open_date']);
         $invite_period_arr = explode("-", $c_topic['invite_period']);
         $c_topic['open_date_year'] = $open_date_arr[0];
         $c_topic['open_date_month'] = $open_date_arr[1];
         $c_topic['open_date_day'] = $open_date_arr[2];
         $c_topic['invite_period_year'] = $invite_period_arr[0];
         $c_topic['invite_period_month'] = $invite_period_arr[1];
         $c_topic['invite_period_day'] = $invite_period_arr[2];
     }
     $this->set('event', $c_topic);
     return 'success';
 }
 function execute($requests)
 {
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $this->set('tail', $GLOBALS['KTAI_URL_TAIL']);
     $c_member_secure = db_member_c_member_secure4c_member_id($u);
     $prof_id = $requests['prof_id'];
     $w = $requests['w'];
     if (empty($requests['target_id']) || $requests['target_id'] == $u) {
         //自分自身
         $target_id = $u;
         $this->set('is_h', true);
         //判別フラグ
     } else {
         //他人
         $target_id = $requests['target_id'];
         $this->set('is_f', true);
         //判別フラグ
     }
     require_once 'Calendar/Week.php';
     $w = intval($requests['w']);
     if (empty($w)) {
         $w = 0;
     }
     $this->set('w', $w);
     $time = strtotime($w . " week");
     $Week = new Calendar_Week(date('Y', $time), date('m', $time), date('d', $time), 0);
     $Week->build();
     $calendar = array();
     $schedule = array();
     $dayofweek = array('日', '月', '火', '水', '木', '金', '土');
     $i = 0;
     $n = 0;
     while ($Day = $Week->fetch()) {
         $y = sprintf("%02d", $Day->thisYear());
         $m = sprintf("%02d", $Day->thisMonth());
         $d = sprintf("%02d", $Day->thisDay());
         $m_disp = sprintf("%2d", $Day->thisMonth());
         if ($i == 0) {
             $this->set("y_disp", $y);
             $this->set("m_disp", $m_disp);
         }
         //イベント
         $event_list = db_commu_event4c_member_id($y, $m, $d, $target_id);
         // 誕生日
         $birth_list = db_schedule_birth4c_member_id($m, $target_id);
         //スケジュール
         $schedule = biz_getDateMemberSchedule($y, $m, $d, $target_id, $u);
         $banner = biz_isBannerSchedule($y, $m, $d, $target_id);
         if (!empty($banner)) {
             foreach ($banner as $value) {
                 array_push($schedule, $value);
             }
         }
         $item = array('year' => $y, 'month' => $m, 'day' => $d, 'dayofweek' => $dayofweek[$i++], 'now' => false, 'event' => $event_list, 'birth' => $birth_list[intval($d)], 'schedule' => $schedule);
         if ($w == 0 && $d == date('d')) {
             $item['now'] = true;
         }
         $calendar[] = $item;
     }
     $this->set("calendar", $calendar);
     $c_member = db_member_c_member4c_member_id($target_id);
     $this->set("pref_list", p_regist_prof_c_profile_pref_list4null());
     $this->set("c_member", $c_member);
     $this->set("msg", $requests['msg']);
     return 'success';
 }
Beispiel #11
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $c_commu_topic_id = $requests['target_c_commu_topic_id'];
     $err_msg = $requests['err_msg'];
     // ----------
     $c_topic = db_commu_c_topic4c_commu_topic_id_2($c_commu_topic_id);
     $c_commu_id = $c_topic['c_commu_id'];
     //--- 権限チェック
     if (!db_commu_is_c_commu_view4c_commu_idAc_member_id($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if (!db_commu_is_c_topic_admin($c_commu_topic_id, $u) && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     $c_commu = db_commu_c_commu4c_commu_id2($c_commu_id);
     if ($c_commu['is_topic'] == 'admin_only' && !db_commu_is_c_commu_admin($c_commu_id, $u)) {
         handle_kengen_error();
     }
     if ($c_commu['is_topic'] == 'member' && !db_commu_is_c_commu_member($c_commu_id, $u)) {
         handle_kengen_error();
     }
     //---
     if (!$c_topic['event_flag']) {
         $p = array('target_c_commu_topic_id' => $c_topic['c_commu_topic_id']);
         openpne_redirect('pc', 'page_c_topic_edit', $p);
     }
     if (!empty($c_topic['filename'])) {
         $c_topic['original_filename'] = db_file_original_filename4filename($c_topic['filename']);
     }
     $this->set('inc_navi', fetch_inc_navi("c", $c_commu_id));
     $this->set("year", db_commu_year4null());
     $this->set('month', p_regist_prof_c_profile_month_list4null());
     $this->set('day', p_regist_prof_c_profile_day_list4null());
     $this->set('pref', p_regist_prof_c_profile_pref_list4null());
     $this->set('err_msg', $err_msg);
     //編集確認画面でエラーがでたときここに戻ってくる。そのときのためにrequestから取得
     //保留
     if ($err_msg) {
         $c_topic_temp = p_c_event_add_confirm_event4request();
         $c_topic['name'] = $c_topic_temp['title'];
         $c_topic['body'] = $c_topic_temp['detail'];
         $c_topic['open_date_comment'] = $c_topic_temp['open_date_comment'];
         $c_topic['open_pref_id'] = $c_topic_temp['open_pref_id'];
         $c_topic['open_pref_comment'] = $c_topic_temp['open_pref_comment'];
         $c_topic['open_date_year'] = $c_topic_temp['open_date_year'];
         $c_topic['open_date_month'] = $c_topic_temp['open_date_month'];
         $c_topic['open_date_day'] = $c_topic_temp['open_date_day'];
         $c_topic['invite_period_year'] = $c_topic_temp['invite_period_year'];
         $c_topic['invite_period_month'] = $c_topic_temp['invite_period_month'];
         $c_topic['invite_period_day'] = $c_topic_temp['invite_period_day'];
     } else {
         $open_date_arr = explode("-", $c_topic['open_date']);
         $invite_period_arr = explode("-", $c_topic['invite_period']);
         $c_topic['open_date_year'] = $open_date_arr[0];
         $c_topic['open_date_month'] = $open_date_arr[1];
         $c_topic['open_date_day'] = $open_date_arr[2];
         $c_topic['invite_period_year'] = $invite_period_arr[0];
         $c_topic['invite_period_month'] = $invite_period_arr[1];
         $c_topic['invite_period_day'] = $invite_period_arr[2];
     }
     $this->set('event', $c_topic);
     // 許可されている拡張子のリスト
     $this->set('allowed_extensions', util_get_file_allowed_extensions('string'));
     return 'success';
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $year = $requests['year'];
     $month = $requests['month'];
     $pref_id = $requests['pref_id'];
     // ----------
     if (empty($requests['target_id']) || $requests['target_id'] == $u) {
         //自分自身
         $target_id = $u;
         $this->set('is_h', true);
         //判別フラグ
         $this->set('inc_navi', fetch_inc_navi('h'));
     } else {
         //他人
         $target_id = $requests['target_id'];
         $this->set('is_f', true);
         //判別フラグ
         $this->set('inc_navi', fetch_inc_navi('f', $target_id));
     }
     if (!$year) {
         $year = date('Y');
     }
     if (!$month) {
         $month = date('n');
     }
     if ($year == date('Y') && $month == date('n')) {
         $is_curr = true;
         $curr_day = date('d');
     }
     // イベント
     $event_list = db_schedule_event4c_member_id($year, $month, $target_id);
     // 誕生日
     $birth_list = db_schedule_birth4c_member_id($month, $target_id);
     // Todo
     $todo_list = biz_schedule_todo4c_member_id($u, $target_id, $year, $month);
     require_once 'Calendar/Month/Weekdays.php';
     $Month = new Calendar_Month_Weekdays($year, $month, 0);
     $Month->build();
     $calendar = array();
     $schedule = array();
     $i = 0;
     while ($Day = $Month->fetch()) {
         if ($Day->isFirst()) {
             $i++;
         }
         if ($Day->isEmpty()) {
             $calendar[$i][] = array();
         } else {
             $day = $Day->thisDay();
             $schedule = biz_getDateMemberSchedule($year, sprintf("%02d", $month), sprintf("%02d", $day), $target_id, $u);
             $banner = biz_isBannerSchedule($year, sprintf("%02d", $month), sprintf("%02d", $day), $target_id);
             if (!empty($banner)) {
                 foreach ($banner as $value) {
                     array_push($schedule, $value);
                 }
             }
             $item = array('day' => $day, 'now' => false, 'birth' => $birth_list[$day], 'event' => $event_list[$day], 'schedule' => $schedule, 'todo' => $todo_list[$day], 'holiday' => db_c_holiday_list4date($month, $day));
             $item['day'] = $day;
             if ($is_curr && $item['day'] == $curr_day) {
                 $item['now'] = true;
             }
             $calendar[$i][] = $item;
         }
     }
     $ym = array('year_disp' => $year, 'month_disp' => $month, 'year_prev' => date('Y', $Month->prevMonth(true)), 'month_prev' => date('n', $Month->prevMonth(true)), 'year_next' => date('Y', $Month->nextMonth(true)), 'month_next' => date('n', $Month->nextMonth(true)));
     $this->set("ym", $ym);
     $this->set("year", $year);
     $this->set("month", $month);
     $this->set("calendar", $calendar);
     $c_member = db_member_c_member4c_member_id($target_id);
     $this->set("pref_list", p_regist_prof_c_profile_pref_list4null());
     $this->set("c_member", $c_member);
     return 'success';
 }
Beispiel #13
0
/**
 * 地域別の人数を取得
 */
function get_analysis_region()
{
    $pref = p_regist_prof_c_profile_pref_list4null();
    $sql = "select pre_addr_c_profile_pref_id as pref_id from c_member";
    $lst = get_array_list4db($sql);
    foreach ($pref as $value) {
        $analysis_region[$value] = 0;
    }
    foreach ($lst as $value) {
        if ($value['pref_id'] == 0) {
            $analysis_region['その他']++;
        } else {
            $analysis_region[$pref[$value['pref_id']]]++;
        }
    }
    return $analysis_region;
}
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_commu_id = $requests['target_c_commu_id'];
     // ----------
     //--- 権限チェック
     $c_commu = db_commu_c_commu4c_commu_id2($target_c_commu_id);
     switch ($c_commu['is_topic']) {
         case 'public':
             //誰でも作成可能
             break;
         case 'member':
             //コミュニティメンバー
             if (!db_commu_is_c_commu_member($target_c_commu_id, $u)) {
                 handle_kengen_error();
             }
             break;
         case 'admin_only':
             //トピック作成権限チェック
             if (!db_commu_is_c_commu_admin($target_c_commu_id, $u)) {
                 handle_kengen_error();
             }
             break;
     }
     //---
     list($event, $errors) = p_c_event_add_confirm_event4request(true);
     $upfile_obj1 = $_FILES['image_filename1'];
     $upfile_obj2 = $_FILES['image_filename2'];
     $upfile_obj3 = $_FILES['image_filename3'];
     $upfile_obj4 = $_FILES['uploadfile'];
     // エラーチェック
     $err_msg = $errors;
     $filesize = 0;
     if (!$event['open_date_month'] || !$event['open_date_day'] || !$event['open_date_year']) {
         $err_msg[] = "開催日時を入力してください";
     } elseif (!t_checkdate($event['open_date_month'], $event['open_date_day'], $event['open_date_year'])) {
         $err_msg[] = "開催日時は存在しません";
     } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0)) {
         $err_msg[] = "開催日時は過去に指定できません";
     }
     if ($event['invite_period_month'] . $event['invite_period_day'] . $event['invite_period_year'] != "") {
         if (!$event['invite_period_month'] || !$event['invite_period_day'] || !$event['invite_period_year']) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (!t_checkdate($event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は存在しません";
         } elseif (mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year']) < mktime(0, 0, 0)) {
             $err_msg[] = "募集期限は過去に指定できません";
         } elseif (mktime(0, 0, 0, $event['open_date_month'], $event['open_date_day'], $event['open_date_year']) < mktime(0, 0, 0, $event['invite_period_month'], $event['invite_period_day'], $event['invite_period_year'])) {
             $err_msg[] = "募集期限は開催日時より未来に指定できません";
         }
     }
     if (!empty($upfile_obj1) && $upfile_obj1['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj1))) {
             $err_msg[] = '画像1は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
     }
     if (!empty($upfile_obj2) && $upfile_obj2['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj2))) {
             $err_msg[] = '画像2は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
     }
     if (!empty($upfile_obj3) && $upfile_obj3['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj3))) {
             $err_msg[] = '画像3は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize += $image['size'];
     }
     // 画像アップロード可能サイズチェック
     if ($filesize) {
         $result = util_image_check_add_image_upload($filesize, $u, 'commu');
         if ($result) {
             if ($result == 2) {
                 $result = 3;
             }
             $err_msg[] = util_image_get_upload_err_msg($result);
         }
     }
     if (OPENPNE_USE_FILEUPLOAD) {
         if (!empty($upfile_obj4) && $upfile_obj4['error'] !== UPLOAD_ERR_NO_FILE) {
             // ファイルサイズ制限
             if ($upfile_obj4['size'] === 0 || $upfile_obj4['size'] > FILE_MAX_FILESIZE * 1024) {
                 $err_msg[] = 'ファイルは' . FILE_MAX_FILESIZE . 'KB以内のファイルにしてください(ただし空のファイルはアップロードできません)';
             }
             // 拡張子制限
             if (!util_check_file_extention($upfile_obj4['name'])) {
                 $err_msg[] = sprintf('アップロードできるファイルの種類は(%s)です', util_get_file_allowed_extensions('string'));
             }
         }
     }
     if ($err_msg) {
         $_REQUEST = $event;
         $_REQUEST['target_c_commu_id'] = $event['c_commu_id'];
         $_REQUEST['err_msg'] = $err_msg;
         openpne_forward('pc', 'page', "c_event_add");
         exit;
     }
     //画像をvar/tmpフォルダにコピー
     $sessid = session_id();
     t_image_clear_tmp($sessid);
     $tmpfile1 = t_image_save2tmp($upfile_obj1, $sessid, "t_1");
     $tmpfile2 = t_image_save2tmp($upfile_obj2, $sessid, "t_2");
     $tmpfile3 = t_image_save2tmp($upfile_obj3, $sessid, "t_3");
     if (OPENPNE_USE_FILEUPLOAD) {
         // 一次ファイルをvar/tmpにコピー
         $tmpfile4 = t_file_save2tmp($upfile_obj4, $sessid, "t_4");
     }
     $this->set('inc_navi', fetch_inc_navi("c", $target_c_commu_id));
     $pref_list = p_regist_prof_c_profile_pref_list4null();
     $event = p_c_event_add_confirm_event4request();
     $event['open_pref_value'] = $pref_list[$event['open_pref_id']];
     $event['image_filename1_tmpfile'] = $tmpfile1;
     $event['image_filename2_tmpfile'] = $tmpfile2;
     $event['image_filename3_tmpfile'] = $tmpfile3;
     $event['filename4_tmpfile'] = $tmpfile4;
     $event['image_filename1'] = $upfile_obj1['name'];
     $event['image_filename2'] = $upfile_obj2['name'];
     $event['image_filename3'] = $upfile_obj3['name'];
     $event['filename4_original_filename'] = $upfile_obj4['name'];
     $this->set('event', $event);
     return 'success';
 }