function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $c_commu_category_id = $requests['c_commu_category_id'];
     $name = $requests['name'];
     $info = $requests['info'];
     $is_admit = $requests['is_admit'];
     $is_open = $requests['is_open'];
     if (db_commu_is_commu4c_commu_name($name)) {
         $p = array('msg' => 49);
         openpne_redirect('ktai', 'page_h_com_add', $p);
     }
     if (!db_commu_c_commu_category_is_create_commu($c_commu_category_id)) {
         $p = array('msg' => 50);
         openpne_redirect('ktai', 'page_h_com_add', $p);
     }
     // ----------
     $c_member_id = $u;
     $c_commu_id = db_commu_insert_c_commu($c_member_id, $name, $c_commu_category_id, $info, $is_admit, $is_open);
     //作成者をコミュメンバーにする
     db_commu_join_c_commu($c_commu_id, $c_member_id);
     $p = array('target_c_commu_id' => $c_commu_id);
     openpne_redirect('ktai', 'page_c_home', $p);
 }
 function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_commu_id = $requests['target_c_commu_id'];
     $name = $requests['name'];
     $c_commu_category_id = $requests['c_commu_category_id'];
     $info = $requests['info'];
     $is_admit = $requests['is_admit'];
     $is_open = $requests['is_open'];
     $is_topic = $requests['is_topic'];
     $is_comment = $requests['is_comment'];
     if (db_commu_is_changed_c_commu_name($target_c_commu_id, $name) && db_commu_is_commu4c_commu_name($name)) {
         $p = array('target_c_commu_id' => $target_c_commu_id, 'msg' => 49);
         openpne_redirect('ktai', 'page_c_edit', $p);
     }
     $c_commu = db_commu_c_commu4c_commu_id($target_c_commu_id);
     if ($c_commu_category_id != $c_commu['c_commu_category_id'] && !db_commu_c_commu_category_is_create_commu($c_commu_category_id)) {
         $p = array('target_c_commu_id' => $target_c_commu_id, 'msg' => 50);
         openpne_redirect('ktai', 'page_c_edit', $p);
     }
     if ($is_open == 'member') {
         if ($is_topic == 'public') {
             $p = array('target_c_commu_id' => $target_c_commu_id, 'msg' => 53);
             openpne_redirect('ktai', 'page_c_edit', $p);
         }
         if ($is_comment == 'public') {
             $p = array('target_c_commu_id' => $target_c_commu_id, 'msg' => 54);
             openpne_redirect('ktai', 'page_c_edit', $p);
         }
     }
     // ----------
     //--- 権限チェック
     //コミュニティ管理者
     $status = db_common_commu_status($u, $target_c_commu_id);
     if (!$status['is_commu_admin']) {
         handle_kengen_error();
     }
     //---
     // 承認待ちメンバー登録処理
     $c_commu = db_commu_c_commu4c_commu_id($target_c_commu_id);
     if ($is_admit == 'public' && $is_admit != $c_commu['is_admit']) {
         $c_commu_member_confirm_list = db_commu_c_commu_member_confirm4c_commu_id($target_c_commu_id);
         foreach ($c_commu_member_confirm_list as $c_commu_member_confirm) {
             db_commu_join_c_commu($target_c_commu_id, $c_commu_member_confirm['c_member_id']);
             do_inc_join_c_commu_send_mail($target_c_commu_id, $c_commu_member_confirm['c_member_id']);
             db_commu_delete_c_commu_member_confirm($c_commu_member_confirm['c_commu_member_confirm_id']);
         }
     }
     db_commu_update_c_commu($target_c_commu_id, $name, $is_topic, $is_comment, $c_commu_category_id, $info, $is_admit, $is_open);
     $p = array('target_c_commu_id' => $target_c_commu_id);
     openpne_redirect('ktai', 'page_c_home', $p);
 }
