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=<< @@ -317,15 +371,15 @@ if(!class_exists('AddonCaptcha')) EOD; - $tags = sprintf($tags, getUrl('captcha_action','captchaImage', 'rand', mt_rand(10000, 99999)) - , $swfURL - , $swfURL - , $lang->reload - , $lang->play); + $tags = sprintf($tags, getUrl('captcha_action', 'captchaImage', 'rand', mt_rand(10000, 99999)) + , $swfURL + , $swfURL + , $lang->reload + , $lang->play); return $tags; } - } + } $GLOBALS['__AddonCaptcha__'] = new AddonCaptcha; $GLOBALS['__AddonCaptcha__']->setInfo($addon_info); Context::set('oCaptcha', $GLOBALS['__AddonCaptcha__']); @@ -342,9 +396,9 @@ if(method_exists($oAddonCaptcha, $called_position)) } $addon_act = Context::get('captcha_action'); -if($addon_act && method_exists($oAddonCaptcha, $called_position.'_'.$addon_act)) +if($addon_act && method_exists($oAddonCaptcha, $called_position . '_' . $addon_act)) { - if(!call_user_func_array(array(&$oAddonCaptcha, $called_position.'_'.$addon_act), array(&$this))) + if(!call_user_func_array(array(&$oAddonCaptcha, $called_position . '_' . $addon_act), array(&$this))) { return false; } diff --git a/addons/counter/counter.addon.php b/addons/counter/counter.addon.php index b61c4bbf4..aa4952d6d 100644 --- a/addons/counter/counter.addon.php +++ b/addons/counter/counter.addon.php @@ -1,5 +1,7 @@ counterExecute(); } /* End of file counter.addon.php */ diff --git a/addons/member_communication/member_communication.addon.php b/addons/member_communication/member_communication.addon.php index c300a91f4..c2ce562b7 100644 --- a/addons/member_communication/member_communication.addon.php +++ b/addons/member_communication/member_communication.addon.php @@ -1,5 +1,7 @@ module != 'member') { // Load a language file from the communication module Context::loadLang('./modules/communication/lang'); // Add menus on the member login information - $oMemberController = &getController('member'); + $oMemberController = getController('member'); $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); // Pop-up to display messages if a flag on new message is set - $flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl); - $flag_file = $flag_path.$logged_info->member_srl; + $flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl); + $flag_file = $flag_path . $logged_info->member_srl; if(file_exists($flag_file) && $addon_info->use_alarm != 'N') { @@ -36,8 +41,8 @@ if($called_position == 'before_module_init' && $this->module != 'member') Context::loadLang('./addons/member_communication/lang'); Context::loadFile(array('./addons/member_communication/tpl/member_communication.js'), true); - $text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); - $link = Context::getRequestUri().'?module=communication&act=dispCommunicationNewMessage'; + $text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); + $link = Context::getRequestUri() . '?module=communication&act=dispCommunicationNewMessage'; $script = ""; Context::addHtmlFooter($script); @@ -45,34 +50,38 @@ if($called_position == 'before_module_init' && $this->module != 'member') } elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') { - $oMemberController = &getController('member'); + $oMemberController = getController('member'); $member_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); // Creates communication model object - $oCommunicationModel = &getModel('communication'); + $oCommunicationModel = getModel('communication'); // Add a feature to display own message box. if($logged_info->member_srl == $member_srl) { // Add your own viewing Note Template - $oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationMessages'), 'cmd_view_message_box', '', 'self'); + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationMessages'), 'cmd_view_message_box', '', 'self'); // Display a list of friends - $oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); + $oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationFriend'), 'cmd_view_friend', '', 'self'); // If not, Add menus to send message and to add friends } else { // Get member information - $oMemberModel = &getModel('member'); + $oMemberModel = getModel('member'); $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); - if(!$target_member_info->member_srl) return; + if(!$target_member_info->member_srl) + { + return; + } + // Get logged-in user information $logged_info = Context::get('logged_info'); // Add a menu for sending message - if( $logged_info->is_admin == 'Y' || $target_member_info->allow_message =='Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) - $oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationSendMessage','receiver_srl',$member_srl), 'cmd_send_message', '', 'popup'); + if($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) + $oMemberController->addMemberPopupMenu(getUrl('', 'module', 'communication', 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup'); // Add a menu for listing friends (if a friend is new) if(!$oCommunicationModel->isAddedFriend($member_srl)) - $oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationAddFriend','target_srl',$member_srl), 'cmd_add_friend', '', 'popup'); + $oMemberController->addMemberPopupMenu(getUrl('', 'module', 'communication', 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup'); } } /* End of file member_communication.addon.php */ diff --git a/addons/member_extra_info/member_extra_info.addon.php b/addons/member_extra_info/member_extra_info.addon.php index 86138a487..20dca76fe 100644 --- a/addons/member_extra_info/member_extra_info.addon.php +++ b/addons/member_extra_info/member_extra_info.addon.php @@ -1,5 +1,7 @@ .... * Check if ther is image name and image mark. Then change it. */ - /** * Just before displaying, change image name/ image mark */ -if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return; +if($called_position != "before_display_content" || Context::get('act') == 'dispPageAdminContentModify') +{ + return; +} // Include a file having functions to replace member image name/mark require_once('./addons/member_extra_info/member_extra_info.lib.php'); // 1. Find a part
content
in the output document, change it to image name/mark by using MemberController::transImageName() $temp_output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output); -if($temp_output) $output = $temp_output; +if($temp_output) +{ + $output = $temp_output; +} unset($temp_output); /* End of file member_extra_info.addon.php */ diff --git a/addons/member_extra_info/member_extra_info.lib.php b/addons/member_extra_info/member_extra_info.lib.php index 429ec8243..4a288e328 100644 --- a/addons/member_extra_info/member_extra_info.lib.php +++ b/addons/member_extra_info/member_extra_info.lib.php @@ -1,16 +1,23 @@ cached = true; $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); $image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl); - if(file_exists($image_name_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_name_file = $image_name_file; - else $image_name_file = ''; - if(file_exists($image_mark_file)) $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file = $image_mark_file; - else $image_mark_file = ''; + if(file_exists($image_name_file)) + { + $GLOBALS['_transImageNameList'][$member_srl]->image_name_file = $image_name_file; + } + else + { + $image_name_file = ''; + } + if(file_exists($image_mark_file)) + { + $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file = $image_mark_file; + } + else + { + $image_mark_file = ''; + } $site_module_info = Context::get('site_module_info'); - $group_image = $oMemberModel->getGroupImageMark($member_srl,$site_module_info->site_srl); + $group_image = $oMemberModel->getGroupImageMark($member_srl, $site_module_info->site_srl); $GLOBALS['_transImageNameList'][$member_srl]->group_image = $group_image; } else @@ -35,20 +54,33 @@ function memberTransImageName($matches) $image_mark_file = $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file; } // If image name and mark doesn't exist, set the original information - if(!$image_name_file && !$image_mark_file && !$group_image) return $matches[0]; + if(!$image_name_file && !$image_mark_file && !$group_image) + { + return $matches[0]; + } // check member_config $config = $oMemberModel->getMemberConfig(); - if($config->image_name == 'Y' && $image_name_file) $nick_name = sprintf('id: %s', Context::getRequestUri(),$image_name_file, strip_tags($nick_name), strip_tags($nick_name)); - if($config->image_mark == 'Y' && $image_mark_file) $nick_name = sprintf('id: %s%s', Context::getRequestUri(),$image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name); + if($config->image_name == 'Y' && $image_name_file) + { + $nick_name = sprintf('id: %s', Context::getRequestUri(), $image_name_file, strip_tags($nick_name), strip_tags($nick_name)); + } + if($config->image_mark == 'Y' && $image_mark_file) + { + $nick_name = sprintf('id: %s%s', Context::getRequestUri(), $image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name); + } - if($group_image) $nick_name = sprintf('%s%s', $group_image->src, $group_image->title, $group_image->description, $nick_name); + if($group_image) + { + $nick_name = sprintf('%s%s', $group_image->src, $group_image->title, $group_image->description, $nick_name); + } - $orig_text = preg_replace('/'.preg_quote($matches[5],'/').'<\/'.$matches[6].'>$/', '', $matches[0]); - return $orig_text.$nick_name.''; + $orig_text = preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]); + return $orig_text . $nick_name . ''; } + /* End of file member_extra_info.lib.php */ /* Location: ./addons/member_extra_info/member_extra_info.lib.php */ diff --git a/addons/mobile/mobile.addon.php b/addons/mobile/mobile.addon.php index 5fc41ffc3..8539c64bd 100644 --- a/addons/mobile/mobile.addon.php +++ b/addons/mobile/mobile.addon.php @@ -1,5 +1,7 @@ display mobile content * Condition - **/ + * */ // Ignore admin page -if(Context::get('module')=='admin') return; +if(Context::get('module') == 'admin') +{ + return; +} // Manage when to call it -if($called_position != 'before_module_proc' && $called_position != 'after_module_proc' ) return; +if($called_position != 'before_module_proc' && $called_position != 'after_module_proc') +{ + return; +} // Ignore if not mobile browser -require_once(_XE_PATH_.'addons/mobile/classes/mobile.class.php'); -if(!mobileXE::getBrowserType()) return; +require_once(_XE_PATH_ . 'addons/mobile/classes/mobile.class.php'); +if(!mobileXE::getBrowserType()) +{ + return; +} // Generate mobile instance $oMobile = &mobileXE::getInstance(); -if(!$oMobile) return; +if(!$oMobile) +{ + return; +} // Specify charset on the add-on settings $oMobile->setCharSet($addon_info->charset); // Set module information @@ -41,9 +55,15 @@ if($called_position == 'before_module_proc') $oMobile->displayLangSelect(); } // On navigation mode, display navigation content - if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent(); + if($oMobile->isNavigationMode()) + { + $oMobile->displayNavigationContent(); + } // If you have a WAP class content output via WAP class - else $oMobile->displayModuleContent(); + else + { + $oMobile->displayModuleContent(); + } // If neither navigation mode nor WAP class is, display the module's result } else if($called_position == 'after_module_proc') diff --git a/addons/openid_delegation_id/openid_delegation_id.addon.php b/addons/openid_delegation_id/openid_delegation_id.addon.php index 554c8c770..42c9a8a2d 100644 --- a/addons/openid_delegation_id/openid_delegation_id.addon.php +++ b/addons/openid_delegation_id/openid_delegation_id.addon.php @@ -1,5 +1,7 @@ server||!$addon_info->delegate||!$addon_info->xrds) return; +if(!$addon_info->server || !$addon_info->delegate || !$addon_info->xrds) +{ + return; +} $header_script = sprintf( - ''."\n". - ''."\n". + '' . "\n" . + '' . "\n" . '', $addon_info->server, $addon_info->delegate, $addon_info->xrds - ); +); Context::addHtmlHeader($header_script); diff --git a/addons/point_level_icon/point_level_icon.addon.php b/addons/point_level_icon/point_level_icon.addon.php index 846b5a646..be46a3eb8 100644 --- a/addons/point_level_icon/point_level_icon.addon.php +++ b/addons/point_level_icon/point_level_icon.addon.php @@ -1,5 +1,7 @@ ]*)member_([0-9\-]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'pointLevelIconTrans', $output); -if($temp_output) $output = $temp_output; +if($temp_output) +{ + $output = $temp_output; +} unset($temp_output); /* End of file point_level_icon.addon.php */ diff --git a/addons/point_level_icon/point_level_icon.lib.php b/addons/point_level_icon/point_level_icon.lib.php index e1289b387..5caa1cd7c 100644 --- a/addons/point_level_icon/point_level_icon.lib.php +++ b/addons/point_level_icon/point_level_icon.lib.php @@ -1,57 +1,77 @@ $/', '', $matches[0]); + $orig_text = preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]); // Check Group Image Mark - $oMemberModel = &getModel('member'); - if($oMemberModel->getGroupImageMark($member_srl)) return $orig_text.$matches[5].''; + $oMemberModel = getModel('member'); + if($oMemberModel->getGroupImageMark($member_srl)) + { + return $orig_text . $matches[5] . ''; + } if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) { // Get point configuration if(!$GLOBALS['_pointConfig']) { - $oModuleModel = &getModel('module'); + $oModuleModel = getModel('module'); $GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point'); } $config = $GLOBALS['_pointConfig']; + // Get point model - if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point'); + if(!$GLOBALS['_pointModel']) + { + $GLOBALS['_pointModel'] = getModel('point'); + } $oPointModel = &$GLOBALS['_pointModel']; + // Get points - if(!$oPointModel->isExistsPoint($member_srl)) return $matches[0]; + if(!$oPointModel->isExistsPoint($member_srl)) + { + return $matches[0]; + } + $point = $oPointModel->getPoint($member_srl); + // Get level $level = $oPointModel->getLevel($point, $config->level_step); $text = $matches[5]; + // Get a path where level icon is $level_icon = sprintf('%smodules/point/icons/%s/%d.gif', Context::getRequestUri(), $config->level_icon, $level); + // Get per to go to the next level if not a top level if($level < $config->max_level) { - $next_point = $config->level_step[$level+1]; + $next_point = $config->level_step[$level + 1]; $present_point = $config->level_step[$level]; - if($next_point > 0) { - $per = (int)(($point - $present_point) / ($next_point - $present_point)*100); - $per = $per.'%'; + if($next_point > 0) + { + $per = (int) (($point - $present_point) / ($next_point - $present_point) * 100); + $per = $per . '%'; } } - $title = sprintf('%s:%s%s%s, %s:%s/%s', Context::getLang('point'), $point, $config->point_name, $per?' ('.$per.')':'', Context::getLang('level'), $level, $config->max_level); + $title = sprintf('%s:%s%s%s, %s:%s/%s', Context::getLang('point'), $point, $config->point_name, $per ? ' (' . $per . ')' : '', Context::getLang('level'), $level, $config->max_level); $alt = sprintf('[%s:%s]', Context::getLang('level'), $level); $GLOBALS['_pointLevelIcon'][$member_srl] = sprintf('%s', $level_icon, $alt, $title); } $text = $GLOBALS['_pointLevelIcon'][$member_srl]; - return $orig_text.$text.$matches[5].''; + return $orig_text . $text . $matches[5] . ''; } /* End of file point_level_icon.lib.php */ diff --git a/addons/resize_image/resize_image.addon.php b/addons/resize_image/resize_image.addon.php index 720b59687..29ee1b319 100644 --- a/addons/resize_image/resize_image.addon.php +++ b/addons/resize_image/resize_image.addon.php @@ -1,13 +1,14 @@