1. Use __XE__ instead of __ZBXE__

2. Reformat indentations


git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9722 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-10-25 06:00:57 +00:00
parent 477db7ed4f
commit 29f0d4a503
12 changed files with 648 additions and 650 deletions

View file

@ -1,17 +1,17 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file adminlogging.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Automatic link add-on
**/
$logged_info = Context::get('logged_info');
$act = Context::get('act');
$kind = strpos(strtolower($act),'admin')!==false?'admin':'';
/**
* @file adminlogging.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Automatic link add-on
**/
$logged_info = Context::get('logged_info');
$act = Context::get('act');
$kind = strpos(strtolower($act),'admin')!==false?'admin':'';
if($called_position == 'before_module_proc' && $kind == 'admin' && $logged_info->is_admin == 'Y') {
$oAdminloggingController = &getController('adminlogging');
$oAdminloggingController->insertLog($this->module, $this->act);
}
if($called_position == 'before_module_proc' && $kind == 'admin' && $logged_info->is_admin == 'Y') {
$oAdminloggingController = &getController('adminlogging');
$oAdminloggingController->insertLog($this->module, $this->act);
}
?>

View file

@ -1,12 +1,12 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file autolink.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Automatic link add-on
**/
if($called_position == 'after_module_proc' && Context::getResponseMethod()!="XMLRPC") {
Context::loadFile(array('./addons/autolink/autolink.js', 'body', '', null), true);
}
/**
* @file autolink.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Automatic link add-on
**/
if($called_position == 'after_module_proc' && Context::getResponseMethod()!="XMLRPC") {
Context::loadFile(array('./addons/autolink/autolink.js', 'body', '', null), true);
}
?>

View file

