Skip to content

Commit

Permalink
refs #514 : Merged from 1.9 tree to 2.0 tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
inureyes committed Feb 24, 2012
1 parent 498e8ff commit dd16e5e
Show file tree
Hide file tree
Showing 24 changed files with 560 additions and 1,177 deletions.
4 changes: 2 additions & 2 deletions framework/id/textcube/config.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
define( "XPATH_LIBRARY_ROOT", ROOT . "/library/contrib/phpxpath/" );
define( "Auth_OpenID_NO_MATH_SUPPORT", 1 );
define( "OPENID_PASSWORD", "-OPENID-" );
define('JQUERY_VERSION','1.5.1');
define('JQUERYMOBILE_VERSION','1.0rc1');
define('JQUERY_VERSION','1.6.4.min');
define('JQUERYMOBILE_VERSION','1.0.1.min');

// Define global variable for legacy support.
// This settings are set to default for configuration.
Expand Down
8 changes: 8 additions & 0 deletions framework/utils/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static function getInstance() {

function __construct() {
$this->browserName = null;
$this->machineName = null;
}

public function getBrowserName() {
Expand Down Expand Up @@ -74,10 +75,17 @@ public function isMobile() {
return (in_array($this->getBrowserName(),array('MobileSafari','Android','Maemo','OperaMini','Minimo','DoCoMo','AvantGo','BlockBerry')));
}
public function isSafari() {
return (in_array($this->getBrowserName(),array('Safari','MobileSafari')) ? true : false);
}
public function isIE() {
return ($this->getBrowserName() == 'IE' ? true : false);
}
public function isChrome() {
return ($this->getBrowserName() == 'Chrome' ? true : false);
}

public function isOpera() {
return ($this->getBrowserName() == 'Opera' ? true : false);
}

function __destruct() {
Expand Down
30 changes: 9 additions & 21 deletions interface/i/archive/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
define('__TEXTCUBE_IPHONE__', true);
require ROOT . '/library/preprocessor.php';
requireView('iphoneView');
if (false) {
fetchConfigVal();
}
$context = Model_Context::getInstance();
printMobileHTMLHeader();
printMobileHTMLMenu();
if(!empty($suri['id'])) $period = $suri['id'];
else $period = Timestamp::getYearMonth();

Expand All @@ -17,9 +17,9 @@
$list = array('title' => getPeriodLabel($period), 'items' => $listWithPaging[0], 'count' => $listWithPaging[1]['total']);
$paging = $listWithPaging[1];
?>
<ul class="posts" id="archive_<?php echo $suri['page'];?>" title="<?php echo getPeriodLabel($period);?>" selected="false">
<ul data-role="listview" class="posts" id="archive_<?php echo $suri['page'];?>" title="<?php echo getPeriodLabel($period);?>" selected="false">
<?php
$itemsView = '<li class="group">'.CRLF;
$itemsView = '<li class="group ui-bar ui-bar-e">'.CRLF;
$itemsView .= ' <span class="left">' . getPeriodLabel($period) . ' ('.$list['count'].')</span>'.CRLF;
$itemsView .= ' <span class="right">Page <span class="now_page">' . $paging['page'] . '</span> / '.$paging['pages'].'</span>'.CRLF;
$itemsView .= '</li>'.CRLF;
Expand All @@ -35,26 +35,14 @@
$itemsView .= ' <a href="' . $context->getProperty('uri.blog') . '/entry/' . $item['id'] . '" class="link">'.CRLF;
$itemsView .= ' <div class="post">'.CRLF;
$itemsView .= ' <span class="title">' . fireEvent('ViewListTitle', htmlspecialchars($item['title'])) . '</span>'.CRLF;
$itemsView .= ' <span class="description">' . Timestamp::format5($item['published']) . ', ' . 'Comments(' . ($item['comments'] > 0 ? $item['comments'] : 0) . ')' . '</span>'.CRLF;
$itemsView .= ' <span class="description">' . Timestamp::format5($item['published']) . ', ' ._text('댓글'). '(' . ($item['comments'] > 0 ? $item['comments'] : 0) . ')' . '</span>'.CRLF;
$itemsView .= ' </div>'.CRLF;
$itemsView .= ' </a>'.CRLF;
$itemsView .= '</li>'.CRLF;
}

$itemsView .= '<li class="pagination">'.CRLF;
if(isset($paging['prev'])){
$itemsView .= '<a href="' .$context->getProperty('uri.blog') . '/archive/' . $period . '?page=' . $paging['prev'] . '" class="previous">'._textf('%1 페이지',$paging['prev']) . '</a>'.CRLF;
}
if (isset($paging['next'])) {
$itemsView .= '<a href="' .$context->getProperty('uri.blog') . '/archive/' . $period . '?page=' . $paging['next'] . '" class="next">'._textf('%1 페이지',$paging['next']) . '</a>'.CRLF;
}
if ($suri['page'] > 1 && $suri['page'] != $paging['pages']) {
$itemsView .= '<strong>' . $suri['page'] . '</strong>'.CRLF;
}
$itemsView .= '</li>'.CRLF;
$itemsView .= '</ul>'.CRLF;
print $itemsView;
?>
</ul>
<?php
print printMobileListNavigation($paging,'archive/',$period);
printMobileHTMLFooter();
}
?>
8 changes: 3 additions & 5 deletions interface/i/category/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
define('__TEXTCUBE_IPHONE__', true);
require ROOT . '/library/preprocessor.php';
requireView('iphoneView');
if (false) {
fetchConfigVal();
}

$category = $suri['id'];
if(isset($category)) {
$blog['entriesOnList'] = 8;
Expand All @@ -24,8 +22,8 @@
$itemsView .= '</li>'.CRLF;
foreach ($list['items'] as $item) {
$author = User::getName($item['userid']);
if($imageName = printIphoneAttachmentExtract(printIphoneEntryContent($blogid, $item['userid'], $item['id']))){
$imageSrc = printIphoneImageResizer($blogid, $imageName, 28);
if($imageName = printMobileAttachmentExtract(printMobileEntryContent($blogid, $item['userid'], $item['id']))){
$imageSrc = printMobileImageResizer($blogid, $imageName, 28);
}else{
$imageSrc = $context->getProperty('service.path') . '/resources/style/iphone/image/noPostThumb.png';
}
Expand Down
10 changes: 5 additions & 5 deletions interface/i/comment/add/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
if(!Validator::validate($IV))
Respond::NotFoundPage();
if (!doesHaveOwnership() && empty($_GET["name_$entryId"])) {
printIphoneErrorPage(_text('Comment write error.'), _text('Please enter your name.'), $context->getProperty('uri.blog')."/comment/$entryId");
printMobileErrorPage(_text('Comment write error.'), _text('Please enter your name.'), $context->getProperty('uri.blog')."/comment/$entryId");
} else if (!doesHaveOwnership() && empty($_GET["comment_$entryId"])) {
printIphoneErrorPage(_text('Comment write error.'), _text('Please enter content.'), $context->getProperty('uri.blog')."/comment/$entryId");
printMobileErrorPage(_text('Comment write error.'), _text('Please enter content.'), $context->getProperty('uri.blog')."/comment/$entryId");
} else {
$comment = array();
$comment['entry'] = $entryId;
Expand All @@ -40,13 +40,13 @@
} else {
$blockMessage = _textf('Blocked %1', $result);
}
printIphoneErrorPage(_text('Comment write blocked.'), $blockMessage, "$context->getProperty('uri.blog')/comment/$entryId");
printMobileErrorPage(_text('Comment write blocked.'), $blockMessage, "$context->getProperty('uri.blog')/comment/$entryId");
} else if ($result === false) {
printIphoneErrorPage(_text('Comment write error.'), _text('Cannot write comment.'), "$context->getProperty('uri.blog')/comment/$entryId");
printMobileErrorPage(_text('Comment write error.'), _text('Cannot write comment.'), "$context->getProperty('uri.blog')/comment/$entryId");
} else {
setcookie('guestName', $comment['name'], time() + 2592000, $context->getProperty('uri.blog'));
setcookie('guestHomepage', $comment['homepage'], time() + 2592000, $context->getProperty('uri.blog'));
printIphoneSimpleMessage(_text('Comment registered.'), _text('Go to comments page'), $context->getProperty('uri.blog')."/comment/$entryId");
printMobileSimpleMessage(_text('Comment registered.'), _text('Go to comments page'), $context->getProperty('uri.blog')."/comment/$entryId");
}
}
?>
10 changes: 5 additions & 5 deletions interface/i/comment/comment/add/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
Respond::NotFoundPage();
list($entryId) = getCommentAttributes($blogid, $replyId, 'entry');
if (!doesHaveOwnership() && empty($_GET["name_$replyId"])) {
printIphoneErrorPage(_text('댓글 작성 오류.'), _text('이름을 입력해 주세요.'), $context->getProperty('uri.blog')."/comment/comment/$replyId");
printMobileErrorPage(_text('댓글 작성 오류.'), _text('이름을 입력해 주세요.'), $context->getProperty('uri.blog')."/comment/comment/$replyId");
} else if (!doesHaveOwnership() && empty($_GET["comment_$replyId"])) {
printIphoneErrorPage(_text('댓글 작성 오류.'), _text('내용을 입력해 주세요.'), $context->getProperty('uri.blog')."/comment/comment/$replyId");
printMobileErrorPage(_text('댓글 작성 오류.'), _text('내용을 입력해 주세요.'), $context->getProperty('uri.blog')."/comment/comment/$replyId");
} else {
$comment = array();
$comment['entry'] = $entryId;
Expand All @@ -40,13 +40,13 @@
} else {
$blockMessage = _textf('%1 은 차단되었습니다.', $result);
}
printIphoneErrorPage(_text('댓글 작성이 차단되었습니다.'), $blockMessage, $context->getProperty('uri.blog')."/comment/$entryId");
printMobileErrorPage(_text('댓글 작성이 차단되었습니다.'), $blockMessage, $context->getProperty('uri.blog')."/comment/$entryId");
} else if ($result === false) {
printIphoneErrorPage(_text('댓글 작성 오류.'), _text('댓글을 작성할 수 없었습니다.'), $context->getProperty('uri.blog')."/comment/$entryId");
printMobileErrorPage(_text('댓글 작성 오류.'), _text('댓글을 작성할 수 없었습니다.'), $context->getProperty('uri.blog')."/comment/$entryId");
} else {
setcookie('guestName', $comment['name'], time() + 2592000, $context->getProperty('uri.blog'));
setcookie('guestHomepage', $comment['homepage'], time() + 2592000, $context->getProperty('uri.blog'));
printIphoneSimpleMessage(_text('댓글이 등록되었습니다.'), _text('댓글 페이지로 이동'), $context->getProperty('uri.blog')."/comment/$entryId");
printMobileSimpleMessage(_text('댓글이 등록되었습니다.'), _text('댓글 페이지로 이동'), $context->getProperty('uri.blog')."/comment/$entryId");
}
}
?>
13 changes: 11 additions & 2 deletions interface/i/comment/comment/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@
define('__TEXTCUBE_IPHONE__', true);
require ROOT . '/library/preprocessor.php';
requireView('iphoneView');
printMobileHTMLHeader();
printMobileHTMLMenu('','comment');


list($entryId) = getCommentAttributes($blogid, $suri['id'], 'entry');
list($entries, $paging) = getEntryWithPaging($blogid, $entryId);
$entry = $entries ? $entries[0] : null;


?>
<div id="comment_reply_<?php echo $suri['id']."_".time();?>" title="Comment reply" selected="false">
<?php
printIphoneCommentFormView($suri['id'], _text('댓글에 답글 달기'), 'comment/comment');
printMobileCommentFormView($suri['id'], _text('댓글에 답글 달기'), 'comment/comment');
?>
<fieldset class="navi margin-top10">
<?php
printIphoneNavigation($entry);
printMobileNavigation($entry);
?>
</fieldset>
</div>
<?php
printMobileHTMLFooter();
?>
6 changes: 3 additions & 3 deletions interface/i/comment/delete/action/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
if(empty($suri['id'])) {
list($entryId) = getCommentAttributes($blogid, $_GET['replyId'], 'entry');
if (deleteComment($blogid, $_GET['replyId'], $entryId, isset($_GET['password']) ? $_GET['password'] : '') === false) {
printIphoneErrorPage(_text('Comment delete error.'), _text('Incorrect Password.'), $context->getProperty('uri.blog')."/comment/delete/{$_GET['replyId']}");
printMobileErrorPage(_text('Comment delete error.'), _text('Incorrect Password.'), $context->getProperty('uri.blog')."/comment/delete/{$_GET['replyId']}");
exit();
}
} else {
list($entryId) = getCommentAttributes($blogid, $suri['id'], 'entry');
if (deleteComment($blogid, $suri['id'], $entryId, '') === false) {
printIphoneErrorPage(_t('Comment delete error'), _t('Administrator access only.'), $context->getProperty('uri.blog')."/comment/delete/{$suri['id']}");
printMobileErrorPage(_t('Comment delete error'), _t('Administrator access only.'), $context->getProperty('uri.blog')."/comment/delete/{$suri['id']}");
exit();
}
}
Expand All @@ -38,7 +38,7 @@
<a href="<?php echo $context->getProperty('uri.blog')."/comment/$entryId";?>" class="whiteButton margin-top10">Go to comments page</a>
<fieldset class="margin-top10">
<?php
printIphoneNavigation($entry);
printMobileNavigation($entry);
?>
</fieldset>
</div>
17 changes: 9 additions & 8 deletions interface/i/comment/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
define('__TEXTCUBE_IPHONE__', true);
require ROOT . '/library/preprocessor.php';
requireView('iphoneView');
printMobileHTMLHeader();
printMobileHTMLMenu('','comment');


