Skip to content

Commit

Permalink
v 0.5.0
Browse files Browse the repository at this point in the history
placeholderjs 적용
liejs 업데이트
sso 관련 버그 픽스
  • Loading branch information
Prev committed Oct 16, 2013
1 parent 08d2562 commit dfbabad
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 38 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ engine-pmc 설치 및 개발 방법은 **[이 문서](https://github.com/Prev/en

#Change Log

### v 0.5.0
+ [placeholderjs](https://github.com/Prev/placeholderjs) 적용
+ [liejs](https://github.com/Prev/liejs) 업데이트
+ sso 관련 버그 픽스

### v 0.4.9
+ 소스 안정화
+ 각종 버그 픽스
Expand Down
2 changes: 1 addition & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Define PMC version
*/
define('PMC_VERSION', '0.4.9');
define('PMC_VERSION', '0.5.0');


/**
Expand Down
8 changes: 7 additions & 1 deletion lib/classes/Context.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public function checkSSO() {
if (!isset($_COOKIE[SSO_COOKIE_NAME]) && isset($_SESSION[SSO_SESSION_NAME]))
unset($_SESSION[SSO_SESSION_NAME]);

if ($_COOKIE[SSO_COOKIE_NAME.'_synchash'] && $_COOKIE[SSO_COOKIE_NAME.'_synchash'] != $_SESSION[SSO_SESSION_NAME.'_synchash']) {
if ($_COOKIE[SSO_COOKIE_NAME.'_synchash'] || $_COOKIE[SSO_COOKIE_NAME.'_synchash'] != $_SESSION[SSO_SESSION_NAME.'_synchash']) {
// 와일드 카드 쿠키와 세션의 싱크를 맞춰줌
unset($_SESSION[SSO_SESSION_NAME]);
}
Expand All @@ -695,6 +695,12 @@ public function checkSSO() {

$ssoData = json_decode($urlData);

if ($ssoData->result == 'expired') {
unset($_SESSION[SSO_SESSION_NAME]);
setCookie2(SSO_COOKIE_NAME, '', time()-60);
return true;
}

if (!$ssoData || $ssoData->result === 'fail') {
unset($_SESSION[SSO_SESSION_NAME]);
setCookie2(SSO_COOKIE_NAME, '', time()-60);
Expand Down
1 change: 1 addition & 0 deletions modules/board/template/article.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<import path="css/article.less">
<import path="/static/js/placeholder.js">
<import path="js/article.js">

<div class="article">
Expand Down
79 changes: 46 additions & 33 deletions sso-server/conf.functions.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,47 @@
<?php

function printError($message) {
$obj = new StdClass();
$obj->result = 'fail';
$obj->error = new StdClass();
$obj->error->message = $message;

echo json_encode($obj);
exit;
}

function execQuery($query) {
$query = join($GLOBALS['db_prefix'], explode('(#)', $query));
$result = mysql_query($query, $GLOBALS['db']);

if ($result === false) return NULL;
if (mysql_num_rows($result) === NULL) return $result;

$arr = array();

while ($fetch = mysql_fetch_object($result))
array_push($arr, $fetch);

return $arr;
}

function execQueryOne($query) {
$result = execQuery($query);
if (is_array($result) && count($result) !== 0)
return $result[0];
else
return $result;
<?php

function printError($message) {
$obj = new StdClass();
$obj->result = 'fail';
$obj->error = new StdClass();
$obj->error->message = $message;

echo json_encode($obj);
exit;
}

function execQuery($query, $fetchType='object') {
$query = join($GLOBALS['db_prefix'], explode('(#)', $query));
$result = mysql_query($query, $GLOBALS['db']);

if (!$result || $result === true) return NULL;
if (mysql_num_rows($result) === NULL) return $result;

$arr = array();

switch ($fetchType) {
case 'object':
while ($fetch = mysql_fetch_object($result))
array_push($arr, $fetch);
break;

case 'array':
while ($fetch = mysql_fetch_array($result))
array_push($arr, $fetch);
break;

case 'row' :
while ($fetch = mysql_fetch_row($result))
array_push($arr, $fetch);
break;
}
return $arr;
}

function execQueryOne($query, $fetchType='object') {
$result = execQuery($query, $fetchType);
if (is_array($result) && count($result) !== 0)
return $result[0];
else
return $result;
}
15 changes: 14 additions & 1 deletion sso-server/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@
$sessionData = execQueryOne('
SELECT * FROM (#)session
WHERE session_key="'.$sessKey.'"
AND expire_time > now()
');

if (!$sessionData) {
printError('session key does not exist');
return;
}

if (strtotime($sessionData->expire_time) < time()) {
$obj = new StdClass();
$obj->result = 'expired';
$obj->error = new StdClass();
$obj->error->message = 'session key is expired';

echo json_encode($obj);
return;
}

$user_id = $sessionData->user_id;
$expire_time = $sessionData->expire_time;

Expand Down Expand Up @@ -90,4 +99,8 @@
array_push($obj->userData->groups, $tmp);
}

execQuery('
DELETE FROM (#)session WHERE expire_time < now()
');

echo json_encode($obj);
4 changes: 2 additions & 2 deletions static/js/global.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions static/js/placeholder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dfbabad

Please sign in to comment.