diff --git a/adm/config_form_update.php b/adm/config_form_update.php
index 47bf8c220..f83e3994e 100644
--- a/adm/config_form_update.php
+++ b/adm/config_form_update.php
@@ -106,6 +106,9 @@ $sql = " update {$g4['config_table']}
cf_facebook_use = '{$_POST['cf_facebook_use']}',
cf_facebook_appid = '{$_POST['cf_facebook_appid']}',
cf_facebook_secret = '{$_POST['cf_facebook_secret']}',
+ cf_twitter_use = '{$_POST['cf_twitter_use']}',
+ cf_twitter_key = '{$_POST['cf_twitter_key']}',
+ cf_twitter_secret = '{$_POST['cf_twitter_secret']}',
cf_1_subj = '{$_POST['cf_1_subj']}',
cf_2_subj = '{$_POST['cf_2_subj']}',
cf_3_subj = '{$_POST['cf_3_subj']}',
diff --git a/common.php b/common.php
index b4cf0bac6..9d360364c 100644
--- a/common.php
+++ b/common.php
@@ -134,8 +134,8 @@ div a {display:block;margin:50px auto 10px;width:170px;text-align:center}
//==============================================================================
// SESSION 설정
//------------------------------------------------------------------------------
-ini_set("session.use_trans_sid", 0); // PHPSESSID를 자동으로 넘기지 않음
-ini_set("url_rewriter.tags",""); // 링크에 PHPSESSID가 따라다니는것을 무력화함 (해뜰녘님께서 알려주셨습니다.)
+@ini_set("session.use_trans_sid", 0); // PHPSESSID를 자동으로 넘기지 않음
+@ini_set("url_rewriter.tags",""); // 링크에 PHPSESSID가 따라다니는것을 무력화함 (해뜰녘님께서 알려주셨습니다.)
session_save_path(G4_DATA_PATH.'/session');
@@ -143,15 +143,6 @@ if (isset($SESSION_CACHE_LIMITER))
@session_cache_limiter($SESSION_CACHE_LIMITER);
else
@session_cache_limiter("no-cache, must-revalidate");
-//==============================================================================
-
-
-//==============================================================================
-// 공용 변수
-//------------------------------------------------------------------------------
-// 기본환경설정
-// 기본적으로 사용하는 필드만 얻은 후 상황에 따라 필드를 추가로 얻음
-$config = sql_fetch(" select * from {$g4['config_table']} ");
ini_set("session.cache_expire", 180); // 세션 캐쉬 보관시간 (분)
ini_set("session.gc_maxlifetime", 10800); // session data의 garbage collection 존재 기간을 지정 (초)
@@ -162,6 +153,15 @@ session_set_cookie_params(0, '/');
ini_set("session.cookie_domain", G4_COOKIE_DOMAIN);
@session_start();
+//==============================================================================
+
+
+//==============================================================================
+// 공용 변수
+//------------------------------------------------------------------------------
+// 기본환경설정
+// 기본적으로 사용하는 필드만 얻은 후 상황에 따라 필드를 추가로 얻음
+$config = sql_fetch(" select * from {$g4['config_table']} ");
define('G4_HTTP_BBS_URL', https_url(G4_BBS_DIR, false));
define('G4_HTTPS_BBS_URL', https_url(G4_BBS_DIR, true));
diff --git a/config.php b/config.php
index a065f5b25..39639a4e6 100644
--- a/config.php
+++ b/config.php
@@ -48,11 +48,9 @@ define('G4_SKIN_DIR', 'skin');
define('G4_GCAPTCHA_DIR', 'gcaptcha');
define('G4_CKEDITOR_DIR', 'ckeditor');
define('G4_MOBILE_DIR', 'mobile');
-<<<<<<< HEAD
-define('G4_KCP_DIR', 'kcp');
-=======
+
define('G4_KCPCERT_DIR', 'kcpcert');
->>>>>>> master
+
define('G4_SNS_DIR', 'sns');
define('G4_SYNDI_DIR', 'syndi');
@@ -82,11 +80,7 @@ define('G4_SKIN_URL', G4_URL.'/'.G4_SKIN_DIR);
define('G4_PLUGIN_URL', G4_URL.'/'.G4_PLUGIN_DIR);
define('G4_GCAPTCHA_URL', G4_PLUGIN_URL.'/'.G4_GCAPTCHA_DIR);
define('G4_CKEDITOR_URL', G4_PLUGIN_URL.'/'.G4_CKEDITOR_DIR); // CKEDITOR 의 라이브러리 경로
-<<<<<<< HEAD
-define('G4_KCP_URL', G4_PLUGIN_URL.'/'.G4_KCP_DIR);
-=======
define('G4_KCPCERT_URL', G4_PLUGIN_URL.'/'.G4_KCPCERT_DIR);
->>>>>>> master
define('G4_SNS_URL', G4_PLUGIN_URL.'/'.G4_SNS_DIR);
define('G4_SYNDI_URL', G4_PLUGIN_URL.'/'.G4_SYNDI_DIR);
define('G4_MOBILE_URL', G4_URL.'/'.G4_MOBILE_DIR);
@@ -101,11 +95,9 @@ define('G4_PLUGIN_PATH', G4_PATH.'/'.G4_PLUGIN_DIR);
define('G4_SKIN_PATH', G4_PATH.'/'.G4_SKIN_DIR);
define('G4_GCAPTCHA_PATH', G4_PLUGIN_PATH.'/'.G4_GCAPTCHA_DIR);
define('G4_CKEDITOR_PATH', G4_PLUGIN_PATH.'/'.G4_CKEDITOR_DIR);
-<<<<<<< HEAD
-define('G4_KCP_PATH', G4_PLUGIN_PATH.'/'.G4_KCP_DIR);
-=======
+
define('G4_KCPCERT_PATH', G4_PLUGIN_PATH.'/'.G4_KCPCERT_DIR);
->>>>>>> master
+
define('G4_SNS_PATH', G4_PLUGIN_PATH.'/'.G4_SNS_DIR);
define('G4_SYNDI_PATH', G4_PLUGIN_PATH.'/'.G4_SYNDI_DIR);
define('G4_MOBILE_PATH', G4_PATH.'/'.G4_MOBILE_DIR);
@@ -139,7 +131,6 @@ define('G4_SPECIAL', 64); // 특수문자
// 모바일 인지 결정 $_SERVER['HTTP_USER_AGENT']
define('G4_MOBILE_AGENT', 'phone|samsung|lgtel|mobile|skt|nokia|blackberry|android|sony');
-
/********************
기타 상수
********************/
diff --git a/lib/common.lib.php b/lib/common.lib.php
index 0986199ee..226c4ee03 100644
--- a/lib/common.lib.php
+++ b/lib/common.lib.php
@@ -998,17 +998,10 @@ function get_sideview($mb_id, $name='', $email='', $homepage='')
if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름
$tmp_name = $tmp_name.' '.$name;
} else {
-<<<<<<< HEAD
$tmp_name = $tmp_name." ".$name;
}
- } else {
- $tmp_name = $tmp_name.' '.$name;
-=======
- $tmp_name = $tmp_name.' '.$name;
- }
} else {
$tmp_name = $tmp_name.' '.$name;
->>>>>>> master
}
$tmp_name .= '';
diff --git a/plugin/sns/facebook/callback.php b/plugin/sns/facebook/callback.php
index e51b3cc6c..2ec663aa9 100644
--- a/plugin/sns/facebook/callback.php
+++ b/plugin/sns/facebook/callback.php
@@ -39,11 +39,12 @@ if ($user) {
echo <<
$(function() {
+ document.write("페이스북 승인이 되었습니다.");
+
var opener = window.opener;
opener.$("#facebook_icon").attr("src", "{$g4_sns_url}/icon/facebook_on.png");
opener.$("#facebook_checked").attr("disabled", false);
opener.$("#facebook_checked").attr("checked", true);
- //alert("페이스북 승인이 되었습니다.");
window.close();
});
diff --git a/plugin/sns/twitter/.gitignore b/plugin/sns/twitter/.gitignore
new file mode 100644
index 000000000..4f4773fb3
--- /dev/null
+++ b/plugin/sns/twitter/.gitignore
@@ -0,0 +1 @@
+config.php
diff --git a/plugin/sns/twitter/LICENSE b/plugin/sns/twitter/LICENSE
new file mode 100644
index 000000000..233854f16
--- /dev/null
+++ b/plugin/sns/twitter/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2009 Abraham Williams - http://abrah.am - abraham@poseurte.ch
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/plugin/sns/twitter/README.md b/plugin/sns/twitter/README.md
new file mode 100644
index 000000000..c9a17ce4b
--- /dev/null
+++ b/plugin/sns/twitter/README.md
@@ -0,0 +1,114 @@
+TwitterOAuth
+------------
+
+PHP library for working with Twitter's OAuth API.
+
+Flow Overview
+=============
+
+1. Build TwitterOAuth object using client credentials.
+2. Request temporary credentials from Twitter.
+3. Build authorize URL for Twitter.
+4. Redirect user to authorize URL.
+5. User authorizes access and returns from Twitter.
+6. Rebuild TwitterOAuth object with client credentials and temporary credentials.
+7. Get token credentials from Twitter.
+8. Rebuild TwitterOAuth object with client credentials and token credentials.
+9. Query Twitter API.
+
+Terminology
+===========
+
+The terminology has changed since 0.1.x to better match the draft-hammer-oauth IETF
+RFC. You can read that at http://tools.ietf.org/html/draft-hammer-oauth. Some of the
+terms will differ from those Twitter uses as well.
+
+client credentials - Consumer key/secret you get when registering an app with Twitter.
+temporary credentials - Previously known as the request token.
+token credentials - Previously known as the access token.
+
+Parameters
+==========
+
+There are a number of parameters you can modify after creating a TwitterOAuth object.
+
+Switch an existing TwitterOAuth install to use version 1.1 of the API.
+
+ $connection->$host = "https://api.twitter.com/1.1/";
+
+Custom useragent.
+
+ $connection->useragent = 'Custom useragent string';
+
+Verify Twitters SSL certificate.
+
+ $connection->ssl_verifypeer = TRUE;
+
+There are several more you can find in TwitterOAuth.php.
+
+Extended flow using example code
+================================
+
+To use TwitterOAuth with the Twitter API you need *TwitterOAuth.php*, *OAuth.php* and
+client credentials. You can get client credentials by registering your application at
+[dev.twitter.com/apps](https://dev.twitter.com/apps).
+
+Users start out on connect.php which displays the "Sign in with Twitter" image hyperlinked
+to redirect.php. This button should be displayed on your homepage in your login section. The
+client credentials are saved in config.php as `CONSUMER_KEY` and `CONSUMER_SECRET`. You can
+save a static callback URL in the app settings page, in the config file or use a dynamic
+callback URL later in step 2. In example use https://example.com/callback.php.
+
+1) When a user lands on redirect.php we build a new TwitterOAuth object using the client credentials.
+If you have your own configuration method feel free to use it instead of config.php.
+
+ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); // Use config.php client credentials
+ $connection = new TwitterOAuth('abc890', '123xyz');
+
+2) Using the built $connection object you will ask Twitter for temporary credentials. The `oauth_callback` value is required.
+
+ $temporary_credentials = $connection->getRequestToken(OAUTH_CALLBACK); // Use config.php callback URL.
+
+3) Now that we have temporary credentials the user has to go to Twitter and authorize the app
+to access and updates their data. You can also pass a second parameter of FALSE to not use [Sign
+in with Twitter](https://dev.twitter.com/docs/auth/sign-twitter).
+
+ $redirect_url = $connection->getAuthorizeURL($temporary_credentials); // Use Sign in with Twitter
+ $redirect_url = $connection->getAuthorizeURL($temporary_credentials, FALSE);
+
+4) You will now have a Twitter URL that you must send the user to.
+
+ https://api.twitter.com/oauth/authenticate?oauth_token=xyz123
+
+5) The user is now on twitter.com and may have to login. Once authenticated with Twitter they will
+will either have to click on allow/deny, or will be automatically redirected back to the callback.
+
+6) Now that the user has returned to callback.php and allowed access we need to build a new
+TwitterOAuth object using the temporary credentials.
+
+ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'],
+ $_SESSION['oauth_token_secret']);
+
+7) Now we ask Twitter for long lasting token credentials. These are specific to the application
+and user and will act like password to make future requests. Normally the token credentials would
+get saved in your database but for this example we are just using sessions.
+
+ $token_credentials = $connection->getAccessToken($_REQUEST['oauth_verifier']);
+
+8) With the token credentials we build a new TwitterOAuth object.
+
+ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $token_credentials['oauth_token'],
+ $token_credentials['oauth_token_secret']);
+
+9) And finally we can make requests authenticated as the user. You can GET, POST, and DELETE API
+methods. Directly copy the path from the API documentation and add an array of any parameter
+you wish to include for the API method such as curser or in_reply_to_status_id.
+
+ $account = $connection->get('account/verify_credentials');
+ $status = $connection->post('statuses/update', array('status' => 'Text of status here', 'in_reply_to_status_id' => 123456));
+ $status = $connection->delete('statuses/destroy/12345');
+
+Contributors
+============
+
+* [Abraham Williams](https://twitter.com/abraham) - Main developer, current maintainer.
diff --git a/plugin/sns/twitter/_common.php b/plugin/sns/twitter/_common.php
new file mode 100644
index 000000000..28c56e92c
--- /dev/null
+++ b/plugin/sns/twitter/_common.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/plugin/sns/twitter/callback-sample.php b/plugin/sns/twitter/callback-sample.php
new file mode 100644
index 000000000..fe55f88e2
--- /dev/null
+++ b/plugin/sns/twitter/callback-sample.php
@@ -0,0 +1,40 @@
+getAccessToken($_REQUEST['oauth_verifier']);
+
+/* Save the access tokens. Normally these would be saved in a database for future use. */
+$_SESSION['access_token'] = $access_token;
+
+/* Remove no longer needed request tokens */
+unset($_SESSION['oauth_token']);
+unset($_SESSION['oauth_token_secret']);
+
+/* If HTTP response is 200 continue otherwise send to connect page to retry */
+if (200 == $connection->http_code) {
+ /* The user has been verified and the access tokens can be saved for future use */
+ $_SESSION['status'] = 'verified';
+ header('Location: ./index.php');
+} else {
+ /* Save HTTP status for error dialog on connnect page.*/
+ header('Location: ./clearsessions.php');
+}
diff --git a/plugin/sns/twitter/callback.php b/plugin/sns/twitter/callback.php
new file mode 100644
index 000000000..1c7e9faaf
--- /dev/null
+++ b/plugin/sns/twitter/callback.php
@@ -0,0 +1,97 @@
+getAccessToken($_REQUEST['oauth_verifier']);
+
+/* Save the access tokens. Normally these would be saved in a database for future use. */
+$_SESSION['access_token'] = $access_token;
+
+/* Remove no longer needed request tokens */
+unset($_SESSION['oauth_token']);
+unset($_SESSION['oauth_token_secret']);
+
+/*
+if (200 == $connection->http_code) {
+ $_SESSION['status'] = 'verified';
+ header('Location: ./index.php');
+} else {
+ header('Location: ./clearsessions.php');
+}
+exit;
+*/
+
+$g4['title'] = '트위터 콜백';
+include_once(G4_PATH.'/head.sub.php');
+
+if (200 == $connection->http_code) {
+
+ /*
+ $access_token = $facebook->getAccessToken();
+
+ $appid = $config['cf_facebook_appid'];
+
+ setcookie('fbs_'.$appid, 1, G4_SERVER_TIME + 86400 * 31, '/', G4_COOKIE_DOMAIN);
+ setcookie('fbs_'.$appid.'_code', $_SESSION['fb_'.$appid.'_code'], G4_SERVER_TIME + 86400 * 31, '/', G4_COOKIE_DOMAIN);
+ setcookie('fbs_'.$appid.'_access_token', $_SESSION['fb_'.$appid.'_access_token'], G4_SERVER_TIME + 86400 * 31, '/', G4_COOKIE_DOMAIN);
+ setcookie('fbs_'.$appid.'_user_id', $_SESSION['fb_'.$appid.'_user_id'], G4_SERVER_TIME + 86400 * 31, '/', G4_COOKIE_DOMAIN);
+
+ sql_query(" update {$g4['member_table']} set mb_facebook_token = '{$access_token}' where mb_id = '{$member['mb_id']}' ", true);
+
+ */
+
+ sql_query(" update {$g4['member_table']} set mb_twitter_token = '{$access_token['oauth_token']}', mb_twitter_token_secret = '{$access_token['oauth_token_secret']}' where mb_id = '{$member['mb_id']}' ", true);
+
+ $g4_sns_url = G4_SNS_URL;
+
+ echo <<
+ $(function() {
+ document.write("트위터에 승인이 되었습니다.");
+
+ var opener = window.opener;
+ opener.$("#twitter_icon").attr("src", "{$g4_sns_url}/icon/twitter_on.png");
+ opener.$("#twitter_checked").attr("disabled", false);
+ opener.$("#twitter_checked").attr("checked", true);
+ window.close();
+ });
+
+EOT;
+
+} else {
+
+ echo <<
+ $(function() {
+ alert("트위터에 승인이 되지 않았습니다.");
+ window.close();
+ });
+
+EOT;
+
+}
+
+include_once(G4_PATH.'/tail.sub.php');
+?>
diff --git a/plugin/sns/twitter/clearsessions.php b/plugin/sns/twitter/clearsessions.php
new file mode 100644
index 000000000..2947d6276
--- /dev/null
+++ b/plugin/sns/twitter/clearsessions.php
@@ -0,0 +1,14 @@
+dev.twitter.com/apps';
+ exit;
+}
+
+/* Build an image link to start the redirect process. */
+$content = '';
+
+/* Include HTML to display on the page. */
+include('html.inc');
diff --git a/plugin/sns/twitter/html.inc b/plugin/sns/twitter/html.inc
new file mode 100644
index 000000000..e093e35e7
--- /dev/null
+++ b/plugin/sns/twitter/html.inc
@@ -0,0 +1,39 @@
+
+
+
+ Twitter OAuth in PHP
+
+
+
+
+
+
Welcome to a Twitter OAuth PHP example.
+
+
This site is a basic showcase of Twitters OAuth authentication method. If you are having issues try clearing your session.