示例#3
0
 function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     $errors = array();
     $validator = new OpenPNE_Validator();
     $validator->addRequests($_REQUEST);
     $validator->addRules($this->_getValidateRules());
     if (!$validator->validate()) {
         $errors = $validator->getErrors();
     }
     $prof = $validator->getParams();
     //--- c_profile の項目をチェック
     $validator = new OpenPNE_Validator();
     $validator->addRequests($_REQUEST['profile']);
     $validator->addRules(util_get_validate_rules_profile('regist'));
     if (!$validator->validate()) {
         $errors = array_merge($errors, $validator->getErrors());
     }
     // 値の整合性をチェック(DB)
     $c_member_profile_list = db_member_check_profile($validator->getParams(), $_REQUEST['public_flag']);
     // 必須項目チェック
     $profile_list = db_member_c_profile_list4null();
     foreach ($profile_list as $profile) {
         $value = $c_member_profile_list[$profile['name']]['value'];
         if ($profile['disp_config'] && $profile['is_required']) {
             if (is_null($value) || $value === '' || $value === array()) {
                 $errors[$profile['name']] = $profile['caption'] . 'を入力してください';
             }
         }
     }
     // 生年月日のチェック
     if (!t_checkdate($prof['birth_month'], $prof['birth_day'], $prof['birth_year'])) {
         $errors[] = '生年月日を正しく入力してください';
     }
     if (t_isFutureDate($prof['birth_day'], $prof['birth_month'], $prof['birth_year'])) {
         $errors[] = '生年月日を未来に設定することはできません';
     }
     // 入力エラー
     if ($errors) {
         ktai_display_error($errors);
     }
     db_member_config_prof_new($u, $prof);
     // insert c_member_profile
     db_member_update_c_member_profile($u, $c_member_profile_list);
     //管理画面で指定したコミュニティに強制参加
     $c_commu_id_list = db_commu_regist_join_list();
     foreach ($c_commu_id_list as $c_commu_id) {
         db_commu_join_c_commu($c_commu_id, $u);
     }
     openpne_redirect('ktai', 'page_h_home');
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $name = $requests['name'];
     $c_commu_category_id = $requests['c_commu_category_id'];
     $info = $requests['info'];
     $is_admit = $requests['is_admit'];
     $is_open = $requests['is_open'];
     $tmpfile = $requests['tmpfile'];
     $err_msg = array();
     if (db_commu_is_commu4c_commu_name($name)) {
         $err_msg[] = 'その' . WORD_COMMUNITY . 'はすでに存在します';
     }
     if (!db_commu_c_commu_category_is_create_commu($c_commu_category_id)) {
         $err_msg[] = '指定されたカテゴリは選択できません';
     }
     // 画像アップロード可能サイズチェック
     if ($tmpfile) {
         $filesize = util_image_get_c_tmp_filesize4filename("c_{$c_commu_id}", $tmpfile);
         $result = util_image_check_add_image_upload($filesize, $u, 'other');
         if ($result) {
             $err_msg[] = util_image_get_upload_err_msg($result);
         }
     }
     if ($err_msg) {
         $_REQUEST['err_msg'] = $err_msg;
         openpne_forward('pc', 'page', "h_com_add");
         exit;
     }
     // ----------
     // コミュニティ作成
     $c_commu_id = db_commu_insert_c_commu($u, $name, $c_commu_category_id, $info, $is_admit, $is_open);
     if ($tmpfile) {
         $filename = image_insert_c_image4tmp("c_{$c_commu_id}", $tmpfile, $u);
         t_image_clear_tmp(session_id());
         // 画像更新
         if ($filename) {
             db_commu_update_c_commu_image_filename($c_commu_id, $filename);
         }
     }
     //作成者をコミュメンバーにする
     db_commu_join_c_commu($c_commu_id, $u);
     $p = array('target_c_commu_id' => $c_commu_id);
     openpne_redirect('pc', 'page_c_home', $p);
 }
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     $target_c_commu_id = $requests['target_c_commu_id'];
     $status = db_commu_get_c_join_status($u, $target_c_commu_id);
     //非公開コミュニティに管理者から招待されている場合は強制的に承認を回避
     $admin_invite = db_commu_c_commu4c_admin_invite_id($target_c_commu_id, $u);
     if ($admin_invite) {
         $status = STATUS_C_JOIN_REQUEST_FREE;
         db_commu_delete_c_commu_admin_invite($admin_invite);
     }
     switch ($status) {
         //承認必要なし
         case STATUS_C_JOIN_REQUEST_FREE:
             // 承認依頼があれば削除
             if ($c_commu_member_confirm_id = db_commu_get_c_commu_member_confirm_id($u, $target_c_commu_id)) {
                 db_commu_delete_c_commu_member_confirm($c_commu_member_confirm_id);
             }
             db_commu_join_c_commu($target_c_commu_id, $u);
             do_inc_join_c_commu_send_mail($target_c_commu_id, $u);
             $p = array('target_c_commu_id' => $target_c_commu_id);
             openpne_redirect('pc', 'page_c_join_commu_2', $p);
             break;
             //管理者承認必要
         //管理者承認必要
         case STATUS_C_JOIN_REQUEST_NEED:
             $p = array('target_c_commu_id' => $target_c_commu_id);
             openpne_redirect('pc', 'page_c_join_request', $p);
             break;
             //承認待ち
         //承認待ち
         case STATUS_C_JOIN_WAIT:
             $p = array('target_c_commu_id' => $target_c_commu_id);
             openpne_redirect('pc', 'page_c_join_err_wait', $p);
             break;
             //既に参加
         //既に参加
         case STATUS_C_JOIN_ALREADY:
             $p = array('target_c_commu_id' => $target_c_commu_id);
             openpne_redirect('pc', 'page_c_join_err_already', $p);
             break;
     }
 }
 function execute($requests)
 {
     $tail = $GLOBALS['KTAI_URL_TAIL'];
     $u = $GLOBALS['KTAI_C_MEMBER_ID'];
     // --- リクエスト変数
     $target_c_commu_id = $requests['target_c_commu_id'];
     // ----------
     $status = db_commu_get_c_join_status($u, $target_c_commu_id);
     $p = array('target_c_commu_id' => $target_c_commu_id);
     //非公開コミュニティに管理者から招待されている場合は強制的に承認を回避
     $admin_invite = db_commu_c_commu4c_admin_invite_id($target_c_commu_id, $u);
     if ($admin_invite) {
         $status = STATUS_C_JOIN_REQUEST_FREE;
         db_commu_delete_c_commu_admin_invite($admin_invite);
     }
     switch ($status) {
         //承認必要なし
         case STATUS_C_JOIN_REQUEST_FREE:
             // 承認依頼があれば削除
             if ($c_commu_member_confirm_id = db_commu_get_c_commu_member_confirm_id($u, $target_c_commu_id)) {
                 db_commu_delete_c_commu_member_confirm($c_commu_member_confirm_id);
             }
             db_commu_join_c_commu($target_c_commu_id, $u);
             do_inc_join_c_commu_send_mail($target_c_commu_id, $u);
             openpne_redirect('ktai', 'page_c_home', $p);
             break;
             //管理者承認必要
         //管理者承認必要
         case STATUS_C_JOIN_REQUEST_NEED:
             openpne_redirect('ktai', 'page_c_join_request', $p);
             break;
             //承認待ち
         //承認待ち
         case STATUS_C_JOIN_WAIT:
             openpne_redirect('ktai', 'page_c_home', $p);
             break;
             //既に参加
         //既に参加
         case STATUS_C_JOIN_ALREADY:
             openpne_redirect('ktai', 'page_c_home', $p);
             break;
     }
 }