@ -1,422 +1,421 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file blogapicounter.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Add blogAPI
*
* It enables to write a post by using an external tool such as ms live writer, firefox performancing, zoundry and so on.
* It should be called before executing the module(before_module_proc). If not, it is forced to shut down.
**/
// Insert a rsd tag when called_position is after_module_proc
if($called_position == 'after_module_proc') {
// Create rsd address of the current module
$site_module_info = Context::get('site_module_info');
$rsd_url = getFullSiteUrl($site_module_info->domain, '', 'mid',$site_module_info->mid, 'act','api');
// Insert rsd tag into the header
Context::addHtmlHeader(" ".'<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$rsd_url.'" />');
}
// If act isnot api, just return
if($_REQUEST['act']!='api') return;
// Read func file
require_once('./addons/blogapi/blogapi.func.php');
// xmlprc parsing
// Parse the requested xmlrpc
$oXmlParser = new XmlParser();
$xmlDoc = $oXmlParser->parse();
/**
* @file blogapicounter.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Add blogAPI
*
* It enables to write a post by using an external tool such as ms live writer, firefox performancing, zoundry and so on.
* It should be called before executing the module(before_module_proc). If not, it is forced to shut down.
**/
// Insert a rsd tag when called_position is after_module_proc
if($called_position == 'after_module_proc') {
// Create rsd address of the current module
$site_module_info = Context::get('site_module_info');
$rsd_url = getFullSiteUrl($site_module_info->domain, '', 'mid',$site_module_info->mid, 'act','api');
// Insert rsd tag into the header
Context::addHtmlHeader(" ".'<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$rsd_url.'" />');
}
// If act isnot api, just return
if($_REQUEST['act']!='api') return;
// Read func file
require_once('./addons/blogapi/blogapi.func.php');
// xmlprc parsing
// Parse the requested xmlrpc
$oXmlParser = new XmlParser();
$xmlDoc = $oXmlParser->parse();
$method_name = $xmlDoc->methodcall->methodname->body;
$params = $xmlDoc->methodcall->params->param;
if($params && !is_array($params)) $params = array($params);
// Compatible with some of methodname
if(in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo'))) {
$method_name = str_replace('metaWeblog.', 'blogger.', $method_name);
}
// Delete the first argument if it is blogger.deletePost
if($method_name == 'blogger.deletePost') array_shift($params);
// Get user_id, password and attempt log-in
$user_id = trim($params[1]->value->string->body);
$password = trim($params[2]->value->string->body);
// Before executing the module, authentication is processed.
if($called_position == 'before_module_init') {
// Attempt log-in by using member controller
if($user_id && $password) {
$oMemberController = &getController('member');
$output = $oMemberController->doLogin($user_id, $password);
// If login fails, an error message appears
if(!$output->toBool()) {
$content = getXmlRpcFailure(1, $output->getMessage());
printContent($content);
}
} else {
$content = getXmlRpcFailure(1, 'not logged');
printContent($content);
}
}
// Before module processing, handle requests from blogapi tool and then terminate.
if($called_position == 'before_module_proc') {
// Check writing permission
if(!$this->grant->write_document) {
printContent( getXmlRpcFailure(1, 'no permission') );
}
// Get information of the categories
$oDocumentModel = &getModel('document');
$category_list = $oDocumentModel->getCategoryList($this->module_srl);
// Specifies a temporary file storage
$tmp_uploaded_path = sprintf('./files/cache/blogapi/%s/%s/', $this->mid, $user_id);
$uploaded_target_path = sprintf('/files/cache/blogapi/%s/%s/', $this->mid, $user_id);
$method_name = $xmlDoc->methodcall->methodname->body;
$params = $xmlDoc->methodcall->params->param;
if($params && !is_array($params)) $params = array($params);
// Compatible with some of methodname
if(in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo'))) {
$method_name = str_replace('metaWeblog.', 'blogger.', $method_name);
}
// Delete the first argument if it is blogger.deletePost
if($method_name == 'blogger.deletePost') array_shift($params);
// Get user_id, password and attempt log-in
$user_id = trim($params[1]->value->string->body);
$password = trim($params[2]->value->string->body);
// Before executing the module, authentication is processed.
if($called_position == 'before_module_init') {
// Attempt log-in by using member controller
if($user_id && $password) {
$oMemberController = &getController('member');
$output = $oMemberController->doLogin($user_id, $password);
// If login fails, an error message appears
if(!$output->toBool()) {
$content = getXmlRpcFailure(1, $output->getMessage());
printContent($content);
}
} else {
$content = getXmlRpcFailure(1, 'not logged');
printContent($content);
}
}
// Before module processing, handle requests from blogapi tool and then terminate.
if($called_position == 'before_module_proc') {
// Check writing permission
if(!$this->grant->write_document) {
printContent( getXmlRpcFailure(1, 'no permission') );
}
// Get information of the categories
$oDocumentModel = &getModel('document');
$category_list = $oDocumentModel->getCategoryList($this->module_srl);
// Specifies a temporary file storage
$tmp_uploaded_path = sprintf('./files/cache/blogapi/%s/%s/', $this->mid, $user_id);
$uploaded_target_path = sprintf('/files/cache/blogapi/%s/%s/', $this->mid, $user_id);
switch($method_name) {
// Blog information
case 'blogger.getUsersBlogs' :
$obj->url = getFullSiteUrl('');
$obj->blogid = $this->mid;
$obj->blogName = $this->module_info->browser_title;
$blog_list = array($obj);
switch($method_name) {
// Blog information
case 'blogger.getUsersBlogs' :
$obj->url = getFullSiteUrl('');
$obj->blogid = $this->mid;
$obj->blogName = $this->module_info->browser_title;
$blog_list = array($obj);
$content = getXmlRpcResponse($blog_list);
printContent($content);
break;
// Return a list of categories
case 'metaWeblog.getCategories' :
$category_obj_list = array();
if($category_list) {
foreach($category_list as $category_srl => $category_info) {
unset($obj);
$obj->description = $category_info->title;
//$obj->htmlUrl = Context::getRequestUri().$this->mid.'/1';
//$obj->rssUrl= Context::getRequestUri().'rss/'.$this->mid.'/1';
$obj->title = $category_info->title;
$obj->categoryid = $category_srl;
$category_obj_list[] = $obj;
}
}
$content = getXmlRpcResponse($blog_list);
printContent($content);
break;
// Return a list of categories
case 'metaWeblog.getCategories' :
$category_obj_list = array();
if($category_list) {
foreach($category_list as $category_srl => $category_info) {
unset($obj);
$obj->description = $category_info->title;
//$obj->htmlUrl = Context::getRequestUri().$this->mid.'/1';
//$obj->rssUrl= Context::getRequestUri().'rss/'.$this->mid.'/1';
$obj->title = $category_info->title;
$obj->categoryid = $category_srl;
$category_obj_list[] = $obj;
}
}
$content = getXmlRpcResponse($category_obj_list);
printContent($content);
break;
// Upload file
case 'metaWeblog.newMediaObject' :
// Check a file upload permission
$oFileModel = &getModel('file');
$file_module_config = $oFileModel->getFileModuleConfig($this->module_srl);
if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) {
$logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y') {
$is_permitted = false;
for($i=0;$i<count($file_module_config->download_grant);$i++) {
$group_srl = $file_module_config->download_grant[$i];
if($logged_info->group_list[$group_srl]) {
$is_permitted = true;
break;
}
}
if(!$is_permitted) printContent( getXmlRpcFailure(1, 'no permission') );
}
}
$content = getXmlRpcResponse($category_obj_list);
printContent($content);
break;
// Upload file
case 'metaWeblog.newMediaObject' :
// Check a file upload permission
$oFileModel = &getModel('file');
$file_module_config = $oFileModel->getFileModuleConfig($this->module_srl);
if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) {
$logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y') {
$is_permitted = false;
for($i=0;$i<count($file_module_config->download_grant);$i++) {
$group_srl = $file_module_config->download_grant[$i];
if($logged_info->group_list[$group_srl]) {
$is_permitted = true;
break;
}
}
if(!$is_permitted) printContent( getXmlRpcFailure(1, 'no permission') );
}
}
$fileinfo = $params[3]->value->struct->member;
foreach($fileinfo as $key => $val) {
$nodename = $val->name->body;
if($nodename == 'bits') $filedata = base64_decode($val->value->base64->body);
elseif($nodename == 'name') $filename = $val->value->string->body;
}
$fileinfo = $params[3]->value->struct->member;
foreach($fileinfo as $key => $val) {
$nodename = $val->name->body;
if($nodename == 'bits') $filedata = base64_decode($val->value->base64->body);
elseif($nodename == 'name') $filename = $val->value->string->body;
}
$tmp_arr = explode('/',$filename);
$filename = array_pop($tmp_arr);
$tmp_arr = explode('/',$filename);
$filename = array_pop($tmp_arr);
if(!is_dir($tmp_uploaded_path)) FileHandler::makeDir($tmp_uploaded_path);
if(!is_dir($tmp_uploaded_path)) FileHandler::makeDir($tmp_uploaded_path);
$target_filename = sprintf('%s%s', $tmp_uploaded_path, $filename);
FileHandler::writeFile($target_filename, $filedata);
$obj->url = Context::getRequestUri().$target_filename;
$target_filename = sprintf('%s%s', $tmp_uploaded_path, $filename);
FileHandler::writeFile($target_filename, $filedata);
$obj->url = Context::getRequestUri().$target_filename;
$content = getXmlRpcResponse($obj);
printContent($content);
break;
// Get posts
case 'metaWeblog.getPost' :
$document_srl = $params[0]->value->string->body;
if(!$document_srl) {
printContent( getXmlRpcFailure(1, 'no permission') );
} else {
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists() || !$oDocument->isGranted()) {
printContent( getXmlRpcFailure(1, 'no permission') );
} else {
// Get a list of categories and set Context
$category = "";
if($oDocument->get('category_srl')) {
$oDocumentModel = &getModel('document');
$category_list = $oDocumentModel->getCategoryList($oDocument->get('module_srl'));
if($category_list[$oDocument->get('category_srl')]) {
$category = $category_list[$oDocument->get('category_srl')]->title;
}
}
$content = sprintf(
'<?xml version="1.0" encoding="utf-8"?>'.
'<methodResponse>'.
'<params>'.
'<param>'.
'<value>'.
'<struct>'.
'<member><name>categories</name><value><array><data><value><![CDATA[%s]]></value></data></array></value></member>'.
'<member><name>dateCreated</name><value><dateTime.iso8601>%s</dateTime.iso8601></value></member>'.
'<member><name>description</name><value><![CDATA[%s]]></value></member>'.
'<member><name>link</name><value>%s</value></member>'.
'<member><name>postid</name><value><string>%s</string></value></member>'.
'<member><name>title</name><value><![CDATA[%s]]></value></member>'.
'<member><name>publish</name><value><boolean>1</boolean></value></member>'.
'</struct>'.
'</value>'.
'</param>'.
'</params>'.
'</methodResponse>',
$category,
date("Ymd", $oDocument->getRegdateTime()).'T'.date("H:i:s", $oDocument->getRegdateTime()),
$oDocument->getContent(false, false, true,false),
getFullUrl('','document_srl', $oDocument->document_srl),
$oDocument->document_srl,
$oDocument->getTitleText()
);
printContent($content);
}
}
break;
// Write a new post
case 'metaWeblog.newPost' :
unset($obj);
$info = $params[3];
// Get information of post, title, and category
for($i=0;$i<count($info->value->struct->member);$i++) {
$val = $info->value->struct->member[$i];
switch($val->name->body) {
case 'title' :
$obj->title = $val->value->string->body;
break;
case 'description' :
$obj->content = $val->value->string->body;
break;
case 'categories' :
$categories = $val->value->array->data->value;
if(!is_array($categories)) $categories = array($categories);
$category = $categories[0]->string->body;
if($category && $category_list) {
foreach($category_list as $category_srl => $category_info) {
if($category_info->title == $category) $obj->category_srl = $category_srl;
}
}
break;
case 'tagwords' :
$tags = $val->value->array->data->value;
if(!is_array($tags)) $tags = array($tags);
for($j=0;$j<count($tags);$j++) {
$tag_list[] = $tags[$j]->string->body;
}
if(count($tag_list)) $obj->tags = implode(',',$tag_list);
break;
}
$content = getXmlRpcResponse($obj);
printContent($content);
break;
// Get posts
case 'metaWeblog.getPost' :
$document_srl = $params[0]->value->string->body;
if(!$document_srl) {
printContent( getXmlRpcFailure(1, 'no permission') );
} else {
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists() || !$oDocument->isGranted()) {
printContent( getXmlRpcFailure(1, 'no permission') );
} else {
// Get a list of categories and set Context
$category = "";
if($oDocument->get('category_srl')) {
$oDocumentModel = &getModel('document');
$category_list = $oDocumentModel->getCategoryList($oDocument->get('module_srl'));
if($category_list[$oDocument->get('category_srl')]) {
$category = $category_list[$oDocument->get('category_srl')]->title;
}
}
$content = sprintf(
'<?xml version="1.0" encoding="utf-8"?>'.
'<methodResponse>'.
'<params>'.
'<param>'.
'<value>'.
'<struct>'.
'<member><name>categories</name><value><array><data><value><![CDATA[%s]]></value></data></array></value></member>'.
'<member><name>dateCreated</name><value><dateTime.iso8601>%s</dateTime.iso8601></value></member>'.
'<member><name>description</name><value><![CDATA[%s]]></value></member>'.
'<member><name>link</name><value>%s</value></member>'.
'<member><name>postid</name><value><string>%s</string></value></member>'.
'<member><name>title</name><value><![CDATA[%s]]></value></member>'.
'<member><name>publish</name><value><boolean>1</boolean></value></member>'.
'</struct>'.
'</value>'.
'</param>'.
'</params>'.
'</methodResponse>',
$category,
date("Ymd", $oDocument->getRegdateTime()).'T'.date("H:i:s", $oDocument->getRegdateTime()),
$oDocument->getContent(false, false, true,false),
getFullUrl('','document_srl', $oDocument->document_srl),
$oDocument->document_srl,
$oDocument->getTitleText()
);
printContent($content);
}
}
break;
// Write a new post
case 'metaWeblog.newPost' :
unset($obj);
$info = $params[3];
// Get information of post, title, and category
for($i=0;$i<count($info->value->struct->member);$i++) {
$val = $info->value->struct->member[$i];
switch($val->name->body) {
case 'title' :
$obj->title = $val->value->string->body;
break;
case 'description' :
$obj->content = $val->value->string->body;
break;
case 'categories' :
$categories = $val->value->array->data->value;
if(!is_array($categories)) $categories = array($categories);
$category = $categories[0]->string->body;
if($category && $category_list) {
foreach($category_list as $category_srl => $category_info) {
if($category_info->title == $category) $obj->category_srl = $category_srl;
}
}
break;
case 'tagwords' :
$tags = $val->value->array->data->value;
if(!is_array($tags)) $tags = array($tags);
for($j=0;$j<count($tags);$j++) {
$tag_list[] = $tags[$j]->string->body;
}
if(count($tag_list)) $obj->tags = implode(',',$tag_list);
break;
}
}
// Set document srl
$document_srl = getNextSequence();
$obj->document_srl = $document_srl;
$obj->module_srl = $this->module_srl;
// Attachment
if(is_dir($tmp_uploaded_path)) {
$file_list = FileHandler::readDir($tmp_uploaded_path);
$file_count = count($file_list);
if($file_count) {
$oFileController = &getController('file');
for($i=0;$i<$file_count;$i++) {
$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
$file_info['name'] = $file_list[$i];
$oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
}
$obj->uploaded_count = $file_count;
}
}
}
// Set document srl
$document_srl = getNextSequence();
$obj->document_srl = $document_srl;
$obj->module_srl = $this->module_srl;
// Attachment
if(is_dir($tmp_uploaded_path)) {
$file_list = FileHandler::readDir($tmp_uploaded_path);
$file_count = count($file_list);
if($file_count) {
$oFileController = &getController('file');
for($i=0;$i<$file_count;$i++) {
$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
$file_info['name'] = $file_list[$i];
$oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
}
$obj->uploaded_count = $file_count;
}
}
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
$oDocumentController = &getController('document');
$obj->commentStatus = 'ALLOW';
$obj->allow_trackback = 'Y';
$output = $oDocumentController->insertDocument($obj);
$oDocumentController = &getController('document');
$obj->commentStatus = 'ALLOW';
$obj->allow_trackback = 'Y';
$output = $oDocumentController->insertDocument($obj);
if(!$output->toBool()) {
$content = getXmlRpcFailure(1, $output->getMessage());
} else {
$content = getXmlRpcResponse(strval($document_srl));
}
FileHandler::removeDir($tmp_uploaded_path);
if(!$output->toBool()) {
$content = getXmlRpcFailure(1, $output->getMessage());
} else {
$content = getXmlRpcResponse(strval($document_srl));
}
FileHandler::removeDir($tmp_uploaded_path);
printContent($content);
break;
// Edit post
case 'metaWeblog.editPost' :
$tmp_val = $params[0]->value->string->body;
if(!$tmp_val) $tmp_val = $params[0]->value->i4->body;
if(!$tmp_val) {
$content = getXmlRpcFailure(1, 'no permission');
break;
}
$tmp_arr = explode('/', $tmp_val);
$document_srl = array_pop($tmp_arr);
if(!$document_srl) {
$content = getXmlRpcFailure(1, 'no permission');
break;
}
printContent($content);
break;
// Edit post
case 'metaWeblog.editPost' :
$tmp_val = $params[0]->value->string->body;
if(!$tmp_val) $tmp_val = $params[0]->value->i4->body;
if(!$tmp_val) {
$content = getXmlRpcFailure(1, 'no permission');
break;
}
$tmp_arr = explode('/', $tmp_val);
$document_srl = array_pop($tmp_arr);
if(!$document_srl) {
$content = getXmlRpcFailure(1, 'no permission');
break;
}
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// Check if a permission to modify a document is granted
if(!$oDocument->isGranted()) {
$content = getXmlRpcFailure(1, 'no permission');
break;
}
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// Check if a permission to modify a document is granted
if(!$oDocument->isGranted()) {
$content = getXmlRpcFailure(1, 'no permission');
break;
}
$obj = $oDocument->getObjectVars();
$obj = $oDocument->getObjectVars();
$info = $params[3];
// Get information of post, title, and category
for($i=0;$i<count($info->value->struct->member);$i++) {
$val = $info->value->struct->member[$i];
switch($val->name->body) {
case 'title' :
$obj->title = $val->value->string->body;
break;
case 'description' :
$obj->content = $val->value->string->body;
break;
case 'categories' :
$categories = $val->value->array->data->value;
if(!is_array($categories)) $categories = array($categories);
$category = $categories[0]->string->body;
if($category && $category_list) {
foreach($category_list as $category_srl => $category_info) {
if($category_info->title == $category) $obj->category_srl = $category_srl;
}
}
break;
case 'tagwords' :
$tags = $val->value->array->data->value;
if(!is_array($tags)) $tags = array($tags);
for($j=0;$j<count($tags);$j++) {
$tag_list[] = $tags[$j]->string->body;
}
if(count($tag_list)) $obj->tags = implode(',',$tag_list);
break;
}
$info = $params[3];
// Get information of post, title, and category
for($i=0;$i<count($info->value->struct->member);$i++) {
$val = $info->value->struct->member[$i];
switch($val->name->body) {
case 'title' :
$obj->title = $val->value->string->body;
break;
case 'description' :
$obj->content = $val->value->string->body;
break;
case 'categories' :
$categories = $val->value->array->data->value;
if(!is_array($categories)) $categories = array($categories);
$category = $categories[0]->string->body;
if($category && $category_list) {
foreach($category_list as $category_srl => $category_info) {
if($category_info->title == $category) $obj->category_srl = $category_srl;
}
}
break;
case 'tagwords' :
$tags = $val->value->array->data->value;
if(!is_array($tags)) $tags = array($tags);
for($j=0;$j<count($tags);$j++) {
$tag_list[] = $tags[$j]->string->body;
}
if(count($tag_list)) $obj->tags = implode(',',$tag_list);
break;
}
}
// Document srl
$obj->document_srl = $document_srl;
$obj->module_srl = $this->module_srl;
// Attachment
if(is_dir($tmp_uploaded_path)) {
$file_list = FileHandler::readDir($tmp_uploaded_path);
$file_count = count($file_list);
if($file_count) {
$oFileController = &getController('file');
for($i=0;$i<$file_count;$i++) {
$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
$file_info['name'] = $file_list[$i];
}
// Document srl
$obj->document_srl = $document_srl;
$obj->module_srl = $this->module_srl;
// Attachment
if(is_dir($tmp_uploaded_path)) {
$file_list = FileHandler::readDir($tmp_uploaded_path);
$file_count = count($file_list);
if($file_count) {
$oFileController = &getController('file');
for($i=0;$i<$file_count;$i++) {
$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
$file_info['name'] = $file_list[$i];
$moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']);
if(file_exists($moved_filename)) continue;
$moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']);
if(file_exists($moved_filename)) continue;
$oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
}
$obj->uploaded_count += $file_count;
}
}
$oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
}
$obj->uploaded_count += $file_count;
}
}
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
$oDocumentController = &getController('document');
$output = $oDocumentController->updateDocument($oDocument,$obj);
$oDocumentController = &getController('document');
$output = $oDocumentController->updateDocument($oDocument,$obj);
if(!$output->toBool()) {
$content = getXmlRpcFailure(1, $output->getMessage());
} else {
$content = getXmlRpcResponse(true);
FileHandler::removeDir($tmp_uploaded_path);
}
if(!$output->toBool()) {
$content = getXmlRpcFailure(1, $output->getMessage());
} else {
$content = getXmlRpcResponse(true);
FileHandler::removeDir($tmp_uploaded_path);
}
printContent($content);
break;
// Delete the post
case 'blogger.deletePost' :
$tmp_val = $params[0]->value->string->body;
$tmp_arr = explode('/', $tmp_val);
$document_srl = array_pop($tmp_arr);
// Get a document
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// If the document exists
if(!$oDocument->isExists()) {
$content = getXmlRpcFailure(1, 'not exists');
// Check if a permission to delete a document is granted
} elseif(!$oDocument->isGranted()) {
$content = getXmlRpcFailure(1, 'no permission');
break;
// Delete
} else {
$oDocumentController = &getController('document');
$output = $oDocumentController->deleteDocument($document_srl);
if(!$output->toBool()) $content = getXmlRpcFailure(1, $output->getMessage());
else $content = getXmlRpcResponse(true);
}
printContent($content);
break;
// Delete the post
case 'blogger.deletePost' :
$tmp_val = $params[0]->value->string->body;
$tmp_arr = explode('/', $tmp_val);
$document_srl = array_pop($tmp_arr);
// Get a document
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// If the document exists
if(!$oDocument->isExists()) {
$content = getXmlRpcFailure(1, 'not exists');
// Check if a permission to delete a document is granted
} elseif(!$oDocument->isGranted()) {
$content = getXmlRpcFailure(1, 'no permission');
break;
// Delete
} else {
$oDocumentController = &getController('document');
$output = $oDocumentController->deleteDocument($document_srl);
if(!$output->toBool()) $content = getXmlRpcFailure(1, $output->getMessage());
else $content = getXmlRpcResponse(true);
}
printContent($content);
break;
// Get recent posts
case 'metaWeblog.getRecentPosts' :
// Options to get a list
$args->module_srl = $this->module_srl; // /< module_srl of the current module
$args->page = 1;
$args->list_count = 20;
$args->sort_index = 'list_order'; // /< Sorting values
$logged_info = Context::get('logged_info');
$args->search_target = 'member_srl';
$args->search_keyword = $logged_info->member_srl;
$output = $oDocumentModel->getDocumentList($args);
if(!$output->toBool() || !$output->data) {
$content = getXmlRpcFailure(1, 'post not founded');
printContent($content);
} else {
$oEditorController = &getController('editor');
printContent($content);
break;
// Get recent posts
case 'metaWeblog.getRecentPosts' :
// Options to get a list
$args->module_srl = $this->module_srl; // /< module_srl of the current module
$args->page = 1;
$args->list_count = 20;
$args->sort_index = 'list_order'; // /< Sorting values
$logged_info = Context::get('logged_info');
$args->search_target = 'member_srl';
$args->search_keyword = $logged_info->member_srl;
$output = $oDocumentModel->getDocumentList($args);
if(!$output->toBool() || !$output->data) {
$content = getXmlRpcFailure(1, 'post not founded');
printContent($content);
} else {
$oEditorController = &getController('editor');
$posts = array();
foreach($output->data as $key => $oDocument) {
$post = null;
$post->categories = array();
$post->dateCreated = date("Ymd", $oDocument->getRegdateTime()).'T'.date("H:i:s", $oDocument->getRegdateTime());
$post->description = htmlspecialchars($oEditorController->transComponent($oDocument->getContent(false,false,true,false)));
$post->link = $post->permaLink = getFullUrl('','document_srl',$oDocument->document_srl);
$post->postid = $oDocument->document_srl;
$post->title = htmlspecialchars($oDocument->get('title'));
$post->publish = 1;
$post->userid = $oDocument->get('user_id');
$post->mt_allow_pings = 0;
$post->mt_allow_comments = $oDocument->allowComment()?1:0;
$posts[] = $post;
}
$content = getXmlRpcResponse($posts);
printContent($content);
}
break;
// Display RSD if there is no request
default :
$homepagelink = getUrl('','mid',$this->mid);
$site_module_info = Context::get('site_module_info');
$api_url = getFullSiteUrl($site_module_info->domain, '', 'mid',$site_module_info->mid, 'act','api');
$content = <<<RSDContent
$posts = array();
foreach($output->data as $key => $oDocument) {
$post = null;
$post->categories = array();
$post->dateCreated = date("Ymd", $oDocument->getRegdateTime()).'T'.date("H:i:s", $oDocument->getRegdateTime());
$post->description = htmlspecialchars($oEditorController->transComponent($oDocument->getContent(false,false,true,false)));
$post->link = $post->permaLink = getFullUrl('','document_srl',$oDocument->document_srl);
$post->postid = $oDocument->document_srl;
$post->title = htmlspecialchars($oDocument->get('title'));
$post->publish = 1;
$post->userid = $oDocument->get('user_id');
$post->mt_allow_pings = 0;
$post->mt_allow_comments = $oDocument->allowComment()?1:0;
$posts[] = $post;
}
$content = getXmlRpcResponse($posts);
printContent($content);
}
break;
// Display RSD if there is no request
default :
$homepagelink = getUrl('','mid',$this->mid);
$site_module_info = Context::get('site_module_info');
$api_url = getFullSiteUrl($site_module_info->domain, '', 'mid',$site_module_info->mid, 'act','api');
$content = <<<RSDContent
<?xml version="1.0" ?>
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd" >
<service>
@ -429,8 +428,8 @@
</service>
</rsd>
RSDContent;
printContent($content);
break;
}
}
printContent($content);
break;
}
}
?>