if(isset($_GET['page'])) $page = $_GET['page'];
else $page = 1;
if(!empty($suri['id'])) { // entry-related comment print
Expand All @@ -13,11 +17,11 @@
?>
<div id="comment_<?php echo $entry['id']."_".time();?>" title="<?php echo _text('댓글');?> : <?php echo htmlspecialchars($entry['title']);?>" selected="false">
<?php
printIphoneCommentView($entry['id']);
printMobileCommentView($entry['id']);
?>
<fieldset class="navi margin-top10">
<?php
printIphoneNavigation($entry, false, true);
printMobileNavigation($entry, false, true);
?>
</fieldset>
</div>
Expand All @@ -27,14 +31,11 @@
?>
<div id="comment_<?php echo time();?>" title="<?php echo _text('최근 댓글');?>" selected="false">
<?php
printIphoneRecentCommentView($page);
?>
<fieldset class="navi margin-top10">
<?php
printIphoneNavigation($entry, false, false, $paging, 'comment');
printMobileRecentCommentView($page);
printMobileNavigation($entry, false, false, $paging, 'comment');
?>
</fieldset>
</div>
<?php
}
printMobileHTMLFooter();
?>
49 changes: 19 additions & 30 deletions interface/i/entry/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,27 @@
define('__TEXTCUBE_IPHONE__', true);
require ROOT . '/library/preprocessor.php';
requireView('iphoneView');
$context = Model_Context::getInstance();
printMobileHTMLHeader();

