예제 #1
0
 /**
  * 外部RSS自動取込の設定内容を登録する
  *
  * @param $community_id コミュニティID
  * @param $form 入力フォーム情報
  * @return 成功(true) / 失敗(false)
  */
 static function set_external_rss_contents($community_id, $form)
 {
     $contents_type_master_array = ACSDB::get_master_array('contents_type');
     $open_level_master_array = ACSDB::get_master_array('open_level');
     // 63: external_rss_url
     $contents_form = array();
     $contents_form['community_id'] = $community_id;
     $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D63'), $contents_type_master_array);
     $contents_form['open_level_code'] = $form['external_rss_url_open_level_code'];
     $contents_form['contents_value'] = $form['external_rss_url'];
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // 非公開 (メンバのみ) の公開コミュニティ
     if (is_array($form['external_rss_url_trusted_community_id_array'])) {
         $external_rss_url_trusted_community_form = array();
         $external_rss_url_trusted_community_form['community_id'] = $community_id;
         $external_rss_url_trusted_community_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D63'), $contents_type_master_array);
         $external_rss_url_trusted_community_form['open_level_code'] = $form['external_rss_url_open_level_code'];
         foreach ($form['external_rss_url_trusted_community_id_array'] as $trusted_community_id) {
             $external_rss_url_trusted_community_form['trusted_community_id'] = $trusted_community_id;
             $ret = ACSCommunity::set_contents_trusted_community($external_rss_url_trusted_community_form);
             if (!$ret) {
                 ACSDB::_do_query("ROLLBACK");
                 return $ret;
             }
         }
     }
     // 64: external_rss_post_user
     $contents_form = array();
     $contents_form['community_id'] = $community_id;
     $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D64'), $contents_type_master_array);
     $contents_form['open_level_code'] = ACSAccessControl::get_default_open_level_code(ACSMsg::get_mst('community_type_master', 'D40'), ACSMsg::get_mst('contents_type_master', 'D64'));
     $contents_form['contents_value'] = $form['external_rss_post_user'];
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // 65: external_rss_ml_send_flag
     $contents_form = array();
     $contents_form['community_id'] = $community_id;
     $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D65'), $contents_type_master_array);
     $contents_form['open_level_code'] = ACSAccessControl::get_default_open_level_code(ACSMsg::get_mst('community_type_master', 'D40'), ACSMsg::get_mst('contents_type_master', 'D65'));
     $contents_form['contents_value'] = ACSLib::get_pg_boolean($form['external_rss_ml_send_flag']);
     // 't', 'f'
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // 66: external_rss_public_release_expire_term
     $contents_form = array();
     $contents_form['community_id'] = $community_id;
     $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D66'), $contents_type_master_array);
     $contents_form['open_level_code'] = ACSAccessControl::get_default_open_level_code(ACSMsg::get_mst('community_type_master', 'D40'), ACSMsg::get_mst('contents_type_master', 'D66'));
     $contents_form['contents_value'] = $form['external_rss_public_release_expire_term'];
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     return $ret;
 }