View file

@ -1,5 +1,5 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file ./addons/blogapi/blogapi.func.php

View file

@ -1,14 +1,14 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file counter.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Counter add-on
**/
// Execute if called_position is before_display_content
if(Context::isInstalled() && $called_position == 'before_module_init' && Context::get('module')!='admin' && Context::getResponseMethod() == 'HTML') {
$oCounterController = &getController('counter');
$oCounterController->counterExecute();
}
/**
* @file counter.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Counter add-on
**/
// Execute if called_position is before_display_content
if(Context::isInstalled() && $called_position == 'before_module_init' && Context::get('module')!='admin' && Context::getResponseMethod() == 'HTML') {
$oCounterController = &getController('counter');
$oCounterController->counterExecute();
}
?>

View file

@ -1,72 +1,71 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file member_communication.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Promote user communication
*
* - Pop-up the message if new message comes in
* - When calling MemberModel::getMemberMenu, feature to send a message is added
* - When caliing MemberModel::getMemberMenu, feature to add a friend is added
**/
// Stop if non-logged-in user is
$logged_info = Context::get('logged_info');
if(!$logged_info) return;
/**
* @file member_communication.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Promote user communication
*
* - Pop-up the message if new message comes in
* - When calling MemberModel::getMemberMenu, feature to send a message is added
* - When caliing MemberModel::getMemberMenu, feature to add a friend is added
**/
// Stop if non-logged-in user is
$logged_info = Context::get('logged_info');
if(!$logged_info) return;
/**
* Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received
**/
if($called_position == 'before_module_init' && $this->module != 'member') {
// Load a language file from the communication module
Context::loadLang('./modules/communication/lang');
// Add menus on the member login information
$oMemberController = &getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
// Pop-up to display messages if a flag on new message is set
$flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl);
$flag_file = $flag_path.$logged_info->member_srl;
/**
* Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received
**/
if($called_position == 'before_module_init' && $this->module != 'member') {
// Load a language file from the communication module
Context::loadLang('./modules/communication/lang');
// Add menus on the member login information
$oMemberController = &getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
// Pop-up to display messages if a flag on new message is set
$flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl);
$flag_file = $flag_path.$logged_info->member_srl;
if(file_exists($flag_file)) {
$new_message_count = trim(FileHandler::readFile($flag_file));
FileHandler::removeFile($flag_file);
Context::loadLang('./addons/member_communication/lang');
Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true);
if(file_exists($flag_file)) {
$new_message_count = trim(FileHandler::readFile($flag_file));
FileHandler::removeFile($flag_file);
Context::loadLang('./addons/member_communication/lang');
Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true);
$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
$link = Context::getRequestUri().'?module=communication&act=dispCommunicationNewMessage';
$script = "<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>";
$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
$link = Context::getRequestUri().'?module=communication&act=dispCommunicationNewMessage';
$script = "<script type=\"text/javascript\">jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>";
Context::addHtmlFooter($script);
}
} elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') {
$oMemberController = &getController('member');
$member_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
// Creates communication model object
$oCommunicationModel = &getModel('communication');
// Add a feature to display own message box.
if($logged_info->member_srl == $member_srl) {
// Add your own viewing Note Template
$oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationMessages'), 'cmd_view_message_box', '', 'self');
// Display a list of friends
$oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationFriend'), 'cmd_view_friend', '', 'self');
// If not, Add menus to send message and to add friends
} else {
// Get member information
$oMemberModel = &getModel('member');
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
if(!$target_member_info->member_srl) return;
// Get logged-in user information
$logged_info = Context::get('logged_info');
// Add a menu for sending message
if( $logged_info->is_admin == 'Y' || $target_member_info->allow_message =='Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
$oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationSendMessage','receiver_srl',$member_srl), 'cmd_send_message', '', 'popup');
// Add a menu for listing friends (if a friend is new)
if(!$oCommunicationModel->isAddedFriend($member_srl))
$oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationAddFriend','target_srl',$member_srl), 'cmd_add_friend', '', 'popup');
}
}
Context::addHtmlFooter($script);
}
} elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') {
$oMemberController = &getController('member');
$member_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
// Creates communication model object
$oCommunicationModel = &getModel('communication');
// Add a feature to display own message box.
if($logged_info->member_srl == $member_srl) {
// Add your own viewing Note Template
$oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationMessages'), 'cmd_view_message_box', '', 'self');
// Display a list of friends
$oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationFriend'), 'cmd_view_friend', '', 'self');
// If not, Add menus to send message and to add friends
} else {
// Get member information
$oMemberModel = &getModel('member');
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
if(!$target_member_info->member_srl) return;
// Get logged-in user information
$logged_info = Context::get('logged_info');
// Add a menu for sending message
if( $logged_info->is_admin == 'Y' || $target_member_info->allow_message =='Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
$oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationSendMessage','receiver_srl',$member_srl), 'cmd_send_message', '', 'popup');
// Add a menu for listing friends (if a friend is new)
if(!$oCommunicationModel->isAddedFriend($member_srl))
$oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationAddFriend','target_srl',$member_srl), 'cmd_add_friend', '', 'popup');
}
}
?>

