diff --git a/classes/extravar/Extravar.class.php b/classes/extravar/Extravar.class.php
index ddda833a7..823effc5b 100644
--- a/classes/extravar/Extravar.class.php
+++ b/classes/extravar/Extravar.class.php
@@ -58,7 +58,7 @@ class ExtraVar
foreach($extra_keys as $val)
{
- $obj = new ExtraItem($val->module_srl, $val->idx, $val->name, $val->type, $val->default, $val->desc, $val->is_required, $val->search, $val->value, $val->eid);
+ $obj = new ExtraItem($val->module_srl, $val->idx, $val->name, $val->type, $val->default, $val->desc, $val->is_required, $val->search, $val->value ?? null, $val->eid);
$this->keys[$val->idx] = $obj;
}
}
diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php
index 3f2956269..77db7d177 100644
--- a/classes/module/ModuleObject.class.php
+++ b/classes/module/ModuleObject.class.php
@@ -754,7 +754,7 @@ class ModuleObject extends BaseObject
if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON')
{
$oAPI = getAPI($this->module_info->module);
- if(method_exists($oAPI, $this->act))
+ if($oAPI instanceof ModuleObject && method_exists($oAPI, $this->act))
{
$oAPI->{$this->act}($this);
}
diff --git a/common/framework/db.php b/common/framework/db.php
index d66be8b7c..b137e0fbb 100644
--- a/common/framework/db.php
+++ b/common/framework/db.php
@@ -420,6 +420,11 @@ class DB
$output = $this->setError(-1, $e->getMessage());
return $output;
}
+ catch (\PDOException $e)
+ {
+ $output = $this->setError(-1, $e->getMessage());
+ return $output;
+ }
// Collect various counts used in the page calculation.
list($is_expression, $list_count) = $query->navigation->list_count->getValue($args);
@@ -477,17 +482,24 @@ class DB
return $stmt;
}
- $result = array();
- $index = $last_index;
- $step = $last_index !== 0 ? -1 : 1;
-
- while ($row = $stmt->fetchObject())
+ try
{
- $result[$index] = $row;
- $index += $step;
+ $result = array();
+ $index = $last_index;
+ $step = $last_index !== 0 ? -1 : 1;
+
+ while ($row = $stmt->fetchObject())
+ {
+ $result[$index] = $row;
+ $index += $step;
+ }
+
+ $stmt->closeCursor();
+ }
+ catch (\PDOException $e)
+ {
+ throw new Exceptions\DBError($e->getMessage(), 0, $e);
}
-
- $stmt->closeCursor();
if ($result_type === 'auto' && $last_index === 0 && count($result) === 1)
{
diff --git a/common/framework/parsers/dbquery/variablebase.php b/common/framework/parsers/dbquery/variablebase.php
index b4ad94dc9..a46ae408b 100644
--- a/common/framework/parsers/dbquery/variablebase.php
+++ b/common/framework/parsers/dbquery/variablebase.php
@@ -294,6 +294,11 @@ class VariableBase
{
list($is_expression, $value) = $this->getDefaultValue();
}
+ else
+ {
+ $is_expression = null;
+ $value = null;
+ }
return [$is_expression, $value];
}
diff --git a/modules/board/board.view.php b/modules/board/board.view.php
index b82bd8b05..198a3eb1e 100644
--- a/modules/board/board.view.php
+++ b/modules/board/board.view.php
@@ -35,8 +35,8 @@ class boardView extends board
{
$this->page_count = $this->module_info->page_count;
}
- $this->except_notice = $this->module_info->except_notice == 'N' ? FALSE : TRUE;
- $this->include_modules = $this->module_info->include_modules ? explode(',', $this->module_info->include_modules) : [];
+ $this->except_notice = ($this->module_info->except_notice ?? '') == 'N' ? FALSE : TRUE;
+ $this->include_modules = ($this->module_info->include_modules ?? []) ? explode(',', $this->module_info->include_modules) : [];
if (count($this->include_modules) && !in_array($this->module_info->module_srl, $this->include_modules))
{
$this->include_modules[] = $this->module_info->module_srl;
@@ -546,7 +546,7 @@ class boardView extends board
}
// setup the list count to be serach list count, if the category or search keyword has been set
- if($args->category_srl || $args->search_keyword)
+ if($args->category_srl ?? null || $args->search_keyword ?? null)
{
$args->list_count = $this->search_list_count;
}
@@ -602,15 +602,10 @@ class boardView extends board
foreach ($document_list as $document)
{
$module_srl = $document->get('module_srl');
- if (isset($map[$module_srl]))
+ if ($document->get('mid') === null)
{
- $document->add('module_title', $map[$module_srl]->browser_title);
- $document->add('mid', $map[$module_srl]->mid);
- }
- else
- {
- $document->add('module_title', $this->module_info->browser_title);
- $document->add('mid', $this->module_info->mid);
+ $document->add('module_title', isset($map[$module_srl]) ? $map[$module_srl]->browser_title : $this->module_info->browser_title);
+ $document->add('mid', isset($map[$module_srl]) ? $map[$module_srl]->mid : $this->module_info->mid);
}
}
}
@@ -618,8 +613,11 @@ class boardView extends board
{
foreach ($document_list as $document)
{
- $document->add('module_title', $this->module_info->browser_title);
- $document->add('mid', $this->module_info->mid);
+ if ($document->get('mid') === null)
+ {
+ $document->add('module_title', $this->module_info->browser_title);
+ $document->add('mid', $this->module_info->mid);
+ }
}
}
}
diff --git a/modules/board/m.skins/default/_list.html b/modules/board/m.skins/default/_list.html
index 302ecde79..fd2662c6c 100644
--- a/modules/board/m.skins/default/_list.html
+++ b/modules/board/m.skins/default/_list.html
@@ -40,7 +40,7 @@
-
+
diff --git a/modules/board/skins/default/list.html b/modules/board/skins/default/list.html
index 0c3a658db..46037890b 100644
--- a/modules/board/skins/default/list.html
+++ b/modules/board/skins/default/list.html
@@ -139,7 +139,7 @@
-
+
diff --git a/modules/board/skins/xedition/list.html b/modules/board/skins/xedition/list.html
index 06b018b48..6230161a0 100644
--- a/modules/board/skins/xedition/list.html
+++ b/modules/board/skins/xedition/list.html
@@ -148,7 +148,7 @@
-
+
{$lang->cmd_search_next}
diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php
index 645ae15bd..eea91c856 100644
--- a/modules/comment/comment.model.php
+++ b/modules/comment/comment.model.php
@@ -728,7 +728,7 @@ class commentModel extends comment
*/
public static function _arrangeComment(&$comment_list, $list, $depth, $parent = NULL)
{
- if(!count($list))
+ if(!is_array($list) || !count($list))
{
return;
}
diff --git a/modules/communication/communication.view.php b/modules/communication/communication.view.php
index 5c4439b18..d4f348659 100644
--- a/modules/communication/communication.view.php
+++ b/modules/communication/communication.view.php
@@ -118,7 +118,7 @@ class communicationView extends communication
Context::set('message', $message);
Context::set('message_files', CommunicationModel::getMessageFiles($message));
- if(Mobile::isFromMobilePhone())
+ if(Mobile::isFromMobilePhone() && file_exists($this->getTemplatePath() . 'read_message.html'))
{
$template_filename = 'read_message';
}
diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php
index 7caa3946d..dcfcd3ee1 100644
--- a/modules/document/document.controller.php
+++ b/modules/document/document.controller.php
@@ -1651,8 +1651,8 @@ class documentController extends document
*/
function declaredDocument($document_srl, $declare_message = '')
{
- // Fail if session information already has a reported document
- if($_SESSION['declared_document'][$document_srl])
+ // Fail if session already tried to report the document
+ if(isset($_SESSION['declared_document'][$document_srl]))
{
return new BaseObject(-1, 'failed_declared');
}
@@ -1687,7 +1687,7 @@ class documentController extends document
// Pass if the author's IP address is as same as visitor's.
if($oDocument->get('ipaddress') == \RX_CLIENT_IP)
{
- $_SESSION['declared_document'][$document_srl] = true;
+ $_SESSION['declared_document'][$document_srl] = false;
return new BaseObject(-1, 'failed_declared');
}
@@ -1700,7 +1700,7 @@ class documentController extends document
// Pass after registering a session if author's information is same as the currently logged-in user's.
if($member_srl && $member_srl == abs($oDocument->get('member_srl')))
{
- $_SESSION['declared_document'][$document_srl] = true;
+ $_SESSION['declared_document'][$document_srl] = false;
return new BaseObject(-1, 'failed_declared');
}
}
@@ -1719,7 +1719,7 @@ class documentController extends document
$output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
if($output->data->count)
{
- $_SESSION['declared_document'][$document_srl] = true;
+ $_SESSION['declared_document'][$document_srl] = false;
return new BaseObject(-1, 'failed_declared');
}
@@ -1835,7 +1835,7 @@ class documentController extends document
if($output->data->count <= 0 || !isset($output->data->count))
{
- $_SESSION['declared_document'][$document_srl] = false;
+ unset($_SESSION['declared_document'][$document_srl]);
return new BaseObject(-1, 'failed_declared_cancel');
}
@@ -1911,7 +1911,7 @@ class documentController extends document
$trigger_obj->declared_count = $declared_count - 1;
ModuleHandler::triggerCall('document.declaredDocumentCancel', 'after', $trigger_obj);
- $_SESSION['declared_document'][$document_srl] = false;
+ unset($_SESSION['declared_document'][$document_srl]);
$this->setMessage('success_declared_cancel');
}
@@ -2463,7 +2463,7 @@ class documentController extends document
$list[$category_srl] = $category_list[$i];
}
// Create the xml file without node data if no data is obtained
- if(!$list)
+ if(!isset($list) || !$list)
{
$xml_buff = "";
FileHandler::writeFile($xml_file, $xml_buff);
diff --git a/modules/document/document.item.php b/modules/document/document.item.php
index 1459be4f7..111cee45f 100644
--- a/modules/document/document.item.php
+++ b/modules/document/document.item.php
@@ -558,7 +558,7 @@ class documentItem extends BaseObject
return $_SESSION['declared_document'][$this->document_srl] = $declaredCount;
}
- return $_SESSION['declared_document'][$this->document_srl] = false;
+ return false;
}
function getTitle($cut_size = 0, $tail = '...')
diff --git a/modules/document/document.model.php b/modules/document/document.model.php
index b396cdc0a..1aa5c0367 100644
--- a/modules/document/document.model.php
+++ b/modules/document/document.model.php
@@ -304,7 +304,26 @@ class documentModel extends document
$args = new stdClass();
$args->module_srl = $obj->module_srl;
$args->category_srl = $obj->category_srl ?? null;
- $output = executeQueryArray('document.getNoticeList', $args, $columnList);
+
+ // Call trigger (before)
+ // This trigger can be used to set an alternative output using a different search method
+ unset($args->use_alternate_output);
+ $output = ModuleHandler::triggerCall('document.getNoticeList', 'before', $args);
+ if ($output instanceof BaseObject && !$output->toBool())
+ {
+ return $output;
+ }
+
+ // If an alternate output is set, use it instead of running the default queries
+ if (isset($args->use_alternate_output) && $args->use_alternate_output instanceof BaseObject)
+ {
+ $output = $args->use_alternate_output;
+ }
+ else
+ {
+ $output = executeQueryArray('document.getNoticeList', $args, $columnList);
+ }
+
if(!$output->toBool() || !$result = $output->data)
{
return;
@@ -322,7 +341,10 @@ class documentModel extends document
$output->data[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
}
self::setToAllDocumentExtraVars();
-
+
+ // Call trigger (after)
+ // This trigger can be used to modify search results
+ ModuleHandler::triggerCall('document.getNoticeList', 'after', $output);
return $output;
}
@@ -707,7 +729,10 @@ class documentModel extends document
// Cleanup of category
$document_category = array();
- self::_arrangeCategory($document_category, $menu->list, 0);
+ if (isset($menu) && isset($menu->list))
+ {
+ self::_arrangeCategory($document_category, $menu->list, 0);
+ }
return $document_category;
}
diff --git a/modules/editor/skins/ckeditor/editor.html b/modules/editor/skins/ckeditor/editor.html
index 902fbf378..7ce7317cf 100644
--- a/modules/editor/skins/ckeditor/editor.html
+++ b/modules/editor/skins/ckeditor/editor.html
@@ -28,10 +28,10 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
{@ $css_content = "" }
-
-
-
-
+
+
+
+
diff --git a/modules/file/file.admin.model.php b/modules/file/file.admin.model.php
index 1bb074c63..d48a1ea1e 100644
--- a/modules/file/file.admin.model.php
+++ b/modules/file/file.admin.model.php
@@ -10,7 +10,7 @@ class fileAdminModel extends file
* Initialization
* @return void
*/
- function init()
+ public function init()
{
}
@@ -62,7 +62,7 @@ class fileAdminModel extends file
* @param array $columnList Column list to get from DB
* @return Object Object contains query result
*/
- function getFileList($obj, $columnList = array())
+ public function getFileList($obj, $columnList = array())
{
$args = new stdClass();
$this->_makeSearchParam($obj, $args);
@@ -75,9 +75,9 @@ class fileAdminModel extends file
elseif($obj->direct_download == 'N') $args->direct_download= 'N';
// Set variables
$args->sort_index = $obj->sort_index;
- $args->page = $obj->page?$obj->page:1;
- $args->list_count = $obj->list_count?$obj->list_count:20;
- $args->page_count = $obj->page_count?$obj->page_count:10;
+ $args->page = isset($obj->page) ? ($obj->page ? $obj->page : 1) : 1;
+ $args->list_count = isset($obj->list_count) ? ($obj->list_count? $obj->list_count : 20) : 20;
+ $args->page_count = isset($obj->page_count) ? ($obj->page_count? $obj->page_count : 10) : 10;
$args->s_module_srl = $obj->module_srl;
$args->exclude_module_srl = $obj->exclude_module_srl;
if(toBool($obj->exclude_secret))
@@ -124,7 +124,7 @@ class fileAdminModel extends file
* @param object $obj Search options (not used...)
* @return array
*/
- function getFilesCountByGroupValid($obj = '')
+ public function getFilesCountByGroupValid($obj = '')
{
//$this->_makeSearchParam($obj, $args);
@@ -138,7 +138,7 @@ class fileAdminModel extends file
* @param string $date Date string
* @return int
*/
- function getFilesCountByDate($date = '')
+ public function getFilesCountByDate($date = '')
{
$args = new stdClass();
if($date)
@@ -162,18 +162,17 @@ class fileAdminModel extends file
* @param object $args Result searach options
* @return void
*/
- function _makeSearchParam(&$obj, &$args)
+ protected function _makeSearchParam(&$obj, &$args)
{
// Search options
- $search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
- $search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
+ $search_target = isset($obj->search_target)? ($obj->search_target? $obj->search_target : trim(Context::get('search_target'))) : trim(Context::get('search_target'));
+ $search_keyword = isset($obj->search_keyword)? ($obj->search_keyword? $obj->search_keyword : trim(Context::get('search_keyword'))) : trim(Context::get('search_keyword'));
if($search_target && $search_keyword)
{
switch($search_target)
{
case 'filename' :
- if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_filename = $search_keyword;
break;
case 'filesize_more' :
diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php
index a36cc0e3e..c2309ac80 100644
--- a/modules/file/file.controller.php
+++ b/modules/file/file.controller.php
@@ -857,7 +857,7 @@ class fileController extends file
$args->module_srl = $module_srl;
$args->upload_target_srl = $upload_target_srl;
$args->download_count = $download_count;
- $args->member_srl = Rhymix\Framework\Session::getMemberSrl();
+ $args->member_srl = Rhymix\Framework\Session::getMemberSrl() ?: 0;
$args->source_filename = $file_info['name'];
$args->sid = Rhymix\Framework\Security::getRandom(32, 'hex');
$args->mime_type = $file_info['type'];
diff --git a/modules/file/queries/getFileList.xml b/modules/file/queries/getFileList.xml
index 9faf6fb1e..43461e9fd 100644
--- a/modules/file/queries/getFileList.xml
+++ b/modules/file/queries/getFileList.xml
@@ -20,15 +20,15 @@
-
+
-
-
-
+
+
+
diff --git a/modules/file/queries/getFileListByTargetStatus.xml b/modules/file/queries/getFileListByTargetStatus.xml
index 7092da25f..999d87e02 100644
--- a/modules/file/queries/getFileListByTargetStatus.xml
+++ b/modules/file/queries/getFileListByTargetStatus.xml
@@ -1,4 +1,4 @@
-
+
@@ -35,15 +35,15 @@
-
+
-
-
-
+
+
+
diff --git a/modules/file/queries/getFilesCountByGroupValid.xml b/modules/file/queries/getFilesCountByGroupValid.xml
index 869d7a3fd..509a4d0c6 100644
--- a/modules/file/queries/getFilesCountByGroupValid.xml
+++ b/modules/file/queries/getFilesCountByGroupValid.xml
@@ -1,4 +1,4 @@
-
+
@@ -12,7 +12,7 @@
-
+
diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php
index 33db6a00d..8a0c36581 100644
--- a/modules/install/install.controller.php
+++ b/modules/install/install.controller.php
@@ -233,7 +233,6 @@ class installController extends install
catch(Exception $e)
{
$oDB->rollback();
- var_dump($e);exit;
throw new Rhymix\Framework\Exception($e->getMessage());
}
diff --git a/modules/integration_search/integration_search.view.php b/modules/integration_search/integration_search.view.php
index 1add46f55..9e0c779f3 100644
--- a/modules/integration_search/integration_search.view.php
+++ b/modules/integration_search/integration_search.view.php
@@ -23,7 +23,7 @@ class integration_searchView extends integration_search
*
* @return void
*/
- function init()
+ public function init()
{
}
@@ -32,7 +32,7 @@ class integration_searchView extends integration_search
*
* @return Object
*/
- function IS()
+ public function IS()
{
$oFile = getClass('file');
$oModuleModel = getModel('module');
@@ -114,7 +114,8 @@ class integration_searchView extends integration_search
// Set a variable for search keyword
$is_keyword = Context::get('is_keyword');
- $is_keyword = escape(trim(utf8_normalize_spaces($is_keyword)));
+ // As the variables from GET or POST will be escaped by setRequestArguments method at Context class, the double_escape variable should be "FALSE", and also the escape function might be useful when this method was called from the other way (for not escaped keyword).
+ $is_keyword = escape(trim(utf8_normalize_spaces($is_keyword)), false);
if (mb_strlen($is_keyword, 'UTF-8') > 250)
{
$is_keyword = mb_substr($is_keyword, 0, 250);
diff --git a/modules/menu/menu.admin.controller.php b/modules/menu/menu.admin.controller.php
index 796aff7b8..c3c3c8820 100644
--- a/modules/menu/menu.admin.controller.php
+++ b/modules/menu/menu.admin.controller.php
@@ -1674,13 +1674,19 @@ class menuAdminController extends menu
}
else
{
- $exposure = explode(',', $exposure);
+ if(is_array($exposure))
+ {
+ $exposure = implode(',', $exposure);
+ }
+
if(in_array($exposure, array('-1','-3')))
{
$args->group_srls = $exposure;
}
-
- if($exposure) $args->group_srls = implode(',', $exposure);
+ else
+ {
+ $args->group_srls = implode(',', array_map('intval', explode(',', $exposure)));
+ }
}
$output = $this->_updateMenuItem($args);
@@ -1929,8 +1935,6 @@ class menuAdminController extends menu
if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = escape($active_btn);
else $active_btn = '';
- $group_srls = ($node->group_srls) ? $node->group_srls : '';
-
if($normal_btn)
{
if($hover_btn) $hover_str = sprintf('onmouseover="this.src=\'%s\'"', $hover_btn); else $hover_str = '';
@@ -1943,8 +1947,9 @@ class menuAdminController extends menu
}
// If the value of node->group_srls exists
- if($group_srls) {
- $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
+ if($node->group_srls) {
+ $group_srls_exported = json_encode(array_values(is_array($node->group_srls) ? $node->group_srls : array_map('intval', explode(',', $node->group_srls))));
+ $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged&&%s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0);
}
else
{
@@ -2035,8 +2040,15 @@ class menuAdminController extends menu
if($node->url) $child_output['url_list'][] = $node->url;
$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
// If node->group_srls value exists
- if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
- else $group_check_code = "true";
+ if($node->group_srls)
+ {
+ $group_srls_exported = json_encode(array_values(is_array($node->group_srls) ? $node->group_srls : array_map('intval', explode(',', $node->group_srls))));
+ $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged && %s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0);
+ }
+ else
+ {
+ $group_check_code = 'true';
+ }
// List variables
$href = escape($node->href ?? '', false);