if(empty($suri['id']) && empty($suri['value'])) {
printMobileHTMLMenu('','list');
$blog['entriesOnList'] = 8;
if(!$listWithPaging = getEntriesWithPaging($blogid, $suri['page'], $blog['entriesOnList']))
$listWithPaging = array(array(), array('total' => 0));
$list = array('title' => (empty($suri['value']) ? getCategoryLabelById($blogid, 0) : $suri['value']), 'items' => $listWithPaging[0], 'count' => $listWithPaging[1]['total']);
$paging = $listWithPaging[1];
?>
<ul class="posts" id="blog_posts_<?php echo $suri['page'];?>" title="<?php echo _text('글목록');?>" selected="false">
<ul data-role="listview" class="posts" id="blog_posts_<?php echo $suri['page'];?>" title="<?php echo _text('글목록');?>" selected="false">
<?php
$itemsView = '<li class="group">'.CRLF;
$itemsView = '<li class="group ui-bar ui-bar-e">'.CRLF;
$itemsView .= ' <span class="left">'._text('글목록').'('.$list['count'].')</span>'.CRLF;
$itemsView .= ' <span class="right">Page <span class="now_page">' . $paging['page'] . '</span> / '.$paging['pages'].'</span>'.CRLF;
$itemsView .= '</li>'.CRLF;
foreach ($list['items'] as $item) {
$author = User::getName($item['userid']);
if($imageName = printIphoneAttachmentExtract($item['content'])){
$imageSrc = printIphoneImageResizer($blogid, $imageName, 28);
if($imageName = printMobileAttachmentExtract($item['content'])){
$imageSrc = printMobileImageResizer($blogid, $imageName, 28);
}else{
$imageSrc = $context->getProperty('service.path') . '/resources/style/iphone/image/noPostThumb.png';
}
Expand All @@ -35,30 +39,18 @@
$itemsView .= ' </a>'.CRLF;
$itemsView .= '</li>'.CRLF;
}

$itemsView .= '<li class="pagination">'.CRLF;
if(isset($paging['prev'])){
$itemsView .= '<a href="' .$context->getProperty('uri.blog') . '/entry?page=' . $paging['prev'] . '" class="previous">'._textf('%1 페이지',$paging['prev']) . '</a>'.CRLF;
}
if (isset($paging['next'])) {
$itemsView .= '<a href="' .$context->getProperty('uri.blog') . '/entry?page=' . $paging['next'] . '" class="next">'._textf('%1 페이지',$paging['next']) . '</a>'.CRLF;
}
if ($suri['page'] > 1 && $suri['page'] != $paging['pages']) {
$itemsView .= '<strong>' . $suri['page'] . '</strong>'.CRLF;
}
$itemsView .= '</li>'.CRLF;
$itemsView .= '</ul>'.CRLF;
print $itemsView;
?>
</ul>
<?php
print printMobileListNavigation($paging,'entry');
} else {
if(!empty($suri['id'])) {
list($entries, $paging) = getEntryWithPaging($blogid, $suri['id']);
} else if(!empty($suri['value'])) {
$entryPrint = true;
list($entries, $paging) = getEntryWithPagingBySlogan($blogid, $suri['value']);
printIphoneHtmlHeader();
printMobileHtmlHeader();
}
printMobileHTMLMenu('','list');

$entry = $entries ? $entries[0] : null;
?>
Expand All @@ -67,13 +59,13 @@
<h2><?php echo htmlspecialchars($entry['title']);?></h2>
<h2 class="noBorderLine"><?php echo Timestamp::format5($entry['published']);?></h2>
</div>
<div class="content"><?php printIphoneEntryContentView($blogid, $entry, null); ?></div>
<div class="content"><?php printMobileEntryContentView($blogid, $entry, null); ?></div>
<?php
$entryTags = getTags($entry['blogid'], $entry['id']);
if (sizeof($entryTags) > 0) {
?>
<h2 class="tags_title">Tags</h2>
<div class="entry_tags">
<div class="entry_tags" data-role="content" data-theme="c">
<h3 class="tags_title">Tags</h3>
<?php
$tags = array();
$relTag = Setting::getBlogSettingGlobal('useMicroformat', 3)>1 && (count($entries) == 1 || !empty($skin->hentryExisted) );
Expand All @@ -83,26 +75,23 @@
echo implode(",\r\n", array_values($tags));
?>
</div>
</div>
<?php
}
?>
<fieldset class="margin-top10">
<?php

if(doesHaveOwnership() || ($entry['visibility'] >= 2) || (isset($_COOKIE['GUEST_PASSWORD']) && (trim($_COOKIE['GUEST_PASSWORD']) == trim($entry['password'])))) {
printIphoneNavigation($entry, true, true, $paging);
printMobileNavigation($entry, true, true, $paging);
} else {
printIphoneNavigation($entry, false, false, $paging);
printMobileNavigation($entry, false, false, $paging);
}
?>
</fieldset>
</div>
<?php
if(!empty($entryPrint)) {
?>
</div>
<?php
printIphoneHtmlFooter();
}
}
printMobileHTMLFooter();
?>
Loading

0 comments on commit dd16e5e

Please sign in to comment.