View file

@ -1,21 +1,21 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file image_name.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Display user image name/image mark
*
* Find member_srl in the part with <div class="member_회원번호"> .... </div>
* Check if ther is image name and image mark. Then change it.
**/
/**
* @file image_name.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Display user image name/image mark
*
* Find member_srl in the part with <div class="member_MemberSerialNumber"> .... </div>
* Check if ther is image name and image mark. Then change it.
**/
/**
* Just before displaying, change image name/ image mark
**/
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
// Include a file having functions to replace member image name/mark
require_once('./addons/member_extra_info/member_extra_info.lib.php');
// 1. Find a part <div class="member_번호"> content </div> in the output document, change it to image name/mark by using MemberController::transImageName()
$output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output);
/**
* Just before displaying, change image name/ image mark
**/
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
// Include a file having functions to replace member image name/mark
require_once('./addons/member_extra_info/member_extra_info.lib.php');
// 1. Find a part <div class="member_MemberSerialNumber"> content </div> in the output document, change it to image name/mark by using MemberController::transImageName()
$output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output);
?>

View file

@ -1,50 +1,50 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file mobile.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Mobile XE add-on
*
* If a mobile connection is made (see the header information), display contents with WAP tags
*
* Time to call
*
* before_module_proc > call when changing general settings for mobile
*
* after_module_proc > display mobile content
* Condition
**/
// Ignore admin page
if(Context::get('module')=='admin') return;
// Manage when to call it
if($called_position != 'before_module_proc' && $called_position != 'after_module_proc' ) return;
// Ignore if not mobile browser
require_once(_XE_PATH_.'addons/mobile/classes/mobile.class.php');
if(!mobileXE::getBrowserType()) return;
// Generate mobile instance
$oMobile = &mobileXE::getInstance();
if(!$oMobile) return;
// Specify charset on the add-on settings
$oMobile->setCharSet($addon_info->charset);
// Set module information
$oMobile->setModuleInfo($this->module_info);
// Register the current module object
$oMobile->setModuleInstance($this);
// Extract content and display/exit if navigate mode is or if WAP class exists
if($called_position == 'before_module_proc') {
/**
* @file mobile.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Mobile XE add-on
*
* If a mobile connection is made (see the header information), display contents with WAP tags
*
* Time to call
*
* before_module_proc > call when changing general settings for mobile
*
* after_module_proc > display mobile content
* Condition
**/
// Ignore admin page
if(Context::get('module')=='admin') return;
// Manage when to call it
if($called_position != 'before_module_proc' && $called_position != 'after_module_proc' ) return;
// Ignore if not mobile browser
require_once(_XE_PATH_.'addons/mobile/classes/mobile.class.php');
if(!mobileXE::getBrowserType()) return;
// Generate mobile instance
$oMobile = &mobileXE::getInstance();
if(!$oMobile) return;
// Specify charset on the add-on settings
$oMobile->setCharSet($addon_info->charset);
// Set module information
$oMobile->setModuleInfo($this->module_info);
// Register the current module object
$oMobile->setModuleInstance($this);
// Extract content and display/exit if navigate mode is or if WAP class exists
if($called_position == 'before_module_proc') {
if($oMobile->isLangChange()) {
$oMobile->setLangType();
$oMobile->displayLangSelect();
}
// On navigation mode, display navigation content
if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent();
// If you have a WAP class content output via WAP class
else $oMobile->displayModuleContent();
// If neither navigation mode nor WAP class is, display the module's result
} else if($called_position == 'after_module_proc') {
// Display
$oMobile->displayContent();
}
if($oMobile->isLangChange()) {
$oMobile->setLangType();
$oMobile->displayLangSelect();
}
// On navigation mode, display navigation content
if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent();
// If you have a WAP class content output via WAP class
else $oMobile->displayModuleContent();
// If neither navigation mode nor WAP class is, display the module's result
} else if($called_position == 'after_module_proc') {
// Display
$oMobile->displayContent();
}
?>

