관리자 페이지에서 1시간 캐싱 인터벌을 가지고 공식 사이트의 최근 뉴스를 가지고 오도록 변경

git-svn-id: http://xe-core.googlecode.com/svn/trunk@1991 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-07-24 10:45:34 +00:00
parent 0ffa6367fd
commit 87e2fab04c
6 changed files with 92 additions and 33 deletions

View file

@ -138,7 +138,7 @@
if(!$fp) return;
$url_info['path'] = str_replace(' ','%20',$url_info['path']);
$header = sprintf("GET %s HTTP/1.0\r\nHost: %s\r\nReferer: %s://%s\r\n\r\n", $url_info['path'], $url_info['host'], $url_info['scheme'], $url_info['host']);
$header = sprintf("GET %s HTTP/1.0\r\nHost: %s\r\nReferer: %s://%s\r\nRequestUrl: %s\r\n\r\n", $url_info['path'], $url_info['host'], $url_info['scheme'], $url_info['host'], Context::getRequestUri());
@fwrite($fp, $header);
$ft = @fopen($target_filename, 'w');

View file

@ -46,6 +46,33 @@
* @brief 관리자 메인 페이지 출력
**/
function dispAdminIndex() {
// 공식사이트에서 최신 뉴스를 가져옴
$newest_news_url = sprintf("http://news.zeroboard.com/%s/news.php", Context::getLangType());
$cache_file = sprintf("./files/cache/newest_news.%s.cache.php", Context::getLangType());
// 1시간 단위로 캐싱 체크
if(!file_exists($cache_file) || filectime($cache_file)+ 60*60 < time()) {
FileHandler::getRemoteFile($newest_news_url, $cache_file);
}
if(file_exists($cache_file)) {
$oXml = new XmlParser();
$buff = $oXml->parse(FileHandler::readFile($cache_file));
$item = $buff->zbxe_news->item;
if($item) {
if(!is_array($item)) $item = array($item);
foreach($item as $key => $val) {
$obj = null;
$obj->title = $val->body;
$obj->date = $val->attrs->date;
$obj->url = $val->attrs->url;
$news[] = $obj;
}
Context::set('news', $news);
}
}
$this->setTemplateFile('index');
}

View file

@ -5,6 +5,10 @@
* @brief 한국어 언어팩 (기본적인 내용만 수록)
**/
$lang->newest_news = "최신 소식";
$lang->env_setup = "환경 설정";
$lang->item_module = "모듈 목록";
$lang->item_addon = "애드온 목록";
$lang->item_widget = "위젯 목록";

View file