예제 #2
0
 /**
  * ユーザ情報(プロフィール)をセットする
  *
  * @param $acs_user_info_row
  * @param ユーザ情報(プロフィール)
  * @return 成功(true) / 失敗(false)
  */
 static function set_user_profile($acs_user_info_row, $form)
 {
     $user_community_id = $form['id'];
     $contents_type_master_array = ACSDB::get_master_array('contents_type');
     $contents_type_code_array['self'] = array_search(ACSMsg::get_mst('contents_type_master', 'D00'), $contents_type_master_array);
     $contents_type_code_array['user_name'] = array_search(ACSMsg::get_mst('contents_type_master', 'D01'), $contents_type_master_array);
     $contents_type_code_array['mail_addr'] = array_search(ACSMsg::get_mst('contents_type_master', 'D02'), $contents_type_master_array);
     $contents_type_code_array['belonging'] = array_search(ACSMsg::get_mst('contents_type_master', 'D03'), $contents_type_master_array);
     $contents_type_code_array['speciality'] = array_search(ACSMsg::get_mst('contents_type_master', 'D04'), $contents_type_master_array);
     $contents_type_code_array['birthplace'] = array_search(ACSMsg::get_mst('contents_type_master', 'D05'), $contents_type_master_array);
     $contents_type_code_array['birthday'] = array_search(ACSMsg::get_mst('contents_type_master', 'D06'), $contents_type_master_array);
     $contents_type_code_array['community_profile'] = array_search(ACSMsg::get_mst('contents_type_master', 'D07'), $contents_type_master_array);
     $contents_type_code_array['community_profile_login'] = array_search(ACSMsg::get_mst('contents_type_master', 'D08'), $contents_type_master_array);
     $contents_type_code_array['community_profile_friend'] = array_search(ACSMsg::get_mst('contents_type_master', 'D09'), $contents_type_master_array);
     $contents_type_code_array['friends_list'] = array_search(ACSMsg::get_mst('contents_type_master', 'D11'), $contents_type_master_array);
     $contents_type_code_array['mail_lang'] = array_search(ACSMsg::get_mst('contents_type_master', 'D51'), $contents_type_master_array);
     // コミュニティ種別マスタ
     $community_type_master_array = ACSDB::get_master_array('community_type');
     // コミュニティ種別コード
     $user_community_type_code = array_search(ACSMsg::get_mst('community_type_master', 'D10'), $community_type_master_array);
     $friends_community_type_code = array_search(ACSMsg::get_mst('community_type_master', 'D20'), $community_type_master_array);
     // 公開レベルマスタ
     $open_level_master_array = ACSDB::get_master_array('open_level');
     // BEGIN
     ACSDB::_do_query("BEGIN");
     // user_infoが未登録のLDAPユーザの場合は基本情報を登録する
     if (!$acs_user_info_row['is_acs_user'] && $acs_user_info_row['is_ldap_user']) {
         // 新コミュニティID
         $user_community_id_seq = ACSDB::get_next_seq('community_id_seq');
         $user_community_id = $user_community_id_seq;
         // (1) ユーザコミュニティ (community)
         $sql = "INSERT INTO community";
         $sql .= " (community_id, community_name, community_type_code)";
         $sql .= " VALUES ({$user_community_id_seq}, null, '{$user_community_type_code}')";
         $ret = ACSDB::_do_query($sql);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
         // (2) ユーザ情報 (user_info)
         $sql = "INSERT INTO user_info";
         $sql .= " (user_id, user_community_id, administrator_flag)";
         $sql .= " VALUES ('{$form['user_id']}', '{$user_community_id_seq}', 'f')";
         $ret = ACSDB::_do_query($sql);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
         // (3) マイフレンズ
         $contents_form = array();
         $contents_form['community_id'] = $user_community_id_seq;
         $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D11'), $contents_type_master_array);
         $contents_form['contents_value'] = '';
         $contents_form['open_level_code'] = ACSAccessControl::get_default_open_level_code(ACSMsg::get_mst('community_type_master', 'D10'), ACSMsg::get_mst('contents_type_master', 'D11'));
         $ret = ACSCommunity::set_contents($contents_form);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
         // (4) マイフレンズコミュニティ (community)
         $friends_community_id_seq = ACSDB::get_next_seq('community_id_seq');
         $sql = "INSERT INTO community";
         $sql .= " (community_id, community_type_code)";
         $sql .= " VALUES ('{$friends_community_id_seq}', '{$friends_community_type_code}')";
         $ret = ACSDB::_do_query($sql);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
         // (5) マイフレンズコミュニティをユーザコミュニティのサブコミュニティとする (sub_community)
         $sql = "INSERT INTO sub_community";
         $sql .= " (community_id, sub_community_id)";
         $sql .= " VALUES ('{$user_community_id_seq}', '{$friends_community_id_seq}')";
         $ret = ACSDB::_do_query($sql);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
         $is_ldap_user_login_flag = 1;
         // ユーザ基本情報ここまで
     }
     // ニックネーム
     $ret = ACSCommunity::set_community_name($user_community_id, $form['community_name']);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // コンテンツ: 氏名, メールアドレス, 所属, 専攻, 出身, 生年月日, プロフィールは3種
     foreach (array('user_name', 'mail_addr', 'belonging', 'speciality', 'birthplace', 'birthday', 'community_profile', 'community_profile_login', 'community_profile_friend', 'friends_list', 'mail_lang') as $contents_key) {
         $contents_form = array('community_id' => $user_community_id, 'contents_type_code' => $contents_type_code_array[$contents_key], 'contents_value' => $form[$contents_key], 'open_level_code' => $form['open_level_code_array'][$contents_key]);
         $ret = ACSCommunity::set_contents($contents_form);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
     }
     // コンテンツ: ページ全体 = 一般公開とする
     $contents_form = array('community_id' => $user_community_id, 'contents_type_code' => $contents_type_code_array['self'], 'contents_value' => '', 'open_level_code' => array_search(ACSMsg::get_mst('open_level_master', 'D01'), $open_level_master_array));
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // 信頼済みコミュニティ: 出身, 生年月日
     foreach (array('birthplace', 'birthday') as $contents_key) {
         if ($form['trusted_community_flag'][$contents_key]) {
             // マイフレンズグループ
             $trusted_community_id_array = explode(',', $form['trusted_community_id_csv_array'][$contents_key]);
             foreach ($trusted_community_id_array as $trusted_community_id) {
                 if ($trusted_community_id == '') {
                     continue;
                 }
                 $contents_trusted_community_form = array('community_id' => $user_community_id, 'contents_type_code' => $contents_type_code_array[$contents_key], 'open_level_code' => $form['open_level_code_array'][$contents_key], 'trusted_community_id' => $trusted_community_id);
                 $ret = ACSCommunity::set_contents_trusted_community($contents_trusted_community_form);
                 if (!$ret) {
                     ACSDB::_do_query("ROLLBACK");
                     return $ret;
                 }
             }
         } else {
             // マイフレンズ
             $trusted_community_id = ACSUser::get_friends_community_id($user_community_id);
             // フレンズコミュニティID
             $contents_trusted_community_form = array('community_id' => $user_community_id, 'contents_type_code' => $contents_type_code_array[$contents_key], 'open_level_code' => $form['open_level_code_array'][$contents_key], 'trusted_community_id' => $trusted_community_id);
             $ret = ACSCommunity::set_contents_trusted_community($contents_trusted_community_form);
             if (!$ret) {
                 ACSDB::_do_query("ROLLBACK");
                 return $ret;
             }
         }
     }
     // COMMIT
     ACSDB::_do_query("COMMIT");
     if ($is_ldap_user_login_flag) {
         $acs_user_info_row = ACSUser::get_user_info_row_by_user_id($form['user_id']);
         // ログ登録: LDAPユーザ新規登録
         ACSLog::set_log($acs_user_info_row, 'New LDAP User Registration', $ret, "[UserID:{$form['user_id']}]");
         // ラストログイン登録
         ACSUser::set_last_login($acs_user_info_row);
     }
     return $ret;
 }