示例#7
0
function do_inc_join_c_commu($c_commu_id, $c_member_id)
{
    return db_commu_join_c_commu($c_commu_id, $c_member_id);
}
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     // --- リクエスト変数
     $target_c_commu_id = $requests['target_c_commu_id'];
     $name = $requests['name'];
     $c_commu_category_id = $requests['c_commu_category_id'];
     $info = $requests['info'];
     $is_admit = $requests['is_admit'];
     $is_open = $requests['is_open'];
     $is_topic = $requests['is_topic'];
     $is_comment = $requests['is_comment'];
     $is_send_join_mail = $requests['is_send_join_mail'];
     // ----------
     $upfile_obj = $_FILES['image_filename'];
     //--- 権限チェック
     //コミュニティ管理者
     $status = db_common_commu_status($u, $target_c_commu_id);
     if (!$status['is_commu_admin']) {
         handle_kengen_error();
     }
     //---
     $err_msg = array();
     $filesize = 0;
     $del_file = array();
     if (!$name) {
         $err_msg[] = WORD_COMMUNITY . "名を入力してください";
     }
     if (!$info) {
         $err_msg[] = WORD_COMMUNITY . "の説明を入力してください";
     }
     if (db_commu_is_changed_c_commu_name($target_c_commu_id, $name) && db_commu_is_commu4c_commu_name($name)) {
         $err_msg[] = 'その' . WORD_COMMUNITY . 'はすでに存在します';
     }
     $c_commu = db_commu_c_commu4c_commu_id($target_c_commu_id);
     if ($c_commu_category_id != $c_commu['c_commu_category_id'] && !db_commu_c_commu_category_is_create_commu($c_commu_category_id)) {
         $_REQUEST['c_commu_category_id'] = $c_commu['c_commu_category_id'];
         $err_msg[] = '指定されたカテゴリは選択できません';
     }
     if ($is_open == 'member') {
         if ($is_topic == 'public') {
             $err_msg[] = '公開範囲とトピック作成権限が指定できない組み合わせです';
         }
         if ($is_comment == 'public') {
             $err_msg[] = '公開範囲とコメント作成権限が指定できない組み合わせです';
         }
     }
     if (!empty($upfile_obj) && $upfile_obj['error'] !== UPLOAD_ERR_NO_FILE) {
         if (!($image = t_check_image($upfile_obj))) {
             $err_msg[] = '画像は' . IMAGE_MAX_FILESIZE . 'KB以内のGIF・JPEG・PNGにしてください';
         }
         $filesize = $image['size'];
         if ($c_commu['image_filename']) {
             $del_file[] = $c_commu['image_filename'];
         }
     }
     //---画像アップロードサイズチェック
     if (!$err_msg && $filesize) {
         $result = util_image_check_change_image_upload($filesize, $del_file, $u, 'other');
         if ($result) {
             $err_msg[] = util_image_get_upload_err_msg($result);
         }
     }
     if ($err_msg) {
         $_REQUEST['err_msg'] = $err_msg;
         $_REQUEST['target_c_commu_id'] = $target_c_commu_id;
         $_REQUEST['name'] = $name;
         $_REQUEST['info'] = $info;
         openpne_forward('pc', 'page', "c_edit");
         exit;
     }
     $c_commu = db_commu_c_commu4c_commu_id($target_c_commu_id);
     //画像アップデート
     $image_filename = image_insert_c_image_direct($upfile_obj, 'c_' . $target_c_commu_id, $u);
     if ($image_filename) {
         //画像削除
         db_image_data_delete($c_commu['image_filename'], $u);
     }
     // 承認待ちメンバー登録処理
     if ($is_admit == 'public' && $is_admit != $c_commu['is_admit']) {
         $member_confirm_list = db_commu_c_commu_member_confirm4c_commu_id($target_c_commu_id);
         foreach ($member_confirm_list as $confirm_id => $c_member_id) {
             db_commu_join_c_commu($target_c_commu_id, $c_member_id);
             do_inc_join_c_commu_send_mail($target_c_commu_id, $c_member_id);
             db_commu_delete_c_commu_member_confirm($confirm_id);
         }
     }
     db_commu_update_c_commu($target_c_commu_id, $name, $is_topic, $is_comment, $c_commu_category_id, $info, $is_admit, $is_open, $image_filename, $is_send_join_mail);
     $p = array('target_c_commu_id' => $target_c_commu_id);
     openpne_redirect('pc', 'page_c_home', $p);
 }