View file

@ -1,27 +1,27 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file openid_delegation_id.addon.php
* @author NHN (developers@xpressengine.com)
* @brief OpenID Delegation ID Add-on
*
* This enables to use openID as user's homepage or blog url.
* Enter your open ID service information on the configuration.
**/
// Execute only wen called_position is before_module_init
if($called_position != 'before_module_init') return;
// Get add-on settings(openid_delegation_id)
if(!$addon_info->server||!$addon_info->delegate||!$addon_info->xrds) return;
/**
* @file openid_delegation_id.addon.php
* @author NHN (developers@xpressengine.com)
* @brief OpenID Delegation ID Add-on
*
* This enables to use openID as user's homepage or blog url.
* Enter your open ID service information on the configuration.
**/
// Execute only wen called_position is before_module_init
if($called_position != 'before_module_init') return;
// Get add-on settings(openid_delegation_id)
if(!$addon_info->server||!$addon_info->delegate||!$addon_info->xrds) return;
$header_script = sprintf(
'<link rel="openid.server" href="%s" />'."\n".
'<link rel="openid.delegate" href="%s" />'."\n".
'<meta http-equiv="X-XRDS-Location" content="%s" />',
$addon_info->server,
$addon_info->delegate,
$addon_info->xrds
);
$header_script = sprintf(
'<link rel="openid.server" href="%s" />'."\n".
'<link rel="openid.delegate" href="%s" />'."\n".
'<meta http-equiv="X-XRDS-Location" content="%s" />',
$addon_info->server,
$addon_info->delegate,
$addon_info->xrds
);
Context::addHtmlHeader($header_script);
Context::addHtmlHeader($header_script);
?>