예제 #3
0
 /**
  * コミュニティを更新する
  * 2006/3/9
  * @param $form コミュニティ情報
  * return 成功(コミュニティID) / 失敗(false)
  */
 static function update_community($form)
 {
     // コミュニティ種別マスタ
     $community_type_master_array = ACSDB::get_master_array('community_type');
     $community_type_code = array_search(ACSMsg::get_mst('community_type_master', 'D40'), $community_type_master_array);
     // コンテンツ種別マスタ
     $contents_type_master_array = ACSDB::get_master_array('contents_type');
     // コミュニティメンバ種別マスタ
     $community_member_type_master_array = ACSDB::get_master_array('community_member_type');
     $community_id_seq = $form['community_id'];
     $org_form = $form;
     ACSLib::escape_sql_array($form);
     ACSLib::get_sql_value_array($form);
     // BEGIN
     ACSDB::_do_query("BEGIN");
     // (1) コミュニティ (community)
     $admission_flag = ACSLib::get_pg_boolean($org_form['admission_flag']);
     $sql = "UPDATE community";
     $sql .= " SET community_name = {$form['community_name']},";
     $sql .= " category_code = {$form['category_code']},";
     $sql .= " admission_flag = {$form['admission_flag']}";
     $sql .= " WHERE community_id = {$community_id_seq}";
     $ret = ACSDB::_do_query($sql);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // (2) コミュニティプロフィール
     $contents_form = array();
     $contents_form['community_id'] = $community_id_seq;
     $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D07'), $contents_type_master_array);
     $contents_form['contents_value'] = $org_form['community_profile'];
     $contents_form['open_level_code'] = ACSAccessControl::get_default_open_level_code(ACSMsg::get_mst('community_type_master', 'D40'), ACSMsg::get_mst('contents_type_master', 'D07'));
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // (3) 参加資格 (join_trusted_community)
     $join_trusted_community_form = array();
     $join_trusted_community_form['community_id'] = $community_id_seq;
     // join_trusted_community 前準備 旧データの一括削除
     $ret = ACSCommunity::delete_join_trusted_community($join_trusted_community_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     //登録
     if (is_array($org_form['join_trusted_community_id_array'])) {
         foreach ($org_form['join_trusted_community_id_array'] as $trusted_community_id) {
             $join_trusted_community_form['trusted_community_id'] = $trusted_community_id;
             $ret = ACSCommunity::set_join_trusted_community($join_trusted_community_form);
             if (!$ret) {
                 ACSDB::_do_query("ROLLBACK");
                 return $ret;
             }
         }
     }
     // (4) 公開範囲 電子掲示板
     // contents
     $contents_form = array();
     $contents_form['community_id'] = $community_id_seq;
     $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D41'), $contents_type_master_array);
     $contents_form['contents_value'] = '';
     $contents_form['open_level_code'] = $org_form['bbs_open_level_code'];
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // contents_trusted_community
     if (is_array($org_form['bbs_trusted_community_id_array'])) {
         $contents_trusted_community_form = array();
         $contents_trusted_community_form['community_id'] = $community_id_seq;
         $contents_trusted_community_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D41'), $contents_type_master_array);
         $contents_trusted_community_form['open_level_code'] = $org_form['bbs_open_level_code'];
         // contents_trusted_community 前準備 旧データの一括削除
         $ret = ACSCommunity::update_contents_trusted_community($contents_trusted_community_form);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
         //登録
         foreach ($org_form['bbs_trusted_community_id_array'] as $trusted_community_id) {
             $contents_trusted_community_form['trusted_community_id'] = $trusted_community_id;
             $ret = ACSCommunity::set_contents_trusted_community($contents_trusted_community_form);
             if (!$ret) {
                 ACSDB::_do_query("ROLLBACK");
                 return $ret;
             }
         }
     }
     // (5) 公開範囲 コミュニティフォルダ (cotents)
     // contents
     $contents_form = array();
     $contents_form['community_id'] = $community_id_seq;
     $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D31'), $contents_type_master_array);
     $contents_form['contents_value'] = '';
     $contents_form['open_level_code'] = $org_form['community_folder_open_level_code'];
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // contents_trusted_community
     if (is_array($org_form['community_folder_trusted_community_id_array'])) {
         $contents_trusted_community_form = array();
         $contents_trusted_community_form['community_id'] = $community_id_seq;
         $contents_trusted_community_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D31'), $contents_type_master_array);
         $contents_trusted_community_form['open_level_code'] = $org_form['community_folder_open_level_code'];
         // contents_trusted_community 前準備 旧データの一括削除
         $ret = ACSCommunity::update_contents_trusted_community($contents_trusted_community_form);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
         // 登録
         foreach ($org_form['community_folder_trusted_community_id_array'] as $trusted_community_id) {
             $contents_trusted_community_form['trusted_community_id'] = $trusted_community_id;
             $ret = ACSCommunity::set_contents_trusted_community($contents_trusted_community_form);
             if (!$ret) {
                 ACSDB::_do_query("ROLLBACK");
                 return $ret;
             }
         }
     }
     // (6) 公開範囲 全体
     // contents
     $contents_form = array();
     $contents_form['community_id'] = $community_id_seq;
     $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D00'), $contents_type_master_array);
     $contents_form['contents_value'] = '';
     $contents_form['open_level_code'] = $org_form['self_open_level_code'];
     $ret = ACSCommunity::set_contents($contents_form);
     if (!$ret) {
         ACSDB::_do_query("ROLLBACK");
         return $ret;
     }
     // (7) コミュニティML
     // contents
     // コミュニティMLアドレス
     if ($org_form['community_ml_address']) {
         $contents_form = array();
         $contents_form['community_id'] = $community_id_seq;
         $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D61'), $contents_type_master_array);
         $contents_form['contents_value'] = $org_form['community_ml_address'];
         $contents_form['open_level_code'] = ACSAccessControl::get_default_open_level_code(ACSMsg::get_mst('community_type_master', 'D40'), ACSMsg::get_mst('contents_type_master', 'D61'));
         $ret = ACSCommunity::set_contents($contents_form);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
         // コミュニティMLステータス
         $contents_form = array();
         $contents_form['community_id'] = $community_id_seq;
         $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D62'), $contents_type_master_array);
         $contents_form['contents_value'] = 'QUEUE';
         $contents_form['open_level_code'] = ACSAccessControl::get_default_open_level_code(ACSMsg::get_mst('community_type_master', 'D40'), ACSMsg::get_mst('contents_type_master', 'D62'));
         $ret = ACSCommunity::set_contents($contents_form);
         if (!$ret) {
             ACSDB::_do_query("ROLLBACK");
             return $ret;
         }
     }
     // COMMIT
     ACSDB::_do_query("COMMIT");
     return $community_id_seq;
 }