Skip to content

Commit

Permalink
refs #514
Browse files Browse the repository at this point in the history
  * trunk와 1.8 트리 동기화
  • Loading branch information
inureyes committed Mar 29, 2010
1 parent c7ee596 commit 80a1073
Show file tree
Hide file tree
Showing 58 changed files with 355 additions and 180 deletions.
6 changes: 4 additions & 2 deletions documents/changelog_ko.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
=== 추가된 점 ===
* 블로그 : 최근 공지와 최근 글의 필자 치환자 추가 및 동작 추가 (#1437)
* 관리패널 : 모바일용 관리 모드 추가 (베타) (#1418)
* 일반 : camouflage 기능 추가 (알파) (#1431)
* 일반 : 다양한 배포본 개발을 돕는 camouflage 기능 추가 (알파) (#1431)

=== 변경된 점 ===
* 일반 : 스태틱 리소스의 더 많은 부분을 serviceURL에서 불러오도록 함 (대용량 서비스 구축시 리소스 서버 분리시 적용) (#1441)

=== 버그 수정 ===
* 일반 : 공지사항 등의 피드 로드가 갱신되지 않는 오류 수정 (#1440)
* 일반 : 공지사항 등의 내부 피드 로드가 갱신되지 않는 오류 수정 (#1440)
* 일반 : RSS/ATOM 을 읽을 때 Cron이 실행되어 특정 경우 응답이 늦어 일부 리더 및 서비스에서 피드를 읽지 못하는 문제 수정 (#1178)
* 블로그 : 댓글 ajax 블록 로드시에 ATOM/RSS 피드 치환자가 동작하지 않는 문제 수정 (#1435)
* 블로그 : 댓글 페이지 사용시 클릭했을때 2번째 페이지가 보이지 않는 문제 수정 (#1201)
* 블로그 : 댓글을 폈을 때 접히지 않는 문제 수정 (#1201)
Expand All @@ -20,6 +21,7 @@
* 에디터 : html 코드의 웹표준 변환이 제대로 변환되지 않는 문제 수정 (#1438)
* 에디터 : 위지윅 에디터의 STD 참조 자바스크립트 에러 문제 수정 (#1439)
* TTXML : 카테고리복원, 방명록 정보, 스팸필터 정보 복원시 잘못될 수 있는 문제 수정 (#1298)
* TTXML : 댓글 알리미 정보가 복원되지 않는 문제 수정 (#1298)
* OpenID : Transaction 관련을 $_SESSION에서 파일로 옮겨 세션 의존으로 인하여 생기는 문제 수정 (#1385)

=== 스킨 치환자 추가 안내 ===
Expand Down
4 changes: 2 additions & 2 deletions framework/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private function URIinterpreter() {
case 'entry': case 'feeder': case 'foaf': case 'guestbook': case 'iMazing':
case 'keylog': case 'line': case 'location': case 'locationSuggest':
case 'logout': case 'notice': case 'page': case 'plugin': case 'pluginForOwner':
case 'search': case 'suggest': case 'tag': case 'ttxml':
case 'search': case 'stream': case 'suggest': case 'tag': case 'ttxml':
$pathPart = $uri['fragment'][0];
$interfacePath = 'interface/blog/'.$pathPart.'.php';
break;
Expand All @@ -157,7 +157,7 @@ private function URIinterpreter() {
break;
case 'i': case 'm':
if(isset($uri['fragment'][1]) && in_array($uri['fragment'][1],array('archive','category','comment','entry','guestbook','imageResizer','link','login','logout','pannels','protected','search','tag','trackback'))) {
$pathPart = $uri['fragment'][0].'/'.$uri['fragment'][1];
$pathPart = $uri['fragment'][0].'/'.$uri['fragment'][1].(isset($uri['fragment'][2]) ? '/'.$uri['fragment'][2] : '').(isset($uri['fragment'][3]) ? '/'.$uri['fragment'][3] : '');
} else {
$pathPart = $uri['fragment'][0];
}
Expand Down
4 changes: 2 additions & 2 deletions framework/boot/10-CoreClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ static function getISO8601($timezone = null) {
static function set($timezone) {
if ( isset( $_ENV['OS'] ) && strncmp($_ENV['OS'], 'Windows', 7) == 0)
$timezone = Timezone::getAlternative($timezone);

date_default_timezone_set($timezone);
return putenv('TZ=' . $timezone);
}

Expand Down Expand Up @@ -593,7 +593,7 @@ static function getISO8601($time = null) {
}

static function getUNIXtime($time = null) {
return (isset($time) ? date('U', $time) : date('U'));
return intval(isset($time) ? date('U', $time) : date('U'));
}

static function getHumanReadable($time = null, $from = null) {
Expand Down
8 changes: 4 additions & 4 deletions framework/boot/30-Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function authorize( $domain, $userid ) {
}
$data = DBModel::getInstance();
$data->reset('Privileges');
$data->setQualifier('userid','equals',$userid);
$data->setQualifier('userid','equals',intval($userid));
$result = $data->getAll('blogid,acl');

foreach( $result as $rec ) {
Expand All @@ -257,9 +257,9 @@ function authorize( $domain, $userid ) {
$blogid = getBlogId();
$data->reset('Privileges');
$data->setQualifier('blogid','equals',$blogid);
$data->setQualifier('userid','equals',$userid);
$data->setQualifier('userid','equals',intval($userid));
$data->setAttribute('lastLogin',Timestamp::getUNIXtime());
$data->update();
$data->update();
// POD::execute("UPDATE {$this->context->getProperty('database.prefix')}Privileges SET lastLogin = ".Timestamp::getUNIXtime()." WHERE blogid = $blogid AND userid = $userid");
return;
}
Expand Down Expand Up @@ -378,7 +378,7 @@ function authenticate( $blogid, $loginid, $password, $blogapi = false ) {
if(!empty($userid) && !is_null($userid)) {
$query = DBModel::getInstance();
$query->reset('UserSettings');
$query->setQualifier('userid','equals',$userid);
$query->setQualifier('userid','equals',intval($userid));
$query->setQualifier('name','equals','AuthToken',true);
$authtoken = $query->getCell('value');
if (!empty($authtoken) && ($authtoken === $password)) { // If user requested auth token, use it to confirm.
Expand Down
2 changes: 1 addition & 1 deletion framework/cache/Memcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function set($key, $value, $expirationDue = 0) {
$key = $this->getNamespaceHash('global').$key;
}
}
$this->memcache->set($key,$value,$expirationDue);
$this->memcache->set($key,$value,0,$expirationDue);
}
public function get($key, $clear = false) {
if(strpos($key,'.') === false) { // If key doesn't contain namespace,
Expand Down
29 changes: 16 additions & 13 deletions framework/data/Cubrid/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function tableList($condition = null) {
}

public static function reservedFieldNames() {
return array('date','value','data','count','year','month', 'type');
return array('date','value','data','count','year','month', 'type', 'size');
}

public static function reservedFunctionNames() {
Expand All @@ -81,39 +81,45 @@ public static function query($query, $compatibility = true) {
'/(ASC|DESC) LIMIT ([0-9]+) OFFSET 0/si',
'/(ASC|DESC) LIMIT ([0-9]+) OFFSET ([0-9]+)/si',
'/(ASC|DESC) LIMIT 1(^[0-9])/si',
'/(ASC|DESC) LIMIT ([0-9]+)/si'
'/(ASC|DESC) LIMIT ([0-9]+)/si',
'/RAND\(\) LIMIT ([0-9]+)/si'
);
$descPagingInst = array(
'$1 FOR ORDERBY_NUM() BETWEEN 1 AND $2',
'$1 FOR ORDERBY_NUM() BETWEEN ($3+1) AND ($2+$3)',
'$1 FOR ORDERBY_NUM() = 1',
'$1 FOR ORDERBY_NUM() BETWEEN 1 AND $2'
'$1 FOR ORDERBY_NUM() BETWEEN 1 AND $2',
'RANDOM() FOR ORDERBY_NUM() BETWEEN 1 AND $1'
);
} else if(stripos($query, "GROUP BY")!==false) {
$origPagingInst = array(
'/GROUP BY(.*)(ORDER BY)(.*)(ASC|DESC) LIMIT ([0-9]+) OFFSET 0/si',
'/GROUP BY(.*)(ORDER BY)(.*)(ASC|DESC) LIMIT ([0-9]+) OFFSET ([0-9]+)/si',
'/GROUP BY(.*)(ORDER BY)(.*)(ASC|DESC) LIMIT 1(^[0-9])/si',
'/GROUP BY(.*)(ORDER BY)(.*)(ASC|DESC) LIMIT ([0-9]+)/si'
'/GROUP BY(.*)(ORDER BY)(.*)(ASC|DESC) LIMIT ([0-9]+)/si',
'/GROUP BY(.*)(ORDER BY)(.*)RAND\(\) LIMIT ([0-9]+)/si'
);
$descPagingInst = array(
'GROUP BY $1 HAVING GROUPBY_NUM() = $5 $2 $3 $4',
'GROUP BY $1 HAVING GROUPBY_NUM() BETWEEN ($6+1) AND $5 $2 $3 $4',
'GROUP BY $1 HAVING GROUPBY_NUM() = 1 $2 $3 $4',
'GROUP BY $1 HAVING GROUPBY_NUM() BETWEEN 1 AND $5 $2 $3 $4'
'GROUP BY $1 HAVING GROUPBY_NUM() BETWEEN 1 AND $5 $2 $3 $4',
'GROUP BY $1 HAVING GROUPBY_NUM() BETWEEN 1 AND $4 $2 RANDOM() $3'
);
} else {
$origPagingInst = array(
'/WHERE(.*)LIMIT ([0-9]+) OFFSET 0/si',
'/WHERE(.*)LIMIT ([0-9]+) OFFSET ([0-9]+)/si',
'/WHERE(.*)LIMIT 1(^[0-9])/si',
'/WHERE(.*)LIMIT ([0-9]+)/si'
'/WHERE(.*)LIMIT ([0-9]+)/si',
'/SUM\((size|value)\)/si'
);
$descPagingInst = array(
'WHERE ROWNUM BETWEEN 1 AND $2 AND $1',
'WHERE ROWNUM BETWEEN ($3+1) AND ($2+$3) AND $1',
'WHERE ROWNUM = 1 AND $1',
'WHERE ROWNUM BETWEEN 1 AND $2 AND $1'
'WHERE ROWNUM BETWEEN 1 AND $2 AND $1',
'SUM("$1")'
);
}
$query = preg_replace($origPagingInst, $descPagingInst,$query);
Expand Down Expand Up @@ -178,10 +184,8 @@ public static function query($query, $compatibility = true) {
$result = cubrid_execute(self::$dbProperties['handle'],$query);
}
self::$lastQueryType = strtolower(substr($query, 0,6));
if( stristr($query, 'update ') ||
stristr($query, 'insert ') ||
stristr($query, 'delete ') ||
stristr($query, 'replace ') ) {
if( in_array(self::$lastQueryType, array('insert','update','delete','replac'))) {
self::commit();
self::clearCache();
}
return $result;
Expand Down Expand Up @@ -283,7 +287,7 @@ public static function queryColumn($query, $useCache=true) {
}

/*@static@*/
public static function queryAll ($query, $type = 'both', $count = -1) {
public static function queryAll($query, $type = 'both', $count = -1) {
return self::queryAllWithCache($query, $type, $count);
//return self::queryAllWithoutCache($query, $type, $count); // Your choice. :)
}
Expand Down Expand Up @@ -359,7 +363,6 @@ public static function cacheSave() {
}

public static function commit() {
global $fileCachedResult;
@cubrid_commit(self::$dbProperties['handle']);
}

Expand Down
7 changes: 6 additions & 1 deletion framework/data/DBModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,16 @@ public function setQualifier($name, $condition, $value = null, $escape = false)
default:
$this->_relations[$name] = 'LIKE';
}
$this->_qualifiers[$name] = ($escape === false && (!is_string($value) || in_array($value,$this->_reservedFunctions)) ?
if($name == 'blogid') { // Legacy support for plugins (with string-type blogid)
$this->_qualifiers[$name] = intval($value);
} else {
$this->_qualifiers[$name] = ($escape === false && (!is_string($value) || in_array($value,$this->_reservedFunctions)) ?
$value : ($escape ? '\'' .
POD::escapeString(
(($this->_relations[$name] == 'LIKE') ? '%'.$value.'%' : $value)
) .
'\'' : "'" . $value . "'"));
}
}
}

Expand Down Expand Up @@ -224,6 +228,7 @@ public function insert() {
foreach($pairs as $key => $value) if (is_null($value)) $pairs[$key] = 'NULL';

$this->_query = 'INSERT INTO ' . $this->table . ' (' . implode(',', $this->_capsulateFields(array_keys($attributes))) . ') VALUES (' . implode(',', $pairs) . ')';

if (POD::query($this->_query)) {
// $this->id = POD::insertId();
return true;
Expand Down
2 changes: 1 addition & 1 deletion framework/legacy/Needlworks.Cache.PageCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ function flushEntry($entryId = null) {
global $database;

if(empty($entryId)) $entryId = '';
else $entryId = $entryId.'-';
else $entryId = intval($entryId);
$Entries = POD::queryColumn("SELECT name
FROM {$database['prefix']}PageCacheLog
WHERE blogid = ".getBlogId()."
Expand Down
10 changes: 5 additions & 5 deletions framework/legacy/Textcube.Control.Session.Memcached.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function read($id) {

public static function write($id, $data) {
if(is_null(self::$mc)) self::initialize();
return self::$mc->set(self::$context->getProperty('service.domain')."/sessions/{$id}/{$_SERVER['REMOTE_ADDR']}",$data,self::$context->getProperty('service.timeout'));
return self::$mc->set(self::$context->getProperty('service.domain')."/sessions/{$id}/{$_SERVER['REMOTE_ADDR']}",$data,0,self::$context->getProperty('service.timeout'));
}

public static function destroy($id, $setCookie = false) {
Expand All @@ -67,9 +67,9 @@ private static function newAnonymousSession() {
if (($id = self::getAnonymousSession()) !== false)
return $id;
$id = dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF));
$result = self::$mc->set(self::$context->getProperty('service.domain')."/sessions/{$id}/{$_SERVER['REMOTE_ADDR']}",true,self::$context->getProperty('service.timeout'));
$result = self::$mc->set(self::$context->getProperty('service.domain')."/sessions/{$id}/{$_SERVER['REMOTE_ADDR']}",true,0,self::$context->getProperty('service.timeout'));
if ($result > 0) {
$result = self::$mc->set(self::$context->getProperty('service.domain')."/anonymousSession/{$_SERVER['REMOTE_ADDR']}",$id,self::$context->getProperty('service.timeout'));
$result = self::$mc->set(self::$context->getProperty('service.domain')."/anonymousSession/{$_SERVER['REMOTE_ADDR']}",$id,0,self::$context->getProperty('service.timeout'));
return $id;
}
}
Expand Down Expand Up @@ -132,7 +132,7 @@ public static function authorize($blogid, $userid) {
$_SESSION['userid'] = $userid;
$id = session_id();
if( self::isGuestOpenIDSession($id) ) {
$result = self::$mc->set(self::$context->getProperty('service.domain')."/authorizedSession/{$id}/{$_SERVER['REMOTE_ADDR']}",$userid,self::$context->getProperty('service.timeout'));
$result = self::$mc->set(self::$context->getProperty('service.domain')."/authorizedSession/{$id}/{$_SERVER['REMOTE_ADDR']}",$userid,0,self::$context->getProperty('service.timeout'));
if ($result) {
return true;
}
Expand All @@ -141,7 +141,7 @@ public static function authorize($blogid, $userid) {
if (self::isAuthorized(session_id())) return true;
for ($i = 0; $i < 3; $i++) {
$id = dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF)) . dechex(rand(0x10000000, 0x7FFFFFFF));
$result = self::$mc->set(self::$context->getProperty('service.domain')."/authorizedSession/{$id}/{$_SERVER['REMOTE_ADDR']}",$userid,self::$context->getProperty('service.timeout'));
$result = self::$mc->set(self::$context->getProperty('service.domain')."/authorizedSession/{$id}/{$_SERVER['REMOTE_ADDR']}",$userid,0,self::$context->getProperty('service.timeout'));

if ($result) {
@session_id($id);
Expand Down
4 changes: 2 additions & 2 deletions framework/legacy/Textcube.Data.CommentNotified.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ function add() {
if (!$query = $this->_buildQuery())
return false;
if (!$query->hasAttribute('written'))
$query->setAttribute('written', 'UNIX_TIMESTAMP()');
$query->setAttribute('written', Timestamp::getUNIXtime());
if (!$query->hasAttribute('modified'))
$query->setAttribute('modified', 'UNIX_TIMESTAMP()');
$query->setAttribute('modified', Timestamp::getUNIXtime());

if (!$query->insert()) {
return $this->_error('insert');
Expand Down
6 changes: 3 additions & 3 deletions framework/legacy/Textcube.Function.Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getBlogSettingGlobal($name, $default = null, $blogid = null, $directAcc
if($directAccess == true) {
$query = DBModel::getInstance();
$query->reset('BlogSettings');
$query->setQualifier('blogid', 'equals', $blogid);
$query->setQualifier('blogid', 'equals', intval($blogid));
$query->setQualifier('name', 'equals', $name, true);
return $query->getCell('value');
}
Expand Down Expand Up @@ -65,7 +65,7 @@ function getBlogSettingsGlobal($blogid = null) {
}
$query = DBModel::getInstance();
$query->reset('BlogSettings');
$query->setQualifier('blogid', 'equals', $blogid);
$query->setQualifier('blogid', 'equals', intval($blogid));
$blogSettings = $query->getAll();
if( $blogSettings ) {
$result = array();
Expand Down Expand Up @@ -354,7 +354,7 @@ function getSkinSettings($blogid, $forceReload = false) {
}
$query = DBModel::getInstance();
$query->reset('SkinSettings');
$query->setQualifier('blogid', 'equals', $blogid);
$query->setQualifier('blogid', 'equals', intval($blogid));
$skinSettings = $query->getAll();
if( $skinSettings ) {
$result = array();
Expand Down
23 changes: 17 additions & 6 deletions framework/legacy/Textcube.Model.Paging.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
class Paging {
function initPaging($url, $prefix = '?page=') {
function init($url, $prefix = '?page=') {
return array('url' => rtrim($url,'?'), 'prefix' => $prefix, 'postfix' => '', 'total' => 0, 'pages' => 0, 'page' => 0, 'before' => array(), 'after' => array());
}

Expand Down Expand Up @@ -94,19 +94,21 @@ function getPagingView( & $paging, & $template, & $itemTemplate, $useCache = fal
$itemsView = ob_get_contents();
ob_end_clean();
$view = $template;
Misc::dress('prev_page', isset($paging['prev']) ? ($mode == 'href' ? "href='" : "href='#' onclick='")."$url$prefix{$paging['prev']}$postfix'" : '', $view, $useCache);
Misc::dress('prev_page', isset($paging['prev']) ? ($mode == 'href' ? "href=\"" : "href=\"#\" onclick=\"")."$url$prefix{$paging['prev']}$postfix\" rel=\"prev\"" : '', $view, $useCache);
Misc::dress('prev_page_title', isset($paging['prev_title']) ? $paging['prev_title'] : '', $view, $useCache);
Misc::dress('paging_rep', $itemsView, $view, $useCache);
Misc::dress('next_page', isset($paging['next']) ? ($mode == 'href' ? "href='" : "href='#' onclick='")."$url$prefix{$paging['next']}$postfix'" : '', $view, $useCache);
Misc::dress('next_page', isset($paging['next']) ? ($mode == 'href' ? "href=\"" : "href=\"#\" onclick=\"")."$url$prefix{$paging['next']}$postfix\" rel=\"next\"" : '', $view, $useCache);
Misc::dress('next_page_title', isset($paging['next_title']) ? $paging['next'] : '', $view, $useCache);
Misc::dress('no_more_prev', isset($paging['prev']) ? '' : 'no-more-prev', $view, $useCache);
Misc::dress('no_more_next', isset($paging['next']) ? '' : 'no-more-next', $view, $useCache);

return $view;
}

function fetchWithPaging($sql, $page, $count, $url = null, $prefix = '?page=', $countItem = null, $onclick = null) {
global $folderURL, $service;
function fetch($sql, $page, $count, $url = null, $prefix = '?page=', $countItem = null, $onclick = null) {
$context = Model_Context::getInstance();
if ($url === null)
$url = $folderURL;
$url = $context->getProperty('uri.folder');
$paging = array('url' => $url, 'prefix' => $prefix, 'postfix' => '', 'onclick' => $onclick);
if (empty($sql))
return array(array(), $paging);
Expand Down Expand Up @@ -134,5 +136,14 @@ function fetchWithPaging($sql, $page, $count, $url = null, $prefix = '?page=', $
if ($countItem !== null) $count = $countItem;
return array(POD::queryAll("$sql LIMIT $count OFFSET $offset"), $paging);
}
/** Legacy methods **/

function initPaging($url, $prefix = '?page=') {
return self::init($url, $prefix);
}

function fetchWithPaging($sql, $page, $count, $url = null, $prefix = '?page=', $countItem = null, $onclick = null) {
return self::fetch($sql, $page, $count, $url, $prefix, $countItem, $onclick);
}
}
?>
2 changes: 1 addition & 1 deletion framework/legacy/Textcube.Model.Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function getRefererStatistics($blogid) {

function getRefererLogsWithPage($page, $count) {
global $database, $blogid;
return Paging::fetchWithPaging("SELECT host, url, referred FROM {$database['prefix']}RefererLogs WHERE blogid = $blogid ORDER BY referred DESC", $page, $count);
return Paging::fetch("SELECT host, url, referred FROM {$database['prefix']}RefererLogs WHERE blogid = $blogid ORDER BY referred DESC", $page, $count);
}

function getRefererLogs() {
Expand Down
1 change: 1 addition & 0 deletions framework/utils/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public function getVersion() {
}

public function isMobile() {
return (in_array($this->getBrowserName(),array('mSafari')));
}
public function isSafari() {
}
Expand Down
2 changes: 1 addition & 1 deletion framework/utils/Unicode.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ static function lessenAsByte($str, $bytes, $tail = '...') {
elseif($siclVerifyInt===3) // Head byte of multi-bytes characters.
$siclLocationSubtInt=1;
elseif($siclVerifyInt===2) { // Middle of multi-bytes character.
for($siclLoopInt=2;$siclLengthInt>=$siclLoopInt;$siclLoopInt++) { // Seeking for head byte.
for($siclLoopInt=2;$bytes>=$siclLoopInt;$siclLoopInt++) { // Seeking for head byte.
if((ord($str[$bytes-$siclLoopInt])>>6)!==2)
break;
}
Expand Down
Loading

0 comments on commit 80a1073

Please sign in to comment.