diff --git a/addons/adminlogging/adminlogging.addon.php b/addons/adminlogging/adminlogging.addon.php
index f0c6f5cc7..6253d12fd 100644
--- a/addons/adminlogging/adminlogging.addon.php
+++ b/addons/adminlogging/adminlogging.addon.php
@@ -1,5 +1,7 @@
is_admin == 'Y')
{
- $oAdminloggingController = &getController('adminlogging');
+ $oAdminloggingController = getController('adminlogging');
$oAdminloggingController->insertLog($this->module, $this->act);
}
/* End of file adminlogging.php */
diff --git a/addons/autolink/autolink.addon.php b/addons/autolink/autolink.addon.php
index a5a5cd6d2..7d1a38743 100644
--- a/addons/autolink/autolink.addon.php
+++ b/addons/autolink/autolink.addon.php
@@ -1,16 +1,19 @@
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(" ".'');
+ Context::addHtmlHeader(" " . '');
}
// 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;$idownload_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(
- ''.
- ''.
- ''.
- ''.
- ''.
- ''.
- 'categories'.
- 'dateCreated%s'.
- 'description'.
- 'link%s'.
- 'postid%s'.
- 'title'.
- 'publish1'.
- ''.
- ''.
- ''.
- ''.
- '',
- $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(
+ '' .
+ '' .
+ '' .
+ '' .
+ '' .
+ '' .
+ 'categories' .
+ 'dateCreated%s' .
+ 'description' .
+ 'link%s' .
+ 'postid%s' .
+ 'title' .
+ 'publish1' .
+ '' .
+ '' .
+ '' .
+ '' .
+ '',
+ $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;$ivalue->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;$jstring->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;$ivalue->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;$jstring->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 = <<mid);
+ $site_module_info = Context::get('site_module_info');
+ $api_url = getFullSiteUrl($site_module_info->domain, '', 'mid', $site_module_info->mid, 'act', 'api');
+ $content = <<
@@ -431,7 +524,7 @@ if($called_position == 'before_module_proc') {
RSDContent;
- printContent($content);
+ printContent($content);
break;
}
}
diff --git a/addons/blogapi/blogapi.func.php b/addons/blogapi/blogapi.func.php
index e85d8120e..338282a8e 100644
--- a/addons/blogapi/blogapi.func.php
+++ b/addons/blogapi/blogapi.func.php
@@ -1,27 +1,26 @@
\n\n\nfaultCode\n%d\n\n\nfaultString\n%s\n\n\n\n",
- $error,
- htmlspecialchars($message)
- );
+ return
+ sprintf(
+ "\n\n\nfaultCode\n%d\n\n\nfaultString\n%s\n\n\n\n", $error, htmlspecialchars($message)
+ );
}
// Display results
function getXmlRpcResponse($params)
{
- $buff = ''."\n";
+ $buff = '' . "\n";
$buff .= _getEncodedVal($params);
$buff .= "\n\n";
@@ -31,16 +30,29 @@ function getXmlRpcResponse($params)
// Encoding
function _getEncodedVal($val, $is_sub_set = false)
{
- if(is_int($val)) $buff = sprintf("%d", $val);
- elseif(is_string($val)&&preg_match('/^([0-9]+)T([0-9\:]+)$/', $val)) $buff = sprintf("%s\n", $val);
- elseif(is_double($val)) $buff = sprintf("%f", $val);
- elseif(is_bool($val)) $buff = sprintf("%d", $val?1:0);
+ if(is_int($val))
+ {
+ $buff = sprintf("%d", $val);
+ }
+ elseif(is_string($val) && preg_match('/^([0-9]+)T([0-9\:]+)$/', $val))
+ {
+ $buff = sprintf("%s\n", $val);
+ }
+ elseif(is_double($val))
+ {
+ $buff = sprintf("%f", $val);
+ }
+ elseif(is_bool($val))
+ {
+ $buff = sprintf("%d", $val ? 1 : 0);
+ }
elseif(is_object($val))
{
$values = get_object_vars($val);
$val_count = count($values);
$buff = "";
- foreach($values as $k => $v) {
+ foreach($values as $k => $v)
+ {
$buff .= sprintf("\n%s\n%s\n", htmlspecialchars($k), _getEncodedVal($v, true));
}
$buff .= "\n";
@@ -49,7 +61,8 @@ function _getEncodedVal($val, $is_sub_set = false)
{
$val_count = count($val);
$buff = "\n";
- for($i=0;$i<$val_count;$i++) {
+ for($i = 0; $i < $val_count; $i++)
+ {
$buff .= _getEncodedVal($val[$i], true);
}
$buff .= "\n";
@@ -58,7 +71,10 @@ function _getEncodedVal($val, $is_sub_set = false)
{
$buff = sprintf("%s\n", $val);
}
- if(!$is_sub_set) return sprintf("\n%s", $buff);
+ if(!$is_sub_set)
+ {
+ return sprintf("\n%s", $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 */
diff --git a/addons/captcha/captcha.addon.php b/addons/captcha/captcha.addon.php
index 384987a73..14d9a8cfc 100644
--- a/addons/captcha/captcha.addon.php
+++ b/addons/captcha/captcha.addon.php
@@ -1,20 +1,23 @@
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('');
+ Context::addHtmlHeader('');
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("\r\n 0\r\n success\r\n \r\n \r\n \r\n \r\n \r\n "
- ,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;$icreateCaptchaAudio($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=<<