mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-31 00:59:58 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7642 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
97bc43ee55
commit
fd444dea19
5 changed files with 193 additions and 22 deletions
|
|
@ -1,9 +0,0 @@
|
||||||
rm -rf ./.svn
|
|
||||||
rm -rf ./schemas/.svn
|
|
||||||
rm -rf ./lang/.svn
|
|
||||||
rm -rf ./tpl/js/.svn
|
|
||||||
rm -rf ./tpl/filter/.svn
|
|
||||||
rm -rf ./tpl/.svn
|
|
||||||
rm -rf ./tpl/css/.svn
|
|
||||||
rm -rf ./queries/.svn
|
|
||||||
rm -rf ./conf/.svn
|
|
||||||
|
|
@ -36,5 +36,98 @@
|
||||||
|
|
||||||
$this->setMessage('success_applied');
|
$this->setMessage('success_applied');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function procSyndicationAdminCheckSitePingResult(){
|
||||||
|
$site_url = trim(Context::get('site_url'));
|
||||||
|
if(!$site_url) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
||||||
|
$oSyndicationModel = &getModel('syndication');
|
||||||
|
|
||||||
|
$id = $oSyndicationModel->getID('site');
|
||||||
|
if(substr($site_url,-1)!='/') $site_url .= '/';
|
||||||
|
$site_ping = sprintf('http://%s?module=syndication&act=getSyndicationList&id=%s&type=site', $site_url, $id);
|
||||||
|
|
||||||
|
$headers = array();
|
||||||
|
$headers['Connection'] = 'TE, close';
|
||||||
|
$headers['User-Agent'] = 'Mozilla/4.0 (compatible; NaverBot/1.0; http://help.naver.com/customer_webtxt_02.jsp)';
|
||||||
|
|
||||||
|
$xml = FileHandler::getRemoteResource($site_ping, null, 3, 'GET', '', $headers);
|
||||||
|
if(!$xml) return new Object(-1, 'msg_ping_test_error');
|
||||||
|
|
||||||
|
$oXmlParser = new XmlParser();
|
||||||
|
$oXml = $oXmlParser->parse($xml);
|
||||||
|
|
||||||
|
if(!$oXml || !is_object($oXml) || !$oXml->entry || !$oXml->entry->id || !$oXml->entry->title) {
|
||||||
|
$this->setMessage('msg_ping_test_error');
|
||||||
|
$this->add('ping_result',$xml);
|
||||||
|
}else{
|
||||||
|
$this->setMessage('msg_success_ping_test');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function procSyndicationAdminCheckApiStatus(){
|
||||||
|
$target_service = Context::get('target_service');
|
||||||
|
if(!$target_service) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
||||||
|
$status_url = trim($this->statuses[$target_service]);
|
||||||
|
if(!$status_url) return new Object(-1,'msg_syndication_status_not_support');
|
||||||
|
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
|
$config = $oModuleModel->getModuleConfig('syndication');
|
||||||
|
$site_url = preg_replace('/^(http|https):\/\//i','',$config->site_url);
|
||||||
|
|
||||||
|
$method = 'getSyndicationStatus' . ucfirst(strtolower($target_service));
|
||||||
|
if(!method_exists(&$this, $method)) return new Object(-1,'msg_syndication_status_not_support');
|
||||||
|
|
||||||
|
$output = call_user_func(array(&$this,$method),$site_url);
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
$this->add('result_status',$output->get('result_status'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSyndicationStatusNaver($site_url){
|
||||||
|
$status_url = trim($this->statuses['Naver']);
|
||||||
|
|
||||||
|
$xml = FileHandler::getRemoteResource(sprintf($status_url,$site_url), null, 3, 'GET', 'application/xml');
|
||||||
|
$oXmlParser = new XmlParser();
|
||||||
|
$oXml = $oXmlParser->parse($xml);
|
||||||
|
$oStatus = $oXml->syndication_status;
|
||||||
|
|
||||||
|
if($oStatus->error->body != 0) return new Object(-1,$oStatus->message->body);
|
||||||
|
|
||||||
|
$result->site_name = $oStatus->site_name->body;
|
||||||
|
$result->first_update = $oStatus->first_update->body;
|
||||||
|
$result->last_update = $oStatus->last_update->body;
|
||||||
|
$result->visit_ok_count = $oStatus->visit_ok_count->body;
|
||||||
|
$result->visit_fail_count = $oStatus->visit_fail_count->body;
|
||||||
|
$result->status = $oStatus->status->body;
|
||||||
|
|
||||||
|
if(!$oStatus->sync || !$oStatus->sync->article){
|
||||||
|
$oArticleList = array();
|
||||||
|
}else{
|
||||||
|
$oArticleList = $oStatus->sync->article;
|
||||||
|
if(!is_array($oArticleList)) $oArticleList = array($oArticleList);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($oArticleList)>0){
|
||||||
|
$article_count = array();
|
||||||
|
foreach($oArticleList as $article){
|
||||||
|
$article_count[$article->attrs->date] = $article->body;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result->article_count = $article_count;
|
||||||
|
$result->max_article_count = max($result->article_count);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Context::set('result', $result);
|
||||||
|
$oTemplateHandler = &TemplateHandler::getInstance();
|
||||||
|
$html = $oTemplateHandler->compile($this->module_path.'tpl', 'naver_result');
|
||||||
|
|
||||||
|
$output = new Object();
|
||||||
|
$output->add('result_status', $html);
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,54 @@
|
||||||
'Naver' => 'http://syndication.openapi.naver.com/ping/',
|
'Naver' => 'http://syndication.openapi.naver.com/ping/',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var $statuses = array(
|
||||||
|
'Naver' => 'http://syndication.openapi.naver.com/status/?site=%s',
|
||||||
|
);
|
||||||
|
|
||||||
function moduleInstall() {
|
function moduleInstall() {
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'syndication', 'controller', 'triggerInsertDocument', 'after');
|
$oModuleController->insertTrigger('document.insertDocument', 'syndication', 'controller', 'triggerInsertDocument', 'after');
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'syndication', 'controller', 'triggerUpdateDocument', 'after');
|
$oModuleController->insertTrigger('document.updateDocument', 'syndication', 'controller', 'triggerUpdateDocument', 'after');
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'syndication', 'controller', 'triggerDeleteDocument', 'after');
|
$oModuleController->insertTrigger('document.deleteDocument', 'syndication', 'controller', 'triggerDeleteDocument', 'after');
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'syndication', 'controller', 'triggerDeleteModule', 'after');
|
$oModuleController->insertTrigger('module.deleteModule', 'syndication', 'controller', 'triggerDeleteModule', 'after');
|
||||||
|
|
||||||
|
$oModuleController->insertTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after');
|
||||||
|
$oModuleController->insertTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after');
|
||||||
|
|
||||||
|
$oAddonAdminModel = &getAdminModel('addon');
|
||||||
|
if($oAddonAdminModel->getAddonInfoXml('catpcha')){
|
||||||
|
$oAddonAdminController = &addonAdminController::getInstance();
|
||||||
|
$oAddonAdminController->doActivate('catpcha');
|
||||||
|
$oAddonAdminController->makeCacheFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUpdate() {
|
function checkUpdate() {
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')) return true;
|
||||||
|
if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function moduleUpdate() {
|
function moduleUpdate() {
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
|
||||||
|
if(!$oModuleModel->getTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after')){
|
||||||
|
$oModuleController->insertTrigger('document.moveDocumentToTrash', 'syndication', 'controller', 'triggerMoveDocumentToTrash', 'after');
|
||||||
|
}
|
||||||
|
if(!$oModuleModel->getTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after')){
|
||||||
|
$oModuleController->insertTrigger('document.restoreTrash', 'syndication', 'controller', 'triggerRestoreTrash', 'after');
|
||||||
|
}
|
||||||
|
|
||||||
|
$oAddonAdminModel = &getAdminModel('addon');
|
||||||
|
if($oAddonAdminModel->getAddonInfoXml('catpcha')){
|
||||||
|
$oAddonAdminController = &addonAdminController::getInstance();
|
||||||
|
$oAddonAdminController->doActivate('catpcha');
|
||||||
|
$oAddonAdminController->makeCacheFile();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function recompileCache() {
|
function recompileCache() {
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,6 @@
|
||||||
|
|
||||||
$this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content);
|
$this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content);
|
||||||
|
|
||||||
$config = $oModuleModel->getModuleConfig('syndication');
|
|
||||||
|
|
||||||
$id = $oSyndicationModel->getID('channel', $obj->module_srl);
|
$id = $oSyndicationModel->getID('channel', $obj->module_srl);
|
||||||
$this->ping($id, 'deleted');
|
$this->ping($id, 'deleted');
|
||||||
|
|
||||||
|
|
@ -68,14 +66,42 @@
|
||||||
$output = executeQuery('syndication.getExceptModule', $obj);
|
$output = executeQuery('syndication.getExceptModule', $obj);
|
||||||
if($output->data->count) return new Object();
|
if($output->data->count) return new Object();
|
||||||
|
|
||||||
$config = $oModuleModel->getModuleConfig('syndication');
|
|
||||||
|
|
||||||
$id = $oSyndicationModel->getID('site', $obj->module_srl);
|
$id = $oSyndicationModel->getID('site', $obj->module_srl);
|
||||||
$this->ping($id, 'deleted');
|
$this->ping($id, 'deleted');
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function triggerMoveDocumentToTrash(&$obj) {
|
||||||
|
$document_srl = $obj->document_srl;
|
||||||
|
$module_srl = $obj->module_srl;
|
||||||
|
|
||||||
|
$oSyndicationModel = &getModel('syndication');
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
|
if($oSyndicationModel->isExceptedModules($module_srl)) return new Object();
|
||||||
|
|
||||||
|
$id = $oSyndicationModel->getID('channel', $module_srl);
|
||||||
|
$this->ping($id, 'deleted');
|
||||||
|
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
function triggerRestoreTrash(&$obj) {
|
||||||
|
$document_srl = $obj->document_srl;
|
||||||
|
$module_srl = $obj->module_srl;
|
||||||
|
|
||||||
|
$oSyndicationModel = &getModel('syndication');
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
|
if($oSyndicationModel->isExceptedModules($module_srl)) return new Object();
|
||||||
|
|
||||||
|
$id = $oSyndicationModel->getID('article', $module_srl.'-'.$document_srl);
|
||||||
|
$this->ping($id, 'article');
|
||||||
|
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
function insertLog($module_srl, $document_srl, $title = null, $summary = null) {
|
function insertLog($module_srl, $document_srl, $title = null, $summary = null) {
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
|
|
|
||||||
|
|
@ -72,18 +72,21 @@
|
||||||
function getSyndicationList() {
|
function getSyndicationList() {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$config = $oModuleModel->getModuleConfig('syndication');
|
$config = $oModuleModel->getModuleConfig('syndication');
|
||||||
|
if(!$config->year || !$config->site_url) return new Object(-1,'msg_check_syndication_config');
|
||||||
|
|
||||||
$id = Context::get('id');
|
$id = Context::get('id');
|
||||||
$type = Context::get('type');
|
$type = Context::get('type');
|
||||||
$page = Context::get('page');
|
$page = Context::get('page');
|
||||||
if(!$id || !$type) return new Object(-1,'msg_invalid_request');
|
if(!$id || !$type) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
||||||
preg_match('/^tag:([^,]+),([0-9]+):([^:]+):(.*)$/i',$id,$match);
|
if(!preg_match('/^tag:([^,]+),([0-9]+):(site|channel|article)(.*)$/i',$id,$matches)) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
||||||
|
$url = $matches[1];
|
||||||
|
$year = $matches[2];
|
||||||
|
$target = $matches[3];
|
||||||
|
$id = $matches[4];
|
||||||
|
if($id && $id{0}==':') $id = substr($id, 1);
|
||||||
|
|
||||||
$url = $match[1];
|
|
||||||
$year = $match[2];
|
|
||||||
$target = $match[3];
|
|
||||||
$id = $match[4];
|
|
||||||
if($id && strpos($id,'-')!==false) list($module_srl, $document_srl) = explode('-',$id);
|
if($id && strpos($id,'-')!==false) list($module_srl, $document_srl) = explode('-',$id);
|
||||||
elseif($id) $module_srl = $id;
|
elseif($id) $module_srl = $id;
|
||||||
if(!$url || !$year || !$target) return new Object(-1,'msg_invalid_request');
|
if(!$url || !$year || !$target) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
@ -113,7 +116,6 @@
|
||||||
if(!$error) {
|
if(!$error) {
|
||||||
Context::set('target', $target);
|
Context::set('target', $target);
|
||||||
Context::set('type', $type);
|
Context::set('type', $type);
|
||||||
|
|
||||||
switch($target) {
|
switch($target) {
|
||||||
case 'site' :
|
case 'site' :
|
||||||
$site_info->id = $this->getID('site');
|
$site_info->id = $this->getID('site');
|
||||||
|
|
@ -174,14 +176,19 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'article':
|
||||||
|
Context::set('article', $this->getArticle($document_srl));
|
||||||
|
$this->setTemplateFile('include.articles');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Context::set('message', $error);
|
Context::set('message', $error);
|
||||||
$this->setTemplateFile('error');
|
$this->setTemplateFile('error');
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::setResponseMethod('XML');
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
|
Context::setResponseMethod('XMLRPC');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChannels() {
|
function getChannels() {
|
||||||
|
|
@ -213,6 +220,25 @@
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getArticle($document_srl) {
|
||||||
|
if($this->site_url==null) $this->init();
|
||||||
|
|
||||||
|
$oDocumentModel = &getModel('document');
|
||||||
|
$oDocument = $oDocumentModel->getDocument($document_srl,false,false);
|
||||||
|
if(!$oDocument->isExists()) return;
|
||||||
|
|
||||||
|
$val = $oDocument->getObjectVars();
|
||||||
|
|
||||||
|
$val->id = $this->getID('article', $val->module_srl.'-'.$val->document_srl);
|
||||||
|
$val->updated = date("Y-m-d\\TH:i:s", ztime($val->last_update)).$GLOBALS['_time_zone'];
|
||||||
|
$val->alternative_href = getFullSiteUrl($this->site_url, '', 'document_srl', $val->document_srl);
|
||||||
|
$val->channel_alternative_href = $this->getChannelAlternativeHref($val->module_srl);
|
||||||
|
$val->channel_id = $this->getID('channel', $val->module_srl.'-'.$val->document_srl);
|
||||||
|
if(!$val->nick_name) $val->nick_name = $val->user_name;
|
||||||
|
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) {
|
function getArticles($module_srl = null, $page=1, $startTime = null, $endTime = null, $type = null, $id = null) {
|
||||||
if($this->site_url==null) $this->init();
|
if($this->site_url==null) $this->init();
|
||||||
|
|
||||||
|
|
@ -289,7 +315,7 @@
|
||||||
function getID($type, $target_id = null) {
|
function getID($type, $target_id = null) {
|
||||||
if($this->site_url==null) $this->init();
|
if($this->site_url==null) $this->init();
|
||||||
|
|
||||||
return sprintf('tag:%s,%d:%s:%s', $this->site_url, $this->year, $type, $target_id);
|
return sprintf('tag:%s,%d:%s', $this->site_url, $this->year, $type) . ($target_id?':'.$target_id:'');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChannelAlternativeHref($module_srl) {
|
function getChannelAlternativeHref($module_srl) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue