mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-19 19:29:56 +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
|
|
@ -36,5 +36,98 @@
|
|||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue