function execute($requests) { $this->_login_params = $requests['login_params']; $config = get_auth_config(); $auth = new OpenPNE_Auth($config); $this->_auth =& $auth; $auth->setExpire($GLOBALS['OpenPNE']['common']['session_lifetime']); $auth->setIdle($GLOBALS['OpenPNE']['common']['session_idletime']); // 現在のセッションを削除 $auth->logout(); if (LOGIN_CHECK_ENABLE) { include_once 'OpenPNE/LoginChecker.php'; $options = array('check_num' => LOGIN_CHECK_NUM, 'check_time' => LOGIN_CHECK_TIME, 'reject_time' => LOGIN_REJECT_TIME); $this->_lc =& new OpenPNE_LoginChecker($options); } if (!$auth->login($requests['is_save'])) { $this->_fail_login(); } if (LOGIN_CHECK_ENABLE && $this->_lc->is_rejected()) { $this->_fail_login(); } $c_member_id = db_member_c_member_id4username_encrypted($auth->getUsername(), false); if (OPENPNE_AUTH_MODE == 'slavepne' && !$c_member_id) { $c_member_id = db_member_create_member($_POST['username']); } if (!$c_member_id) { $this->_fail_login(); } if (OPENPNE_ONE_SESSION_PER_USER) { db_member_update_c_member_secure_insert_sess_id($c_member_id, session_id()); } if (db_member_is_login_rejected($c_member_id)) { $this->_fail_login('login_rejected'); } if (db_member_is_blacklist($c_member_id)) { $this->_fail_login('login_rejected'); } db_member_do_access($c_member_id); db_api_update_token($c_member_id); $url = OPENPNE_URL; if ($this->_login_params) { $url .= '?' . $this->_login_params; } client_redirect_absolute($url); }
function execute($requests) { if (!($c_member_id = db_member_c_member_id4easy_access_id(OpenPNE_KtaiID::getID()))) { // 認証エラー $p = array('msg' => 14, 'kad' => t_encrypt($requests['ktai_address']), 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } $c_member = db_member_c_member4c_member_id($c_member_id, true); @session_name('OpenPNEktai'); $config = get_auth_config(true); $auth = new OpenPNE_Auth($config); $auth->setExpire($GLOBALS['OpenPNE']['ktai']['session_lifetime']); $auth->setIdle($GLOBALS['OpenPNE']['ktai']['session_idletime']); $this->_auth =& $auth; if (LOGIN_CHECK_ENABLE) { // 不正ログインチェック include_once 'OpenPNE/LoginChecker.php'; $options = array('check_num' => LOGIN_CHECK_NUM, 'check_time' => LOGIN_CHECK_TIME, 'reject_time' => LOGIN_REJECT_TIME); $lc = new OpenPNE_LoginChecker($options); if ($lc->is_rejected()) { // 認証エラー $lc->fail_login(); $p = array('msg' => '0', 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } } $auth->auth =& $auth->factory(true); $username = db_member_username4c_member_id($c_member_id, true); if (OPENPNE_AUTH_MODE == 'email') { $username = t_encrypt($username); } $auth->auth->setAuth($username); $auth->auth->setAuthData('OPENPNE_URL', OPENPNE_URL); $auth->auth->setAuthData('USER_AGENT', $_SERVER['HTTP_USER_AGENT']); if (OPENPNE_ONE_SESSION_PER_USER) { db_member_update_c_member_secure_insert_sess_id($c_member_id, session_id()); } if (db_member_is_login_rejected($c_member_id)) { ktai_display_error('ログインできませんでした。'); } if (db_member_is_blacklist($c_member_id)) { ktai_display_error('ログインできませんでした。'); } db_member_do_access($c_member_id); // ログイン後のリダイレクト先を決定する $a = ''; $m = 'ktai'; $p = array(); if ($requests['login_params']) { parse_str($requests['login_params'], $p); } if (!empty($p['a'])) { $a = $p['a']; } if (!empty($p['m'])) { $m = $p['m']; } if ($m == 'ktai' && $a == 'page_o_login') { $a = ''; } $_SESSION['c_member_id'] = $c_member_id; $p['ksid'] = session_id(); openpne_redirect($m, $a, $p); }
function main() { $matches = array(); list($from_user, $from_host) = explode('@', $this->from, 2); list($to_user, $to_host) = explode('@', $this->to, 2); // メンテナンスモード if (OPENPNE_UNDER_MAINTENANCE) { $this->error_mail('現在メンテナンス中のため、メール投稿はおこなえません。しばらく時間を空けて再度送信してください。'); m_debug_log('mail_sns::main() maintenance mode'); return false; } // from_host が携帯ドメイン以外はエラー if (!is_ktai_mail_address($this->from)) { m_debug_log('mail_sns::main() from wrong host'); return false; } if (MAIL_ADDRESS_PREFIX) { if (strpos($to_user, MAIL_ADDRESS_PREFIX) === 0) { $to_user = substr($to_user, strlen(MAIL_ADDRESS_PREFIX)); } } if (!$this->c_member_id) { // 送信者がSNSメンバーでない場合 if (!IS_CLOSED_SNS) { // get 新規登録 if ($to_user == 'get') { // アフィリエイトIDが付いている場合 $body = $this->decoder->get_text_body(); m_debug_log('mail_sns::regist_get()', PEAR_LOG_INFO); return $this->regist_get($body); } } m_debug_log('mail_sns::main() action not found'); return false; } // 送信者がログイン停止登録されているメンバーの場合 if (db_member_is_login_rejected($this->c_member_id)) { m_debug_log('mail_sns::main() mail from rejected member'); return false; } // 送信者がブラックリスト登録済みメンバーの場合 if (db_member_is_blacklist($this->c_member_id)) { m_debug_log('mail_sns::main() mail from member on blacklist'); return false; } //--- // ログインURL通知 if ($to_user == 'get') { m_debug_log('mail_sns::login_get()', PEAR_LOG_INFO); return $this->login_get(); } elseif (preg_match('/^t(\\d+)$/', $to_user, $matches) || preg_match('/^t(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { // トピックIDのチェック if (!($c_commu_topic_id = $matches[1])) { return false; } if (MAIL_ADDRESS_HASHED) { if (empty($matches[2])) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_commu_topic_comment()', PEAR_LOG_INFO); return $this->add_commu_topic_comment($c_commu_topic_id); } elseif ($to_user == 'blog' || preg_match('/^b(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { if (MAIL_ADDRESS_HASHED) { if (empty($matches[1]) || empty($matches[2])) { return false; } // メンバーIDのチェック if ($matches[1] != $this->c_member_id) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_diary()', PEAR_LOG_INFO); return $this->add_diary(); } elseif (preg_match('/^bc(\\d+)$/', $to_user, $matches) || preg_match('/^bc(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { // 日記IDのチェック if (!($c_diary_id = $matches[1])) { return false; } if (MAIL_ADDRESS_HASHED) { if (empty($matches[2])) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_diary_comment()', PEAR_LOG_INFO); return $this->add_diary_comment($c_diary_id); } elseif ($to_user == 'album' || preg_match('/^a(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { if (MAIL_ADDRESS_HASHED) { if (empty($matches[1]) || empty($matches[2])) { return false; } // メンバーIDのチェック if ($matches[1] != $this->c_member_id) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_album()', PEAR_LOG_INFO); return $this->add_album(); } elseif (preg_match('/^ai(\\d+)$/', $to_user, $matches) || preg_match('/^ai(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { // アルバムIDのチェック if (!($c_album_id = $matches[1])) { return false; } if (MAIL_ADDRESS_HASHED) { if (empty($matches[2])) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_album_image()', PEAR_LOG_INFO); return $this->add_album_image($c_album_id); } elseif (preg_match('/^p(\\d+)$/', $to_user, $matches) || preg_match('/^p(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { // メンバーIDのチェック if ($matches[1] != $this->c_member_id) { return false; } if (MAIL_ADDRESS_HASHED) { if (empty($matches[2])) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_member_image()', PEAR_LOG_INFO); return $this->add_member_image(); } elseif (preg_match('/^bi(\\d+)$/', $to_user, $matches) || preg_match('/^bi(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { // 日記IDのチェック if (!($c_diary_id = $matches[1])) { return false; } if (MAIL_ADDRESS_HASHED) { if (empty($matches[2])) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_diary_image()', PEAR_LOG_INFO); return $this->add_diary_image($c_diary_id); } elseif (preg_match('/^ci(\\d+)$/', $to_user, $matches) || preg_match('/^ci(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { // コミュニティIDのチェック if (!($c_commu_id = $matches[1])) { return false; } if (MAIL_ADDRESS_HASHED) { if (empty($matches[2])) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_commu_image()', PEAR_LOG_INFO); return $this->add_commu_image($c_commu_id); } elseif (preg_match('/^ti(\\d+)$/', $to_user, $matches) || preg_match('/^ti(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { // トピックIDのチェック if (!($c_commu_topic_id = $matches[1])) { return false; } if (MAIL_ADDRESS_HASHED) { if (empty($matches[2])) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_topic_image()', PEAR_LOG_INFO); return $this->add_topic_image($c_commu_topic_id); } elseif (preg_match('/^ac(\\d+)$/', $to_user, $matches) || preg_match('/^ac(\\d+)-([0-9a-f]+)$/', $to_user, $matches)) { // アルバムIDのチェック if (!($c_album_id = $matches[1])) { return false; } if (MAIL_ADDRESS_HASHED) { if (empty($matches[2])) { return false; } // メンバーハッシュのチェック if (!t_check_user_hash($this->c_member_id, $matches[2])) { return false; } } m_debug_log('mail_sns::add_album_cover_image()', PEAR_LOG_INFO); return $this->add_album_cover_image($c_album_id); } m_debug_log('mail_sns::main() action not found(member)'); return false; }
function execute($requests) { // --- リクエスト変数 $c_member_id = $requests['c_member_id']; $ktai_address = $requests['ktai_address']; $password = $requests['password']; // ---------- @session_name('OpenPNEktai'); $config = get_auth_config(true); $auth = new OpenPNE_Auth($config); $auth->setExpire($GLOBALS['OpenPNE']['ktai']['session_lifetime']); $auth->setIdle($GLOBALS['OpenPNE']['ktai']['session_idletime']); $this->_auth =& $auth; if (LOGIN_CHECK_ENABLE) { // 不正ログインチェック include_once 'OpenPNE/LoginChecker.php'; $options = array('check_num' => LOGIN_CHECK_NUM, 'check_time' => LOGIN_CHECK_TIME, 'reject_time' => LOGIN_REJECT_TIME); $lc = new OpenPNE_LoginChecker($options); if ($lc->is_rejected() || !$auth->login()) { // 認証エラー $lc->fail_login(); $p = array('msg' => '0', 'kad' => t_encrypt($ktai_address), 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } } else { if (!$auth->login()) { $p = array('msg' => '0', 'kad' => t_encrypt($ktai_address), 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } } $c_member_id = db_member_c_member_id4username_encrypted($auth->getUsername(), true); if (OPENPNE_AUTH_MODE == 'slavepne' && !$c_member_id) { $c_member_id = db_member_create_member($_POST['username']); } if (!$c_member_id) { $p = array('msg' => '0', 'kad' => t_encrypt($ktai_address), 'login_params' => $requests['login_params']); openpne_redirect('ktai', 'page_o_login', $p); } if (OPENPNE_ONE_SESSION_PER_USER) { db_member_update_c_member_secure_insert_sess_id($c_member_id, session_id()); } if (db_member_is_login_rejected($c_member_id)) { ktai_display_error('ログインできませんでした。'); } if (db_member_is_blacklist($c_member_id)) { ktai_display_error('ログインできませんでした。'); } db_member_do_access($c_member_id); // ログイン後のリダイレクト先を決定する $a = ''; $m = 'ktai'; $p = array(); if ($requests['login_params']) { parse_str($requests['login_params'], $p); } if (!empty($p['a'])) { $a = $p['a']; } if (!empty($p['m'])) { $m = $p['m']; } if ($m == 'ktai' && $a == 'page_o_login') { $a = ''; } $_SESSION['c_member_id'] = $c_member_id; $p['ksid'] = session_id(); openpne_redirect($m, $a, $p); }