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:
flyskyko 2013-02-04 08:30:39 +00:00
parent 005768c71e
commit 669c9a5948
14 changed files with 768 additions and 492 deletions

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file adminlogging.addon.php * @file adminlogging.addon.php
@ -12,7 +14,7 @@ $kind = strpos(strtolower($act),'admin')!==false?'admin':'';
if($called_position == 'before_module_proc' && $kind == 'admin' && $logged_info->is_admin == 'Y') 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); $oAdminloggingController->insertLog($this->module, $this->act);
} }
/* End of file adminlogging.php */ /* End of file adminlogging.php */

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file autolink.addon.php * @file autolink.addon.php
@ -8,7 +10,8 @@ if(!defined('__XE__')) exit();
*/ */
if($called_position == 'after_module_proc' && Context::getResponseMethod() != "XMLRPC") if($called_position == 'after_module_proc' && Context::getResponseMethod() != "XMLRPC")
{ {
if(Mobile::isFromMobilePhone()) { if(Mobile::isFromMobilePhone())
{
Context::addJsFile('./common/js/jquery.min.js', false, '', -1000000); Context::addJsFile('./common/js/jquery.min.js', false, '', -1000000);
Context::addJsFile('./common/js/xe.min.js', false, '', -1000000); Context::addJsFile('./common/js/xe.min.js', false, '', -1000000);
} }

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file blogapicounter.addon.php * @file blogapicounter.addon.php
@ -10,7 +12,8 @@ if(!defined('__XE__')) exit();
* It should be called before executing the module(before_module_proc). If not, it is forced to shut down. * 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 // 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 // Create rsd address of the current module
$site_module_info = Context::get('site_module_info'); $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');
@ -18,7 +21,11 @@ if($called_position == 'after_module_proc') {
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 act isnot api, just return
if($_REQUEST['act']!='api') return; if($_REQUEST['act'] != 'api')
{
return;
}
// Read func file // Read func file
require_once('./addons/blogapi/blogapi.func.php'); require_once('./addons/blogapi/blogapi.func.php');
// xmlprc parsing // xmlprc parsing
@ -28,48 +35,67 @@ $xmlDoc = $oXmlParser->parse();
$method_name = $xmlDoc->methodcall->methodname->body; $method_name = $xmlDoc->methodcall->methodname->body;
$params = $xmlDoc->methodcall->params->param; $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 // 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); $method_name = str_replace('metaWeblog.', 'blogger.', $method_name);
} }
// Delete the first argument if it is blogger.deletePost // 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 // Get user_id, password and attempt log-in
$user_id = trim($params[1]->value->string->body); $user_id = trim($params[1]->value->string->body);
$password = trim($params[2]->value->string->body); $password = trim($params[2]->value->string->body);
// Before executing the module, authentication is processed. // 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 // Attempt log-in by using member controller
if($user_id && $password) { if($user_id && $password)
$oMemberController = &getController('member'); {
$oMemberController = getController('member');
$output = $oMemberController->doLogin($user_id, $password); $output = $oMemberController->doLogin($user_id, $password);
// If login fails, an error message appears // If login fails, an error message appears
if(!$output->toBool()) { if(!$output->toBool())
{
$content = getXmlRpcFailure(1, $output->getMessage()); $content = getXmlRpcFailure(1, $output->getMessage());
printContent($content); printContent($content);
} }
} else { }
else
{
$content = getXmlRpcFailure(1, 'not logged'); $content = getXmlRpcFailure(1, 'not logged');
printContent($content); printContent($content);
} }
} }
// Before module processing, handle requests from blogapi tool and then terminate. // 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 // Check writing permission
if(!$this->grant->write_document) { if(!$this->grant->write_document)
{
printContent(getXmlRpcFailure(1, 'no permission')); printContent(getXmlRpcFailure(1, 'no permission'));
} }
// Get information of the categories // Get information of the categories
$oDocumentModel = &getModel('document'); $oDocumentModel = getModel('document');
$category_list = $oDocumentModel->getCategoryList($this->module_srl); $category_list = $oDocumentModel->getCategoryList($this->module_srl);
// Specifies a temporary file storage // Specifies a temporary file storage
$tmp_uploaded_path = sprintf('./files/cache/blogapi/%s/%s/', $this->mid, $user_id); $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); $uploaded_target_path = sprintf('/files/cache/blogapi/%s/%s/', $this->mid, $user_id);
switch($method_name) { switch($method_name)
{
// Blog information // Blog information
case 'blogger.getUsersBlogs' : case 'blogger.getUsersBlogs' :
$obj = new stdClass();
$obj->url = getFullSiteUrl(''); $obj->url = getFullSiteUrl('');
$obj->blogid = $this->mid; $obj->blogid = $this->mid;
$obj->blogName = $this->module_info->browser_title; $obj->blogName = $this->module_info->browser_title;
@ -81,9 +107,11 @@ if($called_position == 'before_module_proc') {
// Return a list of categories // Return a list of categories
case 'metaWeblog.getCategories' : case 'metaWeblog.getCategories' :
$category_obj_list = array(); $category_obj_list = array();
if($category_list) { if($category_list)
foreach($category_list as $category_srl => $category_info) { {
unset($obj); foreach($category_list as $category_srl => $category_info)
{
$obj = new stdClass();
$obj->description = $category_info->title; $obj->description = $category_info->title;
//$obj->htmlUrl = Context::getRequestUri().$this->mid.'/1'; //$obj->htmlUrl = Context::getRequestUri().$this->mid.'/1';
//$obj->rssUrl= Context::getRequestUri().'rss/'.$this->mid.'/1'; //$obj->rssUrl= Context::getRequestUri().'rss/'.$this->mid.'/1';
@ -99,37 +127,49 @@ if($called_position == 'before_module_proc') {
// Upload file // Upload file
case 'metaWeblog.newMediaObject' : case 'metaWeblog.newMediaObject' :
// Check a file upload permission // Check a file upload permission
$oFileModel = &getModel('file'); $oFileModel = getModel('file');
$file_module_config = $oFileModel->getFileModuleConfig($this->module_srl); $file_module_config = $oFileModel->getFileModuleConfig($this->module_srl);
if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) { if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant) > 0)
{
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y') { if($logged_info->is_admin != 'Y')
{
$is_permitted = false; $is_permitted = false;
for($i=0;$i<count($file_module_config->download_grant);$i++) { for($i = 0; $i < count($file_module_config->download_grant); $i++)
{
$group_srl = $file_module_config->download_grant[$i]; $group_srl = $file_module_config->download_grant[$i];
if($logged_info->group_list[$group_srl]) { if($logged_info->group_list[$group_srl])
{
$is_permitted = true; $is_permitted = true;
break; break;
} }
} }
if(!$is_permitted) printContent( getXmlRpcFailure(1, 'no permission') ); if(!$is_permitted)
printContent(getXmlRpcFailure(1, 'no permission'));
} }
} }
$fileinfo = $params[3]->value->struct->member; $fileinfo = $params[3]->value->struct->member;
foreach($fileinfo as $key => $val) { foreach($fileinfo as $key => $val)
{
$nodename = $val->name->body; $nodename = $val->name->body;
if($nodename == 'bits') $filedata = base64_decode($val->value->base64->body); if($nodename == 'bits')
elseif($nodename == 'name') $filename = $val->value->string->body; $filedata = base64_decode($val->value->base64->body);
elseif($nodename == 'name')
$filename = $val->value->string->body;
} }
$tmp_arr = explode('/', $filename); $tmp_arr = explode('/', $filename);
$filename = array_pop($tmp_arr); $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); $target_filename = sprintf('%s%s', $tmp_uploaded_path, $filename);
FileHandler::writeFile($target_filename, $filedata); FileHandler::writeFile($target_filename, $filedata);
$obj = new stdClass();
$obj->url = Context::getRequestUri() . $target_filename; $obj->url = Context::getRequestUri() . $target_filename;
$content = getXmlRpcResponse($obj); $content = getXmlRpcResponse($obj);
@ -138,20 +178,28 @@ if($called_position == 'before_module_proc') {
// Get posts // Get posts
case 'metaWeblog.getPost' : case 'metaWeblog.getPost' :
$document_srl = $params[0]->value->string->body; $document_srl = $params[0]->value->string->body;
if(!$document_srl) { if(!$document_srl)
{
printContent(getXmlRpcFailure(1, 'no permission')); printContent(getXmlRpcFailure(1, 'no permission'));
} else { }
$oDocumentModel = &getModel('document'); else
{
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl); $oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists() || !$oDocument->isGranted()) { if(!$oDocument->isExists() || !$oDocument->isGranted())
{
printContent(getXmlRpcFailure(1, 'no permission')); printContent(getXmlRpcFailure(1, 'no permission'));
} else { }
else
{
// Get a list of categories and set Context // Get a list of categories and set Context
$category = ""; $category = "";
if($oDocument->get('category_srl')) { if($oDocument->get('category_srl'))
{
$oDocumentModel = &getModel('document'); $oDocumentModel = &getModel('document');
$category_list = $oDocumentModel->getCategoryList($oDocument->get('module_srl')); $category_list = $oDocumentModel->getCategoryList($oDocument->get('module_srl'));
if($category_list[$oDocument->get('category_srl')]) { if($category_list[$oDocument->get('category_srl')])
{
$category = $category_list[$oDocument->get('category_srl')]->title; $category = $category_list[$oDocument->get('category_srl')]->title;
} }
} }
@ -188,12 +236,14 @@ if($called_position == 'before_module_proc') {
break; break;
// Write a new post // Write a new post
case 'metaWeblog.newPost' : case 'metaWeblog.newPost' :
unset($obj); $obj = new stdClass();
$info = $params[3]; $info = $params[3];
// Get information of post, title, and category // Get information of post, title, and category
for($i=0;$i<count($info->value->struct->member);$i++) { for($i = 0; $i < count($info->value->struct->member); $i++)
{
$val = $info->value->struct->member[$i]; $val = $info->value->struct->member[$i];
switch($val->name->body) { switch($val->name->body)
{
case 'title' : case 'title' :
$obj->title = $val->value->string->body; $obj->title = $val->value->string->body;
break; break;
@ -202,36 +252,45 @@ if($called_position == 'before_module_proc') {
break; break;
case 'categories' : case 'categories' :
$categories = $val->value->array->data->value; $categories = $val->value->array->data->value;
if(!is_array($categories)) $categories = array($categories); if(!is_array($categories))
$categories = array($categories);
$category = $categories[0]->string->body; $category = $categories[0]->string->body;
if($category && $category_list) { if($category && $category_list)
foreach($category_list as $category_srl => $category_info) { {
if($category_info->title == $category) $obj->category_srl = $category_srl; foreach($category_list as $category_srl => $category_info)
{
if($category_info->title == $category)
$obj->category_srl = $category_srl;
} }
} }
break; break;
case 'tagwords' : case 'tagwords' :
$tags = $val->value->array->data->value; $tags = $val->value->array->data->value;
if(!is_array($tags)) $tags = array($tags); if(!is_array($tags))
for($j=0;$j<count($tags);$j++) { $tags = array($tags);
for($j = 0; $j < count($tags); $j++)
{
$tag_list[] = $tags[$j]->string->body; $tag_list[] = $tags[$j]->string->body;
} }
if(count($tag_list)) $obj->tags = implode(',',$tag_list); if(count($tag_list))
$obj->tags = implode(',', $tag_list);
break; break;
} }
} }
// Set document srl // Set document srl
$document_srl = getNextSequence(); $document_srl = getNextSequence();
$obj->document_srl = $document_srl; $obj->document_srl = $document_srl;
$obj->module_srl = $this->module_srl; $obj->module_srl = $this->module_srl;
// Attachment // Attachment
if(is_dir($tmp_uploaded_path)) { if(is_dir($tmp_uploaded_path))
{
$file_list = FileHandler::readDir($tmp_uploaded_path); $file_list = FileHandler::readDir($tmp_uploaded_path);
$file_count = count($file_list); $file_count = count($file_list);
if($file_count) { if($file_count)
{
$oFileController = &getController('file'); $oFileController = &getController('file');
for($i=0;$i<$file_count;$i++) { for($i = 0; $i < $file_count; $i++)
{
$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]); $file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
$file_info['name'] = $file_list[$i]; $file_info['name'] = $file_list[$i];
$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true); $fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
@ -249,9 +308,12 @@ if($called_position == 'before_module_proc') {
$obj->allow_trackback = 'Y'; $obj->allow_trackback = 'Y';
$output = $oDocumentController->insertDocument($obj); $output = $oDocumentController->insertDocument($obj);
if(!$output->toBool()) { if(!$output->toBool())
{
$content = getXmlRpcFailure(1, $output->getMessage()); $content = getXmlRpcFailure(1, $output->getMessage());
} else { }
else
{
$content = getXmlRpcResponse(strval($document_srl)); $content = getXmlRpcResponse(strval($document_srl));
} }
FileHandler::removeDir($tmp_uploaded_path); FileHandler::removeDir($tmp_uploaded_path);
@ -261,22 +323,26 @@ if($called_position == 'before_module_proc') {
// Edit post // Edit post
case 'metaWeblog.editPost' : case 'metaWeblog.editPost' :
$tmp_val = $params[0]->value->string->body; $tmp_val = $params[0]->value->string->body;
if(!$tmp_val) $tmp_val = $params[0]->value->i4->body; if(!$tmp_val)
if(!$tmp_val) { $tmp_val = $params[0]->value->i4->body;
if(!$tmp_val)
{
$content = getXmlRpcFailure(1, 'no permission'); $content = getXmlRpcFailure(1, 'no permission');
break; break;
} }
$tmp_arr = explode('/', $tmp_val); $tmp_arr = explode('/', $tmp_val);
$document_srl = array_pop($tmp_arr); $document_srl = array_pop($tmp_arr);
if(!$document_srl) { if(!$document_srl)
{
$content = getXmlRpcFailure(1, 'no permission'); $content = getXmlRpcFailure(1, 'no permission');
break; break;
} }
$oDocumentModel = &getModel('document'); $oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl); $oDocument = $oDocumentModel->getDocument($document_srl);
// Check if a permission to modify a document is granted // Check if a permission to modify a document is granted
if(!$oDocument->isGranted()) { if(!$oDocument->isGranted())
{
$content = getXmlRpcFailure(1, 'no permission'); $content = getXmlRpcFailure(1, 'no permission');
break; break;
} }
@ -285,9 +351,11 @@ if($called_position == 'before_module_proc') {
$info = $params[3]; $info = $params[3];
// Get information of post, title, and category // Get information of post, title, and category
for($i=0;$i<count($info->value->struct->member);$i++) { for($i = 0; $i < count($info->value->struct->member); $i++)
{
$val = $info->value->struct->member[$i]; $val = $info->value->struct->member[$i];
switch($val->name->body) { switch($val->name->body)
{
case 'title' : case 'title' :
$obj->title = $val->value->string->body; $obj->title = $val->value->string->body;
break; break;
@ -296,40 +364,50 @@ if($called_position == 'before_module_proc') {
break; break;
case 'categories' : case 'categories' :
$categories = $val->value->array->data->value; $categories = $val->value->array->data->value;
if(!is_array($categories)) $categories = array($categories); if(!is_array($categories))
$categories = array($categories);
$category = $categories[0]->string->body; $category = $categories[0]->string->body;
if($category && $category_list) { if($category && $category_list)
foreach($category_list as $category_srl => $category_info) { {
if($category_info->title == $category) $obj->category_srl = $category_srl; foreach($category_list as $category_srl => $category_info)
{
if($category_info->title == $category)
$obj->category_srl = $category_srl;
} }
} }
break; break;
case 'tagwords' : case 'tagwords' :
$tags = $val->value->array->data->value; $tags = $val->value->array->data->value;
if(!is_array($tags)) $tags = array($tags); if(!is_array($tags))
for($j=0;$j<count($tags);$j++) { $tags = array($tags);
for($j = 0; $j < count($tags); $j++)
{
$tag_list[] = $tags[$j]->string->body; $tag_list[] = $tags[$j]->string->body;
} }
if(count($tag_list)) $obj->tags = implode(',',$tag_list); if(count($tag_list))
$obj->tags = implode(',', $tag_list);
break; break;
} }
} }
// Document srl // Document srl
$obj->document_srl = $document_srl; $obj->document_srl = $document_srl;
$obj->module_srl = $this->module_srl; $obj->module_srl = $this->module_srl;
// Attachment // Attachment
if(is_dir($tmp_uploaded_path)) { if(is_dir($tmp_uploaded_path))
{
$file_list = FileHandler::readDir($tmp_uploaded_path); $file_list = FileHandler::readDir($tmp_uploaded_path);
$file_count = count($file_list); $file_count = count($file_list);
if($file_count) { if($file_count)
{
$oFileController = &getController('file'); $oFileController = &getController('file');
for($i=0;$i<$file_count;$i++) { for($i = 0; $i < $file_count; $i++)
{
$file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]); $file_info['tmp_name'] = sprintf('%s%s', $tmp_uploaded_path, $file_list[$i]);
$file_info['name'] = $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']); $moved_filename = sprintf('./files/attach/images/%s/%s/%s', $this->module_srl, $document_srl, $file_info['name']);
if(file_exists($moved_filename)) continue; if(file_exists($moved_filename))
continue;
$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true); $fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
$uploaded_filename = $fileOutput->get('uploaded_filename'); $uploaded_filename = $fileOutput->get('uploaded_filename');
@ -343,9 +421,12 @@ if($called_position == 'before_module_proc') {
$oDocumentController = &getController('document'); $oDocumentController = &getController('document');
$output = $oDocumentController->updateDocument($oDocument, $obj); $output = $oDocumentController->updateDocument($oDocument, $obj);
if(!$output->toBool()) { if(!$output->toBool())
{
$content = getXmlRpcFailure(1, $output->getMessage()); $content = getXmlRpcFailure(1, $output->getMessage());
} else { }
else
{
$content = getXmlRpcResponse(true); $content = getXmlRpcResponse(true);
FileHandler::removeDir($tmp_uploaded_path); FileHandler::removeDir($tmp_uploaded_path);
} }
@ -358,21 +439,28 @@ if($called_position == 'before_module_proc') {
$tmp_arr = explode('/', $tmp_val); $tmp_arr = explode('/', $tmp_val);
$document_srl = array_pop($tmp_arr); $document_srl = array_pop($tmp_arr);
// Get a document // Get a document
$oDocumentModel = &getModel('document'); $oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl); $oDocument = $oDocumentModel->getDocument($document_srl);
// If the document exists // If the document exists
if(!$oDocument->isExists()) { if(!$oDocument->isExists())
{
$content = getXmlRpcFailure(1, 'not exists'); $content = getXmlRpcFailure(1, 'not exists');
// Check if a permission to delete a document is granted // Check if a permission to delete a document is granted
} elseif(!$oDocument->isGranted()) { }
elseif(!$oDocument->isGranted())
{
$content = getXmlRpcFailure(1, 'no permission'); $content = getXmlRpcFailure(1, 'no permission');
break; break;
// Delete // Delete
} else { }
$oDocumentController = &getController('document'); else
{
$oDocumentController = getController('document');
$output = $oDocumentController->deleteDocument($document_srl); $output = $oDocumentController->deleteDocument($document_srl);
if(!$output->toBool()) $content = getXmlRpcFailure(1, $output->getMessage()); if(!$output->toBool())
else $content = getXmlRpcResponse(true); $content = getXmlRpcFailure(1, $output->getMessage());
else
$content = getXmlRpcResponse(true);
} }
printContent($content); printContent($content);
@ -380,6 +468,7 @@ if($called_position == 'before_module_proc') {
// Get recent posts // Get recent posts
case 'metaWeblog.getRecentPosts' : case 'metaWeblog.getRecentPosts' :
// Options to get a list // Options to get a list
$args = new stdClass();
$args->module_srl = $this->module_srl; // /< module_srl of the current module $args->module_srl = $this->module_srl; // /< module_srl of the current module
$args->page = 1; $args->page = 1;
$args->list_count = 20; $args->list_count = 20;
@ -388,15 +477,19 @@ if($called_position == 'before_module_proc') {
$args->search_target = 'member_srl'; $args->search_target = 'member_srl';
$args->search_keyword = $logged_info->member_srl; $args->search_keyword = $logged_info->member_srl;
$output = $oDocumentModel->getDocumentList($args); $output = $oDocumentModel->getDocumentList($args);
if(!$output->toBool() || !$output->data) { if(!$output->toBool() || !$output->data)
{
$content = getXmlRpcFailure(1, 'post not founded'); $content = getXmlRpcFailure(1, 'post not founded');
printContent($content); printContent($content);
} else { }
$oEditorController = &getController('editor'); else
{
$oEditorController = getController('editor');
$posts = array(); $posts = array();
foreach($output->data as $key => $oDocument) { foreach($output->data as $key => $oDocument)
$post = null; {
$post = new stdClass();
$post->categories = array(); $post->categories = array();
$post->dateCreated = date("Ymd", $oDocument->getRegdateTime()) . 'T' . date("H:i:s", $oDocument->getRegdateTime()); $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->description = htmlspecialchars($oEditorController->transComponent($oDocument->getContent(false, false, true, false)));

View file

@ -1,20 +1,19 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file ./addons/blogapi/blogapi.func.php * @file ./addons/blogapi/blogapi.func.php
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief Function collections for the implementation of blogapi * @brief Function collections for the implementation of blogapi
* */ * */
// Error messages // Error messages
function getXmlRpcFailure($error, $message) function getXmlRpcFailure($error, $message)
{ {
return return
sprintf( 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", "<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)
$error,
htmlspecialchars($message)
); );
} }
@ -31,16 +30,29 @@ function getXmlRpcResponse($params)
// Encoding // Encoding
function _getEncodedVal($val, $is_sub_set = false) function _getEncodedVal($val, $is_sub_set = false)
{ {
if(is_int($val)) $buff = sprintf("<value><i4>%d</i4></value>", $val); if(is_int($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); $buff = sprintf("<value><i4>%d</i4></value>", $val);
elseif(is_bool($val)) $buff = sprintf("<value><boolean>%d</boolean></value>", $val?1:0); }
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)) elseif(is_object($val))
{ {
$values = get_object_vars($val); $values = get_object_vars($val);
$val_count = count($values); $val_count = count($values);
$buff = "<value><struct>"; $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 .= sprintf("<member>\n<name>%s</name>\n%s</member>\n", htmlspecialchars($k), _getEncodedVal($v, true));
} }
$buff .= "</struct></value>\n"; $buff .= "</struct></value>\n";
@ -49,7 +61,8 @@ function _getEncodedVal($val, $is_sub_set = false)
{ {
$val_count = count($val); $val_count = count($val);
$buff = "<value><array>\n<data>"; $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 .= _getEncodedVal($val[$i], true);
} }
$buff .= "</data>\n</array></value>"; $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); $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; return $buff;
} }
@ -75,5 +91,6 @@ function printContent($content)
Context::close(); Context::close();
exit(); exit();
} }
/* End of file blogapi.func.php */ /* End of file blogapi.func.php */
/* Location: ./addons/blogapi/blogapi.func.php */ /* Location: ./addons/blogapi/blogapi.func.php */

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined("__ZBXE__")) exit();
if(!defined("__ZBXE__"))
exit();
/** /**
* @file captcha.addon.php * @file captcha.addon.php
@ -7,14 +9,15 @@ if(!defined("__ZBXE__")) exit();
* @brief Captcha for a particular action * @brief Captcha for a particular action
* English alphabets and voice verification added * English alphabets and voice verification added
* */ * */
if(!class_exists('AddonCaptcha')) if(!class_exists('AddonCaptcha'))
{ {
// On the mobile mode, XE Core does not load jquery and xe.js as normal. // 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/jquery.min.js', 'head', NULL, -100000), true);
Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true); Context::loadFile(array('./common/js/xe.min.js', 'head', NULL, -100000), true);
class AddonCaptcha class AddonCaptcha
{ {
var $addon_info; var $addon_info;
function setInfo(&$addon_info) function setInfo(&$addon_info)
@ -33,17 +36,38 @@ if(!class_exists('AddonCaptcha'))
function before_module_init(&$ModuleHandler) function before_module_init(&$ModuleHandler)
{ {
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin) return false; if($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)
if($this->addon_info->target != 'all' && Context::get('is_logged')) return false; {
if($_SESSION['XE_VALIDATOR_ERROR'] == -1) $_SESSION['captcha_authed'] = false; return false;
if($_SESSION['captcha_authed']) 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'); $type = Context::get('captchaType');
$target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment'); $target_acts = array('procBoardInsertDocument', 'procBoardInsertComment', 'procIssuetrackerInsertIssue', 'procIssuetrackerInsertHistory', 'procTextyleInsertComment');
if($this->addon_info->apply_find_account=='apply') $target_acts[] = 'procMemberFindAccount'; if($this->addon_info->apply_find_account == 'apply')
if($this->addon_info->apply_resend_auth_mail=='apply') $target_acts[] = 'procMemberResendAuthMail'; {
if($this->addon_info->apply_signup=='apply') $target_acts[] = 'procMemberInsert'; $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')
{ {
@ -53,7 +77,7 @@ if(!class_exists('AddonCaptcha'))
{ {
Context::loadLang('./addons/captcha/lang'); Context::loadLang('./addons/captcha/lang');
$_SESSION['XE_VALIDATOR_ERROR'] = -1; $_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_MESSAGE_TYPE'] = 'error';
$_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url'); $_SESSION['XE_VALIDATOR_RETURN_URL'] = Context::get('error_return_url');
$ModuleHandler->_setInputValueToSession(); $ModuleHandler->_setInputValueToSession();
@ -79,7 +103,10 @@ if(!class_exists('AddonCaptcha'))
function createKeyword() function createKeyword()
{ {
$type = Context::get('captchaType'); $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); shuffle($arr);
@ -89,12 +116,13 @@ if(!class_exists('AddonCaptcha'))
function before_module_init_setCaptchaSession() function before_module_init_setCaptchaSession()
{ {
if($_SESSION['captcha_authed']) return false; if($_SESSION['captcha_authed'])
{
return false;
}
// Load language files // Load language files
Context::loadLang(_XE_PATH_ . 'addons/captcha/lang'); Context::loadLang(_XE_PATH_ . 'addons/captcha/lang');
// Generate keywords // Generate keywords
$this->createKeyword(); $this->createKeyword();
$target = Context::getLang('target_captcha'); $target = Context::getLang('target_captcha');
@ -117,8 +145,14 @@ if(!class_exists('AddonCaptcha'))
function before_module_init_captchaImage() function before_module_init_captchaImage()
{ {
if($_SESSION['captcha_authed']) return false; if($_SESSION['captcha_authed'])
if(Context::get('renew')) $this->createKeyword(); {
return false;
}
if(Context::get('renew'))
{
$this->createKeyword();
}
$keyword = $_SESSION['captcha_keyword']; $keyword = $_SESSION['captcha_keyword'];
$im = $this->createCaptchaImage($keyword); $im = $this->createCaptchaImage($keyword);
@ -137,32 +171,35 @@ if(!class_exists('AddonCaptcha'))
function createCaptchaImage($string) function createCaptchaImage($string)
{ {
$arr = array(); $arr = array();
for($i=0,$c=strlen($string);$i<$c;$i++) $arr[] = $string{$i}; for($i = 0, $c = strlen($string); $i < $c; $i++)
// Font site {
$arr[] = $string{$i};
}
// Font site
$w = 18; $w = 18;
$h = 25; $h = 25;
// Character length // Character length
$c = count($arr); $c = count($arr);
// Character image // Character image
$im = array(); $im = array();
// Create an image by total size
// 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); shuffle($deg);
// Create an image for each letter
// Create an image for each letter
foreach($arr as $i => $str) foreach($arr as $i => $str)
{ {
$im[$i + 1] = @imagecreate($w, $h); $im[$i + 1] = @imagecreate($w, $h);
$background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255);
$text_color = imagecolorallocate($im[$i + 1], 0, 0, 0); $text_color = imagecolorallocate($im[$i + 1], 0, 0, 0);
// Control font size
// Control font size
$ran = range(1, 20); $ran = range(1, 20);
shuffle($ran); shuffle($ran);
@ -181,41 +218,52 @@ if(!class_exists('AddonCaptcha'))
} }
// Combine images of each character // 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]); imagedestroy($im[$i]);
} }
// Larger image
// Larger image
$big_count = 2; $big_count = 2;
$big = imagecreatetruecolor(($w + 2) * $big_count * $c, $h * $big_count); $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); imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w + 2) * $big_count * $c, $h * $big_count, ($w + 2) * $c, $h);
imagedestroy($im[0]); imagedestroy($im[0]);
if(function_exists('imageantialias')) imageantialias($big,true); if(function_exists('imageantialias'))
// Background line {
imageantialias($big, true);
}
// Background line
$line_color = imagecolorallocate($big, 0, 0, 0); $line_color = imagecolorallocate($big, 0, 0, 0);
$w = ($w + 2) * $big_count * $c; $w = ($w + 2) * $big_count * $c;
$h = $h * $big_count; $h = $h * $big_count;
$d = array_pop($deg); $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); 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; return $big;
} }
function before_module_init_captchaAudio() function before_module_init_captchaAudio()
{ {
if($_SESSION['captcha_authed']) return false; if($_SESSION['captcha_authed'])
{
return false;
}
$keyword = strtoupper($_SESSION['captcha_keyword']); $keyword = strtoupper($_SESSION['captcha_keyword']);
$data = $this->createCaptchaAudio($keyword); $data = $this->createCaptchaAudio($keyword);
@ -246,7 +294,10 @@ if(!class_exists('AddonCaptcha'))
for($j = $start; $j < $datalen; $j+=64) for($j = $start; $j < $datalen; $j+=64)
{ {
$ch = ord($_data{$j}); $ch = ord($_data{$j});
if($ch<9 || $ch>119) continue; if($ch < 9 || $ch > 119)
{
continue;
}
$_data{$j} = chr($ch + rand(-8, 8)); $_data{$j} = chr($ch + rand(-8, 8));
} }
@ -258,7 +309,10 @@ if(!class_exists('AddonCaptcha'))
function compareCaptcha() function compareCaptcha()
{ {
if($_SESSION['captcha_authed']) return true; if($_SESSION['captcha_authed'])
{
return true;
}
if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text'))) if(strtoupper($_SESSION['captcha_keyword']) == strtoupper(Context::get('secret_text')))
{ {
@ -324,8 +378,8 @@ EOD;
, $lang->play); , $lang->play);
return $tags; return $tags;
} }
}
}
$GLOBALS['__AddonCaptcha__'] = new AddonCaptcha; $GLOBALS['__AddonCaptcha__'] = new AddonCaptcha;
$GLOBALS['__AddonCaptcha__']->setInfo($addon_info); $GLOBALS['__AddonCaptcha__']->setInfo($addon_info);
Context::set('oCaptcha', $GLOBALS['__AddonCaptcha__']); Context::set('oCaptcha', $GLOBALS['__AddonCaptcha__']);

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file counter.addon.php * @file counter.addon.php
@ -9,7 +11,7 @@ if(!defined('__XE__')) exit();
// Execute if called_position is before_display_content // 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(); $oCounterController->counterExecute();
} }
/* End of file counter.addon.php */ /* End of file counter.addon.php */

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file member_communication.addon.php * @file member_communication.addon.php
@ -12,7 +14,10 @@ if(!defined('__XE__')) exit();
*/ */
// Stop if non-logged-in user is // Stop if non-logged-in user is
$logged_info = Context::get('logged_info'); $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 * Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received
@ -22,7 +27,7 @@ if($called_position == 'before_module_init' && $this->module != 'member')
// Load a language file from the communication module // Load a language file from the communication module
Context::loadLang('./modules/communication/lang'); Context::loadLang('./modules/communication/lang');
// Add menus on the member login information // Add menus on the member login information
$oMemberController = &getController('member'); $oMemberController = getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
// Pop-up to display messages if a flag on new message is set // Pop-up to display messages if a flag on new message is set
@ -45,11 +50,11 @@ if($called_position == 'before_module_init' && $this->module != 'member')
} }
elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu')
{ {
$oMemberController = &getController('member'); $oMemberController = getController('member');
$member_srl = Context::get('target_srl'); $member_srl = Context::get('target_srl');
$mid = Context::get('cur_mid'); $mid = Context::get('cur_mid');
// Creates communication model object // Creates communication model object
$oCommunicationModel = &getModel('communication'); $oCommunicationModel = getModel('communication');
// Add a feature to display own message box. // Add a feature to display own message box.
if($logged_info->member_srl == $member_srl) if($logged_info->member_srl == $member_srl)
{ {
@ -62,9 +67,13 @@ elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu'
else else
{ {
// Get member information // Get member information
$oMemberModel = &getModel('member'); $oMemberModel = getModel('member');
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); $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 // Get logged-in user information
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
// Add a menu for sending message // Add a menu for sending message

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file image_name.addon.php * @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> * Find member_srl in the part with <div class="member_MemberSerialNumber"> .... </div>
* Check if ther is image name and image mark. Then change it. * Check if ther is image name and image mark. Then change it.
*/ */
/** /**
* Just before displaying, change image name/ image mark * 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 // Include a file having functions to replace member image name/mark
require_once('./addons/member_extra_info/member_extra_info.lib.php'); 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() // 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); $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); unset($temp_output);
/* End of file member_extra_info.addon.php */ /* End of file member_extra_info.addon.php */

View file

@ -1,4 +1,5 @@
<?php <?php
/** /**
* @brief If member_srl exists in the div or span, replace to image name or nick image for each member_srl * @brief If member_srl exists in the div or span, replace to image name or nick image for each member_srl
* */ * */
@ -6,11 +7,17 @@ function memberTransImageName($matches)
{ {
// If member_srl < 0, then return text only in the body // If member_srl < 0, then return text only in the body
$member_srl = $matches[3]; $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=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]; $nick_name = $matches[5];
// If pre-defined data in the global variablesm return it // If pre-defined data in the global variablesm return it
@ -19,10 +26,22 @@ function memberTransImageName($matches)
$GLOBALS['_transImageNameList'][$member_srl]->cached = true; $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_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); $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; if(file_exists($image_name_file))
else $image_name_file = ''; {
if(file_exists($image_mark_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file = $image_mark_file; $GLOBALS['_transImageNameList'][$member_srl]->image_name_file = $image_name_file;
else $image_mark_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'); $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);
@ -35,20 +54,33 @@ function memberTransImageName($matches)
$image_mark_file = $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file; $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 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 // check member_config
$config = $oMemberModel->getMemberConfig(); $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_name == 'Y' && $image_name_file)
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); {
$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]); $orig_text = preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]);
return $orig_text . $nick_name . '</' . $matches[6] . '>'; return $orig_text . $nick_name . '</' . $matches[6] . '>';
} }
/* End of file member_extra_info.lib.php */ /* End of file member_extra_info.lib.php */
/* Location: ./addons/member_extra_info/member_extra_info.lib.php */ /* Location: ./addons/member_extra_info/member_extra_info.lib.php */

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file mobile.addon.php * @file mobile.addon.php
@ -16,15 +18,27 @@ if(!defined('__XE__')) exit();
* Condition * Condition
* */ * */
// Ignore admin page // Ignore admin page
if(Context::get('module')=='admin') return; if(Context::get('module') == 'admin')
{
return;
}
// Manage when to call it // 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 // Ignore if not mobile browser
require_once(_XE_PATH_ . 'addons/mobile/classes/mobile.class.php'); require_once(_XE_PATH_ . 'addons/mobile/classes/mobile.class.php');
if(!mobileXE::getBrowserType()) return; if(!mobileXE::getBrowserType())
{
return;
}
// Generate mobile instance // Generate mobile instance
$oMobile = &mobileXE::getInstance(); $oMobile = &mobileXE::getInstance();
if(!$oMobile) return; if(!$oMobile)
{
return;
}
// Specify charset on the add-on settings // Specify charset on the add-on settings
$oMobile->setCharSet($addon_info->charset); $oMobile->setCharSet($addon_info->charset);
// Set module information // Set module information
@ -41,9 +55,15 @@ if($called_position == 'before_module_proc')
$oMobile->displayLangSelect(); $oMobile->displayLangSelect();
} }
// On navigation mode, display navigation content // 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 // 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 // If neither navigation mode nor WAP class is, display the module's result
} }
else if($called_position == 'after_module_proc') else if($called_position == 'after_module_proc')

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file openid_delegation_id.addon.php * @file openid_delegation_id.addon.php
@ -10,9 +12,15 @@ if(!defined('__XE__')) exit();
* Enter your open ID service information on the configuration. * Enter your open ID service information on the configuration.
* */ * */
// Execute only wen called_position is before_module_init // 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) // 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( $header_script = sprintf(
'<link rel="openid.server" href="%s" />' . "\n" . '<link rel="openid.server" href="%s" />' . "\n" .

View file

@ -1,5 +1,7 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file point.addon.php * @file point.addon.php
@ -9,12 +11,18 @@ if(!defined('__XE__')) exit();
* Display point level icon before user name when point system is enabled. * Display point level icon before user name when point system is enabled.
* */ * */
// return unless before_display_content // 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'); 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); $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); unset($temp_output);
/* End of file point_level_icon.addon.php */ /* End of file point_level_icon.addon.php */

View file

@ -1,44 +1,64 @@
<?php <?php
/** /**
* @brief Function to change point icon. * @brief Function to change point icon.
*/ */
function pointLevelIconTrans($matches) function pointLevelIconTrans($matches)
{ {
$member_srl = $matches[3]; $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 // Check Group Image Mark
$oMemberModel = &getModel('member'); $oMemberModel = getModel('member');
if($oMemberModel->getGroupImageMark($member_srl)) return $orig_text.$matches[5].'</'.$matches[6].'>'; if($oMemberModel->getGroupImageMark($member_srl))
{
return $orig_text . $matches[5] . '</' . $matches[6] . '>';
}
if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) if(!isset($GLOBALS['_pointLevelIcon'][$member_srl]))
{ {
// Get point configuration // Get point configuration
if(!$GLOBALS['_pointConfig']) if(!$GLOBALS['_pointConfig'])
{ {
$oModuleModel = &getModel('module'); $oModuleModel = getModel('module');
$GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point'); $GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
} }
$config = $GLOBALS['_pointConfig']; $config = $GLOBALS['_pointConfig'];
// Get point model // Get point model
if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point'); if(!$GLOBALS['_pointModel'])
{
$GLOBALS['_pointModel'] = getModel('point');
}
$oPointModel = &$GLOBALS['_pointModel']; $oPointModel = &$GLOBALS['_pointModel'];
// Get points // Get points
if(!$oPointModel->isExistsPoint($member_srl)) return $matches[0]; if(!$oPointModel->isExistsPoint($member_srl))
{
return $matches[0];
}
$point = $oPointModel->getPoint($member_srl); $point = $oPointModel->getPoint($member_srl);
// Get level // Get level
$level = $oPointModel->getLevel($point, $config->level_step); $level = $oPointModel->getLevel($point, $config->level_step);
$text = $matches[5]; $text = $matches[5];
// Get a path where level icon is // Get a path where level icon is
$level_icon = sprintf('%smodules/point/icons/%s/%d.gif', Context::getRequestUri(), $config->level_icon, $level); $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 // Get per to go to the next level if not a top level
if($level < $config->max_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]; $present_point = $config->level_step[$level];
if($next_point > 0) { if($next_point > 0)
{
$per = (int) (($point - $present_point) / ($next_point - $present_point) * 100); $per = (int) (($point - $present_point) / ($next_point - $present_point) * 100);
$per = $per . '%'; $per = $per . '%';
} }

View file

@ -1,12 +1,13 @@
<?php <?php
if(!defined('__XE__')) exit();
if(!defined('__XE__'))
exit();
/** /**
* @file resize_image.addon.php * @file resize_image.addon.php
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief Add-on to resize images in the body * @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()) if(Mobile::isFromMobilePhone())