@ -77,7 +77,9 @@ select.time_zone { width:70%; position:relative; top:4px; }
.gap1 { margin-top:.8em; }
.tableSummaryType1 { font:bold .8em Tahoma; color:#a0a0a0; margin-bottom:10px;}
.tableSummaryType1 strong { font:bold 1em Tahoma; color:#ff1a00;}
.tableType1 { width:100%; border-bottom:2px solid #c1c0bd;}
.tableType1 caption { padding:2em 0 .5em 1.5em; font-weight:bold; text-align:left; background:url(../images/iconH3.gif) no-repeat .5em 2em;}
.tableType1 th { font-weight:normal; color:#ffffff; background:url(../images/tableType1Header.gif) repeat-x; height:28px;}
.tableType1 th select { vertical-align:middle; }
.tableType1 td { text-align:center; color:#636363; height:30px; border-top:1px solid #ededed;}
@ -92,6 +94,7 @@ select.time_zone { width:70%; position:relative; top:4px; }
.tableType1 td .red { color:#c95b53;}
.tableType2 { border:2px solid #c1c0bd; border-left:none; border-right:none; width:100%;}
.tableType2 caption { padding:2em 0 .5em 1.5em; font-weight:bold; text-align:left; background:url(../images/iconH3.gif) no-repeat .5em 2em;}
.tableType2 th { border-top:1px solid #fbfbfb; border-bottom:1px solid #e4e4e4; background:#f5f5f5; padding:10px 10px 10px 2em; font-weight:normal; text-align:left; color:#606060;}
.tableType2 td { border-bottom:1px solid #ededed; padding:10px 10px 7px 10px; font-size:.9em; color:#7b7972;}
.tableType2 td input,
@ -105,6 +108,7 @@ select.time_zone { width:70%; position:relative; top:4px; }
.tableType2 td a.red { color:#c95b53;}
.tableType3 { width:100%; border-bottom:2px solid #c1c0bd;}
.tableType3 caption { padding:2em 0 .5em 1.5em; font-weight:bold; text-align:left; background:url(../images/iconH3.gif) no-repeat .5em 2em;}
.tableType3 th.bold { font-weight:bold; }
.tableType3 th,
.tableType3 td { border-top:1px solid #bfbfbf;}
@ -209,3 +213,6 @@ select.time_zone { width:70%; position:relative; top:4px; }
ul.extra_vars li { margin-bottom:.5em;}
li.type_key { float:left; width:10em; }
li.type_value { clear:right; }
.admin_news { width:49%; float:left; margin-right:10px; }
.admin_link { width:49%; float:right; }

View file

@ -7,6 +7,7 @@
<table cellspacing="0" class="tableType4">
<col width="250" />
<col />
<caption>{$lang->env_setup}</caption>
<tr>
<th scope="row">Lang</th>
<td>
@ -38,38 +39,58 @@
<p>{$lang->about_time_zone}</p>
</td>
</tr>
<tr>
<th scope="row" colspan="2">
<div class="tRight">
<span class="button"><input type="submit" value="{$lang->cmd_save}" /></span>
</div>
</th>
</tr>
</table>
<div class="tRight gap1">
<span class="button"><input type="submit" value="{$lang->cmd_save}" /></span>
</div>
</form>
<!-- 사용자 링크 -->
<table cellspacing="0" class="tableType3 gap1">
<col width="250" />
<col />
<tr>
<th colspan="2" class="bold">{$lang->zeroboard_xe_user_links}</th>
</tr>
<!--@foreach($lang->xe_user_links as $key => $val)-->
<tr>
<th scope="col">{$key}</th>
<td class="left blue"><a href="#" onclick="winopen('{$val}'); return false;">{$val}</a></td>
</tr>
<!--@end-->
<div class="admin_news">
<!--@if($news)-->
<table cellspacing="0" class="tableType1">
<caption>{$lang->newest_news}</caption>
<thead>
<tr>
<th scope="col">{$lang->title}</th>
<th scope="col">{$lang->regdate}</th>
</tr>
</thead>
<tbody>
<!--@foreach($news as $key => $val)-->
<tr>
<td><a href="{$val->url}" onclick="window.open(this.href);return false;">{$val->title}</a></td>
<td>{zdate($val->date,"Y-m-d H:i")}</td>
</tr>
<!--@end-->
</tbody>
</table>
<!--@end-->
</div>
<!-- 개발자 링크 -->
<tr>
<th colspan="2" class="bold">{$lang->zeroboard_xe_developer_links}</th>
</tr>
<!--@foreach($lang->xe_developer_links as $key => $val)-->
<tr>
<th scope="col">{$key}</th>
<td class="left blue"><a href="#" onclick="winopen('{$val}'); return false;">{$val}</a></td>
</tr>
<!--@end-->
</table>
<div class="admin_link">
<!-- 사용자 링크 -->
<table cellspacing="0" class="tableType3">
<col width="250" />
<col />
<caption>{$lang->zeroboard_xe_user_links}</caption>
<!--@foreach($lang->xe_user_links as $key => $val)-->
<tr>
<th scope="col">{$key}</th>
<td class="left blue"><a href="#" onclick="winopen('{$val}'); return false;">{$val}</a></td>
</tr>
<!--@end-->
</table>
<!-- 개발자 링크 -->
<table cellspacing="0" class="tableType3">
<col width="250" />
<col />
<caption>{$lang->zeroboard_xe_developer_links}</caption>
<!--@foreach($lang->xe_developer_links as $key => $val)-->
<tr>
<th scope="col">{$key}</th>
<td class="left blue"><a href="#" onclick="winopen('{$val}'); return false;">{$val}</a></td>
</tr>
<!--@end-->
</table>
</div>

View file

@ -109,7 +109,7 @@
<!--@if($module_info->display_readed_count!='N')--><td class="reading">{$document->get('readed_count')}</td><!--@end-->
<!--@if($module_info->display_voted_count!='N')--><td class="recommend">{$document->get('voted_count')}</td><!--@end-->
<!--@if($module_info->display_regdate!='N')--><td class="date">{$document->getRegdate('Y-m-d')}</td><!--@end-->
<!--@if($module_info->display_last_update=='Y')--><td class="date">{zdate($document->get('last_update'),'Y-m-d H:m')}</td><!--@end-->
<!--@if($module_info->display_last_update=='Y')--><td class="date">{zdate($document->get('last_update'),'Y-m-d H:i')}</td><!--@end-->
</tr>
<!--@end-->
</tbody>