function xmlrpc_smtp2pne($message) { // パラメータを取得 $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return $param; } $params = XML_RPC_decode($param); // 入力チェック とりあえず空かどうかのみ if (empty($params['prefix']) and empty($params['domain'])) { return xmlrpc_get_response_faultDefault('incorrect_params'); } if (empty($params['to'])) { return xmlrpc_get_response_faultDefault('incorrect_params'); } if (empty($params['from'])) { return xmlrpc_get_response_faultDefault('incorrect_params'); } // デコーダオブジェクトを作成 $options['from_encoding'] = 'UTF-8'; $options['to_encoding'] = 'UTF-8'; $options['img_tmp_dir'] = OPENPNE_VAR_DIR . '/tmp'; $options['img_max_filesize'] = IMAGE_MAX_FILESIZE * 1024; $options['trim_doublebyte_space'] = OPENPNE_TRIM_DOUBLEBYTE_SPACE; $decoder =& new OpenPNE_KtaiMail_RPC($options); $decoder->assign($params); // メール受信処理オブジェクトを起動 $mail_sns =& new mail_sns($decoder); if (!$mail_sns->main()) { //エラーの場合はfaultCodeを返す return xmlrpc_get_fault_response(56, 'Can\'t Receive Mail'); } return xmlrpc_get_response(0); }
/** * 認証API */ function xmlrpc_000_auth($message) { $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return false; } $params = XML_RPC_decode($param); if (empty($params['sid'])) { return false; } if (empty($params['mid'])) { return false; } if (empty($params['dt'])) { return false; } $c_member_id = $params['mid']; $datetime = $params['dt']; if (!db_member_c_member4c_member_id_LIGHT($c_member_id)) { return xmlrpc_get_fault_response(56); } if (!($member_token = db_api_get_member_token($c_member_id))) { return xmlrpc_get_fault_response(52); } $session_id = api_get_sid($c_member_id, $member_token, $datetime); if ($params['sid'] != $session_id) { return xmlrpc_get_fault_response(52); } return xmlrpc_get_response($c_member_id); }
function xmlrpc_di_000_get_diary($message) { $dummy = array(); $re_false = array('result' => 1, 'list' => $dummy); $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return xmlrpc_get_response($re_false); } $params = XML_RPC_decode($param); if (empty($params['mid_to'])) { //対象メンバID必須 return xmlrpc_get_response($re_false); } if (empty($params['count'])) { //取得数必須 return xmlrpc_get_response($re_false); } if (!is_numeric($params['mid_to'])) { //対象メンバIDは整数値 return xmlrpc_get_response($re_false); } if (!empty($params['mid_from'])) { //アクセスメンバIDは(存在する場合は)整数値 if (!is_numeric($params['mid_from'])) { return xmlrpc_get_response($re_false); } } if (!is_numeric($params['count'])) { //取得数は整数値 return xmlrpc_get_response($re_false); } if ($params['count'] < 0) { //取得数は正 return xmlrpc_get_response($re_false); } $member_id_to = $params['mid_to']; $member_id_from = $params['mid_from']; $count = $params['count']; if ($count > 100) { //取得最大数は100 $count = 100; } if (!($arr = OP::op_diary_get_c_diary($member_id_to, $member_id_from, $count))) { return xmlrpc_get_response($re_false); } else { foreach ($arr as $key => $value) { $diary[$key]['id'] = $arr[$key]['c_diary_id']; $diary[$key]['subject'] = $arr[$key]['subject']; $diary[$key]['body'] = $arr[$key]['body']; $diary[$key]['datetime'] = date('Y/m/d H:i:s', strtotime($arr[$key]['r_datetime'])); } $re_true = array('result' => 0, 'list' => $diary); return xmlrpc_get_response($re_true); } }
/** * @copyright 2005-2008 OpenPNE Project * @license http://www.php.net/license/3_01.txt PHP License 3.01 */ function xmlrpc_002_get_member_point($message) { $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return false; } $params = XML_RPC_decode($param); if (empty($params['c_member_id'])) { return false; } $point = get_point($params['c_member_id']); return xmlrpc_get_response($point); }
function xmlrpc_as_001_set_ashiato($message) { $dummy = array(); $re_false = array('result' => 1); $re_true = array('result' => 0); $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return xmlrpc_get_response($re_false); } $params = XML_RPC_decode($param); //「あしあと」を付けたメンバID必須 if (empty($params['mid_from'])) { return xmlrpc_get_response($re_false); } //「あしあと」を付けられたメンバID必須 if (empty($params['mid_to'])) { return xmlrpc_get_response($re_false); } $mid_from = $params['mid_from']; $mid_to = $params['mid_to']; //登録済みのメンバか if (!OP::op_member_is_active_c_member_id($mid_from)) { return xmlrpc_get_response($re_false); } //登録済みのメンバか if (!OP::op_member_is_active_c_member_id($mid_to)) { return xmlrpc_get_response($re_false); } //あしあとを付けたメンバIDと付けられたメンバIDは同一か if ($mid_from == $mid_to) { return xmlrpc_get_response($re_true); } //一定時間内の連続アクセスか? if (!OP::op_ashiato_check_access_minute($mid_to, $mid_from)) { return xmlrpc_get_response($re_true); } //忍び足状態か? if (USE_SHINOBIASHI) { if (OP::op_member_is_shinobiashi($mid_from)) { return xmlrpc_get_response($re_true); } } if (!OP::op_ashiato_insert_c_ashiato($mid_to, $mid_from)) { return xmlrpc_get_response($re_false); } //正常終了 return xmlrpc_get_response($re_true); }
function xmlrpc_as_000_get_ashiato($message) { $dummy = array(); $re_false = array('result' => 1, 'list' => $dummy); $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return xmlrpc_get_response($re_false); } $params = XML_RPC_decode($param); //対象メンバID必須 if (empty($params['mid'])) { return xmlrpc_get_response($re_false); } //取得数必須 if (empty($params['count'])) { return xmlrpc_get_response($re_false); } //取得数は数値 if (!is_numeric($params['count'])) { return xmlrpc_get_response($re_false); } $member_id = $params['mid']; $count = intval($params['count']); $profile = $params['profile']; //取得数は正 if ($count <= 0) { return xmlrpc_get_response($re_false); } //登録済みのメンバか if (!OP::op_member_is_active_c_member_id($member_id)) { return xmlrpc_get_response($re_false); } //あしあとのあるメンバか if (!OP::op_is_ahiato_member($member_id)) { return xmlrpc_get_response($re_false); } //取得最大数は100 if ($count > 100) { $count = 100; } $list = OP::op_ashiato_list_c_member_profile($member_id, $count, $profile); if (empty($list)) { return xmlrpc_get_respose($re_false); } return xmlrpc_get_response(array('result' => 0, 'list' => $list)); }
/** * @copyright 2005-2008 OpenPNE Project * @license http://www.php.net/license/3_01.txt PHP License 3.01 */ function xmlrpc_001_get_c_member($message) { $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return false; } $params = XML_RPC_decode($param); if (empty($params['target_c_member_id'])) { return false; } if (empty($params['my_c_member_id'])) { return false; } $t_id = intval($params['target_c_member_id']); $m_id = intval($params['my_c_member_id']); // my_c_member_id が不正 if (!db_member_c_member4c_member_id_LIGHT($m_id)) { return xmlrpc_get_fault_response(56); } if ($t_id == $m_id) { // 自分 $public_flag = 'private'; } elseif (db_friend_is_friend($t_id, $m_id)) { $public_flag = 'friend'; } else { $public_flag = 'public'; } // target_c_member_id が不正 if (!($c_member = db_member_c_member4c_member_id($t_id, false, true, $public_flag))) { return xmlrpc_get_fault_response(56); } // アクセスブロック判定 if (db_member_is_access_block($m_id, $t_id)) { $result = array('c_member_id' => $t_id, 'nickname' => $c_member['nickname'], 'image_url' => xmlrpc_get_image_url()); } else { $result = array('c_member_id' => $t_id, 'nickname' => $c_member['nickname'], 'image_url' => xmlrpc_get_image_url($c_member['image_filename']), 'image_url_1' => xmlrpc_get_image_url($c_member['image_filename_1'], false), 'image_url_2' => xmlrpc_get_image_url($c_member['image_filename_2'], false), 'image_url_3' => xmlrpc_get_image_url($c_member['image_filename_3'], false), 'birth_year' => intval($c_member['birth_year']), 'birth_month' => intval($c_member['birth_month']), 'birth_day' => intval($c_member['birth_day']), 'access_date' => xmlrpc_get_date($c_member['access_date']), 'r_date' => xmlrpc_get_date($c_member['r_date']), 'profile' => array()); foreach ($c_member['profile'] as $key => $profile) { $result['profile'][$key] = $profile['value']; } } return xmlrpc_get_response($result); }
/** * @copyright 2005-2008 OpenPNE Project * @license http://www.php.net/license/3_01.txt PHP License 3.01 */ function xmlrpc_901_o_search($message) { $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return false; } $params = XML_RPC_decode($param); if (!array_key_exists('searchword', $params)) { return false; } if (empty($params['type'])) { return false; } $searchword = $params['searchword']; if (empty($searchword)) { $searchword = ''; } $type = $params['type']; $number = 0; switch ($type) { case 'DIARY': $diary = p_h_diary_list_all_search_c_diary4c_diary($searchword, 0, 1); $number += (int) $diary[3]; break; case 'COMMUNITY': $commu = db_commu_search_c_commu4c_commu_category($searchword, 0, 0, 1); $number += (int) $commu[3]; break; case 'ALL': default: $diary = p_h_diary_list_all_search_c_diary4c_diary($searchword, 0, 1); $number += (int) $diary[3]; $commu = db_commu_search_c_commu4c_commu_category($searchword, 0, 0, 1); $number += (int) $commu[3]; break; } $result = array('number' => intval($number), 'sns_name' => SNS_NAME); return xmlrpc_get_response($result); }
/** * @copyright 2005-2008 OpenPNE Project * @license http://www.php.net/license/3_01.txt PHP License 3.01 */ function xmlrpc_101_add_point($message) { $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return false; } $params = XML_RPC_decode($param); if (empty($params['c_member_id'])) { return false; } if (!isset($params['point'])) { return false; } $c_member_id = intval($params['c_member_id']); $point = intval($params['point']); if (!db_member_c_member4c_member_id_LIGHT($c_member_id)) { return xmlrpc_get_fault_response(56); } $c_point_log_id = db_point_insert_log($c_member_id, $point, $params['memo']); db_point_insert_tags($c_point_log_id, $params['tags']); $point = db_point_add_point($c_member_id, $point); return xmlrpc_get_response($point); }
function xmlrpc_di_001_set_comment($message) { $re_true = array('result' => 0); $re_false = array('result' => 1); $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return xmlrpc_get_response($re_false); } $params = XML_RPC_decode($param); if (empty($params['mid'])) { //コメント書込メンバID必須 return xmlrpc_get_response($re_false); } if (empty($params['did'])) { //コメント書込日記ID必須 return xmlrpc_get_response($re_false); } if (is_null($params['body']) || $params['body'] === '') { //コメント本文必須(0または'0'を除く) return xmlrpc_get_response($re_false); } if (!is_numeric($params['mid'])) { //コメント書込メンバIDは整数値 return xmlrpc_get_response($re_false); } if (!is_numeric($params['did'])) { //コメント書込日記IDは整数値 return xmlrpc_get_response($re_false); } if (mb_strwidth($params['body']) > 65535) { //コメント本文は65535bytesまで return xmlrpc_get_response($re_false); } $member_id = $params['mid']; $diary_id = $params['did']; $diary_body = rawurldecode($params['body']); $d_member_id = OP::op_diary_get_c_member_id4c_diary_id($diary_id); //日記IDから日記作成メンバIDを取得 if (!OP::op_member_is_active_c_member_id($d_member_id)) { //アクティブメンバーか? return xmlrpc_get_response($re_false); } if ($member_id != $d_member_id) { //日記作成メンバ本人か? if (OP::op_member_is_access_block($member_id, $d_member_id)) { //アクセスブロックされているか? return xmlrpc_get_response($re_false); } $pubflg = OP::op_diary_get_c_member_id4public_flg($diary_id); //日記IDから公開範囲を取得 if ($pubflg != "public") { //公開範囲がpublic以外か? if ($pubflg != "friend") { //公開範囲がfriendか? return xmlrpc_get_response($re_false); } if (!OP::op_friend_is_friend($d_member_id, $member_id)) { //フレンド登録済以外か? return xmlrpc_get_response($re_false); } } } if (!OP::op_diary_insert_c_diary_comment($member_id, $diary_id, $diary_body)) { //コメント書込 return xmlrpc_get_response($re_false); } if (!OP::op_diary_c_diary_is_no_checked($diary_id)) { //未読フラグ書込 return xmlrpc_get_response($re_false); } if ($member_id != $d_member_id) { //日記作成メンバ本人か? OP::op_point_add_point($member_id, OP::op_action_get_point4c_action_id(3)); OP::op_point_add_point($d_member_id, OP::op_action_get_point4c_action_id(2)); } return xmlrpc_get_response($re_true); }
function xmlrpc_au_000_auth($message) { $re_false = array('result' => 1); $param = $message->getParam(0); if (!XML_RPC_Value::isValue($param)) { return xmlrpc_get_response($re_false); } $params = XML_RPC_decode($param); if (empty($params['mail'])) { //メールアドレス必須 return xmlrpc_get_response($re_false); } if (empty($params['passwd'])) { //パスワード必須 return xmlrpc_get_response($re_false); } if (is_null($params['sidflg']) || $params['sidflg'] === '') { //セッション作成フラグ必須 return xmlrpc_get_response($re_false); } if (!is_numeric($params['sidflg'])) { //セッション作成フラグは数値 return xmlrpc_get_response($re_false); } if (intval($params['sidflg']) != 0 && intval($params['sidflg']) != 1) { //セッション作成フラグは0 or 1 return xmlrpc_get_response($re_false); } $user_mail = htmlentities($params['mail']); $user_passwd = htmlentities($params['passwd']); $sid = htmlspecialchars($params['sid']); $sidflg = intval($params['sidflg']); $is_ktai = is_ktai_mail_address($user_mail); //携帯か? if ($is_ktai) { //携帯からのアクセス $c_member_id = OP::op_member_k_auth_login($user_mail, $user_passwd); } else { //PCからのアクセス $c_member_id = OP::op_member_auth_login($user_mail, $user_passwd); } if (!$c_member_id) { //メンバIDが取得できたか? return xmlrpc_get_response($re_false); } if (OP::op_member_is_login_rejected($c_member_id)) { //ログイン拒否されているか? return xmlrpc_get_response($re_false); } if (!OP::op_member_is_active_c_member_id($c_member_id)) { //アクティブメンバーか? return xmlrpc_get_response($re_false); } if (!$sidflg) { //セッションIDを作成するか $req = array('c_member_id' => $c_member_id, 'address' => $user_mail, 'password' => $user_passwd, 'sid' => $sid, 'is_ktai' => $is_ktai); if (!($session_id = OP::op_k_login($req))) { return xmlrpc_get_response($re_false); } $re_true = array('result' => 0, 'sid' => $session_id, 'mid' => intval($c_member_id)); } else { //セッションIDを作成しない $re_true = array('result' => 0, 'mid' => intval($c_member_id)); } return xmlrpc_get_response($re_true); }