示例#9
0
/**
 * メンバー登録を行う
 *
 * @param array $c_member
 * @param array $c_member_secure
 * @param array $c_member_profile_list
 * @param bool $is_password_encrypted    パスワードが既に暗号化済みかどうか
 * @return int
 */
function util_regist_c_member($c_member, $c_member_secure, $c_member_profile_list = array(), $is_password_encrypted = false)
{
    // メール受信設定をデフォルト値に
    $c_member['is_receive_mail'] = 1;
    $c_member['is_receive_ktai_mail'] = 1;
    $c_member['is_receive_daily_news'] = 1;
    // メンバー登録
    $u = db_member_insert_c_member($c_member, $c_member_secure, $is_password_encrypted);
    if ($u === false) {
        // メンバー登録に失敗した場合
        return false;
    }
    if (OPENPNE_USE_POINT_RANK) {
        //入会者にポイント加算
        $point = db_action_get_point4c_action_id(1);
        db_point_add_point($u, $point);
        //メンバー招待をした人にポイント加算
        $point = db_action_get_point4c_action_id(7);
        db_point_add_point($c_member['c_member_id_invite'], $point);
    }
    // c_member_profile
    db_member_update_c_member_profile($u, $c_member_profile_list);
    // 招待者とフレンドリンク
    db_friend_insert_c_friend($u, $c_member['c_member_id_invite']);
    //管理画面で指定したコミュニティに強制参加
    $c_commu_id_list = db_commu_regist_join_list();
    foreach ($c_commu_id_list as $c_commu_id) {
        db_commu_join_c_commu($c_commu_id, $u);
    }
    // ログインIDを登録
    if (OPENPNE_AUTH_MODE == 'pneid') {
        $login_id = strtolower($c_member['login_id']);
        db_member_insert_username($u, $login_id);
    }
    return $u;
}
示例#10
0
 function execute($requests)
 {
     $u = $GLOBALS['AUTH']->uid();
     $mode = $requests['mode'];
     $errors = array();
     $validator = new OpenPNE_Validator();
     if ($mode == 'register') {
         $validator->addRequests($_SESSION['prof_req']);
     } else {
         $validator->addRequests($_REQUEST);
     }
     $validator->addRules($this->_getValidateRules());
     if (!$validator->validate()) {
         $errors = array_merge($errors, $validator->getErrors());
     }
     $prof = $validator->getParams();
     //--- c_profile の項目をチェック
     $validator = new OpenPNE_Validator();
     if ($mode == 'register') {
         $validator->addRequests($_SESSION['prof_req']['profile']);
         $request_public_flags = $_SESSION['prof_req']['public_flag'];
     } else {
         $validator->addRequests($_REQUEST['profile']);
         $request_public_flags = $_REQUEST['public_flag'];
     }
     $validator->addRules(util_get_validate_rules_profile('regist'));
     if (!$validator->validate()) {
         $errors = array_merge($errors, $validator->getErrors());
     }
     // 値の整合性をチェック(DB)
     $c_member_profile_list = db_member_check_profile($validator->getParams(), $request_public_flags);
     // 必須項目チェック
     $profile_list = db_member_c_profile_list4null();
     foreach ($profile_list as $profile) {
         $value = $c_member_profile_list[$profile['name']]['value'];
         if ($profile['disp_config'] && $profile['is_required']) {
             if (is_null($value) || $value === '' || $value === array()) {
                 $errors[$profile['name']] = $profile['caption'] . 'を入力してください';
             }
         }
     }
     // 生年月日のチェック
     if (!t_checkdate($prof['birth_month'], $prof['birth_day'], $prof['birth_year'])) {
         $errors[] = '生年月日を正しく入力してください';
     }
     if (t_isFutureDate($prof['birth_day'], $prof['birth_month'], $prof['birth_year'])) {
         $errors[] = '生年月日を未来に設定することはできません';
     }
     $prof['profile'] = $c_member_profile_list;
     if ($errors && $mode != "input") {
         $_REQUEST['msg'] = array_shift($errors);
         $mode = "input";
         $_SESSION['prof'] = $prof;
         unset($_SESSION['prof_req']);
     }
     switch ($mode) {
         case "input":
             openpne_forward('pc', 'page', "h_regist_prof");
             exit;
             break;
         default:
         case "confirm":
             $_SESSION['prof_req'] = $_REQUEST;
             $_SESSION['prof'] = $prof;
             openpne_forward('pc', 'page', "h_regist_prof_confirm");
             exit;
             break;
         case "register":
             db_member_config_prof_new($u, $prof);
             db_member_update_c_member_profile($u, $c_member_profile_list);
             //管理画面で指定したコミュニティに強制参加
             $c_commu_id_list = db_commu_regist_join_list();
             foreach ($c_commu_id_list as $c_commu_id) {
                 db_commu_join_c_commu($c_commu_id, $u);
             }
             unset($_SESSION['prof']);
             openpne_redirect('pc', 'page_h_home');
             break;
     }
 }