diff --git a/documents/COPYRIGHT b/documents/COPYRIGHT index 0295623b1..a194505a9 100644 --- a/documents/COPYRIGHT +++ b/documents/COPYRIGHT @@ -1,4 +1,4 @@ -Copyright (C) 2004-2008, Needlworks / Tatter Network Foundation. +Copyright (C) 2004-2010, Needlworks / Tatter Network Foundation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/documents/INSTALL b/documents/INSTALL index 07145edb5..f2885175b 100644 --- a/documents/INSTALL +++ b/documents/INSTALL @@ -1,7 +1,7 @@ Textcube Installation --------------------- -Please read requirements.txt to see what softwares you need before installation. +Please read manual_requirements.txt to see what softwares you need before installation. For MySQL 4.1 or above, UTF-8 for default character set and collation settings is strongly recommended. @@ -36,14 +36,6 @@ is strongly recommended. Step 4: Run setup.php on your web browser. - NOTE: (for localhost installers) - * Use 127.0.0.1 instead of localhost to avoid later login problems for most - of web browsers. - * If you're using Google Chrome, you have to edit your hosts configuration - to avoid login problems, because it refuses to save cookies even for - 127.0.0.1 IP address. - See C:\Windows\System32\drivers\etc\hosts file. - Step 5: You will see a notice about IIS during installation. Step 6: After setup, add $service['fancyURL'] = 2; to config.php to force using rewrites. diff --git a/documents/changelog_ko.txt b/documents/changelog_ko.txt index 3d892550a..fbaa16854 100644 --- a/documents/changelog_ko.txt +++ b/documents/changelog_ko.txt @@ -1,5 +1,54 @@ * 이 문서는 변경사항을 모두 포함하고 있지 않을 수 있습니다. 자세한 변경사항 열람을 위해서는 텍스트큐브 개발 사이트 (http://dev.textcube.org) 의 해당 버전의 로드맵과 티켓들을 확인해 주시기 바랍니다. * 버그 로그는 일반적으로 이전 버전에서 발생했으나 해결된 부분을 포함하며, 이번 버전을 만드는 과정에서 발생하는 버그는 기록하지 않습니다. + +== v1.8.3 개발 관련 노트 == +=== 추가된 점 === + * 블로그 : 최근 공지와 최근 글의 필자 치환자 추가 및 동작 추가 (#1437) + * 관리패널 : 모바일용 관리 모드 추가 (베타) (#1418) + * 일반 : camouflage 기능 추가 (알파) (#1431) + +=== 변경된 점 === + * 일반 : 스태틱 리소스의 더 많은 부분을 serviceURL에서 불러오도록 함 (대용량 서비스 구축시 리소스 서버 분리시 적용) (#1441) + +=== 버그 수정 === + * 일반 : 공지사항 등의 피드 로드가 갱신되지 않는 오류 수정 (#1440) + * 블로그 : 댓글 ajax 블록 로드시에 ATOM/RSS 피드 치환자가 동작하지 않는 문제 수정 (#1435) + * 블로그 : 댓글 페이지 사용시 클릭했을때 2번째 페이지가 보이지 않는 문제 수정 (#1201) + * 블로그 : 댓글을 폈을 때 접히지 않는 문제 수정 (#1201) + * 모바일 : 아이폰 모드에서 댓글보기 동작 오류 수정 (#1436) + * 모바일 : 아이폰뷰에서 블로그 소유자의 이름이 제대로 나오지 않는 문제 수정 (#1432) + * 에디터 : html 코드의 웹표준 변환이 제대로 변환되지 않는 문제 수정 (#1438) + * 에디터 : 위지윅 에디터의 STD 참조 자바스크립트 에러 문제 수정 (#1439) + * TTXML : 카테고리복원, 방명록 정보, 스팸필터 정보 복원시 잘못될 수 있는 문제 수정 (#1298) + * OpenID : Transaction 관련을 $_SESSION에서 파일로 옮겨 세션 의존으로 인하여 생기는 문제 수정 (#1385) + +=== 스킨 치환자 추가 안내 === +텍스트큐브 1.8.3부터는 아래의 스킨 치환자를 추가로 지원합니다. + +==== 공지 영역 내 ==== + * notice_rep_author : 저자 이름 + * notice_rep_author_link : 저자가 작성한 글 목록 페이지로 가는 링크 + +==== 키로그 영역 내 ==== + * keylog_rep_author : 저자 이름 + * keylog_rep_author_link : 저자가 작성한 글 목록 페이지로 가는 링크 + +==== 본문 영역 내 ==== + * article_rep_author_link : 저자 이름 + * article_rep_author_link : 저자가 작성한 글 목록 페이지로 가는 링크 + +==== 사이드바의 최근 댓글 영역 내 ==== + * rctps_rep_author : 저자 이름 + * rctps_rep_author_link : 저자가 작성한 글 목록 페이지로 가는 링크 + +=== 모바일 관리 패널 안내 === +텍스트큐브 1.8.3에는 모바일 관리 패널의 초기 버전이 반영되었습니다. 아직 초기 버전이기 때문에 사용을 위해서는 옵션 파일의 수정이 필요합니다. 설치된 디렉토리의 config.php 에 아래의 한 줄을 추가하시면 됩니다. + +$service['usemobileadmin'] = true; + +이후 정식 기능이 될 경우에는 서버 메뉴의 환경 설정 패널에서 조정할 수 있게 될 예정입니다. + + == v1.8.2 개발 관련 노트 == === 추가된 점 === * 설치 : 설치시 PHP 버전을 확인하여 동작 가능 여부를 알려줌 (#1406) diff --git a/documents/config.txt b/documents/config.txt deleted file mode 100644 index a4b31dd2d..000000000 --- a/documents/config.txt +++ /dev/null @@ -1,29 +0,0 @@ -//This document explains about the available options at config.php - -ini_set('display_errors', 'off'); -$database['server'] = 'localhost'; -$database['database'] = 'noname'; -$database['username'] = 'noname'; -$database['password'] = 'noname'; -$database['prefix'] = 'tt_'; -$service['type'] = 'path'; -$service['domain'] = 'domain.ext'; -$service['path'] = '/path1/path2'; -$service['skin'] = 'skin_name'; -$service['timeout'] = 3600; // Session timeout limit -$service['disableEolinSuggestion'] = false; // Disable auto-suggestion using EOLIN server. -//Usually it searches local tag by default. -// From 1.1 -$service['useEncodedURL'] = false; // URL encoding using RFC1738 -$serviceURL = ''; // Useful if using other web program under the same domain -// From 1.5 -$service['useNumericURLonRSS'] = false; // Can force permalink to numeric format on RSS output. -$service['useLegacySupport'] = false; // Uses legacy support (for tattertools plugins) function. -// From 1.6 -$service['reader'] = true; // Use Textcube reader. You can set it to false if you do not use Textcube reader, and want to decrease DB load. -$service['pagecache'] = true; // pagecache function. (changed from disablePageCache option at TC 1.5) -$service['debugmode'] = false; // Textcube debug mode. (for core / plugin debug or optimization) (changed from requireComponent('Needlworks.Function.Debug'); at TC 1.5) -$service['debug_session_dump'] = false; // session info debuging. -$service['debug_rewrite_module'] = false; // rewrite handling module info debuging. -$service['allowBlogVisibilitySetting'] = true; // Allow service users to change blog visibility -$service['favicon_daily_traffic'] = 10; // Set favicon traffic limitation. default is 10MB. diff --git a/documents/manual_config.txt b/documents/manual_config.txt new file mode 100644 index 000000000..2a9c2481c --- /dev/null +++ b/documents/manual_config.txt @@ -0,0 +1,54 @@ +// +// Textcube service-wide configurable options via config.php +// --------------------------------------------------------- +// +// This document explains about the available options at config.php +// + \ No newline at end of file diff --git a/documents/requirements.txt b/documents/manual_requirements.txt similarity index 77% rename from documents/requirements.txt rename to documents/manual_requirements.txt index 1d7b49638..b312d589a 100644 --- a/documents/requirements.txt +++ b/documents/manual_requirements.txt @@ -1,4 +1,4 @@ -Textcube 1.5 Requirements +Textcube 1.8 Requirements ------------------------- 1. For Linux Systems : @@ -6,14 +6,17 @@ Textcube 1.5 Requirements Minimum requirements : * Apache 1.3 or above * with mod_rewrite module - * PHP 4.3 or above - * MySQL 3.23 or above - * with UTF-8 emulation routine in Textcube + * PHP 5.2 or above + * Database Management System + * MySQL 4.1 / MariaDB 5 or above + * with UTF-8 emulation routine in Textcube + * Cubrid R2008 or above + * PostgreSQL 8.3 or above Suggested environment : * Apache 2.2 or above * with mode_rewrite module - * PHP 5.1 or above + * PHP 5.2 or above * with iconv / gd module * MySQL 5.0 or above * with UTF-8 character set and collation settings @@ -24,8 +27,6 @@ Textcube 1.5 Requirements (Need to modify config.php. referer 'config' in DOC directory.) * InnoDB with Entries / Tags / TagRelations table. - WARNING: From Textcube 1.8 and 2.0, PHP 5.2 will be the MINIMUM requirement. - 2. For Microsoft Windows : * IIS 5.0 or above diff --git a/documents/workflow.txt b/documents/manual_workflow.txt similarity index 100% rename from documents/workflow.txt rename to documents/manual_workflow.txt diff --git a/documents/workflow_1.7.txt b/documents/workflow_1.7.txt deleted file mode 100644 index 73bf76a88..000000000 --- a/documents/workflow_1.7.txt +++ /dev/null @@ -1,47 +0,0 @@ - -Textcube Simple task flow -========================= - By J.K.Shin (inureyes@gmail.com) - ------------- -Requesting - interface/~ ------------- | -Dispatching +------+------+ - | | - index.php .htaccess - (without rewrite module) (with rewrite module) - | | - +------+------+ - | - rewrite.php - | + /config.php - +-------------------------------+-----------------------------+ - | | | - library/includeForBlog.php library/includeForBlogOwner.php library/includeForReader.php - (Weblog interface) (Administration panel interface) (RSS Reader) - | | | - +-------------------------------+-----------------------------+ - | - /library/include.php - | + /library/config.php - | + /config.php (override) - | + /library/component/~ - [Loading mandatory models / views] - | + /library/model/~ - | + /library/view/~ ------------- | -Initializing /library/initiallize.php - | + /library/suri.php - | + /library/session.php ------------- | + /resources/language/ -Quilting +-----------------+-----------------+ - (Sequence defined at each interface path) /interface/common/owner/header.php - /interface/common/blog/begin.php | - + /library/blog.skin.php | | - /interface/common/blog/~ Interface code - | | - /interface/common/blog/end.php /interface/common/owner/footer.php ------------- | | -Finalizing +-----------------+-----------------+ - diff --git a/framework/data/DBModel.php b/framework/data/DBModel.php index 57ad75fac..bc7add91b 100644 --- a/framework/data/DBModel.php +++ b/framework/data/DBModel.php @@ -200,7 +200,7 @@ public function getRow($field = '*') { public function getColumn($field = '*') { $field = $this->_treatReservedFields($field); - return POD::queryColumn('SELECT ' . $field . ' FROM ' . $this->table . $this->_makeWhereClause() . ' LIMIT 1'); + return POD::queryColumn('SELECT ' . $field . ' FROM ' . $this->table . $this->_makeWhereClause()); } public function getAll($field = '*') { diff --git a/library/config.default.php b/framework/id/textcube/config.default.php similarity index 88% rename from library/config.default.php rename to framework/id/textcube/config.default.php index 956eb82d9..b1851d6ee 100644 --- a/library/config.default.php +++ b/framework/id/textcube/config.default.php @@ -18,12 +18,10 @@ } else { define('DS', "/"); } - -// OpenID-Specific parameters -define( 'OPENID_LIBRARY_ROOT', ROOT . "/library/contrib/phpopenid/" ); -define( 'XPATH_LIBRARY_ROOT', ROOT . "/library/contrib/phpxpath/" ); -define( 'Auth_OpenID_NO_MATH_SUPPORT', 1 ); -define( 'OPENID_PASSWORD', "-OPENID-" ); +define( "OPENID_LIBRARY_ROOT", ROOT . "/library/contrib/phpopenid/" ); +define( "XPATH_LIBRARY_ROOT", ROOT . "/library/contrib/phpxpath/" ); +define( "Auth_OpenID_NO_MATH_SUPPORT", 1 ); +define( "OPENID_PASSWORD", "-OPENID-" ); // Define global variable. global $database, $service, $blog, $memcache; @@ -60,4 +58,5 @@ $service['debug_session_dump'] = false; $service['debug_rewrite_module'] = false; $service['useNumericURLonRSS'] = false; +//$service['adminskin'] = 'whitedream'; ?> diff --git a/framework/legacy/Textcube.Control.Session.php b/framework/legacy/Textcube.Control.Session.php index 20a3e5049..81e2bd540 100644 --- a/framework/legacy/Textcube.Control.Session.php +++ b/framework/legacy/Textcube.Control.Session.php @@ -125,7 +125,7 @@ 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::query('count',"INSERT INTO ".self::$context->getProperty('database.prefix')."Sessions (id, address, created, updated) VALUES('$id', '{$_SERVER['REMOTE_ADDR']}', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() - $meet_again_baby)"); + $result = self::query('count',"INSERT INTO ".self::$context->getProperty('database.prefix')."Sessions (id, address, server, request, referer, created, updated) VALUES('$id', '{$_SERVER['REMOTE_ADDR']}', '', '', '', UNIX_TIMESTAMP(), UNIX_TIMESTAMP() - $meet_again_baby)"); if ($result > 0) return $id; } diff --git a/framework/legacy/Textcube.Data.Category.php b/framework/legacy/Textcube.Data.Category.php index 57fcfe10f..22cd7e7f9 100644 --- a/framework/legacy/Textcube.Data.Category.php +++ b/framework/legacy/Textcube.Data.Category.php @@ -36,8 +36,7 @@ function open($filter = true, $fields = '*', $sort = 'priority') { if ($filter) $pool->setQualifier('parent',null); } else if (!empty($filter)) { - $condition = explode('=',$filter); - $condition = trim($condition); + $condition = array_map(create_function('$s','return trim($s);'), explode('=',$filter)); $pool->setQualifier($condition[0],'equals',$condition[1]); } if (!empty($sort)) @@ -61,7 +60,7 @@ function close() { function shift() { $this->reset(); - if ($this->_result && ($row = each($this->_result))) { + if ($this->_result && ($row = POD::fetch($this->_result))) { foreach ($row as $name => $value) { if ($name == 'blogid') continue; diff --git a/framework/legacy/Textcube.Data.Comment.php b/framework/legacy/Textcube.Data.Comment.php index 9ec2ee697..2da3ccc0b 100644 --- a/framework/legacy/Textcube.Data.Comment.php +++ b/framework/legacy/Textcube.Data.Comment.php @@ -92,7 +92,10 @@ function add() { $this->ip = $_SERVER['REMOTE_ADDR']; if (!isset($this->isfiltered)) $this->isfiltered = 0; - + + //regacy + if (isset($this->commenter)) {$this->replier = $this->commenter;/*unset($this->commenter);*/;} + if (!$query = $this->_buildQuery()) return false; if (!$query->hasAttribute('written')) diff --git a/framework/legacy/Textcube.Function.Setting.php b/framework/legacy/Textcube.Function.Setting.php index f6aef8a31..29819d3bd 100644 --- a/framework/legacy/Textcube.Function.Setting.php +++ b/framework/legacy/Textcube.Function.Setting.php @@ -320,10 +320,9 @@ function setServiceSetting($name, $value, $global = null) { function removeServiceSetting($name, $global = null) { if(is_null($global)) $name = 'plugin_' . $name; - $name = 'plugin_' . $name; $query = DBModel::getInstance(); $query->reset('ServiceSettings'); - $query->setQualifier('name','equals', $name,true); + $query->setQualifier('name','like', $name,true); return $query->delete(); } diff --git a/framework/model/Config.php b/framework/model/Config.php index 2945860b1..bd75ed69e 100644 --- a/framework/model/Config.php +++ b/framework/model/Config.php @@ -10,14 +10,15 @@ public static function getInstance() { return self::_getInstance(__CLASS__); } - protected function __construct() { - $this->__basicConfigLoader(); + protected function __construct($id = 'textcube') { + $this->__basicConfigLoader($id); } - private function __basicConfigLoader() { + private function __basicConfigLoader($id) { global $database, $service; // For Legacy global variable support $this->settings = array(); - require_once(ROOT.'/library/config.default.php'); // Loading default configuration + if (file_exists(ROOT.'/framework/id/load')) $id = trim(file_get_contents(ROOT.'/framework/id/load')); + require_once(ROOT.'/framework/id/'.$id.'/config.default.php'); // Loading default configuration if (file_exists(ROOT.'/config.php')) @include(ROOT.'/config.php'); // Override configuration // Map port setting. if (@is_numeric($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT'] != 80) && ($_SERVER['SERVER_PORT'] != 443)) diff --git a/framework/model/Line.php b/framework/model/Line.php index c8cd220c7..efa67564e 100644 --- a/framework/model/Line.php +++ b/framework/model/Line.php @@ -17,6 +17,7 @@ public static function getInstance() { } public function reset($param = null) { + parent::reset('Lines'); $this->id = null; $this->blogid = getBlogId(); $this->category = 'public'; @@ -39,7 +40,7 @@ public function add() { $this->setAttribute('root',$this->root,true); $this->setAttribute('author',$this->author,true); $this->setAttribute('content',$this->content,true); - $this->setAttribute('permalink',$this->content,true); + $this->setAttribute('permalink',$this->permalink,true); $this->setAttribute('created',$this->created); return $this->insert(); } @@ -107,6 +108,7 @@ public function getFormattedList($conditions) { foreach($data as $d) { $template = $conditions['template']; $d['created'] = Timestamp::getHumanReadable($d['created']); + if($d['root'] == 'default') $d['root'] = 'Textcube Line'; foreach($conditions['dress'] as $tag => $match) { dress($tag, $d[$match],$template); } diff --git a/framework/utils/Browser.php b/framework/utils/Browser.php index bfdd0ee4c..946392832 100644 --- a/framework/utils/Browser.php +++ b/framework/utils/Browser.php @@ -17,7 +17,7 @@ function __construct() { public function getBrowserName() { /// Blocking (is in development) $ctx = Model_Context::getInstance(); - if($ctx->getProperty('service.useMobileAdmin') != true) { + if($ctx->getProperty('service.usemobileadmin') != true) { return 'unknown'; } if(!is_null($this->browserName)) return $this->browserName; diff --git a/interface/blog/comment/addopenid/index.php b/interface/blog/comment/addopenid/index.php index c71499527..8637b31ae 100644 --- a/interface/blog/comment/addopenid/index.php +++ b/interface/blog/comment/addopenid/index.php @@ -3,11 +3,7 @@ /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; -requireComponent('Textcube.Control.Openid'); -if (false) { - fetchConfigVal(); -} $entryId = $suri['id']; $IV = array( 'GET' => array( diff --git a/interface/blog/feeder.php b/interface/blog/feeder.php index bbfb41c33..82ce1bf23 100644 --- a/interface/blog/feeder.php +++ b/interface/blog/feeder.php @@ -4,9 +4,6 @@ /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; -if (false) { - fetchConfigVal(); -} list($status, $url) = updateRandomFeed(); Respond::PrintResult(array('error' => $status, 'url' => $url)); ?> diff --git a/interface/common/blog/entries.php b/interface/common/blog/entries.php index 623aebe28..6d58d1e57 100644 --- a/interface/common/blog/entries.php +++ b/interface/common/blog/entries.php @@ -18,10 +18,10 @@ // $entryRsses .= ''.CRLF; - $entryRsses .= ''.CRLF. - ''.CRLF; } @@ -50,7 +50,8 @@ // 사용자가 작성한 본문은 interface/common/blog/end.php의 removeAllTags() 다음에 처리하기 위한 조치. $contentContainer["keylog_{$entry['id']}"] = getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], null, 'Keylog'); dress('keylog_rep_desc', setTempTag("keylog_{$entry['id']}"), $entryView); - dress('keylog_rep_author', User::getName($entry['userid']), $entryView); + dress('keylog_rep_author', User::getName($entry['userid']), $entryView); + dress('keylog_rep_author_link', $blogURL."/author/".rawurlencode(User::getName($entry['userid'])), $entryView); $entriesView .= $entryView; $isKeylog = true; } else if ($entry['category'] == - 2) { // This is notice @@ -66,6 +67,7 @@ $contentContainer["notice_{$entry['id']}"] = getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentformatter'], getKeywordNames($blogid), 'Notice'); dress('notice_rep_desc', setTempTag("notice_{$entry['id']}"), $entryView); dress('notice_rep_author', User::getName($entry['userid']), $entryView); + dress('notice_rep_author_link', $blogURL."/author/".rawurlencode(User::getName($entry['userid'])), $entryView); $entriesView .= $entryView; } else if (doesHaveOwnership() || ($entry['visibility'] >= 2) || (isset($_COOKIE['GUEST_PASSWORD']) && (trim($_COOKIE['GUEST_PASSWORD']) == trim($entry['password'])))) { // This is post @@ -120,6 +122,7 @@ } $author = User::getName($entry['userid']); dress('article_rep_author', fireEvent('ViewPostAuthor', $author, $entry['id']), $entryView); + dress('article_rep_author_link', $blogURL."/author/".rawurlencode($author), $entryView); dress('article_rep_id', $entry['id'], $entryView); dress('article_rep_link', $permalink, $entryView); dress('article_rep_rp_rssurl', $context->getProperty('uri.default').'/rss/comment/'.$entry['id'], $entryView); @@ -143,7 +146,7 @@ dress('article_rep_date_modified', fireEvent('ViewPostDate', Timestamp::format5($entry['modified']), $entry['modified']), $entryView); dress('entry_archive_link', $context->getProperty('uri.blog')."/archive/" . Timestamp::getDate($entry['published']), $entryView); if ($entry['acceptcomment'] || ($entry['comments'] > 0)) - dress('article_rep_rp_link', "loadComment({$entry['id']},1); return false", $entryView); + dress('article_rep_rp_link', "loadComment({$entry['id']},1,false); return false", $entryView); else dress('article_rep_rp_link', "return false", $entryView); @@ -164,6 +167,7 @@ $protectedEntryView = $skin->entryProtected; $author = User::getName($entry['userid']); dress('article_rep_author', fireEvent('ViewPostAuthor', $author, $entry['id']), $protectedEntryView); + dress('article_rep_author_link', $blogURL."/author/".rawurlencode($author), $protectedEntryView); dress('article_rep_id', $entry['id'], $protectedEntryView); dress('article_rep_link', $permalink, $protectedEntryView); dress('article_rep_title', htmlspecialchars(fireEvent('ViewPostTitle', $entry['title'], $entry['id'])), $protectedEntryView); diff --git a/interface/common/blog/line.php b/interface/common/blog/line.php index c4fedd520..e6f2f5efc 100644 --- a/interface/common/blog/line.php +++ b/interface/common/blog/line.php @@ -12,21 +12,21 @@ $printDate = ''; foreach ($lines as $item) { $time = Timestamp::getHumanReadable($item['created']); - /* - if($printDate != Timestamp::formatDate($item['created'])) { - $time = Timestamp::format5($item['created']); - $printDate = Timestamp::formatDate($item['created']); - } else { - $time = Timestamp::format('%H:%M',$item['created']); - }*/ + if($item['root'] == 'default') $item['root'] = 'Textcube Line'; $itemsView .= str_replace( array( '[##_line_rep_regdate_##]', - '[##_line_rep_content_##]' + '[##_line_rep_content_##]', + '[##_line_rep_author_##]', + '[##_line_rep_source_##]', + '[##_line_rep_permalink_##]' ), array( fireEvent('ViewLineDate', $time, $item['created']), - fireEvent('ViewLineContent', htmlspecialchars($item['content'])) + fireEvent('ViewLineContent', $item['content']), + fireEvent('ViewLineAuthor', htmlspecialchars($item['author'])), + fireEvent('ViewLineSource', htmlspecialchars($item['root'])), + fireEvent('ViewLinePermalink', $item['permalink']) ), $skin->lineItem ); diff --git a/interface/common/owner/footer.php b/interface/common/owner/footer.php index c64e2fdec..fd5d684bc 100644 --- a/interface/common/owner/footer.php +++ b/interface/common/owner/footer.php @@ -150,7 +150,7 @@ - + diff --git a/interface/i/index.php b/interface/i/index.php index c9a6d3ff7..d5fdd8444 100644 --- a/interface/i/index.php +++ b/interface/i/index.php @@ -10,7 +10,7 @@ ?>
    getProperty('blog.logo')) ? printIphoneImageResizer($blogid, $context->getProperty('blog.logo'), 80) : "{$context->getProperty('service.path')}/resources/style/iphone/image/textcube_logo.png"; $itemsView = '
  • '.CRLF; $itemsView .= ' '.CRLF; diff --git a/interface/index.php b/interface/index.php index 9c128265a..bec2ca978 100644 --- a/interface/index.php +++ b/interface/index.php @@ -57,7 +57,6 @@ header("Location: ".$context->getProperty('uri.blog')."/i"); exit; } } - publishEntries(); if (!empty($_POST['mode']) && $_POST['mode'] == 'fb') { // Treat comment notifier. @@ -70,7 +69,6 @@ notifyComment(); } - fireEvent('OBStart'); if(empty($suri['id'])) { // Without id. diff --git a/interface/owner/center/about/index.php b/interface/owner/center/about/index.php index 74ba5dbbf..1accc56dc 100644 --- a/interface/owner/center/about/index.php +++ b/interface/owner/center/about/index.php @@ -102,6 +102,10 @@ Jun-whan Ahn + + Young-jin Yoon + + diff --git a/interface/owner/communication/comment/index.php b/interface/owner/communication/comment/index.php index 8092635bc..948758ba9 100644 --- a/interface/owner/communication/comment/index.php +++ b/interface/owner/communication/comment/index.php @@ -176,24 +176,16 @@ function toggleThisTr(tr, isActive) { ?> $('#list-form tbody td.selection').click(function(ev) { $('#allChecked').attr('checked', false); - var checked = $(':check', this).attr('checked'); - $(':check', this).attr('checked', checked ? false : true); - toggleThisTr($(this).parent(), !checked); - ev.stopPropagation(); - }); - $('#list-form tbody td.selection :check').click(function(ev) { - $('#allChecked').attr('checked', false); - var checked = $(this).attr('checked'); - toggleThisTr($(this).parent().parent(), checked); + var checked = $(':checked', this).attr('checked'); + $(':checked', this).attr('checked', checked ? true : false); + toggleThisTr($(this).parent(), checked); ev.stopPropagation(); }); $('#allChecked').click(function(ev) { var checked = $(this).attr('checked'); - $('#list-form tbody td.selection :check').each(function(index, item) { - if ($(item).attr('checked') != checked) { - $(item).attr('checked', checked); - toggleThisTr($(item).parent().parent(), checked); - } + $('#list-form tbody td.selection input:checkbox').each(function(index, item) { + $(item).attr('checked', checked ? true : false); + toggleThisTr($(item).parent().parent(), checked); }); }); }); diff --git a/interface/owner/communication/notify/index.php b/interface/owner/communication/notify/index.php index f4257a981..1794a3735 100644 --- a/interface/owner/communication/notify/index.php +++ b/interface/owner/communication/notify/index.php @@ -137,24 +137,16 @@ function toggleThisTr(tr, isActive) { $('#allChecked').removeAttr('disabled'); $('#list-form tbody td.selection').click(function(ev) { $('#allChecked').attr('checked', false); - var checked = $(':check', this).attr('checked'); - $(':check', this).attr('checked', checked ? false : true); - toggleThisTr($(this).parent(), !checked); - ev.stopPropagation(); - }); - $('#list-form tbody td.selection :check').click(function(ev) { - $('#allChecked').attr('checked', false); - var checked = $(this).attr('checked'); - toggleThisTr($(this).parent().parent(), checked); + var checked = $(':checked', this).attr('checked'); + $(':checked', this).attr('checked', checked ? true : false); + toggleThisTr($(this).parent(), checked); ev.stopPropagation(); }); $('#allChecked').click(function(ev) { var checked = $(this).attr('checked'); - $('#list-form tbody td.selection :check').each(function(index, item) { - if ($(item).attr('checked') != checked) { - $(item).attr('checked', checked); - toggleThisTr($(item).parent().parent(), checked); - } + $('#list-form tbody td.selection input:checkbox').each(function(index, item) { + $(item).attr('checked', checked ? true : false); + toggleThisTr($(item).parent().parent(), checked); }); }); }); diff --git a/interface/owner/communication/trackback/index.php b/interface/owner/communication/trackback/index.php index 2637a4af5..48a3b8a51 100644 --- a/interface/owner/communication/trackback/index.php +++ b/interface/owner/communication/trackback/index.php @@ -229,24 +229,16 @@ function toggleThisTr(tr, isActive) { removeItselfById('category-move-button'); $('#list-form tbody td.selection').click(function(ev) { $('#allChecked').attr('checked', false); - var checked = $(':check', this).attr('checked'); - $(':check', this).attr('checked', checked ? false : true); - toggleThisTr($(this).parent(), !checked); - ev.stopPropagation(); - }); - $('#list-form tbody td.selection :check').click(function(ev) { - $('#allChecked').attr('checked', false); - var checked = $(this).attr('checked'); - toggleThisTr($(this).parent().parent(), checked); + var checked = $(':checked', this).attr('checked'); + $(':checked', this).attr('checked', checked ? true : false); + toggleThisTr($(this).parent(), checked); ev.stopPropagation(); }); $('#allChecked').click(function(ev) { var checked = $(this).attr('checked'); - $('#list-form tbody td.selection :check').each(function(index, item) { - if ($(item).attr('checked') != checked) { - $(item).attr('checked', checked); - toggleThisTr($(item).parent().parent(), checked); - } + $('#list-form tbody td.selection input:checkbox').each(function(index, item) { + $(item).attr('checked', checked ? true : false); + toggleThisTr($(item).parent().parent(), checked); }); }); }); diff --git a/interface/owner/data/export/index.php b/interface/owner/data/export/index.php index bbe051ef4..ffe731d49 100644 --- a/interface/owner/data/export/index.php +++ b/interface/owner/data/export/index.php @@ -402,7 +402,7 @@ $filter = new Filter(); if ($filter->open()) { do { - $writer->write('' . '' . htmlspecialchars($filter->pattern) . '' . ''); + $writer->write('' . '' . htmlspecialchars($filter->pattern) . '' . ''); $writer->write(CRLF); } while ($filter->shift()); $filter->close(); diff --git a/interface/owner/data/import/index.php b/interface/owner/data/import/index.php index 68aa7e70a..025b1d511 100644 --- a/interface/owner/data/import/index.php +++ b/interface/owner/data/import/index.php @@ -352,8 +352,10 @@ function importer($path, $node, $line) { $comment->entry = $post->id; $cursor = & $node['comment'][$i]; $comment->name = $cursor['commenter'][0]['name'][0]['.value']; - if (!empty($cursor['commenter'][0]['id'][0]['.value'])) - $comment->id = $cursor['commenter'][0]['id'][0]['.value']; + if (!empty($cursor['id'][0]['.value'])) + $comment->id = $cursor['id'][0]['.value']; + if (!empty($cursor['commenter'][0]['.attributes']['id'])) + $comment->commenter = $cursor['commenter'][0]['.attributes']['id']; if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) $comment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) @@ -378,8 +380,10 @@ function importer($path, $node, $line) { $childComment->entry = $post->id; $childComment->parent = $comment->id; $cursor = & $node['comment'][$i]['comment'][$j]; - if (!empty($cursor['commenter'][0]['id'][0]['.value'])) - $childComment->id = $cursor['commenter'][0]['id'][0]['.value']; + if (!empty($cursor['id'][0]['.value'])) + $childComment->id = $cursor['id'][0]['.value']; + if (!empty($cursor['commenter'][0]['.attributes']['id'])) + $childComment->commenter = $cursor['commenter'][0]['.attributes']['id']; $childComment->name = $cursor['commenter'][0]['name'][0]['.value']; if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) $childComment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; @@ -745,8 +749,10 @@ function importer($path, $node, $line) { setProgress($item++ / $items * 100, _t('방명록을 복원하고 있습니다.')); $comment = new GuestComment(); $comment->name = $node['commenter'][0]['name'][0]['.value']; - if (!empty($node['commenter'][0]['id'][0]['.value'])) - $comment->id = $node['commenter'][0]['id'][0]['.value']; + if (!empty($node['id'][0]['.value'])) + $comment->id = $node['id'][0]['.value']; + if (!empty($node['commenter'][0]['.attributes']['id'])) + $comment->commenter = $node['commenter'][0]['.attributes']['id']; if (!empty($node['commenter'][0]['homepage'][0]['.value'])) $comment->homepage = $node['commenter'][0]['homepage'][0]['.value']; if (!empty($node['commenter'][0]['ip'][0]['.value'])) @@ -765,8 +771,10 @@ function importer($path, $node, $line) { $childComment->parent = $comment->id; $cursor = & $node['comment'][$j]; $childComment->name = $cursor['commenter'][0]['name'][0]['.value']; - if (!empty($cursor['commenter'][0]['id'][0]['.value'])) - $childComment->id = $cursor['commenter'][0]['id'][0]['.value']; + if (!empty($cursor['id'][0]['.value'])) + $comment->id = $cursor['id'][0]['.value']; + if (!empty($cursor['commenter'][0]['.attributes']['id'])) + $childComment->commenter = $cursor['commenter'][0]['.attributes']['id']; if (!empty($cursor['commenter'][0]['homepage'][0]['.value'])) $childComment->homepage = $cursor['commenter'][0]['homepage'][0]['.value']; if (!empty($cursor['commenter'][0]['ip'][0]['.value'])) diff --git a/interface/owner/data/remove/index.php b/interface/owner/data/remove/index.php index 8aad03d9e..903c0fe91 100644 --- a/interface/owner/data/remove/index.php +++ b/interface/owner/data/remove/index.php @@ -10,7 +10,6 @@ ); require ROOT . '/library/preprocessor.php'; requireStrictRoute(); -requireComponent('Textcube.Data.DataMaintenance'); if (empty($_POST['confirmativePassword']) || !User::confirmPassword(User::getBlogOwner(getBlogId()), $_POST['confirmativePassword'])) Respond::ResultPage(1); DataMaintenance::removeAll(Validator::getBool(@$_POST['removeAttachments'])); diff --git a/interface/owner/entry/edit/index.php b/interface/owner/entry/edit/index.php index 1b4a16319..8a149de7a 100644 --- a/interface/owner/entry/edit/index.php +++ b/interface/owner/entry/edit/index.php @@ -487,7 +487,10 @@ function EntryManager() { PM.removeRequest(this); alert(""); this.nowsaving = false; + document.getElementById("saveAndReturnButton").value = ""; + } + document.getElementById("saveAndReturnButton").value = ""; PM.addRequest(request, ""); request.send(data); } @@ -497,7 +500,7 @@ function EntryManager() { if(document.getElementById('templateDialog').style.display != 'none') { toggleTemplateDialog(); } - document.getElementById("saveButton").value = ""; + document.getElementById("saveButton").value = ""; document.getElementById("saveButton").style.color = "#000"; if (this.timer == null) this.timer = window.setTimeout(entryManager.saveDraft, 5000); @@ -894,7 +897,7 @@ function returnToList() { - + | - + @@ -956,6 +959,10 @@ function returnToList() { diff --git a/interface/owner/entry/index.php b/interface/owner/entry/index.php index d3062c235..0a8b6dace 100644 --- a/interface/owner/entry/index.php +++ b/interface/owner/entry/index.php @@ -1182,7 +1182,7 @@ function closeWhatIsEolin() { [[##_paging_rep_link_num_##]]'; +$pagingItemTemplate = '[##_paging_rep_link_num_##]'; echo str_repeat("\t", 12).getPagingView($paging, $pagingTemplate, $pagingItemTemplate, false).CRLF; ?> diff --git a/interface/owner/entry/line/index.php b/interface/owner/entry/line/index.php index 538a1f1ce..69370b58a 100644 --- a/interface/owner/entry/line/index.php +++ b/interface/owner/entry/line/index.php @@ -45,14 +45,16 @@ $conditions['linesforpage'] = 15; $d = _t('삭제'); + $conditions['template'] = <<
    [##_date_##]
    [##_content_##]
    +
    {$d}
    EOS; -$conditions['dress'] = array('id'=>'id','date'=>'created','content'=>'content'); +$conditions['dress'] = array('id'=>'id','date'=>'created','content'=>'content','permalink'=>'permalink','root'=>'root'); $line = Model_Line::getInstance(); $view = $line->getFormattedList($conditions); $m = _t('더 보기'); diff --git a/interface/owner/entry/line/more/index.php b/interface/owner/entry/line/more/index.php index e0daf9549..5d314beec 100644 --- a/interface/owner/entry/line/more/index.php +++ b/interface/owner/entry/line/more/index.php @@ -26,10 +26,11 @@
    [##_date_##]
    [##_content_##]
    +
    {$d}
    EOS; -$conditions['dress'] = array('id'=>'id','date'=>'created','content'=>'content'); +$conditions['dress'] = array('id'=>'id','date'=>'created','content'=>'content','permalink'=>'permalink','root'=>'root'); $line = Model_Line::getInstance(); $contentView = $line->getFormattedList($conditions); if(empty($contentView)) { diff --git a/interface/owner/network/xfn/index.php b/interface/owner/network/xfn/index.php index 5dd32e463..755bcc8a0 100644 --- a/interface/owner/network/xfn/index.php +++ b/interface/owner/network/xfn/index.php @@ -4,7 +4,6 @@ /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) require ROOT . '/library/preprocessor.php'; requireModel("blog.link"); -requireComponent("Textcube.Core.BackwardCompatibility"); if( isset($_POST['usexfn']) ) { updateXfn( $blogid, $_POST ); diff --git a/interface/owner/setting/openid/change/index.php b/interface/owner/setting/openid/change/index.php index 77c8ffa90..40feb3fc7 100644 --- a/interface/owner/setting/openid/change/index.php +++ b/interface/owner/setting/openid/change/index.php @@ -11,7 +11,6 @@ ); require ROOT . '/library/preprocessor.php'; -requireComponent( 'Textcube.Control.Openid' ); requireLibrary('blog.skin'); requireStrictRoute(); requireModel( 'common.plugin' ); diff --git a/interface/owner/setting/openid/delegate/index.php b/interface/owner/setting/openid/delegate/index.php index 944c47e4e..2e1897f88 100644 --- a/interface/owner/setting/openid/delegate/index.php +++ b/interface/owner/setting/openid/delegate/index.php @@ -10,7 +10,6 @@ ); require ROOT . '/library/preprocessor.php'; -requireComponent( 'Textcube.Control.Openid' ); requireLibrary('blog.skin'); requireStrictRoute(); $skin = new Skin($skinSetting['skin']); diff --git a/library/model/blog.attachment.php b/library/model/blog.attachment.php index ae2d0f2c6..5b5ce0086 100644 --- a/library/model/blog.attachment.php +++ b/library/model/blog.attachment.php @@ -19,10 +19,9 @@ function getAttachments($blogid, $parent, $orderBy = null, $sort='ASC') { $pool->setQualifier('blogid','equals',$blogid); $pool->setQualifier('parent','equals',$parent); if(!is_null($orderBy)) { - $pool->setOrder($orderBy, $sort); + $pool->setOrder($orderBy,$sort); } - $result = $pool->getAll('*'); - if($result) { + if($result = $pool->getAll('*')) { foreach($result as $attachment) { array_push($attachments, $attachment); array_push($__gCacheAttachment, $attachment); @@ -75,7 +74,7 @@ function getAttachmentByOnlyName($blogid, $name) { $pool = DBModel::getInstance(); $pool->reset('Attachments'); $pool->setQualifier('blogid','equals',$blogid); - $pool->setQualifier('name','equals',$name, true); + $pool->setQualifier('name','equals',$name,true); $newAttachment = $pool->getRow('*'); array_push($__gCacheAttachment,$newAttachment); return $newAttachment; @@ -96,11 +95,12 @@ function getAttachmentByLabel($blogid, $parent, $label) { function getAttachmentSize($blogid=null, $parent = null) { $pool = DBModel::getInstance(); $pool->reset('Attachments'); - - if (!empty($blogid)) - $pool->setQualifier('blogid','equals',$blogid); - if ($parent == 0 || !empty($parent)) - $pool->setQualifier('parent','equals',$parent); + if(!empty($blogid)) { + $pool->setQualifier('blogid','equals',$blogid); + } + if ($parent == 0 || !empty($parent)) { + $pool->setQualifier('parent','equals',$parent); + } return $pool->getCell('sum(size)'); } @@ -156,23 +156,23 @@ function addAttachment($blogid, $parent, $file) { if (!move_uploaded_file($file['tmp_name'], $attachment['path'])) return false; @chmod($attachment['path'], 0666); - $name = POD::escapeString($attachment['name']); - $label = POD::escapeString(UTF8::lessenAsEncoding($attachment['label'], 64)); - $attachment['mime'] = UTF8::lessenAsEncoding($attachment['mime'], 32); - + $attachment['label'] = UTF8::lessenAsEncoding($attachment['label'], 64); + $attachment['mime'] = UTF8::lessenAsEncoding($attachment['mime'], 32); + + $pool->reset('Attachments'); $pool->setAttribute('blogid',$blogid); - $pool->setAttribute('parent',$parent); - $pool->setAttribute('name',$name, true); - $pool->setAttribute('label',$label,true); + $pool->setAttribute('parent',$attachment['parent']); + $pool->setAttribute('name',$attachment['name'],true); + $pool->setAttribute('label',$attachment['label'],true); $pool->setAttribute('mime',$attachment['mime'],true); - $pool->setAttribute('size',$attachment['size']); + $pool->setAttribute('size',$attachment['size'],true); $pool->setAttribute('width',$attachment['width']); $pool->setAttribute('height',$attachment['height']); $pool->setAttribute('attached',Timestamp::getUNIXtime()); $pool->setAttribute('downloads',0); $pool->setAttribute('enclosure',0); - $result = $pool->insert(); + $result = $pool->insert(); if (!$result) { @unlink($attachment['path']); return false; @@ -185,12 +185,11 @@ function deleteAttachment($blogid, $parent, $name) { if (!Validator::filename($name)) return false; $origname = $name; - $pool = DBModel::getInstance(); $pool->reset('Attachments'); $pool->setQualifier('blogid','equals',$blogid); - $pool->setQualifier('name','equals',$name, true); - if ($pool->delete()) { + $pool->setQualifier('name','equals',$name,true); + if($pool->delete()) { if( file_exists( ROOT . "/attach/$blogid/$origname") ) { @unlink(ROOT . "/attach/$blogid/$origname"); } @@ -205,15 +204,15 @@ function copyAttachments($blogid, $originalEntryId, $targetEntryId) { $path = ROOT . "/attach/$blogid"; $attachments = getAttachments($blogid, $originalEntryId); if(empty($attachments)) return true; - + $pool = DBModel::getInstance(); $pool->reset('Entries'); $pool->setQualifier('blogid','equals',$blogid); $pool->setQualifier('id','equals',$originalEntryId); - if(!$pool->getCell('id')) return 2; // original entry does not exists + if(!$pool->getCell('id')) return 2; // original entry does not exists; $pool->setQualifier('id','equals',$targetEntryId); - if(!$pool->getCell('id')) return 3; // target entry does not exists - + if(!$pool->getCell('id')) return 3; // target entry does not exists; + foreach($attachments as $attachment) { $extension = Misc::getFileExtension($attachment['label']); $originalPath = "$path/{$attachment['name']}"; @@ -222,19 +221,19 @@ function copyAttachments($blogid, $originalEntryId, $targetEntryId) { $attachment['path'] = "$path/{$attachment['name']}"; } while (file_exists($attachment['path'])); if(!copy($originalPath, $attachment['path'])) return 4; // copy failed. - + $pool->reset('Attachments'); $pool->setAttribute('blogid',$blogid); $pool->setAttribute('parent',$targetEntryId); - $pool->setAttribute('name',$attachment['name'], true); + $pool->setAttribute('name',$attachment['name'],true); $pool->setAttribute('label',$attachment['label'],true); $pool->setAttribute('mime',$attachment['mime'],true); - $pool->setAttribute('size',$attachment['size']); + $pool->setAttribute('size',$attachment['size'],true); $pool->setAttribute('width',$attachment['width']); $pool->setAttribute('height',$attachment['height']); $pool->setAttribute('attached',Timestamp::getUNIXtime()); $pool->setAttribute('downloads',0); - $pool->setAttribute('enclosure',0); + $pool->setAttribute('enclosure',0); if(!$pool->insert()) { return false; } @@ -255,6 +254,7 @@ function deleteTotalAttachment($blogid) { function deleteAttachmentMulti($blogid, $parent, $names) { requireModel('blog.feed'); + $pool = DBModel::getInstance(); $files = explode('!^|', $names); foreach ($files as $name) { if ($name == '') @@ -262,12 +262,10 @@ function deleteAttachmentMulti($blogid, $parent, $names) { if (!Validator::filename($name)) continue; $origname = $name; - - $pool = DBModel::getInstance(); $pool->reset('Attachments'); - $pool->setQualifier('blogid','equals',$blogid); - $pool->setQualifier('parent','equals',$parent); - $pool->setQualifier('name','equals',$name, true); + $pool->setAttribute('blogid','eq',$blogid); + $pool->setAttribute('parent','eq',$parent); + $pool->setAttribute('name','eq',$name,true); if($pool->delete()) { unlink(ROOT . "/attach/$blogid/$origname"); } else { @@ -284,56 +282,62 @@ function deleteAttachments($blogid, $parent) { } function downloadAttachment($name) { - $context = Model_Context::getInstance(); - $blogid = intval($context->getProperty('blog.id')); + requireModel('blog.feed'); $pool = DBModel::getInstance(); + $blogid = getBlogId(); + $pool->reset('Attachments'); - $pool->setQualifier('blogid','equals',$blogid); - $pool->setQualifier('name','equals',$name, true); - $count = $pool->getCell('downloads'); - - $pool->setAttribute('downloads',$count + 1); - $pool->update(); + $pool->setQualifier('blogid','eq',$blogid); + $pool->setQualifier('name','eq',$name,true); + $downloadCount = $pool->getCell('downloads'); + if($downloadCount !== false) { + $pool->reset('Attachments'); + $pool->setAttribute('downloads',$downloadCount + 1); + $pool->setQualifier('blogid','eq',$blogid); + $pool->setQualifier('name','eq',$name,true); + $pool->update(); + } } function setEnclosure($name, $order) { requireModel('blog.feed'); requireModel('blog.attachment'); - + $pool = DBModel::getInstance(); + $blogid = getBlogId(); + $pool->reset('Attachments'); - $pool->setQualifier('blogid','equals',$blogid); - $pool->setQualifier('name','equals',$name, true); + $pool->setQualifier('blogid','eq',$blogid); + $pool->setQualifier('name','eq',$name,true); $parent = $pool->getCell('parent'); - if($parent !== null) { + if($parent !== null) { $pool->setAttribute('enclosure',0); - $pool->setQualifier('parent','equals',$parent); + $pool->setQualifier('parent','eq',$parent); $pool->unsetQualifier('name'); $pool->update(); - if ($order) { + if($order) { clearFeed(); $pool->setAttribute('enclosure',1); $pool->unsetQualifier('parent'); - $pool->setQualifier('name','equals',$name, true); - $result = $pool->update(); - return ($update ? 1 : 2); - } else + $pool->setQualifier('name','eq',$name,true); + return $pool->update(); + } else { return 0; - } else - return 3; + } + } else { + return 3; + } } function getEnclosure($entry) { - global $database; if ($entry < 0) return null; - $context = Model_Context::getInstance(); - $blogid = intval($context->getProperty('blog.id')); $pool = DBModel::getInstance(); + $pool->reset('Attachments'); - $pool->setQualifier('parent','equals',$entry); - $pool->setQualifier('enclosure', 'equals', 1); - $pool->setQualifier('blogid','equals',$blogid); + $pool->setQualifier('blogid','eq',getBlogId()); + $pool->setQualifier('parent','eq',$entry); + $pool->setQualifier('enclosure','eq',1); return $pool->getCell('name'); } diff --git a/library/model/blog.blogSetting.php b/library/model/blog.blogSetting.php index 193d49a2e..694370a53 100644 --- a/library/model/blog.blogSetting.php +++ b/library/model/blog.blogSetting.php @@ -17,9 +17,11 @@ function setBlogTitle($blogid, $title) { } function setBlogDescription($blogid, $description) { - if ($description == $blog['description']) + $context = Model_Context::getInstance(); + if ($description == $context->getProperty('blog.description')) return true; if(Setting::setBlogSettingGlobal('description',UTF8::lessenAsEncoding($description, 255)) === false) return false; + $context->setProperty('blog.description', $description); requireModel('blog.feed'); requireLibrary('blog.skin'); clearFeed(); @@ -48,8 +50,8 @@ function removeBlogLogo($blogid) { if(Setting::setBlogSettingGlobal('logo','') === false) return false; else { - deleteAttachment($blogid, - 1, $context->getProperty('blog.logo')); + $context->setProperty('blog.logo',''); return true; } } @@ -142,7 +144,6 @@ function setDefaultDomain($blogid, $default) { function useBlogSlogan($blogid, $useSloganOnPost, $useSloganOnCategory, $useSloganOnTag) { global $blog; requireModel('blog.feed'); - requireComponent('Needlworks.Cache.PageCache'); $useSloganOnPost = $useSloganOnPost ? 1 : 0; $useSloganOnCategory = $useSloganOnCategory ? 1 : 0; $useSloganOnTag = $useSloganOnTag ? 1 : 0; diff --git a/library/model/blog.cron.php b/library/model/blog.cron.php index 508c6d7c5..120db3dde 100644 --- a/library/model/blog.cron.php +++ b/library/model/blog.cron.php @@ -5,19 +5,19 @@ function dumbCronScheduler($checkOnly=true) { - global $service, $blog; - requireModel('common.setting'); + $ctx = Model_Context::getInstance(); $now = Timestamp::getUNIXtime(); - $dumbCronStamps = getServiceSetting('dumbCronStamps', + $dumbCronStamps = Setting::getServiceSetting('dumbCronStamps', serialize( array( '1m' => 0, '5m' => 0, '30m' => 0, - '1h' => 0, '2h' => 0, '6h' => 0, '12h' => 0, '24h' => 0, 'Daily' => 0 ))); + '1h' => 0, '2h' => 0, '6h' => 0, '12h' => 0, '24h' => 0, 'Daily' => 0 )),true); $dumbCronStamps = unserialize( $dumbCronStamps ); $schedules = array( '1m' => 60, '5m' => 60*5, + '10m' => 60*10, '30m' => 60*30, '1h' => 60*60, '2h' => 60*60*2, @@ -27,20 +27,23 @@ function dumbCronScheduler($checkOnly=true) 'Daily' => 60*60*24, '1w' => 60*60*24*7 ); /* Events: Cron1m, Cron5m, Cron30m, Cron1h, Cron2h, Cron6h, Cron12h */ - $log_file = dirname(__FILE__).DS."..".DS."..".DS."cache".DS."cronlog.txt"; + $log_file = ROOT.'/cache/cronlog.txt'; $log = fopen( $log_file, "a" ); foreach( $schedules as $d => $diff ) { if( !isset( $dumbCronStamps[$d] ) ) { $dumbCronStamps[$d] = 0; } if( $now > $diff + $dumbCronStamps[$d] ) { - if( $checkOnly && eventExists("Cron$d") ) return true; + if( $checkOnly && eventExists("Cron$d") ) { + fclose($log); + return true; + } fireEvent( "Cron$d", null, $now ); if($d == '6h') { requireModel('blog.trash'); trashVan(); } - fwrite( $log, date( 'Y-m-d H:i:s' ).' '.$blog['name']." Cron$d executed ({$_SERVER['REQUEST_URI']})\r\n" ); + fwrite( $log, date( 'Y-m-d H:i:s' ).' '.$ctx->getProperty('blog.name')." Cron$d executed ({$_SERVER['REQUEST_URI']})\r\n" ); $dumbCronStamps[$d] = $now; } } @@ -52,7 +55,7 @@ function dumbCronScheduler($checkOnly=true) $log = fopen( $log_file, "w" ); fwrite( $log, $logcontent ); fclose( $log ); - setServiceSetting( 'dumbCronStamps', serialize( $dumbCronStamps ) ); + Setting::setServiceSetting( 'dumbCronStamps', serialize( $dumbCronStamps ), true ); return false; } @@ -63,11 +66,15 @@ function doCronJob() function checkCronJob() { - global $service,$blogURL; + $ctx = Model_Context::getInstance(); +// global $service,$blogURL; /* Cron, only in single page request, not in a page dead link */ if( !empty($_SERVER['HTTP_REFERER']) || !dumbCronScheduler(true) ) return; - ob_start(); + $request = new HTTPRequest('GET', $ctx->getProperty('uri.default').'/cron'); + $request->timeout = 2; + $request->send(); + /*ob_start(); $s = fsockopen( $_SERVER['SERVER_ADDR'], isset($service['port']) ? $service['port'] : 80 ); fputs( $s, "GET {$blogURL}/cron HTTP/1.1\r\n" ); fputs( $s, "Host: {$_SERVER['HTTP_HOST']}\r\n" ); @@ -81,6 +88,6 @@ function checkCronJob() echo ob_get_clean(); } else { ob_clean(); - } + }*/ } ?> diff --git a/library/model/blog.feed.php b/library/model/blog.feed.php index 89a2cc234..2b6e64d3e 100644 --- a/library/model/blog.feed.php +++ b/library/model/blog.feed.php @@ -160,11 +160,12 @@ function getFeedItemByLines($lines) { 'id' => $row['id'], 'title' => RSSMessage(Timestamp::format5($row['created'])), 'link' => $entryURL, + 'author' => RSSMessage($row['author']), 'categories' => array(), 'description' => RSSMessage($content), 'pubDate' => $row['created'], 'updDate' => $row['created'], - 'guid' => "$defaultURL/" . $row['id'], + 'guid' => $entryURL ); array_push($channelItems, $item); } diff --git a/library/model/blog.notice.php b/library/model/blog.notice.php index b4edd652b..80d99f751 100644 --- a/library/model/blog.notice.php +++ b/library/model/blog.notice.php @@ -30,7 +30,7 @@ function getRecentNotices($blogid) { $context = Model_Context::getInstance(); $query = getDefaultDBModelOnNotice($blogid); $query->setLimit($context->getProperty('skin.noticesOnRecent')); - return $query->getAll('id, title, slogan, published'); + return $query->getAll('id, title, slogan, published, userid'); } function getDefaultDBModelOnNotice($blogid) { $context = Model_Context::getInstance(); diff --git a/library/model/blog.service.php b/library/model/blog.service.php index b999fd5f8..83bce3a94 100644 --- a/library/model/blog.service.php +++ b/library/model/blog.service.php @@ -7,7 +7,6 @@ $__gCacheBlogSettings = array(); function getBlogidByName($name) { - global $database; $query = DBModel::getInstance(); $query->reset('BlogSettings'); $query->setQualifier('name','equals', 'name',true); @@ -30,32 +29,32 @@ function getSkinSettings($blogid, $forceReload = false) { } function getDefaultURL($blogid) { - global $database, $service; - $blog = Setting::getBlogSettingsGlobal( $blogid ); - switch ($service['type']) { + $context = Model_Context::getInstance(); + switch ($context->getProperty('service.type')) { case 'domain': - if ($blog['defaultDomain'] && $blog['secondaryDomain']) - return ('http://' . $blog['secondaryDomain'] . (isset($service['port']) ? ':' . $service['port'] : '') . $service['path']); + if ($context->getProperty('blog.defaultDomain') && $context->getProperty('blog.secondaryDomain')) + return ('http://' . $context->getProperty('blog.secondaryDomain') . ($context->getProperty('service.port') ? ':' . $context->getProperty('service.port') : '') . $context->getProperty('service.path')); else - return ('http://' . $blog['name'] . '.' . $service['domain'] . (isset($service['port']) ? ':' . $service['port'] : '') . $service['path']); + return ('http://' . $context->getProperty('blog.name') . '.' . $context->getProperty('service.domain') . ($context->getProperty('service.port') ? ':' . $context->getProperty('service.port') : '') . $context->getProperty('service.path')); case 'path': - return ('http://' . $service['domain'] . (isset($service['port']) ? ':' . $service['port'] : '') . $service['path'] . '/' . $blog['name']); + return ('http://' . $context->getProperty('service.domain') . ($context->getProperty('service.port') ? ':' . $context->getProperty('service.port') : '') . $context->getProperty('service.path') . '/' . $context->getProperty('blog.name')); case 'single': default: - return ('http://' . $service['domain'] . (isset($service['port']) ? ':' . $service['port'] : '') . $service['path']); + return ('http://' . $context->getProperty('service.domain') . ($context->getProperty('service.port') ? ':' . $context->getProperty('service.port') : '') . $context->getProperty('service.path')); } } function getBlogURL($name = null, $domain = null, $path = null, $type = null) { - global $service, $blog; + $context = Model_Context::getInstance(); + $context->useNamespace('service'); if ($type === null) - $type = $service['type']; + $type = $context->getProperty('type'); if ($path === null) - $path = $service['path']; + $path = $context->getProperty('path'); if ($domain === null) - $domain = $service['domain'] . (isset($service['port']) ? ":{$service['port']}" : ''); + $domain = $context->getProperty('domain') . ($context->getProperty('port') ? ':'.$context->getProperty('port') : ''); if ($name === null) - $name = $blog['name']; + $name = $context->getProperty('blog.name'); switch ($type) { case 'domain': return "http://$name.$domain$path"; @@ -72,8 +71,8 @@ function getBlogURLById($id = null, $domain = null, $path = null, $type = null) } function getFancyURLpostfix() { - global $service; - switch($service['fancyURL']) { + $context = Model_Context::getInstance(); + switch($context->getProperty('service.fancyURL')) { case 0: return '/index.php?'; case 1: return '/?'; case 2:default: return ''; @@ -81,13 +80,14 @@ function getFancyURLpostfix() { } function getBlogURLRule($domain = null, $path = null, $type = null) { - global $service, $blog; + $context = Model_Context::getInstance(); + $context->useNamespace('service'); if ($type === null) - $type = $service['type']; + $type = $context->getProperty('type'); if ($path === null) - $path = $service['path']; + $path = $context->getProperty('path'); if ($domain === null) - $domain = $service['domain'] . (isset($service['port']) ? ":{$service['port']}" : ''); + $domain = $context->getProperty('domain') . ($context->getProperty('port') ? ':'.$context->getProperty('port') : ''); switch ($type) { case 'domain': return array('http://', ".$domain$path"); @@ -118,9 +118,10 @@ function writeHtaccess($contents) { } function writeConfigFile($settings) { + $context = Model_Context::getInstance(); $writer = new OutputWriter; - - global $database, $service; + $database = $context->getAllFromNamespace('database'); + $service = $context->getAllFromNamespace('service'); $config = array(); $contents = " +?> \ No newline at end of file diff --git a/library/model/blog.trash.php b/library/model/blog.trash.php index 8f80fb872..20c710374 100644 --- a/library/model/blog.trash.php +++ b/library/model/blog.trash.php @@ -142,15 +142,15 @@ function restoreTrackbackTrash($blogid, $id) { function trashVan() { global $database; requireModel('common.setting'); - if(Timestamp::getUNIXtime() - getServiceSetting('lastTrashSweep',0) > 86400) { + if(Timestamp::getUNIXtime() - Setting::getServiceSetting('lastTrashSweep',0, true) > 86400) { POD::execute("DELETE FROM {$database['prefix']}Comments where isfiltered < UNIX_TIMESTAMP() - 1296000 AND isfiltered > 0"); POD::execute("DELETE FROM {$database['prefix']}RemoteResponses where isfiltered < UNIX_TIMESTAMP() - 1296000 AND isfiltered > 0"); POD::execute("DELETE FROM {$database['prefix']}RefererLogs WHERE referred < UNIX_TIMESTAMP() - 604800"); - setServiceSetting('lastTrashSweep',Timestamp::getUNIXtime()); + Setting::setServiceSetting('lastTrashSweep',Timestamp::getUNIXtime(),true); } if(Timestamp::getUNIXtime() - getServiceSetting('lastNoticeRead',0) > 43200) { - removeServiceSetting('TextcubeNotice%',true); - setServiceSetting('lastNoticeRead',Timestamp::getUNIXtime()); + Setting::removeServiceSetting('TextcubeNotice%',true); + Setting::setServiceSetting('lastNoticeRead',Timestamp::getUNIXtime(),true); } } diff --git a/library/model/common.plugin.php b/library/model/common.plugin.php index aeede2af9..6d8f96199 100644 --- a/library/model/common.plugin.php +++ b/library/model/common.plugin.php @@ -26,7 +26,6 @@ function activatePlugin($name) { return false; if (!file_exists(ROOT . "/plugins/$name/index.xml") || !file_exists(ROOT . "/plugins/$name/index.php")) return false; - $xmls = new XMLStruct(); $manifest = @file_get_contents(ROOT . "/plugins/$name/index.xml"); if ($xmls->open($manifest)) { diff --git a/library/model/common.setting.php b/library/model/common.setting.php index 985b6d93c..ab393e0a7 100644 --- a/library/model/common.setting.php +++ b/library/model/common.setting.php @@ -22,12 +22,10 @@ function clearUserSettingCache() { } function getServiceSetting($name, $default = null) { - requireComponent('Textcube.Function.Setting'); return Setting::getServiceSetting($name, $default, true); } function setServiceSetting($name, $value) { - requireComponent('Textcube.Function.Setting'); return Setting::setServiceSettingGlobal($name, $value); } diff --git a/library/plugins.php b/library/plugins.php index cac6e0e1c..914a87292 100644 --- a/library/plugins.php +++ b/library/plugins.php @@ -13,7 +13,7 @@ $adminMenuMappings = array(); $adminHandlerMappings = array(); $configMappings = array(); -$baseConfigPost = $service['path'].'/owner/setting/plugins/currentSetting'; +$baseConfigPost = $context->getProperty('service.path').'/owner/setting/plugins/currentSetting'; $configPost = ''; $configVal = ''; $typeSchema = null; @@ -25,7 +25,10 @@ if (getBlogId()) { if($gCacheStorage->getContent('activePlugins')) $activePlugins = $gCacheStorage->getContent('activePlugins'); else { - $activePlugins = POD::queryColumn("SELECT name FROM {$database['prefix']}Plugins WHERE blogid = ".getBlogId()); + $pool = DBModel::getInstance(); + $pool->reset('Plugins'); + $pool->setQualifier('blogid','eq',getBlogId()); + $activePlugins = $pool->getColumn('name'); $gCacheStorage->setContent('activePlugins',$activePlugins); } $xmls = new XMLStruct(); diff --git a/library/preprocessor.php b/library/preprocessor.php index dd0d17e1a..9135e919c 100644 --- a/library/preprocessor.php +++ b/library/preprocessor.php @@ -56,13 +56,13 @@ /** LOAD : Configuration and Debug module (if necessary) -------------------- */ -global $config, $context, $uri; +global $context, $uri; +//global $config, $context, $uri; /// Loading configuration $context = Model_Context::getInstance(); // automatic initialization via first instanciation $config = Model_Config::getInstance(); $uri = Model_URIHandler::getInstance(); - /// Loading debug module if($context->getProperty('service.debugmode') == true) { if(!is_null($context->getProperty('database.dbms'))) { diff --git a/library/view/iphoneView.php b/library/view/iphoneView.php index 02872b8f0..03dfa5fa9 100644 --- a/library/view/iphoneView.php +++ b/library/view/iphoneView.php @@ -120,6 +120,7 @@ function printIphoneArchivesView($archives) { global $blogURL; $oldPeriod = ''; $newPeriod = ''; + $printArchive = ''; foreach ($archives as $archive) { $newPeriod = substr($archive['period'],0,4); if($newPeriod != $oldPeriod){ diff --git a/library/view/view.php b/library/view/view.php index b2f0662e0..8ececd6b1 100644 --- a/library/view/view.php +++ b/library/view/view.php @@ -65,16 +65,16 @@ function dressInsertBefore($tag, $value, & $contents, $useCache = false, $forceP } function getScriptsOnHead() { - global $service; + $context = Model_Context::getInstance(); + $context->getProperty('service.resourcepath'); ob_start(); ?> - - - - - - - + + + + + service; + $context = Model_Context::getInstance(); ob_start(); ?> + @@ -124,7 +122,7 @@ function getUpperView($paging) { //]]> getProperty('service.flashclipboardpoter') == true) { ?>
    - - - - -verifyCredentials(); - $acount_id = $acount->id; - $acount_name = $acount->name; - $acount_screen_name = $acount->screen_name; - $acount_link = "http://twitter.com/" . $acount_screen_name; - $acount_image = $acount->profile_image_url; - $following_count = $acount->friends_count; - $followers_count = $acount->followers_count; - $updates_count = $acount->statuses_count; - $description = $acount->description; -?> -
    -

    트위터 정보

    -
    -
    - - -
    -
    -
    - - -
    -
    Saved Searches
    -savedSearches(); - $searchesList = '
      '; - if (count($searches) > 0) { - foreach ($searches as $search) { - $searchesList .= '
    • '; - $searchesList .= 'query) ? 'class="selectMenu"' : '') . ' >' . $search->name . ''; - $searchesList .= '
    • '; - if (strtolower($search_q) == strtolower($search->query)) { - $savedMatchID = $search->id; - } - } - } - $searchesList .= '
    '; - echo $searchesList; -?> -
    - -// //following friends -// $user_photo = ""; -// $limit = 0; -// $option = array('page'=>1); -// $friends = $tw->getFriends($option); -// foreach ($friends as $user) { -// $limit++; -// $user_name = $user->name; -// $user_screen_name = $user->screen_name; -// $user_image = $user->profile_image_url; -// $user_image = str_replace('_normal', '_mini', $user_image); -// $user_link = "http://twitter.com/" . $user_screen_name; -// $user_photo .= '' . $user_name . ' - profile image.'; -// if ($limit == 30) break; -// } -// echo $user_photo; -// -//
    -?> -
    -
    -
    - - -
    -

    트위터

    -
    -
    -

    - a direct message.'; - } else { - $doingTitle = "What are you doing?"; - } -?> - -

    - 140자 남음 -
    -
    - - - -
    -
    -
    - class="shortenLink" style="" /> - class="shortenURLCreate tw_button" /> -
    -
    - class="tw_button" /> -
    -
    -
    -
    -
    - -

    - '; - if (empty($savedMatchID)) { - $savedHtml .= 'Save this search'; - } else { - $savedHtml .= 'Remove this saved search'; - } - $savedHtml .= ''; - echo $savedHtml; - } - ?> -

    -
    - - -
    - -
      "> -$search_q, 'page'=>2, 'rpp'=>$data['listLength']); - $option = array('q'=>$search_q, 'page'=>1, 'rpp'=>$data['listLength']); - } else { - $optionNext = array('page'=>2, 'count'=>$data['listLength']); - $option = array('page'=>1, 'count'=>$data['listLength']); - } - - if ($menu == 'friends') { - $timelineNext = $tw->getFriendsTimeline($optionNext); - $timeline = $tw->getFriendsTimeline($option); - count($timeline); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'my') { - $timelineNext = $tw->getUserTimeline($optionNext); - $timeline = $tw->getUserTimeline($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'replies') { - $timelineNext = $tw->getReplies($optionNext); - $timeline = $tw->getReplies($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'direct') { - if ($seleteTab == "inbox") { - $timelineNext = $tw->getMessages($optionNext); - $timeline = $tw->getMessages($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else { - $timelineNext = $tw->getSentMessages($optionNext); - $timeline = $tw->getSentMessages($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } - } else if ($menu == 'favorites') { - $timelineNext = $tw->getFavorites($optionNext); - $timeline = $tw->getFavorites($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'following') { - $timelineNext = $tw->getFriends(array('page'=>2)); - $timeline = $tw->getFriends(array('page'=>1)); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'followers') { - $timelineNext = $tw->getFollowers(array('page'=>2)); - $timeline = $tw->getFollowers(array('page'=>1)); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'search') { - $timelineNext = $tw->getSearch($optionNext, 'json'); - $timeline = $tw->getSearch($option, 'json'); - $timelineResultsNext = $timelineNext->results; - $timelineResults = $timeline->results; - } - $nextPagingCount = count($timelineResultsNext); - foreach ($timelineResults as $status) { - if ($menu == 'direct') { - $status_id = $status->id; - if ($seleteTab == "inbox") { - $user_id = $status->sender->id; - $user_name = $status->sender->name; - $user_screen_name = $status->sender->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->sender->profile_image_url; - } else { - $user_id = $status->recipient->id; - $user_name = $status->recipient->name; - $user_screen_name = $status->recipient->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->recipient->profile_image_url; - } - $text = $status->text; - $text_convert = getTextBodyConvert($text); - $source = getTextLinkConvert($status->source); - $published = getTwitterDateConvert($status->created_at); - $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; - $in_reply_to_status_id = ""; - $in_reply_to_screen_name = ""; - $in_reply_to_link = ""; - } else if ($menu == 'following' || $menu == 'followers') { - $user_id = $status->id; - $user_name = $status->name; - $user_screen_name = $status->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->profile_image_url; - $profile_image = str_replace('_normal.', '_mini.', $profile_image); - $location = !empty($status->location) ? ":: " . $status->location : ""; - $following = !empty($status->following) ? $status->following : 'false'; - $description = $status->description; - } else if ($menu == 'search') { - $status_id = $status->id; - $user_id = $status->from_user_id; - $user_name = $status->from_user; - $user_screen_name = $status->from_user; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->profile_image_url; - $text = $status->text; - $text_convert = getTextBodyConvert($text); - $text_convert = getBindSearchHighlight($search_q, $text_convert); - $source = getTextLinkConvert($status->source); - $published = getTwitterDateConvert($status->created_at); - $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; - } else { - $status_id = $status->id; - $user_id = $status->user->id; - $user_name = $status->user->name; - $user_screen_name = $status->user->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->user->profile_image_url; - $text = $status->text; - $text_convert = getTextBodyConvert($text); - $source = getTextLinkConvert($status->source); - $published = getTwitterDateConvert($status->created_at); - $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; - $favorited = $status->favorited; - $in_reply_to_status_id = !empty($status->in_reply_to_status_id) ? $status->in_reply_to_status_id : ""; - $in_reply_to_screen_name = !empty($status->in_reply_to_screen_name) ? $status->in_reply_to_screen_name : ""; - $in_reply_to_link = !empty($in_reply_to_status_id) ? ' in reply to ' . $in_reply_to_screen_name . '' : ""; - } - - $metaActionHtml = ""; - if (!in_array($menu, array("direct", 'following','followers'))) { - $metaActionHtml .= ''; - } - if (($data['username'] != $user_screen_name) && !in_array($menu, array("direct", 'following','followers'))) { - $metaActionHtml .= ''; - } - if ($data['username'] != $user_screen_name && $menu != "direct") { - $metaActionHtml .= ''; - } - if ($menu == "direct" || $menu == "followers") { - $metaActionHtml .= ''; - } - if (($data['username'] == $user_screen_name) || $menu == "direct") { - $metaActionHtml .= ''; - } - if (($menu == 'following' || $menu == 'followers') && $following == 'true') { - $metaActionHtml .= ''; - if ($menu == 'followers') { - $metaActionHtml .= ''; - } - } else if ($menu == 'followers' && $following == 'false') { - $metaActionHtml .= ''; - $metaActionHtml .= ''; - } - - if ($menu == 'following' || $menu == 'followers') { -?> -
    • -
      - - - <?php echo $user_name;?> - - -
      - - - - - -
      - - - - - - - -
      -
      -
      -
    • - -
    • -
      - - - <?php echo $user_name;?> - - -
      - - - - - -
      - - - - from - - - - - -
      -
      -
      -
    • - -
    - -
    -
    - -
    -

    트위터 환경설정 오류

    -
    -

    트위터 사용자 정보를 설정해야 합니다. 아이디와 비밀번호를 다시 확인해보세요.

    -
    -
    - -
    -$search_q, 'page'=>($page+1), 'rpp'=>$data['listLength']); - $option = array('q'=>$search_q, 'page'=>$page, 'rpp'=>$data['listLength']); - } else { - $optionNext = array('page'=>($page+1), 'count'=>$data['listLength']); - $option = array('page'=>$page, 'count'=>$data['listLength']); - } - if ($menu == 'friends') { - $timelineNext = $tw->getFriendsTimeline($optionNext); - $timeline = $tw->getFriendsTimeline($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'my') { - $timelineNext = $tw->getUserTimeline($optionNext); - $timeline = $tw->getUserTimeline($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'replies') { - $timelineNext = $tw->getReplies($optionNext); - $timeline = $tw->getReplies($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'direct') { - if ($seleteTab == "inbox") { - $timelineNext = $tw->getMessages($optionNext); - $timeline = $tw->getMessages($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else { - $timelineNext = $tw->getSentMessages($optionNext); - $timeline = $tw->getSentMessages($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } - } else if ($menu == 'favorites') { - $timelineNext = $tw->getFavorites($optionNext); - $timeline = $tw->getFavorites($option); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'following') { - $timelineNext = $tw->getFriends(array('page'=>($page+1))); - $timeline = $tw->getFriends(array('page'=>$page)); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'followers') { - $timelineNext = $tw->getFollowers(array('page'=>($page+1))); - $timeline = $tw->getFollowers(array('page'=>$page)); - $timelineResultsNext = $timelineNext; - $timelineResults = $timeline; - } else if ($menu == 'search') { - $timelineNext = $tw->getSearch($optionNext, 'json'); - $timeline = $tw->getSearch($option, 'json'); - $timelineResultsNext = $timelineNext->results; - $timelineResults = $timeline->results; - } - - $morePagingHtml = ""; - $nextPagingCount = count($timelineResultsNext); - - foreach ($timelineResults as $status) { - if ($menu == 'direct') { - if ($seleteTab == "inbox") { - $user_id = $status->sender->id; - $user_name = $status->sender->name; - $user_screen_name = $status->sender->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->sender->profile_image_url; - } else { - $user_id = $status->recipient->id; - $user_name = $status->recipient->name; - $user_screen_name = $status->recipient->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->recipient->profile_image_url; - } - $text = $status->text; - $text_convert = getTextBodyConvert($text); - $source = getTextLinkConvert($status->source); - $published = getTwitterDateConvert($status->created_at); - $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; - $in_reply_to_status_id = ""; - $in_reply_to_screen_name = ""; - $in_reply_to_link = ""; - } else if ($menu == 'following' || $menu == 'followers') { - $user_id = $status->id; - $user_name = $status->name; - $user_screen_name = $status->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->profile_image_url; - $profile_image = str_replace('_normal.', '_mini.', $profile_image); - $location = $status->location; - $following = !empty($status->following) ? $status->following : 'false'; - $description = $status->description; - } else if ($menu == 'search') { - $status_id = $status->id; - $user_id = $status->from_user_id; - $user_name = $status->from_user; - $user_screen_name = $status->from_user; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->profile_image_url; - $text = getTextLinkConvert($status->text); - $text_convert = getTextBodyConvert($text); - $text_convert = getBindSearchHighlight($search_q, $text_convert); - $source = getTextLinkConvert($status->source); - $published = getTwitterDateConvert($status->created_at); - $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; - } else { - $status_id = $status->id; - $user_id = $status->user->id; - $user_name = $status->user->name; - $user_screen_name = $status->user->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $status->user->profile_image_url; - $text = $status->text; - $text_convert = getTextBodyConvert($text); - $source = getTextLinkConvert($status->source); - $published = getTwitterDateConvert($status->created_at); - $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; - $favorited = $status->favorited; - $in_reply_to_status_id = !empty($status->in_reply_to_status_id) ? $status->in_reply_to_status_id : ""; - $in_reply_to_screen_name = !empty($status->in_reply_to_screen_name) ? $status->in_reply_to_screen_name : ""; - $in_reply_to_link = !empty($in_reply_to_status_id) ? ' in reply to ' . $in_reply_to_screen_name . '' : ""; - } - - $metaActionHtml = ""; - if (!in_array($menu, array("direct", 'following','followers'))) { - $metaActionHtml .= ''; - } - if (($data['username'] != $user_screen_name) && !in_array($menu, array("direct", 'following','followers'))) { - $metaActionHtml .= ''; - } - if ($data['username'] != $user_screen_name && $menu != "direct") { - $metaActionHtml .= ''; - } - if ($menu == "direct" || $menu == "followers") { - $metaActionHtml .= ''; - } - if (($data['username'] == $user_screen_name) || $menu == "direct") { - $metaActionHtml .= ''; - } - if (($menu == 'following' || $menu == 'followers') && $following == 'true') { - $metaActionHtml .= ''; - if ($menu == 'followers') { - $metaActionHtml .= ''; - } - } else if ($menu == 'followers' && $following == 'false') { - $metaActionHtml .= ''; - $metaActionHtml .= ''; - } - - if ($menu == 'following' || $menu == 'followers') { - $morePagingHtml .= '
  • '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . $user_name . ''.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . $user_screen_name . ''.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . UTF8::lessenAsEm(UTF8::convert($description,'utf-8'), 100, '...') . ''.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . $user_name . ''.CRLF; - $morePagingHtml .= ' | ' . $location . ''.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . $metaActionHtml .CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= '
  • '.CRLF; - } else { - $morePagingHtml .= '
  • '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . $user_name . ''.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . $user_screen_name . ''.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . $text_convert . ''.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= ' '.CRLF; - if ($menu != 'direct') { - $morePagingHtml .= ' '.CRLF; - } - if ($menu != 'direct') { - $morePagingHtml .= ' from ' . $source . ' ' . $in_reply_to_link . ''.CRLF; - } - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= ' ' . $metaActionHtml .CRLF; - $morePagingHtml .= ' '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= '
    '.CRLF; - $morePagingHtml .= '
  • '.CRLF; - } - } - $morePagination = ""; - if ($nextPagingCount > 0) { - if ($menu == "direct") { - $paramTab = "&seleteTab=" . ($seleteTab == "inbox" ? "inbox" : "sent"); - } else if ($menu == "search") { - $paramTab = "&q=" . urlencode($search_q); - } else { - $paramTab = ""; - } - $morePagination = 'MORE'; - } - header('Content-Type: text/xml; charset=UTF-8'); - echo ''; - flush(); -} - -function getTwitterPostUpdate($target) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - $menu = (isset($_POST['menu']) && !empty($_POST['menu'])) ? $_POST['menu'] : ""; - $update_body = (isset($_POST['body']) && !empty($_POST['body'])) ? $_POST['body'] : ""; - $reply_to = (isset($_POST['reply_to']) && !empty($_POST['reply_to'])) ? $_POST['reply_to'] : null; -// $update_body .= $data['hashTag'] == "1" ? " " . $data['hashTags'] : ""; - $result = ''; - if (!empty($data['username']) && !empty($data['password'])) { - if (!empty($update_body)) { - $updatedHtml = ""; - $tw = new Twitter($data['username'], $data['password']); - $updated = $tw->updateStatus($update_body, $reply_to); - - $status_id = $updated->id; - $user_id = $updated->user->id; - $user_name = $updated->user->name; - $user_screen_name = $updated->user->screen_name; - $user_link = "https://twitter.com/{$user_screen_name}"; - $profile_image = $updated->user->profile_image_url; - $text = $updated->text; - $text_convert = getTextBodyConvert($text); - $source = getTextLinkConvert($updated->source); - $published = getTwitterDateConvert($updated->created_at); - $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; - $favorited = $updated->favorited; - $in_reply_to_status_id = !empty($updated->in_reply_to_status_id) ? $updated->in_reply_to_status_id : ""; - $in_reply_to_screen_name = !empty($updated->in_reply_to_screen_name) ? $updated->in_reply_to_screen_name : ""; - $in_reply_to_link = !empty($in_reply_to_status_id) ? ' in reply to ' . $in_reply_to_screen_name . '' : ""; - - $metaActionHtml = ""; - if ($menu != "direct") { - $metaActionHtml .= ''; - } - if (($data['username'] != $user_screen_name) && $menu != "direct") { - $metaActionHtml .= ''; - } - if ($data['username'] != $user_screen_name && $menu != "direct") { - $metaActionHtml .= ''; - } - if ($menu == "direct" || $menu == "followers") { - $metaActionHtml .= ''; - } - if (($data['username'] == $user_screen_name) || $menu == "direct") { - $metaActionHtml .= ''; - } - - $updatedHtml .= '
  • '.CRLF; - $updatedHtml .= '
    '.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' ' . $user_name . ''.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= '
    '.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' ' . $user_screen_name . ''.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' ' . $text_convert . ''.CRLF; - $updatedHtml .= '
    '.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' from ' . $source . ' ' . $in_reply_to_link . ''.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= ' ' . $metaActionHtml .CRLF;; - $updatedHtml .= ' '.CRLF; - $updatedHtml .= '
    '.CRLF; - $updatedHtml .= '
    '.CRLF; - $updatedHtml .= '
    '.CRLF; - $updatedHtml .= '
  • '.CRLF; - - header('Content-Type: text/xml; charset=UTF-8'); - $result = ''; - $result .= '0'; - $result .= '' . $status_id . ''; - $result .= ''; - $result .= ''; - echo $result; - flush(); - } - } -} - -function getTwitterDestroyStatus($target) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - $id = (isset($_POST['id']) && !empty($_POST['id'])) ? $_POST['id'] : ""; - - $result = ''; - if (!empty($data['username']) && !empty($data['password'])) { - if (!empty($id)) { - $tw = new Twitter($data['username'], $data['password']); - $status = $tw->destroyStatus($id); - $errorMSG = empty($status->error) ? "0" : $status->error; - $status_id = ""; - if ($errorMSG == "0") { - $status_id = $status->id; - } - - header('Content-Type: text/xml; charset=UTF-8'); - $result = ''; - $result .= '' . $errorMSG . ''; - $result .= '' . $status_id . ''; - $result .= ''; - echo $result; - flush(); - } - } -} - -function getTwitterNewMessage($target) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - $menu = (isset($_POST['menu']) && !empty($_POST['menu'])) ? $_POST['menu'] : ""; - $text = (isset($_POST['text']) && !empty($_POST['text'])) ? $_POST['text'] : ""; - $user = (isset($_POST['user']) && !empty($_POST['user'])) ? $_POST['user'] : ""; - - $result = ''; - if (!empty($data['username']) && !empty($data['password'])) { - if (!empty($text)) { - $updatedHtml = ""; - $tw = new Twitter($data['username'], $data['password']); - $message = $tw->newMessage($user, $text); - $errorMSG = empty($message->error) ? "0" : $message->error; - $message_id = ""; - $messageHtml = ""; - if ($errorMSG == "0") { - $message_id = $message->id; - $message_text = $message->text; - $message_convert = getTextBodyConvert($message_text); - $published = getTwitterDateConvert($message->created_at); - - $sender_id = $message->sender->id; - $sender_name = $message->sender->name; - $sender_screen_name = $message->sender->screen_name; - $sender_link = "https://twitter.com/{$sender_screen_name}"; - $sender_profile_image = $message->sender->profile_image_url; - - $recipient_id = $message->recipient->id; - $recipient_name = $message->recipient->name; - $recipient_screen_name = $message->recipient->screen_name; - $recipient_link = "https://twitter.com/{$recipient_screen_name}"; - $recipient_profile_image = $message->recipient->profile_image_url; - - if ($menu == "direct" || $menu == "followers") { - $metaActionHtml .= ''; - } - if (($data['username'] == $sender_screen_name) || $menu == "direct") { - $metaActionHtml .= ''; - } - - $messageHtml .= '
  • '.CRLF; - $messageHtml .= '
    '.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' ' . $recipient_name . ''.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= '
    '.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' ' . $recipient_screen_name . ''.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' ' . $message_convert . ''.CRLF; - $messageHtml .= '
    '.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' ' . $published . ''.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' '.CRLF; - $messageHtml .= ' ' . $metaActionHtml .CRLF;; - $messageHtml .= ' '.CRLF; - $messageHtml .= '
    '.CRLF; - $messageHtml .= '
    '.CRLF; - $messageHtml .= '
    '.CRLF; - $messageHtml .= '
  • '.CRLF; - } - - header('Content-Type: text/xml; charset=UTF-8'); - $result = ''; - $result .= '' . $errorMSG . ''; - $result .= '' . $message_id . ''; - $result .= ''; - $result .= ''; - echo $result; - flush(); - } - } -} - -function getTwitterDestroyMessage($target) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - $id = (isset($_POST['id']) && !empty($_POST['id'])) ? $_POST['id'] : ""; - - $result = ''; - if (!empty($data['username']) && !empty($data['password'])) { - if (!empty($id)) { - $updatedHtml = ""; - $tw = new Twitter($data['username'], $data['password']); - $message = $tw->destroyMessage($id); - $errorMSG = empty($message->error) ? "0" : $message->error; - $message_id = ""; - $messageHtml = ""; - if ($errorMSG == "0") { - $message_id = $message->id; - } - - header('Content-Type: text/xml; charset=UTF-8'); - $result = ''; - $result .= '' . $errorMSG . ''; - $result .= '' . $message_id . ''; - $result .= ''; - echo $result; - flush(); - } - } -} - -function getTwitterCreateFriendship($target) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - $menu = (isset($_POST['menu']) && !empty($_POST['menu'])) ? $_POST['menu'] : ""; - $user_id = (isset($_POST['user_id']) && !empty($_POST['user_id'])) ? $_POST['user_id'] : ""; - - $result = ''; - if (!empty($data['username']) && !empty($data['password'])) { - if (!empty($user_id)) { - $tw = new Twitter($data['username'], $data['password']); - $friendship = $tw->createFriendship($user_id); - $errorMSG = empty($friendship->error) ? "0" : $friendship->error; - $friendshipID = ""; - if ($errorMSG == "0") { - $friendshipID = $friendship->id; - $following = $friendship->following; - $user_screen_name = $friendship->screen_name; - } - - header('Content-Type: text/xml; charset=UTF-8'); - $result = ''; - $result .= '' . $errorMSG . ''; - $result .= '' . $friendshipID . ''; - $result .= '' . $following . ''; - $result .= ''; - $result .= ''; - echo $result; - flush(); - } - } -} - -function getTwitterDestroyFriendship($target) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - $menu = (isset($_POST['menu']) && !empty($_POST['menu'])) ? $_POST['menu'] : ""; - $user_id = (isset($_POST['user_id']) && !empty($_POST['user_id'])) ? $_POST['user_id'] : ""; - - $result = ''; - if (!empty($data['username']) && !empty($data['password'])) { - if (!empty($user_id)) { - $updatedHtml = ""; - $tw = new Twitter($data['username'], $data['password']); - $friendship = $tw->destroyFriendship($user_id); - $errorMSG = empty($friendship->error) ? "0" : $friendship->error; - $friendshipID = ""; - if ($errorMSG == "0") { - $friendshipID = $friendship->id; - $following = $friendship->following; - $user_screen_name = $friendship->screen_name; - } - - header('Content-Type: text/xml; charset=UTF-8'); - $result = ''; - $result .= '' . $errorMSG . ''; - $result .= '' . $friendshipID . ''; - $result .= '' . $following . ''; - $result .= ''; - $result .= ''; - echo $result; - flush(); - } - } -} - - -// Twitter update (Admin->center->dashboard->Twitter update widget) -function CT_Twitter_updating($target){ - global $service, $pluginURL, $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - - $twFlagCHK = ""; - $twFlagMSG = ""; - if(empty($data['username']) || empty($data['password'])){ - $twFlagCHK = "disabled"; - $twFlagMSG = " * 트위터 사용자 정보를 설정해야 합니다.\n * 아이디와 비밀번호를 입력하세요.\n"; - } - ob_start(); -?> - - - - -
    -
    - - -
    -
    - class="shortenLink" style="" /> - class="shortenURLCreate tw_button" /> -
    -
    - 140자 남음  - class="update_button_mini tw_button" /> -
    -
    -
    -' . $resultShortenURL['error'] . ''; - flush(); -} - -function getUpdatingNewPostToTwitter($target, $mother) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - - $blogid = getBlogId(); - if (!empty($data['username']) && !empty($data['password']) && $data['twitterUpdate'] == "public_synd") { - if ($data['updateText'] == 'title') { - $content = getTwitterContent($blogid, $target, 'title'); - } else { - $content = getTwitterContent($blogid, $target, 'content'); - } - if (in_array($content['visibility'], array("2", "3"))) { - $tw = new Twitter($data['username'], $data['password']); - $updated = $tw->updateStatus($content['body']); - } - } - return $target; -} - -function getUpdatingNewLineToTwitter($target, $mother) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - - if (!empty($data['username']) && !empty($data['password'])) { - $content = UTF8::lessenAsEncoding($mother->content,140); - $tw = new Twitter($data['username'], $data['password']); - $updated = $tw->updateStatus($content); - } - return $target; -} - -function getUpdatingNewPostToTwitterSynd($target, $mother) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - - $blogid = getBlogId(); - if (!empty($data['username']) && !empty($data['password']) && $data['twitterUpdate'] == "syndicate") { - if ($data['updateText'] == 'title') { - $content = getTwitterContent($blogid, $target, 'title'); - } else { - $content = getTwitterContent($blogid, $target, 'content'); - } - if (in_array($content['visibility'], array("2", "3"))) { - $tw = new Twitter($data['username'], $data['password']); - $updated = $tw->updateStatus($content['body']); - } - } - return $target; -} - -function getTwitterContent($blogid, $entryId, $updateText='title') { - global $blog, $service, $defaultURL, $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - - $content = array(); - $tempContentTags = ""; - $entry = getEntry($blogid, $entryId); - $tempPermalink = $defaultURL . ($blog['useSloganOnPost'] ? "/entry/" . URL::encode($entry['slogan'], $service['useEncodedURL']) : "/" . $entry['id']); - $resultShortenURL = getTwitterBitlyShortenURL($tempPermalink); - $tempContentTags = $data['hashTag'] == "1" ? $data['hashTags'] : ""; - $tempContentTags .= " - " . ($resultShortenURL['error'] == "0" ? $resultShortenURL['shortUrl'] : $tempPermalink); - - $tempContentLimit = 140 - (strlen($tempContentTags) + 5); - if ($updateText == 'title') { - $tempContent = UTF8::lessenAsEncoding($entry['title'], $tempContentLimit, '...'); - } else { - $tempContent = UTF8::lessenAsEncoding(stripHTML(getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentFormatter'])), $tempContentLimit, '...'); - } - - $content['body'] = $tempContent . " " . $tempContentTags; - $content['visibility'] = $entry['visibility']; - return $content; -} - -function getTwitterBitlyShortenURL($longURL) { - global $configVal; - $data = Misc::fetchConfigVal($configVal); - getTwitterInitConfigVal($data); - - $result = array(); - if (!empty($longURL)) { - $tw = new Twitter($data['username'], $data['password']); - $params = array(); - $params['login'] = "textcube"; //It's key for plugin. It does not change.(by jparker2.0@gmail.com) - $params['apiKey'] = "R_fcfc2c0c70d30aca174fa771c415d2cb"; //It's key for plugin. It does not change.(by jparker2.0@gmail.com) - $params['longUrl'] = $longURL; - $shorten = $tw->bitShortenURL($params, 'xml'); - $resultError = $shorten->results->nodeKeyVal->errorCode; - $result['error'] = empty($resultError) ? $shorten->errorCode : $resultError; - if ($result['error'] == "0") { - $result['shortUrl'] = $shorten->results->nodeKeyVal->shortUrl; - } - } - return $result; -} - -function getCurrentBlogVersion() { - $currentVersion = file_get_contents(ROOT . '/cache/CHECKUP'); - $currentVersion = substr($currentVersion, 0, 3); - return $currentVersion; -} - -function getJQueryCheckLoad($target) { - global $pluginURL; - if (getCurrentBlogVersion() < 1.8) { - $target .= ''.CRLF; - $target .= ''.CRLF; - } - return $target; -} - -function getTwitterInitConfigVal(&$data) { - $data['username'] = isset($data['username']) && !empty($data['username']) ? $data['username'] : ""; - $data['password'] = isset($data['password']) && !empty($data['password']) ? $data['password'] : ""; - $data['hashTag'] = isset($data['hashTag']) && !empty($data['hashTag']) ? $data['hashTag'] : ""; - $data['hashTags'] = isset($data['hashTags']) && !empty($data['hashTags']) ? $data['hashTags'] : ""; - $data['twitterUpdate'] = isset($data['twitterUpdate']) && !empty($data['twitterUpdate']) ? $data['twitterUpdate'] : "none"; - $data['updateText'] = isset($data['updateText']) && !empty($data['updateText']) ? $data['updateText'] : "title"; - $data['listLength'] = isset($data['listLength']) && !empty($data['listLength']) ? $data['listLength'] : "10"; -} - -function getTwitterDataSet($DATA) { - $cfg = Misc::fetchConfigVal($DATA); - $tw = new Twitter($cfg['username'], $cfg['password']); - $res = $tw->getUserTimeline(); - if (!empty($res->error)) { - return "::Authentication error::\n\n Username && Password requires authentication. \n (" . $res->error . ")"; - } - - return true; -} -?> +]+?href=(?:"|')(.*?)(?:"|')(?:>|')(.*?)(?:<|')\/a(?:>|')@i", $textLink, $match)) { + $returnLink = '' . $match[2] .''; + } else if (preg_match("@]+?href=['\"](.+)['\"]>(.*)@Usi", $textLink, $match)) { + $returnLink = '' . $match[2] .''; + } else { + $returnLink = $textLink; + } + return $returnLink; +} + +// Twitter text body converting +function getTextBodyConvert($text) { + global $pluginMenuURL; + if (empty($pluginMenuURL)) { + $pluginMenuURL = getPluginMenuURL(); + } + + preg_match_all('@((http|https|ftp)://[^\s"\']+)@i', $text, $temp); + for ($i=0; $i' . UTF8::lessenAsEm($temp[1][$i], 30) . '', $text); + } + + preg_match_all('@\@{1}(\w+)@i', $text, $temp); + for ($i=0; $i' . $temp[1][$i] . '', $text); + } + + preg_match_all('@\#{1}(\w+)@i', $text, $temp); + for ($i=0; $i' . $temp[0][$i] . '', $text); + } + + return $text; +} + +// Twitter plugin menu url +function getPluginMenuURL() { + global $pluginURL, $blogURL; + $temp = explode("/" , $pluginURL); + $plugin = $temp[(count($temp)-1)]; + $pluginMenuURL = $blogURL . '/owner/plugin/adminMenu?name=' . $plugin . '/PN_Twitter_Management'; + return $pluginMenuURL; +} + +// Twitter date convert +function getTwitterDateConvert($published) { + $nowDate = time(); + $published = strtotime($published); + $dateConvert = getCovertDate(($nowDate - $published), $published); + return $dateConvert; +} + +function getCovertDate($reqTime, $published) { + $dateConvert = ''; + + if ($reqTime < 0 ) { + $dateConvert = 'less than 5 seconds ago'; + return $dateConvert; + } + + $month = floor($reqTime / 2592000); + $reqTime %= 2592000; + $day = floor($reqTime / 86400); + $reqTime %= 86400; + $hour = floor($reqTime / 3600); + $reqTime %= 3600; + $minute = floor($reqTime / 60); + $reqTime %= 60; + $second = $reqTime; + + if ($day > 1) { + $dateConvert = date('g:i A M jS', $published); + } else if($day > 0 && $day <=3) { + $dateConvert = 'about ' . $day . ' ' . ($day > 1 ? 'days' : 'day') . ' ago'; + } else if($hour > 0) { + $dateConvert = 'about ' . $hour . ' ' . ($hour > 1 ? 'hours' : 'hour') . ' ago'; + } else if($minute > 0) { + $dateConvert = $minute . ' ' . ($minute > 1 ? 'minutes' : 'minute') . ' ago'; + } else if($second >= 0) { + if($second >= 0 && $second < 5) { + $dateConvert = 'less than 5 seconds ago'; + } else if($second >= 5 && $second < 10) { + $dateConvert = 'less than 10 seconds ago'; + } else if($second >= 10 && $second < 20) { + $dateConvert = 'less than 20 seconds ago'; + } else if($second >= 20 && $second < 30) { + $dateConvert = 'half a minute ago'; + } else if($second >= 30 && $second < 60) { + $dateConvert = 'less than a minute ago'; + } + } + return $dateConvert; +} + +// Twitter Recipients List +function getTwitterRecipientsList($target) { + global $service, $pluginURL, $blogURL, $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $tw = new Twitter($data['username'], $data['password']); + $recipientsList = $tw->getRecipientsList(array('twttr'=>'true')); + + header('Content-Type: application/x-json; charset=UTF-8'); + echo $recipientsList; + flush(); +} + +// Twitter Create Favorites +function getCreateFavorites($target) { + global $service, $pluginURL, $blogURL, $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $id = (isset($_POST['id']) && !empty($_POST['id'])) ? $_POST['id'] : ''; + $tw = new Twitter($data['username'], $data['password']); + $cFav = $tw->createFavorite($id); + $cFavID = !empty($cFav->id) ? $cFav->id : ''; + $favorited = $cFav->favorited; + header('Content-Type: text/xml; charset=UTF-8'); + echo ''; + flush(); +} + +// Twitter Destroy Favorites +function getDestroyFavorites($target) { + global $service, $pluginURL, $blogURL, $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $id = (isset($_POST['id']) && !empty($_POST['id'])) ? $_POST['id'] : ''; + $tw = new Twitter($data['username'], $data['password']); + $dFav = $tw->destroyFavorite($id); + $dFavID = !empty($dFav->id) ? $dFav->id : ''; + $favorited = $dFav->favorited; + header('Content-Type: text/xml; charset=UTF-8'); + echo ''; + flush(); +} + +// Twitter Search keyword highlight +function getBindSearchHighlight($keyword, $content) { + $src = array("/", "|"); + $dst = array("\/", "\|"); + if (!trim($keyword)) return $content; + $tempContent = str_replace($src, $dst, quotemeta($keyword)); + $tempKeyword = $tempContent . "(?![^<]*>)"; + return preg_replace("/($tempKeyword)/i", "\\1", $content); +} + +// Twitter Saved Searches open or close +function getSavedSearchesOpenClose($target) { + $savedSearchesView = (isset($_POST['openclose']) && !empty($_POST['openclose'])) ? $_POST['openclose'] : 'open'; + Setting::setBlogSetting("saved_searches", $savedSearchesView); + header('Content-Type: text/xml; charset=UTF-8'); + echo ''; + flush(); +} + +// Twitter Create Saved Searches +function getCreateSavedSearches($target) { + global $service, $pluginURL, $blogURL, $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + $q = (isset($_POST['qdata']) && !empty($_POST['qdata'])) ? $_POST['qdata'] : ''; + $result = ''; + if (!empty($data['username']) && !empty($data['password'])) { + if (!empty($q)) { + $tw = new Twitter($data['username'], $data['password']); + $createSave = $tw->createSavedSearches(array('q'=>$q)); + $errorMSG = empty($createSave->error) ? "0" : $createSave->error; + $saved_id = ""; + if ($errorMSG == "0") { + $saved_id = $createSave->id; + $saved_query = $createSave->query; + } + + header('Content-Type: text/xml; charset=UTF-8'); + $result = ''; + $result .= '' . $errorMSG . ''; + $result .= '' . $saved_id . ''; + $result .= '' . $saved_query . ''; + $result .= ''; + echo $result; + flush(); + } + } +} + +// Twitter Destroy Saved Searches +function getDestroySavedSearches($target) { + global $service, $pluginURL, $blogURL, $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + $id = (isset($_POST['qdata']) && !empty($_POST['qdata'])) ? $_POST['qdata'] : ''; + $result = ''; + if (!empty($data['username']) && !empty($data['password'])) { + if (!empty($id)) { + $tw = new Twitter($data['username'], $data['password']); + $destroySave = $tw->destroySavedSearches($id); + $errorMSG = empty($destroySave->error) ? "0" : $destroySave->error; + $saved_id = ""; + if ($errorMSG == "0") { + $saved_id = $destroySave->id; + $saved_query = $destroySave->query; + } + + header('Content-Type: text/xml; charset=UTF-8'); + $result = ''; + $result .= '' . $errorMSG . ''; + $result .= '' . $saved_id . ''; + $result .= '' . $saved_query . ''; + $result .= ''; + echo $result; + flush(); + } + } +} + +// Twitter management (Admin->center->Twitter management) +function PN_Twitter_Management() { + global $service, $pluginURL, $blogURL, $pluginMenuURL, $pluginName, $handler, $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + $savedSearchesView = !is_null(Setting::getBlogSetting("saved_searches")) ? Setting::getBlogSetting("saved_searches") : "open"; + $menu = (isset($_GET['menu']) && !empty($_GET['menu'])) ? $_GET['menu'] : 'friends'; + $user_id = (isset($_GET['user_id']) && !empty($_GET['user_id'])) ? $_GET['user_id'] : ''; + $seleteTab = (isset($_GET['seleteTab']) && !empty($_GET['seleteTab'])) ? $_GET['seleteTab'] : 'inbox'; + $search_q = (isset($_GET['q']) && !empty($_GET['q'])) ? $_GET['q'] : ''; + + $twFlagCHK = ""; + $twFlagMSG = ""; + if (empty($data['username']) || empty($data['password'])) { + $twFlagCHK = "disabled"; + $twFlagMSG = " * 트위터 사용자 정보를 설정해야 합니다.\n * 아이디와 비밀번호를 입력하세요.\n"; + } +?> + + + + + +verifyCredentials(); + $acount_id = $acount->id; + $acount_name = $acount->name; + $acount_screen_name = $acount->screen_name; + $acount_link = "http://twitter.com/" . $acount_screen_name; + $acount_image = $acount->profile_image_url; + $following_count = $acount->friends_count; + $followers_count = $acount->followers_count; + $updates_count = $acount->statuses_count; + $description = $acount->description; +?> +
    +

    트위터 정보

    +
    +
    + + +
    +
    +
    + + +
    +
    Saved Searches
    +savedSearches(); + $searchesList = '
      '; + if (count($searches) > 0) { + foreach ($searches as $search) { + $searchesList .= '
    • '; + $searchesList .= 'query) ? 'class="selectMenu"' : '') . ' >' . $search->name . ''; + $searchesList .= '
    • '; + if (strtolower($search_q) == strtolower($search->query)) { + $savedMatchID = $search->id; + } + } + } + $searchesList .= '
    '; + echo $searchesList; +?> +
    + +// //following friends +// $user_photo = ""; +// $limit = 0; +// $option = array('page'=>1); +// $friends = $tw->getFriends($option); +// foreach ($friends as $user) { +// $limit++; +// $user_name = $user->name; +// $user_screen_name = $user->screen_name; +// $user_image = $user->profile_image_url; +// $user_image = str_replace('_normal', '_mini', $user_image); +// $user_link = "http://twitter.com/" . $user_screen_name; +// $user_photo .= '' . $user_name . ' - profile image.'; +// if ($limit == 30) break; +// } +// echo $user_photo; +// +//
    +?> +
    +
    + + + +
    +

    트위터

    +
    +
    +

    + a direct message.'; + } else { + $doingTitle = "What are you doing?"; + } +?> + +

    + 140자 남음 +
    +
    + + + +
    +
    +
    + class="shortenLink" style="" /> + class="shortenURLCreate tw_button" /> +
    +
    + class="tw_button" /> +
    +
    +
    +
    +
    + +

    + '; + if (empty($savedMatchID)) { + $savedHtml .= 'Save this search'; + } else { + $savedHtml .= 'Remove this saved search'; + } + $savedHtml .= ''; + echo $savedHtml; + } + ?> +

    +
    + + +
    + +
      "> +$search_q, 'page'=>2, 'rpp'=>$data['listLength']); + $option = array('q'=>$search_q, 'page'=>1, 'rpp'=>$data['listLength']); + } else { + $optionNext = array('page'=>2, 'count'=>$data['listLength']); + $option = array('page'=>1, 'count'=>$data['listLength']); + } + + if ($menu == 'friends') { + $timelineNext = $tw->getFriendsTimeline($optionNext); + $timeline = $tw->getFriendsTimeline($option); + count($timeline); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'my') { + $timelineNext = $tw->getUserTimeline($optionNext); + $timeline = $tw->getUserTimeline($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'replies') { + $timelineNext = $tw->getReplies($optionNext); + $timeline = $tw->getReplies($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'direct') { + if ($seleteTab == "inbox") { + $timelineNext = $tw->getMessages($optionNext); + $timeline = $tw->getMessages($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else { + $timelineNext = $tw->getSentMessages($optionNext); + $timeline = $tw->getSentMessages($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } + } else if ($menu == 'favorites') { + $timelineNext = $tw->getFavorites($optionNext); + $timeline = $tw->getFavorites($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'following') { + $timelineNext = $tw->getFriends(array('page'=>2)); + $timeline = $tw->getFriends(array('page'=>1)); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'followers') { + $timelineNext = $tw->getFollowers(array('page'=>2)); + $timeline = $tw->getFollowers(array('page'=>1)); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'search') { + $timelineNext = $tw->getSearch($optionNext, 'json'); + $timeline = $tw->getSearch($option, 'json'); + $timelineResultsNext = $timelineNext->results; + $timelineResults = $timeline->results; + } + $nextPagingCount = count($timelineResultsNext); + foreach ($timelineResults as $status) { + if ($menu == 'direct') { + $status_id = $status->id; + if ($seleteTab == "inbox") { + $user_id = $status->sender->id; + $user_name = $status->sender->name; + $user_screen_name = $status->sender->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->sender->profile_image_url; + } else { + $user_id = $status->recipient->id; + $user_name = $status->recipient->name; + $user_screen_name = $status->recipient->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->recipient->profile_image_url; + } + $text = $status->text; + $text_convert = getTextBodyConvert($text); + $source = getTextLinkConvert($status->source); + $published = getTwitterDateConvert($status->created_at); + $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; + $in_reply_to_status_id = ""; + $in_reply_to_screen_name = ""; + $in_reply_to_link = ""; + } else if ($menu == 'following' || $menu == 'followers') { + $user_id = $status->id; + $user_name = $status->name; + $user_screen_name = $status->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->profile_image_url; + $profile_image = str_replace('_normal.', '_mini.', $profile_image); + $location = !empty($status->location) ? ":: " . $status->location : ""; + $following = !empty($status->following) ? $status->following : 'false'; + $description = $status->description; + } else if ($menu == 'search') { + $status_id = $status->id; + $user_id = $status->from_user_id; + $user_name = $status->from_user; + $user_screen_name = $status->from_user; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->profile_image_url; + $text = $status->text; + $text_convert = getTextBodyConvert($text); + $text_convert = getBindSearchHighlight($search_q, $text_convert); + $source = getTextLinkConvert($status->source); + $published = getTwitterDateConvert($status->created_at); + $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; + } else { + $status_id = $status->id; + $user_id = $status->user->id; + $user_name = $status->user->name; + $user_screen_name = $status->user->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->user->profile_image_url; + $text = $status->text; + $text_convert = getTextBodyConvert($text); + $source = getTextLinkConvert($status->source); + $published = getTwitterDateConvert($status->created_at); + $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; + $favorited = $status->favorited; + $in_reply_to_status_id = !empty($status->in_reply_to_status_id) ? $status->in_reply_to_status_id : ""; + $in_reply_to_screen_name = !empty($status->in_reply_to_screen_name) ? $status->in_reply_to_screen_name : ""; + $in_reply_to_link = !empty($in_reply_to_status_id) ? ' in reply to ' . $in_reply_to_screen_name . '' : ""; + } + + $metaActionHtml = ""; + if (!in_array($menu, array("direct", 'following','followers'))) { + $metaActionHtml .= ''; + } + if (($data['username'] != $user_screen_name) && !in_array($menu, array("direct", 'following','followers'))) { + $metaActionHtml .= ''; + } + if ($data['username'] != $user_screen_name && $menu != "direct") { + $metaActionHtml .= ''; + } + if ($menu == "direct" || $menu == "followers") { + $metaActionHtml .= ''; + } + if (($data['username'] == $user_screen_name) || $menu == "direct") { + $metaActionHtml .= ''; + } + if (($menu == 'following' || $menu == 'followers') && $following == 'true') { + $metaActionHtml .= ''; + if ($menu == 'followers') { + $metaActionHtml .= ''; + } + } else if ($menu == 'followers' && $following == 'false') { + $metaActionHtml .= ''; + $metaActionHtml .= ''; + } + + if ($menu == 'following' || $menu == 'followers') { +?> +
    • +
      + + + <?php echo $user_name;?> + + +
      + + + + + +
      + + + + + + + +
      +
      +
      +
    • + +
    • +
      + + + <?php echo $user_name;?> + + +
      + + + + + +
      + + + + from + + + + + +
      +
      +
      +
    • + +
    + +
    +
    + +
    +

    트위터 환경설정 오류

    +
    +

    트위터 사용자 정보를 설정해야 합니다. 아이디와 비밀번호를 다시 확인해보세요.

    +
    +
    + +
    +$search_q, 'page'=>($page+1), 'rpp'=>$data['listLength']); + $option = array('q'=>$search_q, 'page'=>$page, 'rpp'=>$data['listLength']); + } else { + $optionNext = array('page'=>($page+1), 'count'=>$data['listLength']); + $option = array('page'=>$page, 'count'=>$data['listLength']); + } + if ($menu == 'friends') { + $timelineNext = $tw->getFriendsTimeline($optionNext); + $timeline = $tw->getFriendsTimeline($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'my') { + $timelineNext = $tw->getUserTimeline($optionNext); + $timeline = $tw->getUserTimeline($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'replies') { + $timelineNext = $tw->getReplies($optionNext); + $timeline = $tw->getReplies($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'direct') { + if ($seleteTab == "inbox") { + $timelineNext = $tw->getMessages($optionNext); + $timeline = $tw->getMessages($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else { + $timelineNext = $tw->getSentMessages($optionNext); + $timeline = $tw->getSentMessages($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } + } else if ($menu == 'favorites') { + $timelineNext = $tw->getFavorites($optionNext); + $timeline = $tw->getFavorites($option); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'following') { + $timelineNext = $tw->getFriends(array('page'=>($page+1))); + $timeline = $tw->getFriends(array('page'=>$page)); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'followers') { + $timelineNext = $tw->getFollowers(array('page'=>($page+1))); + $timeline = $tw->getFollowers(array('page'=>$page)); + $timelineResultsNext = $timelineNext; + $timelineResults = $timeline; + } else if ($menu == 'search') { + $timelineNext = $tw->getSearch($optionNext, 'json'); + $timeline = $tw->getSearch($option, 'json'); + $timelineResultsNext = $timelineNext->results; + $timelineResults = $timeline->results; + } + + $morePagingHtml = ""; + $nextPagingCount = count($timelineResultsNext); + + foreach ($timelineResults as $status) { + if ($menu == 'direct') { + if ($seleteTab == "inbox") { + $user_id = $status->sender->id; + $user_name = $status->sender->name; + $user_screen_name = $status->sender->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->sender->profile_image_url; + } else { + $user_id = $status->recipient->id; + $user_name = $status->recipient->name; + $user_screen_name = $status->recipient->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->recipient->profile_image_url; + } + $text = $status->text; + $text_convert = getTextBodyConvert($text); + $source = getTextLinkConvert($status->source); + $published = getTwitterDateConvert($status->created_at); + $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; + $in_reply_to_status_id = ""; + $in_reply_to_screen_name = ""; + $in_reply_to_link = ""; + } else if ($menu == 'following' || $menu == 'followers') { + $user_id = $status->id; + $user_name = $status->name; + $user_screen_name = $status->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->profile_image_url; + $profile_image = str_replace('_normal.', '_mini.', $profile_image); + $location = $status->location; + $following = !empty($status->following) ? $status->following : 'false'; + $description = $status->description; + } else if ($menu == 'search') { + $status_id = $status->id; + $user_id = $status->from_user_id; + $user_name = $status->from_user; + $user_screen_name = $status->from_user; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->profile_image_url; + $text = getTextLinkConvert($status->text); + $text_convert = getTextBodyConvert($text); + $text_convert = getBindSearchHighlight($search_q, $text_convert); + $source = getTextLinkConvert($status->source); + $published = getTwitterDateConvert($status->created_at); + $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; + } else { + $status_id = $status->id; + $user_id = $status->user->id; + $user_name = $status->user->name; + $user_screen_name = $status->user->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $status->user->profile_image_url; + $text = $status->text; + $text_convert = getTextBodyConvert($text); + $source = getTextLinkConvert($status->source); + $published = getTwitterDateConvert($status->created_at); + $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; + $favorited = $status->favorited; + $in_reply_to_status_id = !empty($status->in_reply_to_status_id) ? $status->in_reply_to_status_id : ""; + $in_reply_to_screen_name = !empty($status->in_reply_to_screen_name) ? $status->in_reply_to_screen_name : ""; + $in_reply_to_link = !empty($in_reply_to_status_id) ? ' in reply to ' . $in_reply_to_screen_name . '' : ""; + } + + $metaActionHtml = ""; + if (!in_array($menu, array("direct", 'following','followers'))) { + $metaActionHtml .= ''; + } + if (($data['username'] != $user_screen_name) && !in_array($menu, array("direct", 'following','followers'))) { + $metaActionHtml .= ''; + } + if ($data['username'] != $user_screen_name && $menu != "direct") { + $metaActionHtml .= ''; + } + if ($menu == "direct" || $menu == "followers") { + $metaActionHtml .= ''; + } + if (($data['username'] == $user_screen_name) || $menu == "direct") { + $metaActionHtml .= ''; + } + if (($menu == 'following' || $menu == 'followers') && $following == 'true') { + $metaActionHtml .= ''; + if ($menu == 'followers') { + $metaActionHtml .= ''; + } + } else if ($menu == 'followers' && $following == 'false') { + $metaActionHtml .= ''; + $metaActionHtml .= ''; + } + + if ($menu == 'following' || $menu == 'followers') { + $morePagingHtml .= '
  • '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . $user_name . ''.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . $user_screen_name . ''.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . UTF8::lessenAsEm(UTF8::convert($description,'utf-8'), 100, '...') . ''.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . $user_name . ''.CRLF; + $morePagingHtml .= ' | ' . $location . ''.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . $metaActionHtml .CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= '
  • '.CRLF; + } else { + $morePagingHtml .= '
  • '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . $user_name . ''.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . $user_screen_name . ''.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . $text_convert . ''.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= ' '.CRLF; + if ($menu != 'direct') { + $morePagingHtml .= ' '.CRLF; + } + if ($menu != 'direct') { + $morePagingHtml .= ' from ' . $source . ' ' . $in_reply_to_link . ''.CRLF; + } + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= ' ' . $metaActionHtml .CRLF; + $morePagingHtml .= ' '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= '
    '.CRLF; + $morePagingHtml .= '
  • '.CRLF; + } + } + $morePagination = ""; + if ($nextPagingCount > 0) { + if ($menu == "direct") { + $paramTab = "&seleteTab=" . ($seleteTab == "inbox" ? "inbox" : "sent"); + } else if ($menu == "search") { + $paramTab = "&q=" . urlencode($search_q); + } else { + $paramTab = ""; + } + $morePagination = 'MORE'; + } + header('Content-Type: text/xml; charset=UTF-8'); + echo ''; + flush(); +} + +function getTwitterPostUpdate($target) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $menu = (isset($_POST['menu']) && !empty($_POST['menu'])) ? $_POST['menu'] : ""; + $update_body = (isset($_POST['body']) && !empty($_POST['body'])) ? $_POST['body'] : ""; + $reply_to = (isset($_POST['reply_to']) && !empty($_POST['reply_to'])) ? $_POST['reply_to'] : null; +// $update_body .= $data['hashTag'] == "1" ? " " . $data['hashTags'] : ""; + $result = ''; + if (!empty($data['username']) && !empty($data['password'])) { + if (!empty($update_body)) { + $updatedHtml = ""; + $tw = new Twitter($data['username'], $data['password']); + $updated = $tw->updateStatus($update_body, $reply_to); + + $status_id = $updated->id; + $user_id = $updated->user->id; + $user_name = $updated->user->name; + $user_screen_name = $updated->user->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $profile_image = $updated->user->profile_image_url; + $text = $updated->text; + $text_convert = getTextBodyConvert($text); + $source = getTextLinkConvert($updated->source); + $published = getTwitterDateConvert($updated->created_at); + $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; + $favorited = $updated->favorited; + $in_reply_to_status_id = !empty($updated->in_reply_to_status_id) ? $updated->in_reply_to_status_id : ""; + $in_reply_to_screen_name = !empty($updated->in_reply_to_screen_name) ? $updated->in_reply_to_screen_name : ""; + $in_reply_to_link = !empty($in_reply_to_status_id) ? ' in reply to ' . $in_reply_to_screen_name . '' : ""; + + $metaActionHtml = ""; + if ($menu != "direct") { + $metaActionHtml .= ''; + } + if (($data['username'] != $user_screen_name) && $menu != "direct") { + $metaActionHtml .= ''; + } + if ($data['username'] != $user_screen_name && $menu != "direct") { + $metaActionHtml .= ''; + } + if ($menu == "direct" || $menu == "followers") { + $metaActionHtml .= ''; + } + if (($data['username'] == $user_screen_name) || $menu == "direct") { + $metaActionHtml .= ''; + } + + $updatedHtml .= '
  • '.CRLF; + $updatedHtml .= '
    '.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' ' . $user_name . ''.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= '
    '.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' ' . $user_screen_name . ''.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' ' . $text_convert . ''.CRLF; + $updatedHtml .= '
    '.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' from ' . $source . ' ' . $in_reply_to_link . ''.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= ' ' . $metaActionHtml .CRLF;; + $updatedHtml .= ' '.CRLF; + $updatedHtml .= '
    '.CRLF; + $updatedHtml .= '
    '.CRLF; + $updatedHtml .= '
    '.CRLF; + $updatedHtml .= '
  • '.CRLF; + + header('Content-Type: text/xml; charset=UTF-8'); + $result = ''; + $result .= '0'; + $result .= '' . $status_id . ''; + $result .= ''; + $result .= ''; + echo $result; + flush(); + } + } +} + +function getTwitterDestroyStatus($target) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $id = (isset($_POST['id']) && !empty($_POST['id'])) ? $_POST['id'] : ""; + + $result = ''; + if (!empty($data['username']) && !empty($data['password'])) { + if (!empty($id)) { + $tw = new Twitter($data['username'], $data['password']); + $status = $tw->destroyStatus($id); + $errorMSG = empty($status->error) ? "0" : $status->error; + $status_id = ""; + if ($errorMSG == "0") { + $status_id = $status->id; + } + + header('Content-Type: text/xml; charset=UTF-8'); + $result = ''; + $result .= '' . $errorMSG . ''; + $result .= '' . $status_id . ''; + $result .= ''; + echo $result; + flush(); + } + } +} + +function getTwitterNewMessage($target) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $menu = (isset($_POST['menu']) && !empty($_POST['menu'])) ? $_POST['menu'] : ""; + $text = (isset($_POST['text']) && !empty($_POST['text'])) ? $_POST['text'] : ""; + $user = (isset($_POST['user']) && !empty($_POST['user'])) ? $_POST['user'] : ""; + + $result = ''; + if (!empty($data['username']) && !empty($data['password'])) { + if (!empty($text)) { + $updatedHtml = ""; + $tw = new Twitter($data['username'], $data['password']); + $message = $tw->newMessage($user, $text); + $errorMSG = empty($message->error) ? "0" : $message->error; + $message_id = ""; + $messageHtml = ""; + if ($errorMSG == "0") { + $message_id = $message->id; + $message_text = $message->text; + $message_convert = getTextBodyConvert($message_text); + $published = getTwitterDateConvert($message->created_at); + + $sender_id = $message->sender->id; + $sender_name = $message->sender->name; + $sender_screen_name = $message->sender->screen_name; + $sender_link = "https://twitter.com/{$sender_screen_name}"; + $sender_profile_image = $message->sender->profile_image_url; + + $recipient_id = $message->recipient->id; + $recipient_name = $message->recipient->name; + $recipient_screen_name = $message->recipient->screen_name; + $recipient_link = "https://twitter.com/{$recipient_screen_name}"; + $recipient_profile_image = $message->recipient->profile_image_url; + + if ($menu == "direct" || $menu == "followers") { + $metaActionHtml .= ''; + } + if (($data['username'] == $sender_screen_name) || $menu == "direct") { + $metaActionHtml .= ''; + } + + $messageHtml .= '
  • '.CRLF; + $messageHtml .= '
    '.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' ' . $recipient_name . ''.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= '
    '.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' ' . $recipient_screen_name . ''.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' ' . $message_convert . ''.CRLF; + $messageHtml .= '
    '.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' ' . $published . ''.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' '.CRLF; + $messageHtml .= ' ' . $metaActionHtml .CRLF;; + $messageHtml .= ' '.CRLF; + $messageHtml .= '
    '.CRLF; + $messageHtml .= '
    '.CRLF; + $messageHtml .= '
    '.CRLF; + $messageHtml .= '
  • '.CRLF; + } + + header('Content-Type: text/xml; charset=UTF-8'); + $result = ''; + $result .= '' . $errorMSG . ''; + $result .= '' . $message_id . ''; + $result .= ''; + $result .= ''; + echo $result; + flush(); + } + } +} + +function getTwitterDestroyMessage($target) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $id = (isset($_POST['id']) && !empty($_POST['id'])) ? $_POST['id'] : ""; + + $result = ''; + if (!empty($data['username']) && !empty($data['password'])) { + if (!empty($id)) { + $updatedHtml = ""; + $tw = new Twitter($data['username'], $data['password']); + $message = $tw->destroyMessage($id); + $errorMSG = empty($message->error) ? "0" : $message->error; + $message_id = ""; + $messageHtml = ""; + if ($errorMSG == "0") { + $message_id = $message->id; + } + + header('Content-Type: text/xml; charset=UTF-8'); + $result = ''; + $result .= '' . $errorMSG . ''; + $result .= '' . $message_id . ''; + $result .= ''; + echo $result; + flush(); + } + } +} + +function getTwitterCreateFriendship($target) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $menu = (isset($_POST['menu']) && !empty($_POST['menu'])) ? $_POST['menu'] : ""; + $user_id = (isset($_POST['user_id']) && !empty($_POST['user_id'])) ? $_POST['user_id'] : ""; + + $result = ''; + if (!empty($data['username']) && !empty($data['password'])) { + if (!empty($user_id)) { + $tw = new Twitter($data['username'], $data['password']); + $friendship = $tw->createFriendship($user_id); + $errorMSG = empty($friendship->error) ? "0" : $friendship->error; + $friendshipID = ""; + if ($errorMSG == "0") { + $friendshipID = $friendship->id; + $following = $friendship->following; + $user_screen_name = $friendship->screen_name; + } + + header('Content-Type: text/xml; charset=UTF-8'); + $result = ''; + $result .= '' . $errorMSG . ''; + $result .= '' . $friendshipID . ''; + $result .= '' . $following . ''; + $result .= ''; + $result .= ''; + echo $result; + flush(); + } + } +} + +function getTwitterDestroyFriendship($target) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + $menu = (isset($_POST['menu']) && !empty($_POST['menu'])) ? $_POST['menu'] : ""; + $user_id = (isset($_POST['user_id']) && !empty($_POST['user_id'])) ? $_POST['user_id'] : ""; + + $result = ''; + if (!empty($data['username']) && !empty($data['password'])) { + if (!empty($user_id)) { + $updatedHtml = ""; + $tw = new Twitter($data['username'], $data['password']); + $friendship = $tw->destroyFriendship($user_id); + $errorMSG = empty($friendship->error) ? "0" : $friendship->error; + $friendshipID = ""; + if ($errorMSG == "0") { + $friendshipID = $friendship->id; + $following = $friendship->following; + $user_screen_name = $friendship->screen_name; + } + + header('Content-Type: text/xml; charset=UTF-8'); + $result = ''; + $result .= '' . $errorMSG . ''; + $result .= '' . $friendshipID . ''; + $result .= '' . $following . ''; + $result .= ''; + $result .= ''; + echo $result; + flush(); + } + } +} + + +// Twitter update (Admin->center->dashboard->Twitter update widget) +function CT_Twitter_updating($target){ + global $service, $pluginURL, $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + $twFlagCHK = ""; + $twFlagMSG = ""; + if(empty($data['username']) || empty($data['password'])){ + $twFlagCHK = "disabled"; + $twFlagMSG = " * 트위터 사용자 정보를 설정해야 합니다.\n * 아이디와 비밀번호를 입력하세요.\n"; + } + ob_start(); +?> + + + + +
    +
    + + +
    +
    + class="shortenLink" style="" /> + class="shortenURLCreate tw_button" /> +
    +
    + 140자 남음  + class="update_button_mini tw_button" /> +
    +
    +
    +' . $resultShortenURL['error'] . ''; + flush(); +} + +function getUpdatingNewPostToTwitter($target, $mother) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + $blogid = getBlogId(); + if (!empty($data['username']) && !empty($data['password']) && $data['twitterUpdate'] == "public_synd") { + if ($data['updateText'] == 'title') { + $content = getTwitterContent($blogid, $target, 'title'); + } else { + $content = getTwitterContent($blogid, $target, 'content'); + } + if (in_array($content['visibility'], array("2", "3"))) { + $tw = new Twitter($data['username'], $data['password']); + $updated = $tw->updateStatus($content['body']); + } + } + return $target; +} + +function getUpdatingNewLineToTwitter($target, $mother) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + if (!empty($data['username']) && !empty($data['password'])) { + $content = UTF8::lessenAsEncoding($mother->content,140); + $tw = new Twitter($data['username'], $data['password']); + $updated = $tw->updateStatus($content); + } + return $target; +} + +function getUpdatingNewPostToTwitterSynd($target, $mother) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + $blogid = getBlogId(); + if (!empty($data['username']) && !empty($data['password']) && $data['twitterUpdate'] == "syndicate") { + if ($data['updateText'] == 'title') { + $content = getTwitterContent($blogid, $target, 'title'); + } else { + $content = getTwitterContent($blogid, $target, 'content'); + } + if (in_array($content['visibility'], array("2", "3"))) { + $tw = new Twitter($data['username'], $data['password']); + $updated = $tw->updateStatus($content['body']); + } + } + return $target; +} + +function getTwitterContent($blogid, $entryId, $updateText='title') { + global $blog, $service, $defaultURL, $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + $content = array(); + $tempContentTags = ""; + $entry = getEntry($blogid, $entryId); + $tempPermalink = $defaultURL . ($blog['useSloganOnPost'] ? "/entry/" . URL::encode($entry['slogan'], $service['useEncodedURL']) : "/" . $entry['id']); + $resultShortenURL = getTwitterBitlyShortenURL($tempPermalink); + $tempContentTags = $data['hashTag'] == "1" ? $data['hashTags'] : ""; + $tempContentTags .= " - " . ($resultShortenURL['error'] == "0" ? $resultShortenURL['shortUrl'] : $tempPermalink); + + $tempContentLimit = 140 - (strlen($tempContentTags) + 5); + if ($updateText == 'title') { + $tempContent = UTF8::lessenAsEncoding($entry['title'], $tempContentLimit, '...'); + } else { + $tempContent = UTF8::lessenAsEncoding(stripHTML(getEntryContentView($blogid, $entry['id'], $entry['content'], $entry['contentFormatter'])), $tempContentLimit, '...'); + } + + $content['body'] = $tempContent . " " . $tempContentTags; + $content['visibility'] = $entry['visibility']; + return $content; +} + +function getTwitterBitlyShortenURL($longURL) { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + + $result = array(); + if (!empty($longURL)) { + $tw = new Twitter($data['username'], $data['password']); + $params = array(); + $params['login'] = "textcube"; //It's key for plugin. It does not change.(by jparker2.0@gmail.com) + $params['apiKey'] = "R_fcfc2c0c70d30aca174fa771c415d2cb"; //It's key for plugin. It does not change.(by jparker2.0@gmail.com) + $params['longUrl'] = $longURL; + $shorten = $tw->bitShortenURL($params, 'xml'); + $resultError = $shorten->results->nodeKeyVal->errorCode; + $result['error'] = empty($resultError) ? $shorten->errorCode : $resultError; + if ($result['error'] == "0") { + $result['shortUrl'] = $shorten->results->nodeKeyVal->shortUrl; + } + } + return $result; +} + +function getCurrentBlogVersion() { + $currentVersion = file_get_contents(ROOT . '/cache/CHECKUP'); + $currentVersion = substr($currentVersion, 0, 3); + return $currentVersion; +} + +function getJQueryCheckLoad($target) { + global $pluginURL; + if (getCurrentBlogVersion() < 1.8) { + $target .= ''.CRLF; + $target .= ''.CRLF; + } + return $target; +} + +function getTwitterInitConfigVal(&$data) { + $data['username'] = isset($data['username']) && !empty($data['username']) ? $data['username'] : ""; + $data['password'] = isset($data['password']) && !empty($data['password']) ? $data['password'] : ""; + $data['hashTag'] = isset($data['hashTag']) && !empty($data['hashTag']) ? $data['hashTag'] : ""; + $data['hashTags'] = isset($data['hashTags']) && !empty($data['hashTags']) ? $data['hashTags'] : ""; + $data['twitterUpdate'] = isset($data['twitterUpdate']) && !empty($data['twitterUpdate']) ? $data['twitterUpdate'] : "none"; + $data['updateText'] = isset($data['updateText']) && !empty($data['updateText']) ? $data['updateText'] : "title"; + $data['listLength'] = isset($data['listLength']) && !empty($data['listLength']) ? $data['listLength'] : "10"; + $data['synchronizeLine'] = isset($data['synchronizeLine']) && !empty($data['synchronizeLine']) ? $data['synchronizeLine'] : false; +} + +function getTwitterDataSet($DATA) { + $cfg = Setting::fetchConfigVal($DATA); + $tw = new Twitter($cfg['username'], $cfg['password']); + $res = $tw->getUserTimeline(); + if (!empty($res->error)) { + return "::Authentication error::\n\n Username && Password requires authentication. \n (" . $res->error . ")"; + } + + return true; +} + +/************************/ +// Synchronizing twitter +function synchronizeTwitterWithLine() { + global $configVal; + $data = Setting::fetchConfigVal($configVal); + getTwitterInitConfigVal($data); + if(empty($data['synchronizeLine'])) return false; + + $page = 1; + $tw = new Twitter($data['username'], $data['password']); + $limit = 0; + + $option = array('page'=>$page, 'count'=>40); + + $timeline = $tw->getUserTimeline($option); + $timelineResults = $timeline; + + $line = Model_Line::getInstance(); + + foreach ($timelineResults as $status) { + $status_id = $status->id; + $user_id = $status->user->id; + $user_name = $status->user->name; + $user_screen_name = $status->user->screen_name; + $user_link = "https://twitter.com/{$user_screen_name}"; + $text = $status->text; + $text_convert = getTextBodyConvert($text); + $source = getTextLinkConvert($status->source); + $published = getTwitterDateConvert($status->created_at); + $published_link = "https://twitter.com/{$user_screen_name}/status/{$status_id}"; + + $line->reset(); + $line->setFilter(array('root','equals','Twitter',true)); + $line->setFilter(array('content','equals',$text_convert,true)); + $line->setFilter(array('created','>',Timestamp::getUNIXtime() - 3600)); + $line->setLimit(1); + if(!$line->get('id')) { + $line->reset(); + $line->created = strtotime($status->created_at); + $line->content = $text_convert; + $line->author = $user_name; + $line->permalink = $published_link; + $line->root = 'Twitter'; + $line->category = 'public'; + $line->add(); + } + } + $cache = pageCache::getInstance(); + $cache->name = 'linesATOM'; + $cache->purge(); + $cache->reset(); + $cache->name = 'linesRSS'; + $cache->purge(); + flush(); +} +?> diff --git a/plugins/JP_TC_PluginForTwitter/index.xml b/plugins/JP_TC_PluginForTwitter/index.xml index 5f74818d1..d24adc4a3 100644 --- a/plugins/JP_TC_PluginForTwitter/index.xml +++ b/plugins/JP_TC_PluginForTwitter/index.xml @@ -5,7 +5,7 @@ http://create74.com/ - 1.9.0716 + 1.10.0221 GPL @@ -36,8 +36,12 @@ getUpdatingNewLineToTwitter getUpdatingNewPostToTwitter getUpdatingNewPostToTwitterSynd - getJQueryCheckLoad - + getUpdatingNewPostToTwitterSynd + + + + + center @@ -96,6 +100,11 @@ * 단, 'following', 'followers' 목록 제외]]> +
    + + + +
    diff --git a/resources/script/EAF4.js b/resources/script/EAF4.js index 01ecc613f..d56d3714d 100644 --- a/resources/script/EAF4.js +++ b/resources/script/EAF4.js @@ -105,7 +105,7 @@ Standardizer.prototype.querySelector = function(selector) { if (typeof(selector) != 'string') return null; return jQuery(selector)[0]; - // NOTE: Possilbe side-effect: + // NOTE: Possible side-effect: // If you pass a html string as selector, jQuery function will return a new extended DOM node. } @@ -115,7 +115,7 @@ Standardizer.prototype.querySelectorAll = function(selector) { if (typeof(selector) != 'string') return null; return jQuery(selector); - // NOTE: Possilbe side-effect: + // NOTE: Possible side-effect: // If you pass a html string as selector, jQuery function will return a new extended DOM node. } diff --git a/resources/script/common2.js b/resources/script/common2.js index 2be9ccc66..8c080fd1e 100644 --- a/resources/script/common2.js +++ b/resources/script/common2.js @@ -1234,15 +1234,14 @@ function recallLastComment(caller,entryId) { } } -function loadComment(entryId, page) { - +function loadComment(entryId, page, force) { var request = new HTTPRequest("POST", blogURL + '/comment/load/' + entryId); var o = document.getElementById("entry" + entryId + "Comment"); - if (o.style.display == 'none') { + if ((!force && o.style.display == 'none') || force) { request.onSuccess = function () { PM.removeRequest(this); o.innerHTML = this.getText("/response/commentBlock"); - window.location.href = '#entry' + entryId + 'Comment'; +// window.location.href = '#entry' + entryId + 'Comment'; }; request.onError = function() { PM.removeRequest(this); @@ -1251,7 +1250,8 @@ function loadComment(entryId, page) { PM.addRequest(request,"Loading Comments..."); request.send('&page='+page); } - o.style.display = (o.style.display == 'none') ? 'block' : 'none'; + if (!force) + o.style.display = (o.style.display == 'none') ? 'block' : 'none'; } diff --git a/resources/script/editor3.js b/resources/script/editor3.js index 505876e1a..2392343f3 100644 --- a/resources/script/editor3.js +++ b/resources/script/editor3.js @@ -12,31 +12,25 @@ var TTEditorResizer = function(target, resizer, documents) { }; TTEditorResizer.prototype.initialize = function() { - var _this = this; - var docEventHandler = function(event) { _this.docEventHandler(event); }; - this.docEventHandler_bounded = docEventHandler; // keep it to remove the handler later - + var docEventHandler = jQuery.proxy(this.docEventHandler, this); for (var i = 0, doc; doc = this.documents[i]; ++i) { STD.addEventListener(doc); - doc.addEventListener("mousemove", docEventHandler, false); - doc.addEventListener("mousedown", docEventHandler, false); - doc.addEventListener("mouseup", docEventHandler, false); - doc.addEventListener("selectstart", docEventHandler, false); + jQuery(doc).bind({ + 'mousemove.doc': docEventHandler, + 'mousedown.doc': docEventHandler, + 'mouseup.doc': docEventHandler, + 'selectstart.doc': docEventHandler + }); } }; TTEditorResizer.prototype.finalize = function() { for (var i = 0, doc; doc = this.documents[i]; ++i) { - doc.removeEventListener("mousemove", this.docEventHandler_bounded, false); - doc.removeEventListener("mousedown", this.docEventHandler_bounded, false); - doc.removeEventListener("mouseup", this.docEventHandler_bounded, false); - doc.removeEventListener("selectstart", this.docEventHandler_bounded, false); + jQuery(doc).unbind('.doc'); } }; TTEditorResizer.prototype.docEventHandler = function(event) { - if (STD.isIE) event.target = event.srcElement; - switch (event.type) { case "mousemove": if (this.rowResizeDown) { diff --git a/skin/admin/canon/basic.css b/skin/admin/canon/basic.css index dab9c4e1c..791e4b2fa 100644 --- a/skin/admin/canon/basic.css +++ b/skin/admin/canon/basic.css @@ -222,6 +222,9 @@ textarea background-image : url("./image/bg_menu_round.png"); background-position : left center; z-index : 220; +/* box-shadow : -2px 2px 5px #ccc; + -webkit-box-shadow : -2px 2px 5px #ccc; + -moz-box-shadow : -2px 2px 5px #ccc;*/ } #main-action li @@ -326,6 +329,9 @@ textarea position : fixed; top : 0; z-index : 200; + box-shadow : 2px 2px 5px #ccc; + -webkit-box-shadow : 2px 2px 5px #ccc; + -moz-box-shadow : 2px 2px 5px #ccc; } #main-menu diff --git a/skin/admin/mobile/basic.css b/skin/admin/mobile/basic.css index 59300b1d9..5d5f49ed6 100644 --- a/skin/admin/mobile/basic.css +++ b/skin/admin/mobile/basic.css @@ -326,7 +326,7 @@ textarea background-image : url("./image/img_menu_post.png") !important; } #main-menu #menu-entry .divider, -#main-menu #menu-entry #sub-menu-entry, +/*#main-menu #menu-entry #sub-menu-entry,*/ #main-menu #menu-entry #sub-menu-line, #main-menu #menu-entry #sub-menu-category, #main-menu #menu-entry #sub-menu-tag @@ -744,8 +744,8 @@ table.data-inbox tr .selection .data-subbox { position : relative; - padding:0 !important; - margin:0 !important; + padding : 0 !important; + margin : 0 !important; } #change-section, @@ -777,7 +777,7 @@ table.data-inbox tr .selection background-color : #FFFFFF; margin : 20px 0 40px 0; text-align : center; - width : 940px; + width : 100%; } #page-navigation span .selected @@ -791,10 +791,9 @@ table.data-inbox tr .selection margin-bottom : 5px; } -#page-list a -{ - color : #999999; - padding : 0 1px; +#page-list a { + padding : 4px; + border : 1px solid #CCC; } #total-count diff --git a/skin/admin/mobile/image/icon_delete.gif b/skin/admin/mobile/image/icon_delete.gif new file mode 100644 index 000000000..7f666e156 Binary files /dev/null and b/skin/admin/mobile/image/icon_delete.gif differ diff --git a/skin/admin/mobile/image/icon_private.gif b/skin/admin/mobile/image/icon_private.gif new file mode 100644 index 000000000..9f883419f Binary files /dev/null and b/skin/admin/mobile/image/icon_private.gif differ diff --git a/skin/admin/mobile/image/icon_protected.gif b/skin/admin/mobile/image/icon_protected.gif new file mode 100644 index 000000000..a717a7425 Binary files /dev/null and b/skin/admin/mobile/image/icon_protected.gif differ diff --git a/skin/admin/mobile/image/icon_public.gif b/skin/admin/mobile/image/icon_public.gif new file mode 100644 index 000000000..cb01da0f9 Binary files /dev/null and b/skin/admin/mobile/image/icon_public.gif differ diff --git a/skin/admin/mobile/image/icon_syndicated.gif b/skin/admin/mobile/image/icon_syndicated.gif new file mode 100644 index 000000000..d86cf637b Binary files /dev/null and b/skin/admin/mobile/image/icon_syndicated.gif differ diff --git a/skin/admin/mobile/image/icon_trackback.gif b/skin/admin/mobile/image/icon_trackback.gif new file mode 100644 index 000000000..b4dd64d2a Binary files /dev/null and b/skin/admin/mobile/image/icon_trackback.gif differ diff --git a/skin/admin/mobile/image/icon_trackback_off.gif b/skin/admin/mobile/image/icon_trackback_off.gif new file mode 100644 index 000000000..42001af66 Binary files /dev/null and b/skin/admin/mobile/image/icon_trackback_off.gif differ diff --git a/skin/admin/mobile/image/img_close_x.png b/skin/admin/mobile/image/img_close_x.png new file mode 100644 index 000000000..34b2671cb Binary files /dev/null and b/skin/admin/mobile/image/img_close_x.png differ diff --git a/skin/admin/mobile/post.css b/skin/admin/mobile/post.css new file mode 100644 index 000000000..d17fd1243 --- /dev/null +++ b/skin/admin/mobile/post.css @@ -0,0 +1,634 @@ +@charset "utf-8"; + +/* Common *****************************************************************************************/ + +#sub-menu-post +{ + background-image : none !important; +} +table.data-inbox th, +table.data-inbox tr .date, +table.data-inbox tr .category, +table.data-inbox tr .response, +table.data-inbox tr .name, +table.data-inbox tr .author, +table.data-inbox tr .site, +#change-section-top, +#data-description, +#page-section .page-count +{ + display : none; +} + +/* table header */ +table.data-inbox tr .title +{ + width:300px !important; +} + +/* table body */ + + +/* Post *******************************************************************************************/ +#part-editor h2 +{ + display : none; +} + +#entry-tabs-box li +{ + height:20px; +} + +#entry-tabs-box li label +{ + display : none; +} +#entry-tabs-box li.entry-all, +#entry-tabs-box li.entry-post, +#entry-tabs-box li.entry-template +{ + display : none; +} + +#category +{ + margin : 0 10px; +} + +#change-section-bottom +{ + background-color : #EEEEEE; + border-top : 1px solid #BBBBBB; + margin : 0 0 5px 0; + padding-top : 8px; + padding-bottom : 8px; + width : 100%; +} +#allCheckedTop, +#allCheckedBottom +{ + margin-left : 7px; +} +#part-post-list h2.caption +{ + display : none; + margin-bottom : 1.6em; +} + + +/* table header */ +#part-post-list table.data-inbox tr .status +{ + width : 13px; +} + +#part-post-list table.data-inbox tr .syndicate +{ + width : 13px; +} + +#part-post-list table.data-inbox tr .protect +{ + padding-right : 0; + width : 37px; +} + +#part-post-list table.data-inbox tr .trackback +{ + padding-right : 3px; +} + +#part-post-list table.data-inbox thead tr th.starred, +#part-post-list table.data-inbox thead tr th.trackback, +#part-post-list table.data-inbox thead tr th.delete +{ + width : 22px; +} + +#part-post-list table.data-inbox thead tr th.starred span, +#part-post-list table.data-inbox thead tr th.syndicate span, +#part-post-list table.data-inbox thead tr th.protect span, +#part-post-list table.data-inbox thead tr th.trackback span, +#part-post-list table.data-inbox thead tr th.delete span +{ + display : none; +} + +#part-post-list table.data-inbox thead tr th.title +{ + text-align : center; +} + +#part-post-list table.data-inbox tr .delete +{ + padding-right : 5px; +} + +/* table body */ + +#part-post-list table.data-inbox tbody tr td.status +{ + padding-right : 2px; +} + +#part-post-list table.data-inbox tbody tr td.title +{ + overflow : hidden; +} + +#part-post-list table.data-inbox tbody tr td.title span.description +{ + color : #CCC; +} + +#part-post-list table.data-inbox tbody tr td.category a.uncategorized, +#part-post-list table.data-inbox tbody tr.keyword-line td.category a, +#part-post-list table.data-inbox tbody tr.notice-line td.category a +{ + color : #BCBCBC; +} + +#part-post-list table.data-inbox tbody tr td.trackback, +#part-post-list table.data-inbox tbody tr td.delete +{ + background-position : right bottom; + padding-left : 0; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td +{ + background-image : none; + border : 1px solid #EEE; + padding : 10px; + text-align : right; +} + +.hidden-layer table tr td +{ + border : none !important; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td label +{ + font-weight : bold; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td .input-button +{ + padding : 0 3px !important; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td .close-button +{ + background-image : url("./image/img_close_x.png"); + background-position : left center; + display : none; + background-repeat : no-repeat; + height : 11px; + padding-left : 1px; + width : 39px; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td .close-button span +{ + display : none; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td table +{ + margin-top : 5px; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td table tr td +{ + border-bottom : 1px solid #DDDDDD !important; + font-size : 0.9em; + font-family : "Courier New", "Courier", monospace; + height : auto !important; + letter-spacing : -1px; + line-height : normal !important; + padding : 2px 5px !important; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td table tr td.address +{ + padding-left : 15px !important; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td table tr td.remove a +{ + background-image : url("./image/img_close_x.png"); + background-position : left top; + background-repeat : no-repeat; + display : block; + height : 11px; + margin-top : 2px; + width : 11px; +} + +#part-post-list table.data-inbox tbody tr.hidden-layer td table tr td.remove span +{ + display : none; +} + +/* Line *******************************************************************************************/ + +#part-post-line #line-content-box +{ + margin-top : 10px; + margin-bottom : 25px; +} + +#line-write-form #line-write +{ + width : 80%; + margin-left : 15px; +} + +#line-write-form .input-button +{ + width : 100px; +} + +#line-content dl +{ + border : 1px solid #eee; + border-radius : 6px; + -moz-border-radius : 6px; + -webkit-border-radius : 6px; + margin : 10px; + height : 48px; +} + +#line-content dl dt +{ + margin : 10px; +} + +#line-content dd.content +{ + margin-top : 10px; + width : 80%; + line-height : 130%; +} + +#line-content dd.delete +{ + background-image : url("./image/icon_delete.gif"); + background-position : left bottom; + width : 12px !important; + height : 12px !important; + margin : 0; + padding : 0 !important; + position : absolute; + top : 15px; + right : 15px; + border : 0; +} + +#line-content dd.delete span +{ + display : none; +} +#line-more-page .more-button +{ + width : 100% !important; + display : block; + border-radius : 6px; + -moz-border-radius : 6px; + -webkit-border-radius : 6px; +} + +/* icons in table.data-inbox */ + +table.data-inbox tbody tr .starred .star-icon +{ + background-image : url("./image/icon_starred.gif"); + background-position : left bottom; + background-repeat : no-repeat; + display : block; + height : 16px; + margin-right : 2px; + width : 16px; +} + +table.data-inbox tbody tr .starred .unstar-icon +{ + background-image : url("./image/icon_unstarred.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + height : 16px; + margin-right : 2px; + width : 16px; +} + +table.data-inbox tbody tr .starred .star-icon a +{ + background-image : url("./image/icon_starred.gif"); + background-position : left bottom; + background-repeat : no-repeat; + display : block; + height : 16px; + width : 16px; +} + +table.data-inbox tbody tr .starred .unstar-icon a +{ + background-image : url("./image/icon_unstarred.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + height : 16px; + width : 16px; +} + +table.data-inbox tbody tr .status .private-on-icon +{ + background-image : url("./image/icon_private.gif"); + background-position : left bottom; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + margin-right : 2px; + width : 15px; +} + +table.data-inbox tbody tr .status .private-off-icon +{ + background-image : url("./image/icon_private.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + margin-right : 2px; + width : 15px; +} + +table.data-inbox tbody tr .status .private-off-icon a +{ + background-image : url("./image/icon_private.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + width : 15px; +} + +table.data-inbox tbody tr .status .private-on-icon span, +table.data-inbox tbody tr .status .private-off-icon span +{ + display : none; +} + +table.data-inbox tbody tr .status .protected-on-icon +{ + background-image : url("./image/icon_protected.gif"); + background-position : left bottom; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + margin-right : 2px; + width : 15px; +} + +table.data-inbox tbody tr .status .protected-off-icon +{ + background-image : url("./image/icon_protected.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + margin-right : 2px; + width : 15px; +} + +table.data-inbox tbody tr .status .protected-off-icon a +{ + background-image : url("./image/icon_protected.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + width : 15px; +} + +table.data-inbox tbody tr .status .protected-on-icon a +{ + background-image : url("./image/icon_protected.gif"); + background-position : left bottom; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + width : 15px; +} +table.data-inbox tbody tr .status .protected-on-icon span, +table.data-inbox tbody tr .status .protected-off-icon span +{ + display : none; +} + +table.data-inbox tbody tr.keyword-line .status .protected-off-icon, +table.data-inbox tbody tr.notice-line .status .protected-off-icon +{ + background-image : none; +} + +table.data-inbox tbody tr.keyword-line .status .protected-off-icon a, +table.data-inbox tbody tr.notice-line .status .protected-off-icon a +{ + display : none; +} + +table.data-inbox tbody tr.keyword-line .syndicate .syndicated-off-icon a, +table.data-inbox tbody tr.notice-line .syndicate .syndicated-off-icon a +{ + display : none; +} + +table.data-inbox tbody tr .status .public-on-icon +{ + background-image : url("./image/icon_public.gif"); + background-position : left bottom; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + margin-right : 2px; + width : 15px; +} + +table.data-inbox tbody tr .status .public-off-icon +{ + background-image : url("./image/icon_public.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + float : left; + height : 15px; + margin-right : 2px; + width : 15px; +} + +table.data-inbox tbody tr .status .public-off-icon a +{ + background-image : url("./image/icon_public.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + height : 15px; + width : 15px; +} + +table.data-inbox tbody tr .status .public-on-icon span, +table.data-inbox tbody tr .status .public-off-icon span +{ + display : none; +} + +table.data-inbox tbody tr .starred .star-icon span, +table.data-inbox tbody tr .starred .unstar-icon span +{ + display : none; +} + +table.data-inbox tbody tr .syndicate .syndicated-on-icon +{ + background-image : url("./image/icon_syndicated.gif"); + background-position : left bottom; + background-repeat : no-repeat; + display : block; + height : 16px; + width : 16px; +} + +table.data-inbox tbody tr .syndicate .syndicated-off-icon +{ + background-image : url("./image/icon_syndicated.gif"); + background-position : left top; + background-repeat : no-repeat; + display : block; + height : 16px; + width : 16px; +} + +table.data-inbox tbody tr .syndicate .syndicated-off-icon a, +table.data-inbox tbody tr .syndicate .syndicated-on-icon a +{ + display : block; + height : 16px; + width : 16px; +} + +table.data-inbox tbody tr .syndicate .syndicated-off-icon span, +table.data-inbox tbody tr .syndicate .syndicated-on-icon span +{ + display : none; +} + +table.data-inbox tbody tr .protect .protect-on-button +{ + background-color : transparent; + background-image : url("./image/icon_protectedsetting.gif"); + background-position : left bottom; + display : block; + height : 13px; + margin : 0 auto; + padding : 0; + width : 26px; +} + +table.data-inbox tbody tr .protect .protect-off-button +{ + background-color : transparent; + background-image : url("./image/icon_protectedsetting.gif"); + background-position : left top; + display : block; + height : 13px; + margin : 0 auto; + padding : 0; + width : 26px; +} + +table.data-inbox tbody tr .protect .protect-on-button span, +table.data-inbox tbody tr .protect .protect-off-button span +{ + display : none; +} + +table.data-inbox tbody tr .trackback .trackback-on-button +{ + background-image : url("./image/icon_trackback.gif"); + background-position : left top; + display : block; + height : 20px; + margin : 0 auto; + padding : 0; + width : 20px; +} + +table.data-inbox tbody tr .trackback .trackback-off-button +{ + background-image : url("./image/icon_trackback_off.gif"); + background-position : left top; + display : block; + height : 20px; + margin : 0 auto; + padding : 0; + width : 20px; +} + +table.data-inbox tbody tr .trackback .trackback-on-button span, +table.data-inbox tbody tr .trackback .trackback-off-button span +{ + display : none; +} + +table.data-inbox tbody tr .delete .delete-button +{ + background-color : transparent; + background-image : url("./image/icon_delete.gif"); + background-position : left top; + display : block; + height : 11px; + margin : 0 auto; + padding : 0; + width : 11px; +} + +table.data-inbox tbody tr .delete .delete-button span +{ + display : none; +} + +table.data-inbox tbody tr td .block-icon span, +table.data-inbox tbody tr td .unblock-icon span +{ + display : none; +} + +/* special columns in table.data-inbox */ +table.data-inbox tbody tr .category, +table.data-inbox tbody tr .title +{ + text-align : left; +} + +/* rollover in table.data-inbox */ +table.data-inbox tbody tr td.rollover-class +{ + background-color : #EEEEEE; +} + +table.data-inbox tbody tr td.inactive-class +{ + background-color : transparent; +} \ No newline at end of file diff --git a/skin/blog/coolant/skin.html b/skin/blog/coolant/skin.html index 318295a10..16dd230aa 100644 --- a/skin/blog/coolant/skin.html +++ b/skin/blog/coolant/skin.html @@ -109,6 +109,8 @@

    Lines
    [##_line_rep_regdate_##]
    [##_line_rep_content_##] +
    [##_line_rep_author_##] +
    [##_line_rep_source_##]