View file

@ -1,18 +1,18 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file point.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Icon-on-point level
*
* Display point level icon before user name when point system is enabled.
**/
// return unless before_display_content
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
/**
* @file point.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Icon-on-point level
*
* Display point level icon before user name when point system is enabled.
**/
// return unless before_display_content
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
require_once('./addons/point_level_icon/point_level_icon.lib.php');
require_once('./addons/point_level_icon/point_level_icon.lib.php');
$oPointController = &getController('point');
$output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output);
$oPointController = &getController('point');
$output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output);
?>

View file

@ -1,52 +1,52 @@
<?php
/**
* @brief Function to change point icon.
**/
function pointLevelIconTrans($matches) {
$member_srl = $matches[3];
if($member_srl<1) return $matches[0];
/**
* @brief Function to change point icon.
**/
function pointLevelIconTrans($matches) {
$member_srl = $matches[3];
if($member_srl<1) return $matches[0];
$orig_text = preg_replace('/'.preg_quote($matches[5],'/').'<\/'.$matches[6].'>$/', '', $matches[0]);
$orig_text = preg_replace('/'.preg_quote($matches[5],'/').'<\/'.$matches[6].'>$/', '', $matches[0]);
// Check Group Image Mark
$oMemberModel = &getModel('member');
if($oMemberModel->getGroupImageMark($member_srl)) return $orig_text.$matches[5].'</'.$matches[6].'>';
// Check Group Image Mark
$oMemberModel = &getModel('member');
if($oMemberModel->getGroupImageMark($member_srl)) return $orig_text.$matches[5].'</'.$matches[6].'>';
if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) {
// Get point configuration
if(!$GLOBALS['_pointConfig']) {
$oModuleModel = &getModel('module');
$GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
}
$config = $GLOBALS['_pointConfig'];
// Get point model
if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point');
$oPointModel = &$GLOBALS['_pointModel'];
// Get points
if(!$oPointModel->isExistsPoint($member_srl)) return $matches[0];
$point = $oPointModel->getPoint($member_srl);
// Get level
$level = $oPointModel->getLevel($point, $config->level_step);
$text = $matches[5];
// Get a path where level icon is
$level_icon = sprintf('%smodules/point/icons/%s/%d.gif', Context::getRequestUri(), $config->level_icon, $level);
// Get per to go to the next level if not a top level
if($level < $config->max_level) {
$next_point = $config->level_step[$level+1];
$present_point = $config->level_step[$level];
if($next_point > 0) {
$per = (int)(($point - $present_point) / ($next_point - $present_point)*100);
$per = $per.'%';
}
}
if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) {
// Get point configuration
if(!$GLOBALS['_pointConfig']) {
$oModuleModel = &getModel('module');
$GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
}
$config = $GLOBALS['_pointConfig'];
// Get point model
if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point');
$oPointModel = &$GLOBALS['_pointModel'];
// Get points
if(!$oPointModel->isExistsPoint($member_srl)) return $matches[0];
$point = $oPointModel->getPoint($member_srl);
// Get level
$level = $oPointModel->getLevel($point, $config->level_step);
$text = $matches[5];
// Get a path where level icon is
$level_icon = sprintf('%smodules/point/icons/%s/%d.gif', Context::getRequestUri(), $config->level_icon, $level);
// Get per to go to the next level if not a top level
if($level < $config->max_level) {
$next_point = $config->level_step[$level+1];
$present_point = $config->level_step[$level];
if($next_point > 0) {
$per = (int)(($point - $present_point) / ($next_point - $present_point)*100);
$per = $per.'%';
}
}
$title = sprintf('%s:%s%s%s, %s:%s/%s', Context::getLang('point'), $point, $config->point_name, $per?' ('.$per.')':'', Context::getLang('level'), $level, $config->max_level);
$alt = sprintf('[%s:%s]', Context::getLang('level'), $level);
$title = sprintf('%s:%s%s%s, %s:%s/%s', Context::getLang('point'), $point, $config->point_name, $per?' ('.$per.')':'', Context::getLang('level'), $level, $config->max_level);
$alt = sprintf('[%s:%s]', Context::getLang('level'), $level);
$GLOBALS['_pointLevelIcon'][$member_srl] = sprintf('<img src="%s" alt="%s" title="%s" style="vertical-align:middle; margin-right:3px;" />', $level_icon, $alt, $title);
}
$text = $GLOBALS['_pointLevelIcon'][$member_srl];
$GLOBALS['_pointLevelIcon'][$member_srl] = sprintf('<img src="%s" alt="%s" title="%s" style="vertical-align:middle; margin-right:3px;" />', $level_icon, $alt, $title);
}
$text = $GLOBALS['_pointLevelIcon'][$member_srl];
return $orig_text.$text.$matches[5].'</'.$matches[6].'>';
}
return $orig_text.$text.$matches[5].'</'.$matches[6].'>';
}
?>

View file

@ -1,18 +1,18 @@
<?php
if(!defined("__ZBXE__")) exit();
if(!defined('__XE__')) exit();
/**
* @file resize_image.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Add-on to resize images in the body
**/
/**
* @file resize_image.addon.php
* @author NHN (developers@xpressengine.com)
* @brief Add-on to resize images in the body
**/
if($called_position == 'after_module_proc' && Context::getResponseMethod()=="HTML") {
if(Mobile::isFromMobilePhone()) {
Context::loadFile('./addons/resize_image/css/resize_image.mobile.css', true);
} else {
Context::loadJavascriptPlugin('ui');
Context::loadFile(array('./addons/resize_image/js/resize_image.min.js', 'body', '', null), true);
}
}
if($called_position == 'after_module_proc' && Context::getResponseMethod()=="HTML") {
if(Mobile::isFromMobilePhone()) {
Context::loadFile('./addons/resize_image/css/resize_image.mobile.css', true);
} else {
Context::loadJavascriptPlugin('ui');
Context::loadFile(array('./addons/resize_image/js/resize_image.min.js', 'body', '', null), true);
}
}
?>