mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
issue 2119. supporting php 5.4.
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12682 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
005768c71e
commit
669c9a5948
14 changed files with 768 additions and 492 deletions
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file adminlogging.addon.php
|
||||
|
|
@ -7,12 +9,12 @@ if(!defined('__XE__')) exit();
|
|||
* @brief Automatic link add-on
|
||||
*/
|
||||
$logged_info = Context::get('logged_info');
|
||||
$act = Context::get('act');
|
||||
$kind = strpos(strtolower($act),'admin')!==false?'admin':'';
|
||||
$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 = getController('adminlogging');
|
||||
$oAdminloggingController->insertLog($this->module, $this->act);
|
||||
}
|
||||
/* End of file adminlogging.php */
|
||||
|
|
|
|||
|
|
@ -1,16 +1,19 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) 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")
|
||||
if($called_position == 'after_module_proc' && Context::getResponseMethod() != "XMLRPC")
|
||||
{
|
||||
if(Mobile::isFromMobilePhone()) {
|
||||
Context::addJsFile('./common/js/jquery.min.js',false, '',-1000000);
|
||||
Context::addJsFile('./common/js/xe.min.js',false, '',-1000000);
|
||||
if(Mobile::isFromMobilePhone())
|
||||
{
|
||||
Context::addJsFile('./common/js/jquery.min.js', false, '', -1000000);
|
||||
Context::addJsFile('./common/js/xe.min.js', false, '', -1000000);
|
||||
}
|
||||
Context::loadFile(array('./addons/autolink/autolink.js', 'body', '', null), true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file blogapicounter.addon.php
|
||||
|
|
@ -8,17 +10,22 @@ if(!defined('__XE__')) exit();
|
|||
*
|
||||
* 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') {
|
||||
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');
|
||||
$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.'" />');
|
||||
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;
|
||||
if($_REQUEST['act'] != 'api')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Read func file
|
||||
require_once('./addons/blogapi/blogapi.func.php');
|
||||
// xmlprc parsing
|
||||
|
|
@ -28,397 +35,483 @@ $xmlDoc = $oXmlParser->parse();
|
|||
|
||||
$method_name = $xmlDoc->methodcall->methodname->body;
|
||||
$params = $xmlDoc->methodcall->params->param;
|
||||
if($params && !is_array($params)) $params = array($params);
|
||||
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'))) {
|
||||
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);
|
||||
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') {
|
||||
if($called_position == 'before_module_init')
|
||||
{
|
||||
// Attempt log-in by using member controller
|
||||
if($user_id && $password) {
|
||||
$oMemberController = &getController('member');
|
||||
if($user_id && $password)
|
||||
{
|
||||
$oMemberController = getController('member');
|
||||
$output = $oMemberController->doLogin($user_id, $password);
|
||||
// If login fails, an error message appears
|
||||
if(!$output->toBool()) {
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$content = getXmlRpcFailure(1, $output->getMessage());
|
||||
printContent($content);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
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') {
|
||||
if($called_position == 'before_module_proc')
|
||||
{
|
||||
// Check writing permission
|
||||
if(!$this->grant->write_document) {
|
||||
printContent( getXmlRpcFailure(1, 'no permission') );
|
||||
if(!$this->grant->write_document)
|
||||
{
|
||||
printContent(getXmlRpcFailure(1, 'no permission'));
|
||||
}
|
||||
// Get information of the categories
|
||||
$oDocumentModel = &getModel('document');
|
||||
$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) {
|
||||
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);
|
||||
$obj = new stdClass();
|
||||
$obj->url = getFullSiteUrl('');
|
||||
$obj->blogid = $this->mid;
|
||||
$obj->blogName = $this->module_info->browser_title;
|
||||
$blog_list = array($obj);
|
||||
|
||||
$content = getXmlRpcResponse($blog_list);
|
||||
printContent($content);
|
||||
$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;
|
||||
}
|
||||
$category_obj_list = array();
|
||||
if($category_list)
|
||||
{
|
||||
foreach($category_list as $category_srl => $category_info)
|
||||
{
|
||||
$obj = new stdClass();
|
||||
$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);
|
||||
$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;
|
||||
}
|
||||
// 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') );
|
||||
}
|
||||
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 = new stdClass();
|
||||
$obj->url = Context::getRequestUri() . $target_filename;
|
||||
|
||||
$content = getXmlRpcResponse($obj);
|
||||
printContent($content);
|
||||
$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);
|
||||
}
|
||||
$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];
|
||||
$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
|
||||
$uploaded_filename = $fileOutput->get('uploaded_filename');
|
||||
$source_filename = $fileOutput->get('source_filename');
|
||||
$obj->content = str_replace($uploaded_target_path . $source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $uploaded_filename), $obj->content);
|
||||
$obj = new stdClass();
|
||||
$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;
|
||||
}
|
||||
}
|
||||
$obj->uploaded_count = $file_count;
|
||||
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];
|
||||
$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
|
||||
$uploaded_filename = $fileOutput->get('uploaded_filename');
|
||||
$source_filename = $fileOutput->get('source_filename');
|
||||
$obj->content = str_replace($uploaded_target_path . $source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl, 3), $uploaded_filename), $obj->content);
|
||||
}
|
||||
$obj->uploaded_count = $file_count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$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);
|
||||
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;
|
||||
}
|
||||
$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;
|
||||
}
|
||||
|
||||
}
|
||||
// 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;
|
||||
|
||||
$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
|
||||
$uploaded_filename = $fileOutput->get('uploaded_filename');
|
||||
$source_filename = $fileOutput->get('source_filename');
|
||||
$obj->content = str_replace($uploaded_target_path . $source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $uploaded_filename), $obj->content);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
$obj->uploaded_count += $file_count;
|
||||
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];
|
||||
|
||||
$moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']);
|
||||
if(file_exists($moved_filename))
|
||||
continue;
|
||||
|
||||
$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
|
||||
$uploaded_filename = $fileOutput->get('uploaded_filename');
|
||||
$source_filename = $fileOutput->get('source_filename');
|
||||
$obj->content = str_replace($uploaded_target_path . $source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl, 3), $uploaded_filename), $obj->content);
|
||||
}
|
||||
$obj->uploaded_count += $file_count;
|
||||
}
|
||||
}
|
||||
|
||||
$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);
|
||||
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');
|
||||
$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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$oDocumentController = getController('document');
|
||||
$output = $oDocumentController->deleteDocument($document_srl);
|
||||
if(!$output->toBool())
|
||||
$content = getXmlRpcFailure(1, $output->getMessage());
|
||||
else
|
||||
$content = getXmlRpcResponse(true);
|
||||
}
|
||||
|
||||
printContent($content);
|
||||
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');
|
||||
// Options to get a list
|
||||
$args = new stdClass();
|
||||
$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);
|
||||
$posts = array();
|
||||
foreach($output->data as $key => $oDocument)
|
||||
{
|
||||
$post = new stdClass();
|
||||
$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
|
||||
$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>
|
||||
|
|
@ -431,7 +524,7 @@ if($called_position == 'before_module_proc') {
|
|||
</service>
|
||||
</rsd>
|
||||
RSDContent;
|
||||
printContent($content);
|
||||
printContent($content);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,26 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file ./addons/blogapi/blogapi.func.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Function collections for the implementation of blogapi
|
||||
**/
|
||||
|
||||
* */
|
||||
// Error messages
|
||||
function getXmlRpcFailure($error, $message)
|
||||
{
|
||||
return
|
||||
sprintf(
|
||||
"<methodResponse>\n<fault><value><struct>\n<member>\n<name>faultCode</name>\n<value><int>%d</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>%s</string></value>\n</member>\n</struct></value></fault>\n</methodResponse>\n",
|
||||
$error,
|
||||
htmlspecialchars($message)
|
||||
);
|
||||
return
|
||||
sprintf(
|
||||
"<methodResponse>\n<fault><value><struct>\n<member>\n<name>faultCode</name>\n<value><int>%d</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>%s</string></value>\n</member>\n</struct></value></fault>\n</methodResponse>\n", $error, htmlspecialchars($message)
|
||||
);
|
||||
}
|
||||
|
||||
// Display results
|
||||
function getXmlRpcResponse($params)
|
||||
{
|
||||
$buff = '<?xml version="1.0" encoding="utf-8"?>'."\n<methodResponse><params>";
|
||||
$buff = '<?xml version="1.0" encoding="utf-8"?>' . "\n<methodResponse><params>";
|
||||
$buff .= _getEncodedVal($params);
|
||||
$buff .= "</params>\n</methodResponse>\n";
|
||||
|
||||
|
|
@ -31,16 +30,29 @@ function getXmlRpcResponse($params)
|
|||
// Encoding
|
||||
function _getEncodedVal($val, $is_sub_set = false)
|
||||
{
|
||||
if(is_int($val)) $buff = sprintf("<value><i4>%d</i4></value>", $val);
|
||||
elseif(is_string($val)&&preg_match('/^([0-9]+)T([0-9\:]+)$/', $val)) $buff = sprintf("<value><dateTime.iso8601>%s</dateTime.iso8601></value>\n", $val);
|
||||
elseif(is_double($val)) $buff = sprintf("<value><double>%f</double></value>", $val);
|
||||
elseif(is_bool($val)) $buff = sprintf("<value><boolean>%d</boolean></value>", $val?1:0);
|
||||
if(is_int($val))
|
||||
{
|
||||
$buff = sprintf("<value><i4>%d</i4></value>", $val);
|
||||
}
|
||||
elseif(is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val))
|
||||
{
|
||||
$buff = sprintf("<value><dateTime.iso8601>%s</dateTime.iso8601></value>\n", $val);
|
||||
}
|
||||
elseif(is_double($val))
|
||||
{
|
||||
$buff = sprintf("<value><double>%f</double></value>", $val);
|
||||
}
|
||||
elseif(is_bool($val))
|
||||
{
|
||||
$buff = sprintf("<value><boolean>%d</boolean></value>", $val ? 1 : 0);
|
||||
}
|
||||
elseif(is_object($val))
|
||||
{
|
||||
$values = get_object_vars($val);
|
||||
$val_count = count($values);
|
||||
$buff = "<value><struct>";
|
||||
foreach($values as $k => $v) {
|
||||
foreach($values as $k => $v)
|
||||
{
|
||||
$buff .= sprintf("<member>\n<name>%s</name>\n%s</member>\n", htmlspecialchars($k), _getEncodedVal($v, true));
|
||||
}
|
||||
$buff .= "</struct></value>\n";
|
||||
|
|
@ -49,7 +61,8 @@ function _getEncodedVal($val, $is_sub_set = false)
|
|||
{
|
||||
$val_count = count($val);
|
||||
$buff = "<value><array>\n<data>";
|
||||
for($i=0;$i<$val_count;$i++) {
|
||||
for($i = 0; $i < $val_count; $i++)
|
||||
{
|
||||
$buff .= _getEncodedVal($val[$i], true);
|
||||
}
|
||||
$buff .= "</data>\n</array></value>";
|
||||
|
|
@ -58,7 +71,10 @@ function _getEncodedVal($val, $is_sub_set = false)
|
|||
{
|
||||
$buff = sprintf("<value><string>%s</string></value>\n", $val);
|
||||
}
|
||||
if(!$is_sub_set) return sprintf("<param>\n%s</param>", $buff);
|
||||
if(!$is_sub_set)
|
||||
{
|
||||
return sprintf("<param>\n%s</param>", $buff);
|
||||
}
|
||||
return $buff;
|
||||
}
|
||||
|
||||
|
|
@ -75,5 +91,6 @@ function printContent($content)
|
|||
Context::close();
|
||||
exit();
|
||||
}
|
||||
|
||||
/* End of file blogapi.func.php */
|
||||
/* Location: ./addons/blogapi/blogapi.func.php */
|
||||
|
|
|
|||
|
|
@ -1,20 +1,23 @@
|
|||
<?php
|
||||
if(!defined("__ZBXE__")) exit();
|
||||
|
||||
if(!defined("__ZBXE__"))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file captcha.addon.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Captcha for a particular action
|
||||
* English alphabets and voice verification added
|
||||
**/
|
||||
|
||||
* */
|
||||
if(!class_exists('AddonCaptcha'))
|
||||
{
|
||||
// On the mobile mode, XE Core does not load jquery and xe.js as normal.
|
||||
Context::loadFile(array('./common/js/jquery.min.js','head', NULL,-100000),true);
|
||||
Context::loadFile(array('./common/js/xe.min.js','head', NULL,-100000),true);
|
||||
Context::loadFile(array('./common/js/jquery.min.js', 'head', NULL, -100000), true);
|
||||
Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true);
|
||||
|
||||
class AddonCaptcha
|
||||
{
|
||||
|
||||
var $addon_info;
|
||||
|
||||
function setInfo(&$addon_info)
|
||||
|
|
@ -33,19 +36,40 @@ if(!class_exists('AddonCaptcha'))
|
|||
function before_module_init(&$ModuleHandler)
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) return false;
|
||||
if($this->addon_info->target != 'all' && Context::get('is_logged')) return false;
|
||||
if($_SESSION['XE_VALIDATOR_ERROR'] == -1) $_SESSION['captcha_authed'] = false;
|
||||
if($_SESSION['captcha_authed']) return false;
|
||||
if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if($this->addon_info->target != 'all' && Context::get('is_logged'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if($_SESSION['XE_VALIDATOR_ERROR'] == -1)
|
||||
{
|
||||
$_SESSION['captcha_authed'] = false;
|
||||
}
|
||||
if($_SESSION['captcha_authed'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$type = Context::get('captchaType');
|
||||
|
||||
$target_acts = array('procBoardInsertDocument','procBoardInsertComment','procIssuetrackerInsertIssue','procIssuetrackerInsertHistory','procTextyleInsertComment');
|
||||
if($this->addon_info->apply_find_account=='apply') $target_acts[] = 'procMemberFindAccount';
|
||||
if($this->addon_info->apply_resend_auth_mail=='apply') $target_acts[] = 'procMemberResendAuthMail';
|
||||
if($this->addon_info->apply_signup=='apply') $target_acts[] = 'procMemberInsert';
|
||||
$target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment');
|
||||
if($this->addon_info->apply_find_account == 'apply')
|
||||
{
|
||||
$target_acts[] = 'procMemberFindAccount';
|
||||
}
|
||||
if($this->addon_info->apply_resend_auth_mail == 'apply')
|
||||
{
|
||||
$target_acts[] = 'procMemberResendAuthMail';
|
||||
}
|
||||
if($this->addon_info->apply_signup == 'apply')
|
||||
{
|
||||
$target_acts[] = 'procMemberInsert';
|
||||
}
|
||||
|
||||
if(Context::getRequestMethod()!='XMLRPC' && Context::getRequestMethod()!=='JSON')
|
||||
if(Context::getRequestMethod() != 'XMLRPC' && Context::getRequestMethod() !== 'JSON')
|
||||
{
|
||||
if($type == 'inline')
|
||||
{
|
||||
|
|
@ -53,7 +77,7 @@ if(!class_exists('AddonCaptcha'))
|
|||
{
|
||||
Context::loadLang('./addons/captcha/lang');
|
||||
$_SESSION['XE_VALIDATOR_ERROR'] = -1;
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied');;
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE'] = Context::getLang('captcha_denied');
|
||||
$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = 'error';
|
||||
$_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url');
|
||||
$ModuleHandler->_setInputValueToSession();
|
||||
|
|
@ -61,7 +85,7 @@ if(!class_exists('AddonCaptcha'))
|
|||
}
|
||||
else
|
||||
{
|
||||
Context::addHtmlHeader('<script> var captchaTargetAct = new Array("'.implode('","',$target_acts).'"); </script>');
|
||||
Context::addHtmlHeader('<script> var captchaTargetAct = new Array("' . implode('","', $target_acts) . '"); </script>');
|
||||
Context::loadFile(array('./addons/captcha/captcha.min.js', 'body', '', null), true);
|
||||
}
|
||||
}
|
||||
|
|
@ -79,22 +103,26 @@ if(!class_exists('AddonCaptcha'))
|
|||
function createKeyword()
|
||||
{
|
||||
$type = Context::get('captchaType');
|
||||
if ($type == 'inline' && $_SESSION['captcha_keyword']) return;
|
||||
if($type == 'inline' && $_SESSION['captcha_keyword'])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$arr = range('A','Y');
|
||||
$arr = range('A', 'Y');
|
||||
shuffle($arr);
|
||||
$arr = array_slice($arr,0,6);
|
||||
$arr = array_slice($arr, 0, 6);
|
||||
$_SESSION['captcha_keyword'] = join('', $arr);
|
||||
}
|
||||
|
||||
function before_module_init_setCaptchaSession()
|
||||
{
|
||||
if($_SESSION['captcha_authed']) return false;
|
||||
if($_SESSION['captcha_authed'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Load language files
|
||||
|
||||
Context::loadLang(_XE_PATH_.'addons/captcha/lang');
|
||||
Context::loadLang(_XE_PATH_ . 'addons/captcha/lang');
|
||||
// Generate keywords
|
||||
|
||||
$this->createKeyword();
|
||||
|
||||
$target = Context::getLang('target_captcha');
|
||||
|
|
@ -105,20 +133,26 @@ if(!class_exists('AddonCaptcha'))
|
|||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
printf("<response>\r\n <error>0</error>\r\n <message>success</message>\r\n <about_captcha><![CDATA[%s]]></about_captcha>\r\n <captcha_reload><![CDATA[%s]]></captcha_reload>\r\n <captcha_play><![CDATA[%s]]></captcha_play>\r\n <cmd_input><![CDATA[%s]]></cmd_input>\r\n <cmd_cancel><![CDATA[%s]]></cmd_cancel>\r\n </response>"
|
||||
,Context::getLang('about_captcha')
|
||||
,Context::getLang('captcha_reload')
|
||||
,Context::getLang('captcha_play')
|
||||
,Context::getLang('cmd_input')
|
||||
,Context::getLang('cmd_cancel')
|
||||
);
|
||||
, Context::getLang('about_captcha')
|
||||
, Context::getLang('captcha_reload')
|
||||
, Context::getLang('captcha_play')
|
||||
, Context::getLang('cmd_input')
|
||||
, Context::getLang('cmd_cancel')
|
||||
);
|
||||
Context::close();
|
||||
exit();
|
||||
}
|
||||
|
||||
function before_module_init_captchaImage()
|
||||
{
|
||||
if($_SESSION['captcha_authed']) return false;
|
||||
if(Context::get('renew')) $this->createKeyword();
|
||||
if($_SESSION['captcha_authed'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if(Context::get('renew'))
|
||||
{
|
||||
$this->createKeyword();
|
||||
}
|
||||
|
||||
$keyword = $_SESSION['captcha_keyword'];
|
||||
$im = $this->createCaptchaImage($keyword);
|
||||
|
|
@ -137,85 +171,99 @@ if(!class_exists('AddonCaptcha'))
|
|||
function createCaptchaImage($string)
|
||||
{
|
||||
$arr = array();
|
||||
for($i=0,$c=strlen($string);$i<$c;$i++) $arr[] = $string{$i};
|
||||
// Font site
|
||||
for($i = 0, $c = strlen($string); $i < $c; $i++)
|
||||
{
|
||||
$arr[] = $string{$i};
|
||||
}
|
||||
|
||||
// Font site
|
||||
$w = 18;
|
||||
$h = 25;
|
||||
|
||||
// Character length
|
||||
|
||||
$c = count($arr);
|
||||
|
||||
// Character image
|
||||
|
||||
$im = array();
|
||||
|
||||
// Create an image by total size
|
||||
$im[] = imagecreate(($w + 2) * count($arr), $h);
|
||||
|
||||
$im[] = imagecreate(($w+2)*count($arr), $h);
|
||||
|
||||
$deg = range(-30,30);
|
||||
$deg = range(-30, 30);
|
||||
shuffle($deg);
|
||||
// Create an image for each letter
|
||||
|
||||
// Create an image for each letter
|
||||
foreach($arr as $i => $str)
|
||||
{
|
||||
$im[$i+1] = @imagecreate($w, $h);
|
||||
$background_color = imagecolorallocate($im[$i+1], 255, 255, 255);
|
||||
$text_color = imagecolorallocate($im[$i+1], 0, 0, 0);
|
||||
// Control font size
|
||||
$im[$i + 1] = @imagecreate($w, $h);
|
||||
$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
|
||||
$text_color = imagecolorallocate($im[$i + 1], 0, 0, 0);
|
||||
|
||||
$ran = range(1,20);
|
||||
// Control font size
|
||||
$ran = range(1, 20);
|
||||
shuffle($ran);
|
||||
|
||||
if(function_exists('imagerotate'))
|
||||
{
|
||||
imagestring($im[$i+1], (array_pop($ran)%3)+3, 2, (array_pop($ran)%8), $str, $text_color);
|
||||
$im[$i+1] = imagerotate($im[$i+1], array_pop($deg), 0);
|
||||
imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 8), $str, $text_color);
|
||||
$im[$i + 1] = imagerotate($im[$i + 1], array_pop($deg), 0);
|
||||
|
||||
$background_color = imagecolorallocate($im[$i+1], 255, 255, 255);
|
||||
imagecolortransparent($im[$i+1], $background_color);
|
||||
$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
|
||||
imagecolortransparent($im[$i + 1], $background_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
imagestring($im[$i+1], (array_pop($ran)%3)+3, 2, (array_pop($ran)%4), $str, $text_color);
|
||||
imagestring($im[$i + 1], (array_pop($ran) % 3) + 3, 2, (array_pop($ran) % 4), $str, $text_color);
|
||||
}
|
||||
}
|
||||
|
||||
// Combine images of each character
|
||||
|
||||
for($i=1;$i<count($im);$i++)
|
||||
for($i = 1; $i < count($im); $i++)
|
||||
{
|
||||
imagecopy($im[0],$im[$i],(($w+2)*($i-1)),0,0,0,$w,$h);
|
||||
imagecopy($im[0], $im[$i], (($w + 2) * ($i - 1)), 0, 0, 0, $w, $h);
|
||||
imagedestroy($im[$i]);
|
||||
}
|
||||
// Larger image
|
||||
|
||||
// Larger image
|
||||
$big_count = 2;
|
||||
$big = imagecreatetruecolor(($w+2)*$big_count*$c, $h*$big_count);
|
||||
imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w+2)*$big_count*$c, $h*$big_count, ($w+2)*$c, $h);
|
||||
$big = imagecreatetruecolor(($w + 2) * $big_count * $c, $h * $big_count);
|
||||
imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h);
|
||||
imagedestroy($im[0]);
|
||||
|
||||
if(function_exists('imageantialias')) imageantialias($big,true);
|
||||
// Background line
|
||||
if(function_exists('imageantialias'))
|
||||
{
|
||||
imageantialias($big, true);
|
||||
}
|
||||
|
||||
// Background line
|
||||
$line_color = imagecolorallocate($big, 0, 0, 0);
|
||||
|
||||
$w = ($w+2)*$big_count*$c;
|
||||
$h = $h*$big_count;
|
||||
$w = ($w + 2) * $big_count * $c;
|
||||
$h = $h * $big_count;
|
||||
$d = array_pop($deg);
|
||||
|
||||
for($i=-abs($d);$i<$h+abs($d);$i=$i+7) imageline($big,0,$i+$d,$w,$i,$line_color);
|
||||
for($i = -abs($d); $i < $h + abs($d); $i = $i + 7)
|
||||
{
|
||||
imageline($big, 0, $i + $d, $w, $i, $line_color);
|
||||
}
|
||||
|
||||
$x = range(0,($w-10));
|
||||
$x = range(0, ($w - 10));
|
||||
shuffle($x);
|
||||
|
||||
for($i=0;$i<200;$i++) imagesetpixel($big,$x[$i]%$w,$x[$i+1]%$h,$line_color);
|
||||
for($i = 0; $i < 200; $i++)
|
||||
{
|
||||
imagesetpixel($big, $x[$i] % $w, $x[$i + 1] % $h, $line_color);
|
||||
}
|
||||
|
||||
return $big;
|
||||
}
|
||||
|
||||
function before_module_init_captchaAudio()
|
||||
{
|
||||
if($_SESSION['captcha_authed']) return false;
|
||||
if($_SESSION['captcha_authed'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$keyword = strtoupper($_SESSION['captcha_keyword']);
|
||||
$data = $this->createCaptchaAudio($keyword);
|
||||
|
|
@ -236,18 +284,21 @@ if(!class_exists('AddonCaptcha'))
|
|||
{
|
||||
$data = '';
|
||||
$_audio = './addons/captcha/audio/F_%s.mp3';
|
||||
for($i=0,$c=strlen($string);$i<$c;$i++)
|
||||
for($i = 0, $c = strlen($string); $i < $c; $i++)
|
||||
{
|
||||
$_data = FileHandler::readFile(sprintf($_audio, $string{$i}));
|
||||
|
||||
$start = rand(5, 68); // Random start in 4-byte header and 64 byte data
|
||||
$datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes
|
||||
|
||||
for($j=$start;$j<$datalen;$j+=64)
|
||||
for($j = $start; $j < $datalen; $j+=64)
|
||||
{
|
||||
$ch = ord($_data{$j});
|
||||
if($ch<9 || $ch>119) continue;
|
||||
$_data{$j} = chr($ch+rand(-8,8));
|
||||
if($ch < 9 || $ch > 119)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$_data{$j} = chr($ch + rand(-8, 8));
|
||||
}
|
||||
|
||||
$data .= $_data;
|
||||
|
|
@ -258,7 +309,10 @@ if(!class_exists('AddonCaptcha'))
|
|||
|
||||
function compareCaptcha()
|
||||
{
|
||||
if($_SESSION['captcha_authed']) return true;
|
||||
if($_SESSION['captcha_authed'])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text')))
|
||||
{
|
||||
|
|
@ -295,13 +349,13 @@ if(!class_exists('AddonCaptcha'))
|
|||
unset($_SESSION['captcha_authed']);
|
||||
$this->createKeyword();
|
||||
|
||||
$swfURL = getUrl().'addons/captcha/swf/play.swf';
|
||||
$swfURL = getUrl() . 'addons/captcha/swf/play.swf';
|
||||
Context::unloadFile('./addons/captcha/captcha.min.js');
|
||||
Context::loadFile(array('./addons/captcha/inline_captcha.js','body'));
|
||||
Context::loadFile(array('./addons/captcha/inline_captcha.js', 'body'));
|
||||
|
||||
global $lang;
|
||||
|
||||
$tags=<<<EOD
|
||||
$tags = <<<EOD
|
||||
<img src="%s" id="captcha_image" alt="CAPTCHA" width="240" height="50" style="width:240px; height:50px; border:1px solid #b0b0b0" />
|
||||
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="0" height="0" id="captcha_audio" align="middle">
|
||||
<param name="allowScriptAccess" value="always" />
|
||||
|
|
@ -317,15 +371,15 @@ if(!class_exists('AddonCaptcha'))
|
|||
<input type="hidden" name="captchaType" value="inline" />
|
||||
<input name="secret_text" type="text" id="secret_text" />
|
||||
EOD;
|
||||
$tags = sprintf($tags, getUrl('captcha_action','captchaImage', 'rand', mt_rand(10000, 99999))
|
||||
, $swfURL
|
||||
, $swfURL
|
||||
, $lang->reload
|
||||
, $lang->play);
|
||||
$tags = sprintf($tags, getUrl('captcha_action', 'captchaImage', 'rand', mt_rand(10000, 99999))
|
||||
, $swfURL
|
||||
, $swfURL
|
||||
, $lang->reload
|
||||
, $lang->play);
|
||||
return $tags;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$GLOBALS['__AddonCaptcha__'] = new AddonCaptcha;
|
||||
$GLOBALS['__AddonCaptcha__']->setInfo($addon_info);
|
||||
Context::set('oCaptcha', $GLOBALS['__AddonCaptcha__']);
|
||||
|
|
@ -342,9 +396,9 @@ if(method_exists($oAddonCaptcha, $called_position))
|
|||
}
|
||||
|
||||
$addon_act = Context::get('captcha_action');
|
||||
if($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act))
|
||||
if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act))
|
||||
{
|
||||
if(!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this)))
|
||||
if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file counter.addon.php
|
||||
|
|
@ -7,9 +9,9 @@ if(!defined('__XE__')) exit();
|
|||
* @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')
|
||||
if(Context::isInstalled() && $called_position == 'before_module_init' && Context::get('module') != 'admin' && Context::getResponseMethod() == 'HTML')
|
||||
{
|
||||
$oCounterController = &getController('counter');
|
||||
$oCounterController = getController('counter');
|
||||
$oCounterController->counterExecute();
|
||||
}
|
||||
/* End of file counter.addon.php */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file member_communication.addon.php
|
||||
|
|
@ -12,22 +14,25 @@ if(!defined('__XE__')) exit();
|
|||
*/
|
||||
// Stop if non-logged-in user is
|
||||
$logged_info = Context::get('logged_info');
|
||||
if(!$logged_info) return;
|
||||
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 = 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;
|
||||
$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) && $addon_info->use_alarm != 'N')
|
||||
{
|
||||
|
|
@ -36,8 +41,8 @@ if($called_position == 'before_module_init' && $this->module != 'member')
|
|||
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';
|
||||
$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);
|
||||
|
|
@ -45,34 +50,38 @@ if($called_position == 'before_module_init' && $this->module != 'member')
|
|||
}
|
||||
elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu')
|
||||
{
|
||||
$oMemberController = &getController('member');
|
||||
$oMemberController = getController('member');
|
||||
$member_srl = Context::get('target_srl');
|
||||
$mid = Context::get('cur_mid');
|
||||
// Creates communication model object
|
||||
$oCommunicationModel = &getModel('communication');
|
||||
$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');
|
||||
$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');
|
||||
$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');
|
||||
$oMemberModel = getModel('member');
|
||||
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
|
||||
if(!$target_member_info->member_srl) return;
|
||||
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');
|
||||
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');
|
||||
$oMemberController->addMemberPopupMenu(getUrl('', 'module', 'communication', 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
|
||||
}
|
||||
}
|
||||
/* End of file member_communication.addon.php */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file image_name.addon.php
|
||||
|
|
@ -9,16 +11,21 @@ if(!defined('__XE__')) exit();
|
|||
* 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;
|
||||
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()
|
||||
$temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output);
|
||||
if($temp_output) $output = $temp_output;
|
||||
if($temp_output)
|
||||
{
|
||||
$output = $temp_output;
|
||||
}
|
||||
unset($temp_output);
|
||||
|
||||
/* End of file member_extra_info.addon.php */
|
||||
|
|
|
|||
|
|
@ -1,16 +1,23 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @brief If member_srl exists in the div or span, replace to image name or nick image for each member_srl
|
||||
**/
|
||||
* */
|
||||
function memberTransImageName($matches)
|
||||
{
|
||||
// If member_srl < 0, then return text only in the body
|
||||
$member_srl = $matches[3];
|
||||
if($member_srl<0) return $matches[5];
|
||||
if($member_srl < 0)
|
||||
{
|
||||
return $matches[5];
|
||||
}
|
||||
// If member_srl=o(not a member), return the entire body
|
||||
if(!$member_srl) return $matches[0];
|
||||
if(!$member_srl)
|
||||
{
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
$oMemberModel = &getModel('member');
|
||||
$oMemberModel = getModel('member');
|
||||
$nick_name = $matches[5];
|
||||
|
||||
// If pre-defined data in the global variablesm return it
|
||||
|
|
@ -19,13 +26,25 @@ function memberTransImageName($matches)
|
|||
$GLOBALS['_transImageNameList'][$member_srl]->cached = true;
|
||||
$image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl);
|
||||
$image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl);
|
||||
if(file_exists($image_name_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_name_file = $image_name_file;
|
||||
else $image_name_file = '';
|
||||
if(file_exists($image_mark_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file = $image_mark_file;
|
||||
else $image_mark_file = '';
|
||||
if(file_exists($image_name_file))
|
||||
{
|
||||
$GLOBALS['_transImageNameList'][$member_srl]->image_name_file = $image_name_file;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_name_file = '';
|
||||
}
|
||||
if(file_exists($image_mark_file))
|
||||
{
|
||||
$GLOBALS['_transImageNameList'][$member_srl]->image_mark_file = $image_mark_file;
|
||||
}
|
||||
else
|
||||
{
|
||||
$image_mark_file = '';
|
||||
}
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$group_image = $oMemberModel->getGroupImageMark($member_srl,$site_module_info->site_srl);
|
||||
$group_image = $oMemberModel->getGroupImageMark($member_srl, $site_module_info->site_srl);
|
||||
$GLOBALS['_transImageNameList'][$member_srl]->group_image = $group_image;
|
||||
}
|
||||
else
|
||||
|
|
@ -35,20 +54,33 @@ function memberTransImageName($matches)
|
|||
$image_mark_file = $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file;
|
||||
}
|
||||
// If image name and mark doesn't exist, set the original information
|
||||
if(!$image_name_file && !$image_mark_file && !$group_image) return $matches[0];
|
||||
if(!$image_name_file && !$image_mark_file && !$group_image)
|
||||
{
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
// check member_config
|
||||
|
||||
$config = $oMemberModel->getMemberConfig();
|
||||
|
||||
if($config->image_name == 'Y' && $image_name_file) $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id: %s" style="border:0;vertical-align:middle;margin-right:3px" />', Context::getRequestUri(),$image_name_file, strip_tags($nick_name), strip_tags($nick_name));
|
||||
if($config->image_mark == 'Y' && $image_mark_file) $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id : %s" style="border:0;vertical-align:middle;margin-right:3px"/>%s', Context::getRequestUri(),$image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name);
|
||||
if($config->image_name == 'Y' && $image_name_file)
|
||||
{
|
||||
$nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id: %s" style="border:0;vertical-align:middle;margin-right:3px" />', Context::getRequestUri(), $image_name_file, strip_tags($nick_name), strip_tags($nick_name));
|
||||
}
|
||||
if($config->image_mark == 'Y' && $image_mark_file)
|
||||
{
|
||||
$nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id : %s" style="border:0;vertical-align:middle;margin-right:3px"/>%s', Context::getRequestUri(), $image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name);
|
||||
}
|
||||
|
||||
if($group_image) $nick_name = sprintf('<img src="%s" style="border:0;max-height:16px;vertical-align:middle;margin-right:3px" alt="%s" title="%s" />%s', $group_image->src, $group_image->title, $group_image->description, $nick_name);
|
||||
if($group_image)
|
||||
{
|
||||
$nick_name = sprintf('<img src="%s" style="border:0;max-height:16px;vertical-align:middle;margin-right:3px" alt="%s" title="%s" />%s', $group_image->src, $group_image->title, $group_image->description, $nick_name);
|
||||
}
|
||||
|
||||
|
||||
$orig_text = preg_replace('/'.preg_quote($matches[5],'/').'<\/'.$matches[6].'>$/', '', $matches[0]);
|
||||
return $orig_text.$nick_name.'</'.$matches[6].'>';
|
||||
$orig_text = preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]);
|
||||
return $orig_text . $nick_name . '</' . $matches[6] . '>';
|
||||
}
|
||||
|
||||
/* End of file member_extra_info.lib.php */
|
||||
/* Location: ./addons/member_extra_info/member_extra_info.lib.php */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file mobile.addon.php
|
||||
|
|
@ -14,17 +16,29 @@ if(!defined('__XE__')) exit();
|
|||
*
|
||||
* after_module_proc > display mobile content
|
||||
* Condition
|
||||
**/
|
||||
* */
|
||||
// Ignore admin page
|
||||
if(Context::get('module')=='admin') return;
|
||||
if(Context::get('module') == 'admin')
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Manage when to call it
|
||||
if($called_position != 'before_module_proc' && $called_position != 'after_module_proc' ) return;
|
||||
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;
|
||||
require_once(_XE_PATH_ . 'addons/mobile/classes/mobile.class.php');
|
||||
if(!mobileXE::getBrowserType())
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Generate mobile instance
|
||||
$oMobile = &mobileXE::getInstance();
|
||||
if(!$oMobile) return;
|
||||
if(!$oMobile)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Specify charset on the add-on settings
|
||||
$oMobile->setCharSet($addon_info->charset);
|
||||
// Set module information
|
||||
|
|
@ -41,9 +55,15 @@ if($called_position == 'before_module_proc')
|
|||
$oMobile->displayLangSelect();
|
||||
}
|
||||
// On navigation mode, display navigation content
|
||||
if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent();
|
||||
if($oMobile->isNavigationMode())
|
||||
{
|
||||
$oMobile->displayNavigationContent();
|
||||
}
|
||||
// If you have a WAP class content output via WAP class
|
||||
else $oMobile->displayModuleContent();
|
||||
else
|
||||
{
|
||||
$oMobile->displayModuleContent();
|
||||
}
|
||||
// If neither navigation mode nor WAP class is, display the module's result
|
||||
}
|
||||
else if($called_position == 'after_module_proc')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file openid_delegation_id.addon.php
|
||||
|
|
@ -8,20 +10,26 @@ if(!defined('__XE__')) exit();
|
|||
*
|
||||
* 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;
|
||||
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;
|
||||
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".
|
||||
'<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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @file point.addon.php
|
||||
|
|
@ -7,14 +9,20 @@ if(!defined('__XE__')) exit();
|
|||
* @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;
|
||||
if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify')
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
require_once('./addons/point_level_icon/point_level_icon.lib.php');
|
||||
|
||||
$temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output);
|
||||
if($temp_output) $output = $temp_output;
|
||||
if($temp_output)
|
||||
{
|
||||
$output = $temp_output;
|
||||
}
|
||||
unset($temp_output);
|
||||
|
||||
/* End of file point_level_icon.addon.php */
|
||||
|
|
|
|||
|
|
@ -1,57 +1,77 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @brief Function to change point icon.
|
||||
*/
|
||||
function pointLevelIconTrans($matches)
|
||||
{
|
||||
$member_srl = $matches[3];
|
||||
if($member_srl<1) return $matches[0];
|
||||
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].'>';
|
||||
$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');
|
||||
$oModuleModel = getModel('module');
|
||||
$GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
|
||||
}
|
||||
$config = $GLOBALS['_pointConfig'];
|
||||
|
||||
// Get point model
|
||||
if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point');
|
||||
if(!$GLOBALS['_pointModel'])
|
||||
{
|
||||
$GLOBALS['_pointModel'] = getModel('point');
|
||||
}
|
||||
$oPointModel = &$GLOBALS['_pointModel'];
|
||||
|
||||
// Get points
|
||||
if(!$oPointModel->isExistsPoint($member_srl)) return $matches[0];
|
||||
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];
|
||||
$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($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);
|
||||
$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];
|
||||
|
||||
return $orig_text.$text.$matches[5].'</'.$matches[6].'>';
|
||||
return $orig_text . $text . $matches[5] . '</' . $matches[6] . '>';
|
||||
}
|
||||
|
||||
/* End of file point_level_icon.lib.php */
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
<?php
|
||||
if(!defined('__XE__')) exit();
|
||||
|
||||
if(!defined('__XE__'))
|
||||
exit();
|
||||
|
||||
/**
|
||||
* @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($called_position == 'after_module_proc' && Context::getResponseMethod() == "HTML")
|
||||
{
|
||||
if(Mobile::isFromMobilePhone())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue