Merge branch 'develop' into pr/member-phone-number

This commit is contained in:
Kijin Sung 2017-12-01 02:04:09 +09:00
commit 8f64e7c6b9
200 changed files with 2025 additions and 1785 deletions

View file

@ -28,9 +28,11 @@ RewriteRule ^([a-zA-Z0-9_]+)/category/([0-9]+)$ ./index.php?mid=$1&category=$2 [
# document permanent link # document permanent link
RewriteRule ^([0-9]+)$ ./index.php?document_srl=$1 [L,QSA] RewriteRule ^([0-9]+)$ ./index.php?document_srl=$1 [L,QSA]
# admin module link
RewriteRule ^admin/?$ ./index.php?module=admin [L,QSA]
# mid link # mid link
RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^admin/?$ ./index.php?module=admin [L,QSA]
RewriteRule ^([a-zA-Z0-9_]+)/?$ ./index.php?mid=$1 [L,QSA] RewriteRule ^([a-zA-Z0-9_]+)/?$ ./index.php?mid=$1 [L,QSA]
# mid + document link # mid + document link

View file

@ -6,6 +6,10 @@ php:
- 5.6 - 5.6
- 7.0 - 7.0
- 7.1 - 7.1
- 7.2
matrix:
allow_failures:
- php: 7.2
services: services:
- mysql - mysql
before_script: before_script:

View file

@ -18,7 +18,7 @@ class reCAPTCHA
$response = Context::get('g-recaptcha-response'); $response = Context::get('g-recaptcha-response');
if (!$response) if (!$response)
{ {
return new Object(-1, lang('recaptcha.msg_recaptcha_invalid_response')); return new BaseObject(-1, 'recaptcha.msg_recaptcha_invalid_response');
} }
try try
@ -31,17 +31,17 @@ class reCAPTCHA
} }
catch (\Requests_Exception $e) catch (\Requests_Exception $e)
{ {
return new Object(-1, lang('recaptcha.msg_recaptcha_connection_error')); return new BaseObject(-1, 'recaptcha.msg_recaptcha_connection_error');
} }
$verify = @json_decode($verify_request->body, true); $verify = @json_decode($verify_request->body, true);
if ($verify && isset($verify['error-codes']) && in_array('invalid-input-response', $verify['error-codes'])) if ($verify && isset($verify['error-codes']) && in_array('invalid-input-response', $verify['error-codes']))
{ {
return new Object(-1, lang('recaptcha.msg_recaptcha_invalid_response')); return new BaseObject(-1, 'recaptcha.msg_recaptcha_invalid_response');
} }
elseif (!$verify || !$verify['success'] || (isset($verify['error-codes']) && $verify['error-codes'])) elseif (!$verify || !$verify['success'] || (isset($verify['error-codes']) && $verify['error-codes']))
{ {
return new Object(-1, lang('recaptcha.msg_recaptcha_server_error')); return new BaseObject(-1, 'recaptcha.msg_recaptcha_server_error');
} }
else else
{ {

View file

@ -16,7 +16,7 @@ class Context
/** /**
* Request method * Request method
* @var string GET|POST|XMLRPC * @var string GET|POST|XMLRPC|JSON
*/ */
public $request_method = 'GET'; public $request_method = 'GET';
@ -28,7 +28,7 @@ class Context
/** /**
* Response method.If it's not set, it follows request method. * Response method.If it's not set, it follows request method.
* @var string HTML|XMLRPC * @var string HTML|XMLRPC|JSON|JS_CALLBACK
*/ */
public $response_method = ''; public $response_method = '';
@ -1904,7 +1904,7 @@ class Context
/** /**
* Return values from the GET/POST/XMLRPC * Return values from the GET/POST/XMLRPC
* *
* @return Object Request variables. * @return object Request variables.
*/ */
public static function getRequestVars() public static function getRequestVars()
{ {

View file

@ -143,7 +143,7 @@ class DB
} }
if(!$db_type && Context::isInstalled()) if(!$db_type && Context::isInstalled())
{ {
return new Object(-1, 'msg_db_not_setted'); return new BaseObject(-1, 'msg_db_not_setted');
} }
if(!isset($GLOBALS['__DB__'])) if(!isset($GLOBALS['__DB__']))
@ -156,7 +156,7 @@ class DB
$class_file = RX_BASEDIR . "classes/db/$class_name.class.php"; $class_file = RX_BASEDIR . "classes/db/$class_name.class.php";
if(!file_exists($class_file)) if(!file_exists($class_file))
{ {
return new Object(-1, 'msg_db_not_setted'); return new BaseObject(-1, 'msg_db_not_setted');
} }
// get a singletone instance of the database driver class // get a singletone instance of the database driver class
@ -449,7 +449,7 @@ class DB
public function getError() public function getError()
{ {
$this->errstr = Context::convertEncodingStr($this->errstr); $this->errstr = Context::convertEncodingStr($this->errstr);
return new Object($this->errno, $this->errstr); return new BaseObject($this->errno, $this->errstr);
} }
/** /**
@ -466,11 +466,11 @@ class DB
if(!$query_id) if(!$query_id)
{ {
return new Object(-1, 'msg_invalid_queryid'); return new BaseObject(-1, 'msg_invalid_queryid');
} }
if(!$this->db_type) if(!$this->db_type)
{ {
return; return new BaseObject(-1, 'msg_db_not_setted');
} }
$this->actDBClassStart(); $this->actDBClassStart();
@ -493,7 +493,7 @@ class DB
if(!isset($typeList[$target])) if(!isset($typeList[$target]))
{ {
$this->actDBClassFinish(); $this->actDBClassFinish();
return; return new BaseObject(-1, 'msg_invalid_queryid');
} }
$module = $id_args[1]; $module = $id_args[1];
$id = $id_args[2]; $id = $id_args[2];
@ -501,14 +501,14 @@ class DB
if(!$target || !$module || !$id) if(!$target || !$module || !$id)
{ {
$this->actDBClassFinish(); $this->actDBClassFinish();
return new Object(-1, 'msg_invalid_queryid'); return new BaseObject(-1, 'msg_invalid_queryid');
} }
$xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id); $xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id);
if(!file_exists($xml_file)) if(!file_exists($xml_file))
{ {
$this->actDBClassFinish(); $this->actDBClassFinish();
return new Object(-1, 'msg_invalid_queryid'); return new BaseObject(-1, 'msg_invalid_queryid');
} }
// look for cache file // look for cache file
@ -564,7 +564,7 @@ class DB
if(!file_exists($cache_file)) if(!file_exists($cache_file))
{ {
return new Object(-1, 'msg_invalid_queryid'); return new BaseObject(-1, 'msg_invalid_queryid');
} }
if (is_object($source_args)) if (is_object($source_args))
@ -582,13 +582,13 @@ class DB
$output = include($cache_file); $output = include($cache_file);
if($output instanceof Object && !$output->toBool()) if($output instanceof BaseObject && !$output->toBool())
{ {
return $output; return $output;
} }
if(!is_object($output) || !method_exists($output, 'getAction')) if(!is_object($output) || !method_exists($output, 'getAction'))
{ {
return new Object(-1, sprintf(lang('msg_failed_to_load_query'), $query_id)); return new BaseObject(-1, sprintf(lang('msg_failed_to_load_query'), $query_id));
} }
// execute appropriate query // execute appropriate query
@ -619,9 +619,9 @@ class DB
{ {
$output = $this->getError(); $output = $this->getError();
} }
elseif(!($output instanceof Object)) elseif(!($output instanceof BaseObject))
{ {
$output = new Object(); $output = new BaseObject();
} }
$output->add('_query', $this->query); $output->add('_query', $this->query);
$output->add('_elapsed_time', sprintf("%0.5f", $this->elapsed_time)); $output->add('_elapsed_time', sprintf("%0.5f", $this->elapsed_time));
@ -688,14 +688,14 @@ class DB
$select = $query->getSelectString($with_values); $select = $query->getSelectString($with_values);
if($select == '') if($select == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$select = 'SELECT ' . $select; $select = 'SELECT ' . $select;
$from = $query->getFromString($with_values); $from = $query->getFromString($with_values);
if($from == '') if($from == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$from = ' FROM ' . $from; $from = ' FROM ' . $from;
@ -790,7 +790,7 @@ class DB
$from = $query->getFromString($with_values); $from = $query->getFromString($with_values);
if($from == '') if($from == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$sql .= ' FROM ' . $from; $sql .= ' FROM ' . $from;
@ -815,13 +815,13 @@ class DB
$columnsList = $query->getUpdateString($with_values); $columnsList = $query->getUpdateString($with_values);
if($columnsList == '') if($columnsList == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$tables = $query->getFromString($with_values); $tables = $query->getFromString($with_values);
if($tables == '') if($tables == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$where = $query->getWhereString($with_values); $where = $query->getWhereString($with_values);

View file

@ -39,8 +39,8 @@ class DBCubrid extends DB
'varchar' => 'character varying', 'varchar' => 'character varying',
'char' => 'character', 'char' => 'character',
'tinytext' => 'character varying(256)', 'tinytext' => 'character varying(256)',
'text' => 'character varying(1073741823)',
'bigtext' => 'character varying(1073741823)', 'bigtext' => 'character varying(1073741823)',
'text' => 'character varying(1073741823)',
'date' => 'character varying(14)', 'date' => 'character varying(14)',
'float' => 'float', 'float' => 'float',
); );
@ -629,7 +629,7 @@ class DBCubrid extends DB
* Get information about a column * Get information about a column
* @param string $table_name table name * @param string $table_name table name
* @param string $column_name column name * @param string $column_name column name
* @return object * @return BaseObject
*/ */
function getColumnInfo($table_name, $column_name) function getColumnInfo($table_name, $column_name)
{ {
@ -987,7 +987,7 @@ class DBCubrid extends DB
/** /**
* Handles insertAct * Handles insertAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
@ -999,7 +999,7 @@ class DBCubrid extends DB
$with_values = FALSE; $with_values = FALSE;
} }
$query = $this->getInsertSql($queryObject, $with_values); $query = $this->getInsertSql($queryObject, $with_values);
if(is_a($query, 'Object')) if($query instanceof BaseObject)
{ {
unset($this->param); unset($this->param);
return; return;
@ -1016,7 +1016,7 @@ class DBCubrid extends DB
/** /**
* Handles updateAct * Handles updateAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
@ -1028,7 +1028,7 @@ class DBCubrid extends DB
$with_values = FALSE; $with_values = FALSE;
} }
$query = $this->getUpdateSql($queryObject, $with_values); $query = $this->getUpdateSql($queryObject, $with_values);
if(is_a($query, 'Object')) if($query instanceof BaseObject)
{ {
unset($this->param); unset($this->param);
return; return;
@ -1046,7 +1046,7 @@ class DBCubrid extends DB
/** /**
* Handles deleteAct * Handles deleteAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
@ -1058,7 +1058,7 @@ class DBCubrid extends DB
$with_values = FALSE; $with_values = FALSE;
} }
$query = $this->getDeleteSql($queryObject, $with_values); $query = $this->getDeleteSql($queryObject, $with_values);
if(is_a($query, 'Object')) if($query instanceof BaseObject)
{ {
unset($this->param); unset($this->param);
return; return;
@ -1079,10 +1079,10 @@ class DBCubrid extends DB
* Handle selectAct * Handle selectAct
* To get a specific page list easily in select statement, * To get a specific page list easily in select statement,
* a method, navigation, is used * a method, navigation, is used
* @param Object $queryObject * @param BaseObject $queryObject
* @param resource $connection * @param resource $connection
* @param boolean $with_values * @param boolean $with_values
* @return Object * @return BaseObject
*/ */
function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE) function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE)
{ {
@ -1099,7 +1099,7 @@ class DBCubrid extends DB
else else
{ {
$query = $this->getSelectSql($queryObject, $with_values); $query = $this->getSelectSql($queryObject, $with_values);
if(is_a($query, 'Object')) if($query instanceof BaseObject)
{ {
unset($this->param); unset($this->param);
return; return;
@ -1114,7 +1114,7 @@ class DBCubrid extends DB
} }
$data = $this->_fetch($result); $data = $this->_fetch($result);
$buff = new Object (); $buff = new BaseObject;
$buff->data = $data; $buff->data = $data;
unset($this->param); unset($this->param);
@ -1124,15 +1124,15 @@ class DBCubrid extends DB
/** /**
* If have a error, return error object * If have a error, return error object
* @param Object $queryObject * @param BaseObject $queryObject
* @return Object * @return BaseObject
*/ */
function queryError($queryObject) function queryError($queryObject)
{ {
$limit = $queryObject->getLimit(); $limit = $queryObject->getLimit();
if($limit && $limit->isPageHandler()) if($limit && $limit->isPageHandler())
{ {
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = 0; $buff->total_count = 0;
$buff->total_page = 0; $buff->total_page = 0;
$buff->page = 1; $buff->page = 1;
@ -1145,10 +1145,10 @@ class DBCubrid extends DB
/** /**
* If select query execute, return page info * If select query execute, return page info
* @param Object $queryObject * @param BaseObject $queryObject
* @param resource $connection * @param resource $connection
* @param boolean $with_values * @param boolean $with_values
* @return Object Object with page info containing * @return BaseObject Object with page info containing
*/ */
function queryPageLimit($queryObject, $connection, $with_values) function queryPageLimit($queryObject, $connection, $with_values)
{ {
@ -1209,7 +1209,7 @@ class DBCubrid extends DB
{ {
// If requested page is bigger than total number of pages, return empty list // If requested page is bigger than total number of pages, return empty list
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = $total_count; $buff->total_count = $total_count;
$buff->total_page = $total_page; $buff->total_page = $total_page;
$buff->page = $page; $buff->page = $page;
@ -1231,7 +1231,7 @@ class DBCubrid extends DB
$virtual_no = $total_count - ($page - 1) * $list_count; $virtual_no = $total_count - ($page - 1) * $list_count;
$data = $this->_fetch($result, $virtual_no); $data = $this->_fetch($result, $virtual_no);
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = $total_count; $buff->total_count = $total_count;
$buff->total_page = $total_page; $buff->total_page = $total_page;
$buff->page = $page; $buff->page = $page;
@ -1265,14 +1265,14 @@ class DBCubrid extends DB
$select = $query->getSelectString($with_values); $select = $query->getSelectString($with_values);
if($select == '') if($select == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$select = 'SELECT ' . $select; $select = 'SELECT ' . $select;
$from = $query->getFromString($with_values); $from = $query->getFromString($with_values);
if($from == '') if($from == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$from = ' FROM ' . $from; $from = ' FROM ' . $from;

View file

@ -32,8 +32,8 @@ class DBMssql extends DB
'number' => 'int', 'number' => 'int',
'varchar' => 'nvarchar', 'varchar' => 'nvarchar',
'char' => 'nchar', 'char' => 'nchar',
'text' => 'ntext',
'bigtext' => 'ntext', 'bigtext' => 'ntext',
'text' => 'ntext',
'date' => 'nvarchar(14)', 'date' => 'nvarchar(14)',
'float' => 'float', 'float' => 'float',
); );
@ -494,7 +494,7 @@ class DBMssql extends DB
* Get information about a column * Get information about a column
* @param string $table_name table name * @param string $table_name table name
* @param string $column_name column name * @param string $column_name column name
* @return object * @return BaseObject
*/ */
function getColumnInfo($table_name, $column_name) function getColumnInfo($table_name, $column_name)
{ {
@ -774,7 +774,7 @@ class DBMssql extends DB
/** /**
* Handles insertAct * Handles insertAct
* @todo Lookup _filterNumber against sql injection - see if it is still needed and how to integrate * @todo Lookup _filterNumber against sql injection - see if it is still needed and how to integrate
* @param Object $queryObject * @param BaseObject $queryObject
* @return resource * @return resource
*/ */
function _executeInsertAct($queryObject) function _executeInsertAct($queryObject)
@ -786,7 +786,7 @@ class DBMssql extends DB
/** /**
* Handles updateAct * Handles updateAct
* @param Object $queryObject * @param BaseObject $queryObject
* @return resource * @return resource
*/ */
function _executeUpdateAct($queryObject) function _executeUpdateAct($queryObject)
@ -808,13 +808,13 @@ class DBMssql extends DB
$columnsList = $query->getUpdateString($with_values); $columnsList = $query->getUpdateString($with_values);
if($columnsList == '') if($columnsList == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$from = $query->getFromString($with_values); $from = $query->getFromString($with_values);
if($from == '') if($from == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$tables = $query->getTables(); $tables = $query->getTables();
@ -838,7 +838,7 @@ class DBMssql extends DB
/** /**
* Handles deleteAct * Handles deleteAct
* @param Object $queryObject * @param BaseObject $queryObject
* @return resource * @return resource
*/ */
function _executeDeleteAct($queryObject) function _executeDeleteAct($queryObject)
@ -876,7 +876,7 @@ class DBMssql extends DB
$select = $query->getSelectString($with_values); $select = $query->getSelectString($with_values);
if($select == '') if($select == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
if($limit != '') if($limit != '')
{ {
@ -890,7 +890,7 @@ class DBMssql extends DB
$from = $query->getFromString($with_values); $from = $query->getFromString($with_values);
if($from == '') if($from == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$from = ' FROM ' . $from; $from = ' FROM ' . $from;
@ -961,9 +961,9 @@ class DBMssql extends DB
* Handle selectAct * Handle selectAct
* In order to get a list of pages easily when selecting \n * In order to get a list of pages easily when selecting \n
* it supports a method as navigation * it supports a method as navigation
* @param Object $queryObject * @param BaseObject $queryObject
* @param resource $connection * @param resource $connection
* @return Object * @return BaseObject
*/ */
function _executeSelectAct($queryObject, $connection = null) function _executeSelectAct($queryObject, $connection = null)
{ {
@ -1000,15 +1000,15 @@ class DBMssql extends DB
/** /**
* If have a error, return error object * If have a error, return error object
* @param Object $queryObject * @param BaseObject $queryObject
* @return Object * @return BaseObject
*/ */
function queryError($queryObject) function queryError($queryObject)
{ {
$limit = $queryObject->getLimit(); $limit = $queryObject->getLimit();
if($limit && $limit->isPageHandler()) if($limit && $limit->isPageHandler())
{ {
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = 0; $buff->total_count = 0;
$buff->total_page = 0; $buff->total_page = 0;
$buff->page = 1; $buff->page = 1;
@ -1024,10 +1024,10 @@ class DBMssql extends DB
/** /**
* If select query execute, return page info * If select query execute, return page info
* @param Object $queryObject * @param BaseObject $queryObject
* @param resource $result * @param resource $result
* @param resource $connection * @param resource $connection
* @return Object Object with page info containing * @return BaseObject Object with page info containing
*/ */
function queryPageLimit($queryObject, $result, $connection) function queryPageLimit($queryObject, $result, $connection)
{ {
@ -1090,7 +1090,7 @@ class DBMssql extends DB
{ {
// If requested page is bigger than total number of pages, return empty list // If requested page is bigger than total number of pages, return empty list
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = $total_count; $buff->total_count = $total_count;
$buff->total_page = $total_page; $buff->total_page = $total_page;
$buff->page = $page; $buff->page = $page;
@ -1110,7 +1110,7 @@ class DBMssql extends DB
$virtual_no = $total_count - $start_count; $virtual_no = $total_count - $start_count;
$data = $this->_fetch($result, $virtual_no); $data = $this->_fetch($result, $virtual_no);
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = $total_count; $buff->total_count = $total_count;
$buff->total_page = $total_page; $buff->total_page = $total_page;
$buff->page = $page; $buff->page = $page;
@ -1120,7 +1120,7 @@ class DBMssql extends DB
else else
{ {
$data = $this->_fetch($result); $data = $this->_fetch($result);
$buff = new Object (); $buff = new BaseObject;
$buff->data = $data; $buff->data = $data;
} }
return $buff; return $buff;

View file

@ -402,7 +402,7 @@ class DBMysql extends DB
* Get information about a column * Get information about a column
* @param string $table_name table name * @param string $table_name table name
* @param string $column_name column name * @param string $column_name column name
* @return object * @return BaseObject
*/ */
function getColumnInfo($table_name, $column_name) function getColumnInfo($table_name, $column_name)
{ {
@ -713,14 +713,14 @@ class DBMysql extends DB
/** /**
* Handles insertAct * Handles insertAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
function _executeInsertAct($queryObject, $with_values = true) function _executeInsertAct($queryObject, $with_values = true)
{ {
$query = $this->getInsertSql($queryObject, $with_values, true); $query = $this->getInsertSql($queryObject, $with_values, true);
if(is_a($query, 'Object')) if($query instanceof BaseObject)
{ {
return; return;
} }
@ -729,14 +729,14 @@ class DBMysql extends DB
/** /**
* Handles updateAct * Handles updateAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
function _executeUpdateAct($queryObject, $with_values = true) function _executeUpdateAct($queryObject, $with_values = true)
{ {
$query = $this->getUpdateSql($queryObject, $with_values, true); $query = $this->getUpdateSql($queryObject, $with_values, true);
if(is_a($query, 'Object')) if($query instanceof BaseObject)
{ {
if(!$query->toBool()) return $query; if(!$query->toBool()) return $query;
else return; else return;
@ -746,14 +746,14 @@ class DBMysql extends DB
/** /**
* Handles deleteAct * Handles deleteAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
function _executeDeleteAct($queryObject, $with_values = true) function _executeDeleteAct($queryObject, $with_values = true)
{ {
$query = $this->getDeleteSql($queryObject, $with_values, true); $query = $this->getDeleteSql($queryObject, $with_values, true);
if(is_a($query, 'Object')) if($query instanceof BaseObject)
{ {
return; return;
} }
@ -764,10 +764,10 @@ class DBMysql extends DB
* Handle selectAct * Handle selectAct
* In order to get a list of pages easily when selecting \n * In order to get a list of pages easily when selecting \n
* it supports a method as navigation * it supports a method as navigation
* @param Object $queryObject * @param BaseObject $queryObject
* @param resource $connection * @param resource $connection
* @param boolean $with_values * @param boolean $with_values
* @return Object * @return BaseObject
*/ */
function _executeSelectAct($queryObject, $connection = null, $with_values = true) function _executeSelectAct($queryObject, $connection = null, $with_values = true)
{ {
@ -780,7 +780,7 @@ class DBMysql extends DB
else else
{ {
$query = $this->getSelectSql($queryObject, $with_values); $query = $this->getSelectSql($queryObject, $with_values);
if(is_a($query, 'Object')) if($query instanceof BaseObject)
{ {
return; return;
} }
@ -792,7 +792,7 @@ class DBMysql extends DB
} }
$data = $this->_fetch($result); $data = $this->_fetch($result);
$buff = new Object (); $buff = new BaseObject;
$buff->data = $data; $buff->data = $data;
if($queryObject->usesClickCount()) if($queryObject->usesClickCount())
@ -820,7 +820,7 @@ class DBMysql extends DB
/** /**
* Fetch a result row as an object * Fetch a result row as an object
* @param resource $result * @param resource $result
* @return object * @return BaseObject
*/ */
function db_fetch_object(&$result) function db_fetch_object(&$result)
{ {
@ -850,15 +850,15 @@ class DBMysql extends DB
/** /**
* If have a error, return error object * If have a error, return error object
* @param Object $queryObject * @param BaseObject $queryObject
* @return Object * @return BaseObject
*/ */
function queryError($queryObject) function queryError($queryObject)
{ {
$limit = $queryObject->getLimit(); $limit = $queryObject->getLimit();
if($limit && $limit->isPageHandler()) if($limit && $limit->isPageHandler())
{ {
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = 0; $buff->total_count = 0;
$buff->total_page = 0; $buff->total_page = 0;
$buff->page = 1; $buff->page = 1;
@ -874,11 +874,11 @@ class DBMysql extends DB
/** /**
* If select query execute, return page info * If select query execute, return page info
* @param Object $queryObject * @param BaseObject $queryObject
* @param resource $result * @param resource $result
* @param resource $connection * @param resource $connection
* @param boolean $with_values * @param boolean $with_values
* @return Object Object with page info containing * @return BaseObject Object with page info containing
*/ */
function queryPageLimit($queryObject, $result, $connection, $with_values = true) function queryPageLimit($queryObject, $result, $connection, $with_values = true)
{ {
@ -938,7 +938,7 @@ class DBMysql extends DB
if($page > $total_page) if($page > $total_page)
{ {
// If requested page is bigger than total number of pages, return empty list // If requested page is bigger than total number of pages, return empty list
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = $total_count; $buff->total_count = $total_count;
$buff->total_page = $total_page; $buff->total_page = $total_page;
$buff->page = $page; $buff->page = $page;
@ -959,7 +959,7 @@ class DBMysql extends DB
$virtual_no = $total_count - ($page - 1) * $list_count; $virtual_no = $total_count - ($page - 1) * $list_count;
$data = $this->_fetch($result, $virtual_no); $data = $this->_fetch($result, $virtual_no);
$buff = new Object (); $buff = new BaseObject;
$buff->total_count = $total_count; $buff->total_count = $total_count;
$buff->total_page = $total_page; $buff->total_page = $total_page;
$buff->page = $page; $buff->page = $page;
@ -981,14 +981,14 @@ class DBMysql extends DB
$select = $query->getSelectString($with_values); $select = $query->getSelectString($with_values);
if($select == '') if($select == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$select = 'SELECT ' . $select; $select = 'SELECT ' . $select;
$from = $query->getFromString($with_values); $from = $query->getFromString($with_values);
if($from == '') if($from == '')
{ {
return new Object(-1, "Invalid query"); return new BaseObject(-1, "Invalid query");
} }
$from = ' FROM ' . $from; $from = ' FROM ' . $from;

View file

@ -299,7 +299,7 @@ class DBMysqli extends DBMysql
/** /**
* Handles insertAct * Handles insertAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
@ -317,7 +317,7 @@ class DBMysqli extends DBMysql
/** /**
* Handles updateAct * Handles updateAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
@ -335,7 +335,7 @@ class DBMysqli extends DBMysql
/** /**
* Handles deleteAct * Handles deleteAct
* @param Object $queryObject * @param BaseObject $queryObject
* @param boolean $with_values * @param boolean $with_values
* @return resource * @return resource
*/ */
@ -355,10 +355,10 @@ class DBMysqli extends DBMysql
* Handle selectAct * Handle selectAct
* In order to get a list of pages easily when selecting \n * In order to get a list of pages easily when selecting \n
* it supports a method as navigation * it supports a method as navigation
* @param Object $queryObject * @param BaseObject $queryObject
* @param resource $connection * @param resource $connection
* @param boolean $with_values * @param boolean $with_values
* @return Object * @return BaseObject
*/ */
function _executeSelectAct($queryObject, $connection = null, $with_values = false) function _executeSelectAct($queryObject, $connection = null, $with_values = false)
{ {
@ -387,7 +387,7 @@ class DBMysqli extends DBMysql
/** /**
* Fetch a result row as an object * Fetch a result row as an object
* @param resource $result * @param resource $result
* @return object * @return BaseObject
*/ */
function db_fetch_object(&$result) function db_fetch_object(&$result)
{ {

View file

@ -6,7 +6,7 @@
* @package /classes/db/queryparts * @package /classes/db/queryparts
* @version 0.1 * @version 0.1
*/ */
class Query extends Object class Query extends BaseObject
{ {
/** /**
@ -560,7 +560,7 @@ class Query extends Object
{ {
if(!$this->_orderByString) if(!$this->_orderByString)
{ {
if(count($this->orderby) === 0) if(countobj($this->orderby) === 0)
{ {
return ''; return '';
} }
@ -587,7 +587,7 @@ class Query extends Object
function getLimitString() function getLimitString()
{ {
$limit = ''; $limit = '';
if(count($this->limit) > 0) if(countobj($this->limit) > 0)
{ {
$limit = ''; $limit = '';
$limit .= $this->limit->toString(); $limit .= $this->limit->toString();
@ -611,7 +611,7 @@ class Query extends Object
$this->arguments = array(); $this->arguments = array();
// Join table arguments // Join table arguments
if(count($this->tables) > 0) if(countobj($this->tables) > 0)
{ {
foreach($this->tables as $table) foreach($this->tables as $table)
{ {
@ -628,7 +628,7 @@ class Query extends Object
// Column arguments // Column arguments
// The if is for delete statements, all others must have columns // The if is for delete statements, all others must have columns
if(count($this->columns) > 0) if(countobj($this->columns) > 0)
{ {
foreach($this->columns as $column) foreach($this->columns as $column)
{ {
@ -644,12 +644,12 @@ class Query extends Object
} }
// Condition arguments // Condition arguments
if(count($this->conditions) > 0) if(countobj($this->conditions) > 0)
{ {
foreach($this->conditions as $conditionGroup) foreach($this->conditions as $conditionGroup)
{ {
$args = $conditionGroup->getArguments(); $args = $conditionGroup->getArguments();
if(count($args) > 0) if(countobj($args) > 0)
{ {
$this->arguments = array_merge($this->arguments, $args); $this->arguments = array_merge($this->arguments, $args);
} }
@ -657,12 +657,12 @@ class Query extends Object
} }
// Navigation arguments // Navigation arguments
if(count($this->orderby) > 0) if(countobj($this->orderby) > 0)
{ {
foreach($this->orderby as $order) foreach($this->orderby as $order)
{ {
$args = $order->getArguments(); $args = $order->getArguments();
if(count($args) > 0) if(countobj($args) > 0)
{ {
$this->arguments = array_merge($this->arguments, $args); $this->arguments = array_merge($this->arguments, $args);
} }

View file

@ -68,7 +68,7 @@ class DisplayHandler extends Handler
$oAddonController = getController('addon'); $oAddonController = getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
if(file_exists($addon_file)) include($addon_file); if(file_exists($addon_file)) include($addon_file);
if($output === false || $output === null || $output instanceof Object) if($output === false || $output === null || $output instanceof BaseObject)
{ {
$output = $original_output; $output = $original_output;
} }

View file

@ -27,6 +27,7 @@ class HTMLDisplayHandler
*/ */
public static $replacements = array( public static $replacements = array(
'@\bcommon/xeicon/@' => 'common/css/xeicon/', '@\bcommon/xeicon/@' => 'common/css/xeicon/',
'@\beditor/skins/xpresseditor/js/xe_textarea\.(?:min\.)?js@' => 'editor/skins/ckeditor/js/xe_textarea.js',
); );
/** /**

View file

@ -8,7 +8,7 @@
* @class EditorHandler * @class EditorHandler
* @author NAVER (developers@xpressengine.com) * @author NAVER (developers@xpressengine.com)
*/ */
class EditorHandler extends Object class EditorHandler extends BaseObject
{ {
/** /**

View file

@ -6,7 +6,7 @@
* *
* @author NAVER (developers@xpressengine.com) * @author NAVER (developers@xpressengine.com)
*/ */
class FileObject extends Object class FileObject extends BaseObject
{ {
/** /**
@ -50,7 +50,7 @@ class FileObject extends Object
*/ */
function append($file_name) function append($file_name)
{ {
$target = new FileObject($file_name, "r"); $target = new self($file_name, "r");
while(!$target->feof()) while(!$target->feof())
{ {
$readstr = $target->read(); $readstr = $target->read();

View file

@ -125,7 +125,7 @@ class XEHttpRequest
$sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout); $sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout);
if(!$sock) if(!$sock)
{ {
return new Object(-1, 'socket_connect_failed'); return new BaseObject(-1, 'socket_connect_failed');
} }
$headers = $this->m_headers + array(); $headers = $this->m_headers + array();
@ -242,7 +242,7 @@ class XEHttpRequest
$body = curl_exec($ch); $body = curl_exec($ch);
if(curl_errno($ch)) if(curl_errno($ch))
{ {
return new Object(-1, 'socket_connect_failed'); return new BaseObject(-1, 'socket_connect_failed');
} }
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

View file

@ -18,7 +18,7 @@ class ModuleHandler extends Handler
var $mid = NULL; ///< Module ID var $mid = NULL; ///< Module ID
var $document_srl = NULL; ///< Document Number var $document_srl = NULL; ///< Document Number
var $module_srl = NULL; ///< Module Number var $module_srl = NULL; ///< Module Number
var $module_info = NULL; ///< Module Info. Object var $module_info = NULL; ///< Module Info
var $error = NULL; ///< an error code. var $error = NULL; ///< an error code.
var $httpStatusCode = NULL; ///< http status code. var $httpStatusCode = NULL; ///< http status code.
@ -858,7 +858,7 @@ class ModuleHandler extends Handler
{ {
Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
} }
if(count($_SESSION['INPUT_ERROR'])) if(countobj($_SESSION['INPUT_ERROR']))
{ {
Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
} }
@ -1237,14 +1237,14 @@ class ModuleHandler extends Handler
* @param string $trigger_name trigger's name to call * @param string $trigger_name trigger's name to call
* @param string $called_position called position * @param string $called_position called position
* @param object $obj an object as a parameter to trigger * @param object $obj an object as a parameter to trigger
* @return Object * @return BaseObject
* */ * */
public static function triggerCall($trigger_name, $called_position, &$obj) public static function triggerCall($trigger_name, $called_position, &$obj)
{ {
// skip if not installed // skip if not installed
if(!Context::isInstalled()) if(!Context::isInstalled())
{ {
return new Object(); return new BaseObject();
} }
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
@ -1292,7 +1292,7 @@ class ModuleHandler extends Handler
)); ));
} }
if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) if($output instanceof BaseObject && !$output->toBool())
{ {
return $output; return $output;
} }
@ -1342,7 +1342,7 @@ class ModuleHandler extends Handler
} }
} }
return new Object(); return new BaseObject();
} }
/** /**

View file

@ -6,7 +6,7 @@
* @author NAVER (developers@xpressengine.com) * @author NAVER (developers@xpressengine.com)
* base class of ModuleHandler * base class of ModuleHandler
* */ * */
class ModuleObject extends Object class ModuleObject extends BaseObject
{ {
var $mid = NULL; ///< string to represent run-time instance of Module (XE Module) var $mid = NULL; ///< string to represent run-time instance of Module (XE Module)
@ -90,43 +90,6 @@ class ModuleObject extends Object
return $this->get('redirect_url'); return $this->get('redirect_url');
} }
/**
* set message
* @param string $message a message string
* @param string $type type of message (error, info, update)
* @return void
* */
function setMessage($message = 'success', $type = NULL)
{
parent::setMessage($message);
$this->setMessageType($type);
}
/**
* set type of message
* @param string $type type of message (error, info, update)
* @return void
* */
function setMessageType($type)
{
$this->add('message_type', $type);
}
/**
* get type of message
* @return string $type
* */
function getMessageType()
{
$type = $this->get('message_type');
$typeList = array('error' => 1, 'info' => 1, 'update' => 1);
if(!isset($typeList[$type]))
{
$type = $this->getError() ? 'error' : 'info';
}
return $type;
}
/** /**
* Set the template path for refresh.html * Set the template path for refresh.html
* refresh.html is executed as a result of method execution * refresh.html is executed as a result of method execution
@ -598,7 +561,7 @@ class ModuleObject extends Object
} }
// check return value of action // check return value of action
if($output instanceof Object) if($output instanceof BaseObject)
{ {
$this->setError($output->getError()); $this->setError($output->getError());
$this->setMessage($output->getMessage()); $this->setMessage($output->getMessage());
@ -624,11 +587,11 @@ class ModuleObject extends Object
$addon_file = $oAddonController->getCacheFilePath($is_mobile ? "mobile" : "pc"); $addon_file = $oAddonController->getCacheFilePath($is_mobile ? "mobile" : "pc");
if(FileHandler::exists($addon_file)) include($addon_file); if(FileHandler::exists($addon_file)) include($addon_file);
if($original_output instanceof Object && !$original_output->toBool()) if($original_output instanceof BaseObject && !$original_output->toBool())
{ {
return FALSE; return FALSE;
} }
elseif($output instanceof Object && $output->getError()) elseif($output instanceof BaseObject && $output->getError())
{ {
$this->setError($output->getError()); $this->setError($output->getError());
$this->setMessage($output->getMessage()); $this->setMessage($output->getMessage());

View file

@ -2,11 +2,11 @@
/* Copyright (C) NAVER <http://www.navercorp.com> */ /* Copyright (C) NAVER <http://www.navercorp.com> */
/** /**
* Every modules inherits from Object class. It includes error, message, and other variables for communicatin purpose. * Every module inherits from BaseObject class.
* *
* @author NAVER (developers@xpressengine.com) * @author NAVER (developers@xpressengine.com)
*/ */
class Object class BaseObject
{ {
/** /**
@ -47,14 +47,36 @@ class Object
} }
/** /**
* Setter to set error code * Setter to set error code or message
* *
* @param int $error error code * @param int|strong $error error code or message
* @return void * @return $this
*/ */
function setError($error = 0) function setError($error = 0)
{ {
$this->error = $error; // If the first argument is an integer, treat it as an error code. Otherwise, treat it as an error message.
$args = func_get_args();
if(strval(intval($error)) === strval($error))
{
$this->error = intval($error);
array_shift($args);
}
else
{
$this->error = -1;
}
// Convert the error message into the correct language and interpolate any other variables into it.
if(count($args))
{
$this->message = lang(array_shift($args));
if(count($args))
{
$this->message = vsprintf($this->message, $args);
}
}
return $this;
} }
/** /**
@ -71,11 +93,12 @@ class Object
* Setter to set HTTP status code * Setter to set HTTP status code
* *
* @param int $code HTTP status code. Default value is `200` that means successful * @param int $code HTTP status code. Default value is `200` that means successful
* @return void * @return $this
*/ */
function setHttpStatusCode($code = 200) function setHttpStatusCode($code = 200)
{ {
$this->httpStatusCode = (int) $code; $this->httpStatusCode = (int) $code;
return $this;
} }
/** /**
@ -92,21 +115,17 @@ class Object
* Setter to set set the error message * Setter to set set the error message
* *
* @param string $message Error message * @param string $message Error message
* @return bool Alaways returns true. * @param string $type type of message (error, info, update)
* @return $this
*/ */
function setMessage($message = 'success', $type = NULL) function setMessage($message = 'success', $type = null)
{ {
if($str = lang($message)) $this->message = lang($message);
if($type !== null)
{ {
$this->message = $str; $this->setMessageType($type);
} }
else return $this;
{
$this->message = $message;
}
// TODO This method always returns True. We'd better remove it
return TRUE;
} }
/** /**
@ -119,38 +138,65 @@ class Object
return $this->message; return $this->message;
} }
/**
* set type of message
* @param string $type type of message (error, info, update)
* @return $this
* */
function setMessageType($type)
{
$this->add('message_type', $type);
return $this;
}
/**
* get type of message
* @return string $type
* */
function getMessageType()
{
$type = $this->get('message_type');
$typeList = array('error' => 1, 'info' => 1, 'update' => 1);
if(!isset($typeList[$type]))
{
$type = $this->getError() ? 'error' : 'info';
}
return $type;
}
/** /**
* Setter to set a key/value pair as an additional variable * Setter to set a key/value pair as an additional variable
* *
* @param string $key A variable name * @param string $key A variable name
* @param mixed $val A value for the variable * @param mixed $val A value for the variable
* @return void * @return $this
*/ */
function add($key, $val) function add($key, $val)
{ {
$this->variables[$key] = $val; $this->variables[$key] = $val;
return $this;
} }
/** /**
* Method to set multiple key/value pairs as an additional variables * Method to set multiple key/value pairs as an additional variables
* *
* @param Object|array $object Either object or array containg key/value pairs to be added * @param object|array $vars Either object or array containg key/value pairs to be added
* @return void * @return $this
*/ */
function adds($object) function adds($vars)
{ {
if(is_object($object)) if(is_object($vars))
{ {
$object = get_object_vars($object); $vars = get_object_vars($vars);
} }
if(is_array($vars))
if(is_array($object))
{ {
foreach($object as $key => $val) foreach($vars as $key => $val)
{ {
$this->variables[$key] = $val; $this->variables[$key] = $val;
} }
} }
return $this;
} }
/** /**
@ -167,7 +213,7 @@ class Object
/** /**
* Method to retrieve an object containing a key/value pairs * Method to retrieve an object containing a key/value pairs
* *
* @return Object Returns an object containing key/value pairs * @return object Returns an object containing key/value pairs
*/ */
function gets() function gets()
{ {
@ -193,7 +239,7 @@ class Object
/** /**
* Method to retrieve an object of key/value pairs * Method to retrieve an object of key/value pairs
* *
* @return Object * @return object
*/ */
function getObjectVars() function getObjectVars()
{ {
@ -225,7 +271,15 @@ class Object
{ {
return $this->toBool(); return $this->toBool();
} }
} }
/**
* Alias to Object for backward compatibility.
*/
if (version_compare(PHP_VERSION, '7.2', '<'))
{
class_alias('BaseObject', 'Object');
}
/* End of file Object.class.php */ /* End of file Object.class.php */
/* Location: ./classes/object/Object.class.php */ /* Location: ./classes/object/Object.class.php */

View file

@ -36,7 +36,7 @@ class Argument
/** /**
* error message * error message
* @var Object * @var BaseObject
*/ */
var $errorMessage; var $errorMessage;
@ -310,14 +310,14 @@ class Argument
if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/is', $val)) if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/is', $val))
{ {
$this->isValid = FALSE; $this->isValid = FALSE;
$this->errorMessage = new Object(-1, sprintf($lang->filter->invalid_email, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_email, $lang->{$key} ? $lang->{$key} : $key));
} }
break; break;
case 'homepage' : case 'homepage' :
if(!preg_match('/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val)) if(!preg_match('/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val))
{ {
$this->isValid = FALSE; $this->isValid = FALSE;
$this->errorMessage = new Object(-1, sprintf($lang->filter->invalid_homepage, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_homepage, $lang->{$key} ? $lang->{$key} : $key));
} }
break; break;
case 'userid' : case 'userid' :
@ -325,7 +325,7 @@ class Argument
if(!preg_match('/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val)) if(!preg_match('/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val))
{ {
$this->isValid = FALSE; $this->isValid = FALSE;
$this->errorMessage = new Object(-1, sprintf($lang->filter->invalid_userid, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_userid, $lang->{$key} ? $lang->{$key} : $key));
} }
break; break;
case 'number' : case 'number' :
@ -337,21 +337,21 @@ class Argument
if(!preg_match('/^(-?)[0-9]+(,\-?[0-9]+)*$/is', $val)) if(!preg_match('/^(-?)[0-9]+(,\-?[0-9]+)*$/is', $val))
{ {
$this->isValid = FALSE; $this->isValid = FALSE;
$this->errorMessage = new Object(-1, sprintf($lang->filter->invalid_number, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_number, $lang->{$key} ? $lang->{$key} : $key));
} }
break; break;
case 'alpha' : case 'alpha' :
if(!preg_match('/^[a-z]+$/is', $val)) if(!preg_match('/^[a-z]+$/is', $val))
{ {
$this->isValid = FALSE; $this->isValid = FALSE;
$this->errorMessage = new Object(-1, sprintf($lang->filter->invalid_alpha, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_alpha, $lang->{$key} ? $lang->{$key} : $key));
} }
break; break;
case 'alpha_number' : case 'alpha_number' :
if(!preg_match('/^[0-9a-z]+$/is', $val)) if(!preg_match('/^[0-9a-z]+$/is', $val))
{ {
$this->isValid = FALSE; $this->isValid = FALSE;
$this->errorMessage = new Object(-1, sprintf($lang->filter->invalid_alpha_number, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_alpha_number, $lang->{$key} ? $lang->{$key} : $key));
} }
break; break;
} }
@ -365,7 +365,7 @@ class Argument
global $lang; global $lang;
$this->isValid = FALSE; $this->isValid = FALSE;
$key = $this->name; $key = $this->name;
$this->errorMessage = new Object(-1, sprintf($lang->filter->outofrange, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->outofrange, $lang->{$key} ? $lang->{$key} : $key));
} }
} }
@ -376,7 +376,7 @@ class Argument
global $lang; global $lang;
$this->isValid = FALSE; $this->isValid = FALSE;
$key = $this->name; $key = $this->name;
$this->errorMessage = new Object(-1, sprintf($lang->filter->outofrange, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->outofrange, $lang->{$key} ? $lang->{$key} : $key));
} }
} }
@ -387,7 +387,7 @@ class Argument
global $lang; global $lang;
$this->isValid = FALSE; $this->isValid = FALSE;
$key = $this->name; $key = $this->name;
$this->errorMessage = new Object(-1, sprintf($lang->filter->isnull, $lang->{$key} ? $lang->{$key} : $key)); $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->isnull, $lang->{$key} ? $lang->{$key} : $key));
} }
} }

View file

@ -41,6 +41,7 @@ if (function_exists('mb_regex_encoding'))
require_once __DIR__ . '/constants.php'; require_once __DIR__ . '/constants.php';
require_once __DIR__ . '/functions.php'; require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/legacy.php'; require_once __DIR__ . '/legacy.php';
require_once RX_BASEDIR . 'classes/object/Object.class.php';
/** /**
* Load user configuration. * Load user configuration.
@ -98,7 +99,6 @@ $GLOBALS['RX_AUTOLOAD_FILE_MAP'] = array_change_key_case(array(
'Mobile' => 'classes/mobile/Mobile.class.php', 'Mobile' => 'classes/mobile/Mobile.class.php',
'ModuleHandler' => 'classes/module/ModuleHandler.class.php', 'ModuleHandler' => 'classes/module/ModuleHandler.class.php',
'ModuleObject' => 'classes/module/ModuleObject.class.php', 'ModuleObject' => 'classes/module/ModuleObject.class.php',
'Object' => 'classes/object/Object.class.php',
'PageHandler' => 'classes/page/PageHandler.class.php', 'PageHandler' => 'classes/page/PageHandler.class.php',
'EmbedFilter' => 'classes/security/EmbedFilter.class.php', 'EmbedFilter' => 'classes/security/EmbedFilter.class.php',
'IpFilter' => 'classes/security/IpFilter.class.php', 'IpFilter' => 'classes/security/IpFilter.class.php',
@ -192,7 +192,7 @@ spl_autoload_register(function($class_name)
/** /**
* Also include the Composer autoloader. * Also include the Composer autoloader.
*/ */
require_once RX_BASEDIR . 'vendor/autoload.php'; require_once RX_BASEDIR . 'vendor/autoload.php';
/** /**
* Load system configuration. * Load system configuration.

View file

@ -3,7 +3,7 @@
/** /**
* RX_VERSION is the version number of the Rhymix CMS. * RX_VERSION is the version number of the Rhymix CMS.
*/ */
define('RX_VERSION', '1.8.45'); define('RX_VERSION', '1.8.46');
/** /**
* RX_MICROTIME is the startup time of the current script, in microseconds since the Unix epoch. * RX_MICROTIME is the startup time of the current script, in microseconds since the Unix epoch.

View file

@ -111,6 +111,7 @@ return array(
'mobile' => array( 'mobile' => array(
'enabled' => true, 'enabled' => true,
'tablets' => false, 'tablets' => false,
'viewport' => 'width=device-width, initial-scale=1.0, user-scalable=yes',
), ),
'use_prepared_statements' => true, 'use_prepared_statements' => true,
'use_rewrite' => true, 'use_rewrite' => true,

View file

@ -30,7 +30,9 @@ class Config
{ {
if (file_exists(\RX_BASEDIR . self::$config_filename)) if (file_exists(\RX_BASEDIR . self::$config_filename))
{ {
ob_start();
self::$_config = (include \RX_BASEDIR . self::$config_filename); self::$_config = (include \RX_BASEDIR . self::$config_filename);
ob_end_clean();
} }
else else
{ {

View file

@ -506,7 +506,7 @@ class Debug
} }
// Localize the error message. // Localize the error message.
$display_error_message = ini_get('display_errors') || (\Context::get('logged_info') && toBool(\Context::get('logged_info')->is_admin)); $display_error_message = ini_get('display_errors') || Session::isAdmin();
$message = $display_error_message ? $message : lang('msg_server_error_see_log'); $message = $display_error_message ? $message : lang('msg_server_error_see_log');
if ($message === 'msg_server_error_see_log') if ($message === 'msg_server_error_see_log')
{ {

View file

@ -22,7 +22,9 @@ class ConfigParser
// Load DB info file. // Load DB info file.
if (file_exists(\RX_BASEDIR . Config::$old_db_config_filename)) if (file_exists(\RX_BASEDIR . Config::$old_db_config_filename))
{ {
ob_start();
include \RX_BASEDIR . Config::$old_db_config_filename; include \RX_BASEDIR . Config::$old_db_config_filename;
ob_end_clean();
} }
else else
{ {
@ -32,7 +34,9 @@ class ConfigParser
// Load FTP info file. // Load FTP info file.
if (file_exists(\RX_BASEDIR . Config::$old_ftp_config_filename)) if (file_exists(\RX_BASEDIR . Config::$old_ftp_config_filename))
{ {
ob_start();
include \RX_BASEDIR . Config::$old_ftp_config_filename; include \RX_BASEDIR . Config::$old_ftp_config_filename;
ob_end_clean();
} }
// Load selected language file. // Load selected language file.

View file

@ -517,6 +517,28 @@ function tobool($input)
return (bool)$input; return (bool)$input;
} }
/**
* Counts members of an array or an object.
*
* @param mixed $array_or_object
* @return int
*/
function countobj($array_or_object)
{
if (is_array($array_or_object))
{
return count($array_or_object);
}
elseif (is_object($array_or_object))
{
return count(get_object_vars($array_or_object));
}
else
{
return @count($array_or_object);
}
}
/** /**
* Checks if the given string contains valid UTF-8. * Checks if the given string contains valid UTF-8.
* *

View file

@ -86,6 +86,7 @@
URITemplate : window.URITemplate, URITemplate : window.URITemplate,
SecondLevelDomains : window.SecondLevelDomains, SecondLevelDomains : window.SecondLevelDomains,
IPv6 : window.IPv6, IPv6 : window.IPv6,
baseurl : null,
/** /**
* @brief 특정 name을 가진 체크박스들의 checked 속성 변경 * @brief 특정 name을 가진 체크박스들의 checked 속성 변경
@ -198,20 +199,35 @@
/* 동일 사이트 내 주소인지 판단 (프로토콜 제외) */ /* 동일 사이트 내 주소인지 판단 (프로토콜 제외) */
isSameHost: function(url) { isSameHost: function(url) {
var site_baseurl = window.XE.URI(window.request_uri).normalizePort().normalizePathname(); if (typeof url !== "string") {
site_baseurl = site_baseurl.hostname() + site_baseurl.directory(); return false;
}
if (url.match(/^\/[^\/]/)) {
return true;
}
if (url.match(/^\w+:[^\/]*$/)) {
return false;
}
if (!window.XE.baseurl) {
window.XE.baseurl = window.XE.URI(window.request_uri).normalizePort().normalizePathname();
window.XE.baseurl = window.XE.baseurl.hostname() + window.XE.baseurl.directory();
}
var target_url = window.XE.URI(url).normalizePort().normalizePathname(); var target_url = window.XE.URI(url).normalizePort().normalizePathname();
if (target_url.is("urn")) {
return false;
}
if (!target_url.hostname()) { if (!target_url.hostname()) {
target_url = target_url.absoluteTo(window.request_uri); target_url = target_url.absoluteTo(window.request_uri);
} }
target_url = target_url.hostname() + target_url.directory(); target_url = target_url.hostname() + target_url.directory();
return target_url.indexOf(site_baseurl) === 0; return target_url.indexOf(window.XE.baseurl) === 0;
} }
}; };
}) (jQuery); })(jQuery);
/* jQuery(document).ready() */ /* jQuery(document).ready() */
jQuery(function($) { jQuery(function($) {
@ -226,8 +242,8 @@ jQuery(function($) {
/* Tabnapping protection, step 1 */ /* Tabnapping protection, step 1 */
$('a[target]').each(function() { $('a[target]').each(function() {
var $this = $(this); var $this = $(this);
var href = $this.attr('href'); var href = $this.attr('href').trim();
var target = $this.attr('target'); var target = $this.attr('target').trim();
if (!href || !target || target === '_top' || target === '_self' || target === '_parent') { if (!href || !target || target === '_top' || target === '_self' || target === '_parent') {
return; return;
} }
@ -243,8 +259,8 @@ jQuery(function($) {
/* Tabnapping protection, step 2 */ /* Tabnapping protection, step 2 */
$('body').on('click', 'a[target]', function(event) { $('body').on('click', 'a[target]', function(event) {
var $this = $(this); var $this = $(this);
var href = $this.attr('href'); var href = $this.attr('href').trim();
var target = $this.attr('target'); var target = $this.attr('target').trim();
if (!href || !target || target === '_top' || target === '_self' || target === '_parent') { if (!href || !target || target === '_top' || target === '_self' || target === '_parent') {
return; return;
} }
@ -314,7 +330,7 @@ jQuery(function($) {
}); });
}); });
(function(){ // String extension methods (function($) { // String extension methods
/** /**
* @brief location.href에서 특정 key의 값을 return * @brief location.href에서 특정 key의 값을 return
@ -405,7 +421,7 @@ jQuery(function($) {
return uri.protocol(protocol).port(port || null).normalizePort().filename(filename); return uri.protocol(protocol).port(port || null).normalizePort().filename(filename);
} }
})(); })(jQuery);
/** /**
* @brief xSleep(micro time) * @brief xSleep(micro time)

View file

@ -8,6 +8,11 @@ $(function() {
"use strict"; "use strict";
// Disable debug panel?
if ($('body').hasClass("disable_debug_panel")) {
return;
}
// Find debug panel elements. // Find debug panel elements.
var panel = $("#rhymix_debug_panel"); var panel = $("#rhymix_debug_panel");
var button = $("#rhymix_debug_button").show(); var button = $("#rhymix_debug_button").show();

View file

@ -158,7 +158,7 @@ function executeQueryArray($query_id, $args = NULL, $arg_columns = NULL)
{ {
$oDB = DB::getInstance(); $oDB = DB::getInstance();
$output = $oDB->executeQuery($query_id, $args, $arg_columns); $output = $oDB->executeQuery($query_id, $args, $arg_columns);
if(isset($output->data) && !is_array($output->data) && count($output->data) > 0) if(isset($output->data) && !is_array($output->data) && countobj($output->data) > 0)
{ {
$output->data = array($output->data); $output->data = array($output->data);
} }

View file

@ -5,7 +5,7 @@
<!-- META --> <!-- META -->
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="generator" content="Rhymix"> <meta name="generator" content="Rhymix">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes" cond="$m" /> <meta name="viewport" content="{config('mobile.viewport') ?: 'width=device-width, initial-scale=1.0, user-scalable=yes'}" cond="$m" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<block loop="Context::getMetaTag() => $no, $val"> <block loop="Context::getMetaTag() => $no, $val">
<meta http-equiv="{$val['name']}"|cond="$val['is_http_equiv']" name="{$val['name']}"|cond="!$val['is_http_equiv']" content="{$val['content']}" /> <meta http-equiv="{$val['name']}"|cond="$val['is_http_equiv']" name="{$val['name']}"|cond="!$val['is_http_equiv']" content="{$val['content']}" />

View file

@ -4,7 +4,6 @@
<load target="css/Orange/layout.css" cond="$layout_info->colorset=='orange'" /> <load target="css/Orange/layout.css" cond="$layout_info->colorset=='orange'" />
<load target="css/nGreenA/layout.css" cond="$layout_info->colorset=='ngreena'" /> <load target="css/nGreenA/layout.css" cond="$layout_info->colorset=='ngreena'" />
<load target="css/nGreenB/layout.css" cond="$layout_info->colorset=='ngreenb'" /> <load target="css/nGreenB/layout.css" cond="$layout_info->colorset=='ngreenb'" />
<load target="../../common/js/jquery.min.js" index="-1000000" />
<load target="js/layout.js" /> <load target="js/layout.js" />
<div class="skip"><a href="#ct">Skip to Content</a></div> <div class="skip"><a href="#ct">Skip to Content</a></div>
<header class="lo_head"> <header class="lo_head">

View file

@ -305,7 +305,7 @@ class addonAdminModel extends addon
$val->options = array($val->options); $val->options = array($val->options);
} }
for($i = 0, $c = count($val->options); $i < $c; $i++) for($i = 0, $c = countobj($val->options); $i < $c; $i++)
{ {
$obj->options[$i] = new stdClass(); $obj->options[$i] = new stdClass();
$obj->options[$i]->title = $val->options[$i]->title->body; $obj->options[$i]->title = $val->options[$i]->title->body;

View file

@ -11,7 +11,7 @@ class addon extends ModuleObject
/** /**
* Implement if additional tasks are necessary when installing * Implement if additional tasks are necessary when installing
* *
* @return Object * @return void
*/ */
function moduleInstall() function moduleInstall()
{ {
@ -21,7 +21,6 @@ class addon extends ModuleObject
$oAddonController->doInsert('member_extra_info', 0, 'site', 'Y'); $oAddonController->doInsert('member_extra_info', 0, 'site', 'Y');
$oAddonController->doInsert('resize_image', 0, 'site', 'Y'); $oAddonController->doInsert('resize_image', 0, 'site', 'Y');
$oAddonController->makeCacheFile(0); $oAddonController->makeCacheFile(0);
return new Object();
} }
/** /**
@ -53,7 +52,7 @@ class addon extends ModuleObject
/** /**
* Execute update * Execute update
* *
* @return Object * @return void
*/ */
function moduleUpdate() function moduleUpdate()
{ {
@ -88,8 +87,6 @@ class addon extends ModuleObject
} }
} }
} }
return new Object(0, 'success_updated');
} }
/** /**

View file

@ -45,6 +45,7 @@ class adminAdminController extends admin
return $output; return $output;
} }
Rhymix\Framework\Cache::delete('admin_menu_langs:' . Context::getLangType());
Rhymix\Framework\Storage::deleteDirectory(\RX_BASEDIR . 'files/cache/menu/admin_lang/'); Rhymix\Framework\Storage::deleteDirectory(\RX_BASEDIR . 'files/cache/menu/admin_lang/');
$this->setRedirectUrl(Context::get('error_return_url')); $this->setRedirectUrl(Context::get('error_return_url'));
@ -157,8 +158,8 @@ class adminAdminController extends admin
} }
// create a DesignInfo file // create a DesignInfo file
$output = $this->updateDefaultDesignInfo($vars); $this->updateDefaultDesignInfo($vars);
return $this->setRedirectUrl(Context::get('error_return_url'), $output); $this->setRedirectUrl(Context::get('error_return_url'));
} }
public function updateDefaultDesignInfo($vars) public function updateDefaultDesignInfo($vars)
@ -208,8 +209,6 @@ class adminAdminController extends admin
} }
$this->makeDefaultDesignFile($designInfo, $vars->site_srl); $this->makeDefaultDesignFile($designInfo, $vars->site_srl);
return new Object();
} }
function makeDefaultDesignFile($designInfo, $site_srl = 0) function makeDefaultDesignFile($designInfo, $site_srl = 0)
@ -286,7 +285,7 @@ class adminAdminController extends admin
/** /**
* Cleanning favorite * Cleanning favorite
* @return Object * @return object|void
*/ */
function cleanFavorite() function cleanFavorite()
{ {
@ -300,7 +299,7 @@ class adminAdminController extends admin
$favoriteList = $output->get('favoriteList'); $favoriteList = $output->get('favoriteList');
if(!$favoriteList) if(!$favoriteList)
{ {
return new Object(); return;
} }
$deleteTargets = array(); $deleteTargets = array();
@ -318,7 +317,7 @@ class adminAdminController extends admin
if(!count($deleteTargets)) if(!count($deleteTargets))
{ {
return new Object(); return;
} }
$args = new stdClass(); $args = new stdClass();
@ -328,8 +327,6 @@ class adminAdminController extends admin
{ {
return $output; return $output;
} }
return new Object();
} }
/** /**
@ -495,7 +492,7 @@ class adminAdminController extends admin
} }
else else
{ {
return new Object(-1, 'fail_to_delete'); return $this->setError('fail_to_delete');
} }
$this->setMessage('success_deleted'); $this->setMessage('success_deleted');
} }
@ -519,7 +516,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('use_sso', $vars->use_sso === 'Y'); Rhymix\Framework\Config::set('use_sso', $vars->use_sso === 'Y');
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
@ -539,19 +536,19 @@ class adminAdminController extends admin
// Validate the mail sender's information. // Validate the mail sender's information.
if (!$vars->mail_default_name) if (!$vars->mail_default_name)
{ {
return new Object(-1, 'msg_advanced_mailer_sender_name_is_empty'); return $this->setError('msg_advanced_mailer_sender_name_is_empty');
} }
if (!$vars->mail_default_from) if (!$vars->mail_default_from)
{ {
return new Object(-1, 'msg_advanced_mailer_sender_email_is_empty'); return $this->setError('msg_advanced_mailer_sender_email_is_empty');
} }
if (!Mail::isVaildMailAddress($vars->mail_default_from)) if (!Mail::isVaildMailAddress($vars->mail_default_from))
{ {
return new Object(-1, 'msg_advanced_mailer_sender_email_is_invalid'); return $this->setError('msg_advanced_mailer_sender_email_is_invalid');
} }
if ($vars->mail_default_reply_to && !Mail::isVaildMailAddress($vars->mail_default_reply_to)) if ($vars->mail_default_reply_to && !Mail::isVaildMailAddress($vars->mail_default_reply_to))
{ {
return new Object(-1, 'msg_advanced_mailer_reply_to_is_invalid'); return $this->setError('msg_advanced_mailer_reply_to_is_invalid');
} }
// Validate the mail driver. // Validate the mail driver.
@ -559,7 +556,7 @@ class adminAdminController extends admin
$mail_driver = $vars->mail_driver; $mail_driver = $vars->mail_driver;
if (!array_key_exists($mail_driver, $mail_drivers)) if (!array_key_exists($mail_driver, $mail_drivers))
{ {
return new Object(-1, 'msg_advanced_mailer_sending_method_is_invalid'); return $this->setError('msg_advanced_mailer_sending_method_is_invalid');
} }
// Validate the mail driver settings. // Validate the mail driver settings.
@ -569,7 +566,7 @@ class adminAdminController extends admin
$conf_value = $vars->{'mail_' . $mail_driver . '_' . $conf_name} ?: null; $conf_value = $vars->{'mail_' . $mail_driver . '_' . $conf_name} ?: null;
if (!$conf_value) if (!$conf_value)
{ {
return new Object(-1, 'msg_advanced_mailer_smtp_host_is_invalid'); return $this->setError('msg_advanced_mailer_smtp_host_is_invalid');
} }
$mail_driver_config[$conf_name] = $conf_value; $mail_driver_config[$conf_name] = $conf_value;
} }
@ -579,7 +576,7 @@ class adminAdminController extends admin
$sms_driver = $vars->sms_driver; $sms_driver = $vars->sms_driver;
if (!array_key_exists($sms_driver, $sms_drivers)) if (!array_key_exists($sms_driver, $sms_drivers))
{ {
return new Object(-1, 'msg_advanced_mailer_sending_method_is_invalid'); return $this->setError('msg_advanced_mailer_sending_method_is_invalid');
} }
// Validate the SMS driver settings. // Validate the SMS driver settings.
@ -589,7 +586,7 @@ class adminAdminController extends admin
$conf_value = $vars->{'sms_' . $sms_driver . '_' . $conf_name} ?: null; $conf_value = $vars->{'sms_' . $sms_driver . '_' . $conf_name} ?: null;
if (!$conf_value) if (!$conf_value)
{ {
return new Object(-1, 'msg_advanced_mailer_smtp_host_is_invalid'); return $this->setError('msg_advanced_mailer_smtp_host_is_invalid');
} }
$sms_driver_config[$conf_name] = $conf_value; $sms_driver_config[$conf_name] = $conf_value;
} }
@ -628,7 +625,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set("sms.allow_split.lms", toBool($vars->allow_split_lms)); Rhymix\Framework\Config::set("sms.allow_split.lms", toBool($vars->allow_split_lms));
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
@ -683,7 +680,7 @@ class adminAdminController extends admin
return $item !== ''; return $item !== '';
})); }));
if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip)) { if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip)) {
return new Object(-1, 'msg_invalid_ip'); return $this->setError('msg_invalid_ip');
} }
$denied_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_denied_ip)); $denied_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_denied_ip));
@ -691,13 +688,13 @@ class adminAdminController extends admin
return $item !== ''; return $item !== '';
})); }));
if (!Rhymix\Framework\Filters\IpFilter::validateRanges($denied_ip)) { if (!Rhymix\Framework\Filters\IpFilter::validateRanges($denied_ip)) {
return new Object(-1, 'msg_invalid_ip'); return $this->setError('msg_invalid_ip');
} }
$oMemberAdminModel = getAdminModel('member'); $oMemberAdminModel = getAdminModel('member');
if (!$oMemberAdminModel->getMemberAdminIPCheck($allowed_ip, $denied_ip)) if (!$oMemberAdminModel->getMemberAdminIPCheck($allowed_ip, $denied_ip))
{ {
return new Object(-1, 'msg_current_ip_will_be_denied'); return $this->setError('msg_current_ip_will_be_denied');
} }
Rhymix\Framework\Config::set('admin.allow', array_values($allowed_ip)); Rhymix\Framework\Config::set('admin.allow', array_values($allowed_ip));
@ -706,7 +703,7 @@ class adminAdminController extends admin
// Save // Save
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
@ -745,7 +742,7 @@ class adminAdminController extends admin
} }
if (!Rhymix\Framework\Cache::getDriverInstance($vars->object_cache_type, $cache_servers)) if (!Rhymix\Framework\Cache::getDriverInstance($vars->object_cache_type, $cache_servers))
{ {
return new Object(-1, 'msg_cache_handler_not_supported'); return $this->setError('msg_cache_handler_not_supported');
} }
Rhymix\Framework\Config::set('cache', array( Rhymix\Framework\Config::set('cache', array(
'type' => $vars->object_cache_type, 'type' => $vars->object_cache_type,
@ -769,6 +766,7 @@ class adminAdminController extends admin
// Mobile view // Mobile view
Rhymix\Framework\Config::set('mobile.enabled', $vars->use_mobile_view === 'Y'); Rhymix\Framework\Config::set('mobile.enabled', $vars->use_mobile_view === 'Y');
Rhymix\Framework\Config::set('mobile.tablets', $vars->tablets_as_mobile === 'Y'); Rhymix\Framework\Config::set('mobile.tablets', $vars->tablets_as_mobile === 'Y');
Rhymix\Framework\Config::set('mobile.viewport', utf8_trim($vars->mobile_viewport));
if (Rhymix\Framework\Config::get('use_mobile_view') !== null) if (Rhymix\Framework\Config::get('use_mobile_view') !== null)
{ {
Rhymix\Framework\Config::set('use_mobile_view', $vars->use_mobile_view === 'Y'); Rhymix\Framework\Config::set('use_mobile_view', $vars->use_mobile_view === 'Y');
@ -799,7 +797,7 @@ class adminAdminController extends admin
// Save // Save
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
@ -837,15 +835,15 @@ class adminAdminController extends admin
), $log_filename); ), $log_filename);
if (file_exists(RX_BASEDIR . $log_filename_today) && !is_writable(RX_BASEDIR . $log_filename_today)) if (file_exists(RX_BASEDIR . $log_filename_today) && !is_writable(RX_BASEDIR . $log_filename_today))
{ {
return new Object(-1, 'msg_debug_log_filename_not_writable'); return $this->setError('msg_debug_log_filename_not_writable');
} }
if (!file_exists(dirname(RX_BASEDIR . $log_filename)) && !FileHandler::makeDir(dirname(RX_BASEDIR . $log_filename))) if (!file_exists(dirname(RX_BASEDIR . $log_filename)) && !FileHandler::makeDir(dirname(RX_BASEDIR . $log_filename)))
{ {
return new Object(-1, 'msg_debug_log_filename_not_writable'); return $this->setError('msg_debug_log_filename_not_writable');
} }
if (!is_writable(dirname(RX_BASEDIR . $log_filename))) if (!is_writable(dirname(RX_BASEDIR . $log_filename)))
{ {
return new Object(-1, 'msg_debug_log_filename_not_writable'); return $this->setError('msg_debug_log_filename_not_writable');
} }
Rhymix\Framework\Config::set('debug.log_filename', $log_filename); Rhymix\Framework\Config::set('debug.log_filename', $log_filename);
@ -855,14 +853,14 @@ class adminAdminController extends admin
return $item !== ''; return $item !== '';
})); }));
if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip)) { if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip)) {
return new Object(-1, 'msg_invalid_ip'); return $this->setError('msg_invalid_ip');
} }
Rhymix\Framework\Config::set('debug.allow', array_values($allowed_ip)); Rhymix\Framework\Config::set('debug.allow', array_values($allowed_ip));
// Save // Save
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
@ -894,7 +892,7 @@ class adminAdminController extends admin
// Save // Save
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
@ -915,7 +913,7 @@ class adminAdminController extends admin
if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip)) if (!Rhymix\Framework\Filters\IpFilter::validateRanges($allowed_ip))
{ {
return new Object(-1, 'msg_invalid_ip'); return $this->setError('msg_invalid_ip');
} }
Rhymix\Framework\Config::set('lock.locked', $vars->sitelock_locked === 'Y'); Rhymix\Framework\Config::set('lock.locked', $vars->sitelock_locked === 'Y');
@ -924,7 +922,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('lock.allow', array_values($allowed_ip)); Rhymix\Framework\Config::set('lock.allow', array_values($allowed_ip));
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
@ -945,7 +943,7 @@ class adminAdminController extends admin
$domain_info = getModel('module')->getSiteInfo($domain_srl); $domain_info = getModel('module')->getSiteInfo($domain_srl);
if ($domain_info->domain_srl != $domain_srl) if ($domain_info->domain_srl != $domain_srl)
{ {
return new Object(-1, 'msg_domain_not_found'); return $this->setError('msg_domain_not_found');
} }
} }
@ -954,7 +952,7 @@ class adminAdminController extends admin
$vars->subtitle = utf8_trim($vars->subtitle); $vars->subtitle = utf8_trim($vars->subtitle);
if ($vars->title === '') if ($vars->title === '')
{ {
return new Object(-1, 'msg_site_title_is_empty'); return $this->setError('msg_site_title_is_empty');
} }
// Validate the domain. // Validate the domain.
@ -972,12 +970,12 @@ class adminAdminController extends admin
} }
if (!$vars->domain) if (!$vars->domain)
{ {
return new Object(-1, 'msg_invalid_domain'); return $this->setError('msg_invalid_domain');
} }
$existing_domain = getModel('module')->getSiteInfoByDomain($vars->domain); $existing_domain = getModel('module')->getSiteInfoByDomain($vars->domain);
if ($existing_domain && $existing_domain->domain == $vars->domain && (!$domain_info || $existing_domain->domain_srl != $domain_info->domain_srl)) if ($existing_domain && $existing_domain->domain == $vars->domain && (!$domain_info || $existing_domain->domain_srl != $domain_info->domain_srl))
{ {
return new Object(-1, 'msg_domain_already_exists'); return $this->setError('msg_domain_already_exists');
} }
// Validate the ports. // Validate the ports.
@ -991,11 +989,11 @@ class adminAdminController extends admin
} }
if ($vars->http_port !== 0 && ($vars->http_port < 1 || $vars->http_port > 65535 || $vars->http_port == 443)) if ($vars->http_port !== 0 && ($vars->http_port < 1 || $vars->http_port > 65535 || $vars->http_port == 443))
{ {
return new Object(-1, 'msg_invalid_http_port'); return $this->setError('msg_invalid_http_port');
} }
if ($vars->https_port !== 0 && ($vars->https_port < 1 || $vars->https_port > 65535 || $vars->https_port == 80)) if ($vars->https_port !== 0 && ($vars->https_port < 1 || $vars->https_port > 65535 || $vars->https_port == 80))
{ {
return new Object(-1, 'msg_invalid_https_port'); return $this->setError('msg_invalid_https_port');
} }
// Validate the security setting. // Validate the security setting.
@ -1009,7 +1007,7 @@ class adminAdminController extends admin
$module_info = getModel('module')->getModuleInfoByModuleSrl(intval($vars->index_module_srl)); $module_info = getModel('module')->getModuleInfoByModuleSrl(intval($vars->index_module_srl));
if (!$module_info || $module_info->module_srl != $vars->index_module_srl) if (!$module_info || $module_info->module_srl != $vars->index_module_srl)
{ {
return new Object(-1, 'msg_invalid_index_module_srl'); return $this->setError('msg_invalid_index_module_srl');
} }
// Validate the index document setting. // Validate the index document setting.
@ -1018,11 +1016,11 @@ class adminAdminController extends admin
$oDocument = getModel('document')->getDocument($vars->index_document_srl); $oDocument = getModel('document')->getDocument($vars->index_document_srl);
if (!$oDocument || !$oDocument->isExists()) if (!$oDocument || !$oDocument->isExists())
{ {
return new Object(-1, 'msg_invalid_index_document_srl'); return $this->setError('msg_invalid_index_document_srl');
} }
if (intval($oDocument->get('module_srl')) !== intval($vars->index_module_srl)) if (intval($oDocument->get('module_srl')) !== intval($vars->index_module_srl))
{ {
return new Object(-1, 'msg_invalid_index_document_srl_module_srl'); return $this->setError('msg_invalid_index_document_srl_module_srl');
} }
} }
else else
@ -1034,14 +1032,14 @@ class adminAdminController extends admin
$enabled_lang = Rhymix\Framework\Config::get('locale.enabled_lang'); $enabled_lang = Rhymix\Framework\Config::get('locale.enabled_lang');
if (!in_array($vars->default_lang, $enabled_lang)) if (!in_array($vars->default_lang, $enabled_lang))
{ {
return new Object(-1, 'msg_lang_is_not_enabled'); return $this->setError('msg_lang_is_not_enabled');
} }
// Validate the default time zone. // Validate the default time zone.
$timezone_list = Rhymix\Framework\DateTime::getTimezoneList(); $timezone_list = Rhymix\Framework\DateTime::getTimezoneList();
if (!isset($timezone_list[$vars->default_timezone])) if (!isset($timezone_list[$vars->default_timezone]))
{ {
return new Object(-1, 'msg_invalid_timezone'); return $this->setError('msg_invalid_timezone');
} }
// Clean up the header and footer scripts. // Clean up the header and footer scripts.
@ -1164,16 +1162,16 @@ class adminAdminController extends admin
$domain_srl = strval(Context::get('domain_srl')); $domain_srl = strval(Context::get('domain_srl'));
if ($domain_srl === '') if ($domain_srl === '')
{ {
return new Object(-1, 'msg_domain_not_found'); return $this->setError('msg_domain_not_found');
} }
$domain_info = getModel('module')->getSiteInfo($domain_srl); $domain_info = getModel('module')->getSiteInfo($domain_srl);
if ($domain_info->domain_srl != $domain_srl) if ($domain_info->domain_srl != $domain_srl)
{ {
return new Object(-1, 'msg_domain_not_found'); return $this->setError('msg_domain_not_found');
} }
if ($domain_info->is_default_domain === 'Y') if ($domain_info->is_default_domain === 'Y')
{ {
return new Object(-1, 'msg_cannot_delete_default_domain'); return $this->setError('msg_cannot_delete_default_domain');
} }
// Delete the domain. // Delete the domain.
@ -1206,19 +1204,19 @@ class adminAdminController extends admin
{ {
if (!($conn = @ftp_connect($vars->ftp_host, $vars->ftp_port, 3))) if (!($conn = @ftp_connect($vars->ftp_host, $vars->ftp_port, 3)))
{ {
return new Object(-1, 'msg_ftp_not_connected'); return $this->setError('msg_ftp_not_connected');
} }
if (!@ftp_login($conn, $vars->ftp_user, $vars->ftp_pass)) if (!@ftp_login($conn, $vars->ftp_user, $vars->ftp_pass))
{ {
return new Object(-1, 'msg_ftp_invalid_auth_info'); return $this->setError('msg_ftp_invalid_auth_info');
} }
if (!@ftp_pasv($conn, $vars->ftp_pasv === 'Y')) if (!@ftp_pasv($conn, $vars->ftp_pasv === 'Y'))
{ {
return new Object(-1, 'msg_ftp_cannot_set_passive_mode'); return $this->setError('msg_ftp_cannot_set_passive_mode');
} }
if (!@ftp_chdir($conn, $vars->ftp_path)) if (!@ftp_chdir($conn, $vars->ftp_path))
{ {
return new Object(-1, 'msg_ftp_invalid_path'); return $this->setError('msg_ftp_invalid_path');
} }
ftp_close($conn); ftp_close($conn);
} }
@ -1226,23 +1224,23 @@ class adminAdminController extends admin
{ {
if (!function_exists('ssh2_connect')) if (!function_exists('ssh2_connect'))
{ {
return new Object(-1, 'disable_sftp_support'); return $this->setError('disable_sftp_support');
} }
if (!($conn = ssh2_connect($vars->ftp_host, $vars->ftp_port))) if (!($conn = ssh2_connect($vars->ftp_host, $vars->ftp_port)))
{ {
return new Object(-1, 'msg_ftp_not_connected'); return $this->setError('msg_ftp_not_connected');
} }
if (!@ssh2_auth_password($conn, $vars->ftp_user, $vars->ftp_pass)) if (!@ssh2_auth_password($conn, $vars->ftp_user, $vars->ftp_pass))
{ {
return new Object(-1, 'msg_ftp_invalid_auth_info'); return $this->setError('msg_ftp_invalid_auth_info');
} }
if (!@($sftp = ssh2_sftp($conn))) if (!@($sftp = ssh2_sftp($conn)))
{ {
return new Object(-1, 'msg_ftp_sftp_error'); return $this->setError('msg_ftp_sftp_error');
} }
if (!@ssh2_sftp_stat($sftp, $vars->ftp_path . 'common/defaults/config.php')) if (!@ssh2_sftp_stat($sftp, $vars->ftp_path . 'common/defaults/config.php'))
{ {
return new Object(-1, 'msg_ftp_invalid_path'); return $this->setError('msg_ftp_invalid_path');
} }
unset($sftp, $conn); unset($sftp, $conn);
} }
@ -1257,7 +1255,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('ftp.sftp', $vars->ftp_sftp === 'Y'); Rhymix\Framework\Config::set('ftp.sftp', $vars->ftp_sftp === 'Y');
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_updated'); $this->setMessage('success_updated');
@ -1278,7 +1276,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('ftp.sftp', false); Rhymix\Framework\Config::set('ftp.sftp', false);
if (!Rhymix\Framework\Config::save()) if (!Rhymix\Framework\Config::save())
{ {
return new Object(-1, 'msg_failed_to_save_config'); return $this->setError('msg_failed_to_save_config');
} }
$this->setMessage('success_deleted'); $this->setMessage('success_deleted');

View file

@ -43,7 +43,7 @@ class adminAdminModel extends admin
$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
{ {
return new Object(-1, 'msg_ftp_invalid_auth_info'); return $this->setError('msg_ftp_invalid_auth_info');
} }
$sftp = ssh2_sftp($connection); $sftp = ssh2_sftp($connection);
@ -112,14 +112,14 @@ class adminAdminModel extends admin
$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
if(!$connection) if(!$connection)
{ {
return new Object(-1, sprintf(lang('msg_ftp_not_connected'), 'host')); return $this->setError('msg_ftp_not_connected', 'host');
} }
$login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password); $login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password);
if(!$login_result) if(!$login_result)
{ {
ftp_close($connection); ftp_close($connection);
return new Object(-1, 'msg_ftp_invalid_auth_info'); return $this->setError('msg_ftp_invalid_auth_info');
} }
// create temp file // create temp file
@ -182,7 +182,7 @@ class adminAdminModel extends admin
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
{ {
return new Object(1, 'msg_ftp_invalid_auth_info'); return new BaseObject(1, 'msg_ftp_invalid_auth_info');
} }
if(!$ftp_info->ftp_host) if(!$ftp_info->ftp_host)
@ -199,7 +199,7 @@ class adminAdminModel extends admin
{ {
if(!function_exists('ssh2_sftp')) if(!function_exists('ssh2_sftp'))
{ {
return new Object(-1, 'disable_sftp_support'); return $this->setError('disable_sftp_support');
} }
return $this->getSFTPPath(); return $this->getSFTPPath();
} }
@ -216,12 +216,12 @@ class adminAdminModel extends admin
$oFTP = new ftp(); $oFTP = new ftp();
if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
{ {
return new Object(1, sprintf(lang('msg_ftp_not_connected'), 'host')); return new BaseObject(1, sprintf(lang('msg_ftp_not_connected'), 'host'));
} }
if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
{ {
return new Object(1, 'msg_ftp_invalid_auth_info'); return new BaseObject(1, 'msg_ftp_invalid_auth_info');
} }
// create temp file // create temp file
@ -286,7 +286,7 @@ class adminAdminModel extends admin
$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
{ {
return new Object(-1, 'msg_ftp_invalid_auth_info'); return $this->setError('msg_ftp_invalid_auth_info');
} }
$sftp = ssh2_sftp($connection); $sftp = ssh2_sftp($connection);
@ -294,7 +294,7 @@ class adminAdminModel extends admin
$dh = @opendir($curpwd); $dh = @opendir($curpwd);
if(!$dh) if(!$dh)
{ {
return new Object(-1, 'msg_ftp_invalid_path'); return $this->setError('msg_ftp_invalid_path');
} }
$list = array(); $list = array();
while(($file = readdir($dh)) !== FALSE) while(($file = readdir($dh)) !== FALSE)
@ -325,7 +325,7 @@ class adminAdminModel extends admin
$ftp_info = Context::getRequestVars(); $ftp_info = Context::getRequestVars();
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
{ {
return new Object(-1, 'msg_ftp_invalid_auth_info'); return $this->setError('msg_ftp_invalid_auth_info');
} }
$this->pwd = $ftp_info->ftp_root_path; $this->pwd = $ftp_info->ftp_root_path;
@ -344,7 +344,7 @@ class adminAdminModel extends admin
{ {
if(!function_exists('ssh2_sftp')) if(!function_exists('ssh2_sftp'))
{ {
return new Object(-1, 'disable_sftp_support'); return $this->setError('disable_sftp_support');
} }
return $this->getSFTPList(); return $this->getSFTPList();
} }
@ -359,7 +359,7 @@ class adminAdminModel extends admin
} }
else else
{ {
return new Object(-1, 'msg_ftp_invalid_auth_info'); return $this->setError('msg_ftp_invalid_auth_info');
} }
} }
$list = array(); $list = array();
@ -380,7 +380,7 @@ class adminAdminModel extends admin
} }
else else
{ {
return new Object(-1, 'msg_ftp_no_directory'); return $this->setError('msg_ftp_no_directory');
} }
$this->add('list', $list); $this->add('list', $list);
} }
@ -624,38 +624,33 @@ class adminAdminModel extends admin
*/ */
function getAdminMenuLang() function getAdminMenuLang()
{ {
$currentLang = Context::getLangType(); static $lang = null;
$cacheFile = sprintf('./files/cache/menu/admin_lang/adminMenu.%s.lang.php', $currentLang);
if ($lang === null)
// Update if no cache file exists or it is older than xml file
if(!is_readable($cacheFile))
{ {
$lang = new stdClass(); $lang = Rhymix\Framework\Cache::get('admin_menu_langs:' . Context::getLangType());
}
if ($lang === null)
{
$lang = array();
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$installed_module_list = $oModuleModel->getModulesXmlInfo(); $installed_module_list = $oModuleModel->getModulesXmlInfo();
foreach($installed_module_list as $key => $value)
$this->gnbLangBuffer = '<?php $lang = new stdClass();';
foreach($installed_module_list AS $key => $value)
{ {
$moduleActionInfo = $oModuleModel->getModuleActionXml($value->module); $moduleActionInfo = $oModuleModel->getModuleActionXml($value->module);
if(is_object($moduleActionInfo->menu)) if(is_object($moduleActionInfo->menu))
{ {
foreach($moduleActionInfo->menu AS $key2 => $value2) foreach($moduleActionInfo->menu as $key2 => $value2)
{ {
$lang->menu_gnb_sub[$key2] = $value2->title; $lang[$key2] = $value2->title;
$this->gnbLangBuffer .=sprintf('$lang->menu_gnb_sub[\'%s\'] = \'%s\';', $key2, $value2->title);
} }
} }
} }
$this->gnbLangBuffer .= ' ?>';
FileHandler::writeFile($cacheFile, $this->gnbLangBuffer); Rhymix\Framework\Cache::set('admin_menu_langs:' . Context::getLangType(), $lang, 0, true);
}
else
{
include $cacheFile;
} }
return $lang->menu_gnb_sub; return $lang;
} }
/** /**
@ -675,7 +670,7 @@ class adminAdminModel extends admin
} }
if(!$output->data) if(!$output->data)
{ {
return new Object(); return new BaseObject();
} }
if($isGetModuleInfo && is_array($output->data)) if($isGetModuleInfo && is_array($output->data))
@ -689,7 +684,7 @@ class adminAdminModel extends admin
} }
} }
$returnObject = new Object(); $returnObject = new BaseObject();
$returnObject->add('favoriteList', $output->data); $returnObject->add('favoriteList', $output->data);
return $returnObject; return $returnObject;
} }
@ -711,7 +706,7 @@ class adminAdminModel extends admin
return $output; return $output;
} }
$returnObject = new Object(); $returnObject = new BaseObject();
if($output->data) if($output->data)
{ {
$returnObject->add('result', TRUE); $returnObject->add('result', TRUE);

View file

@ -565,6 +565,7 @@ class adminAdminView extends admin
Context::set('use_rewrite', Rhymix\Framework\Config::get('use_rewrite')); Context::set('use_rewrite', Rhymix\Framework\Config::get('use_rewrite'));
Context::set('use_mobile_view', (config('mobile.enabled') !== null ? config('mobile.enabled') : config('use_mobile_view')) ? true : false); Context::set('use_mobile_view', (config('mobile.enabled') !== null ? config('mobile.enabled') : config('use_mobile_view')) ? true : false);
Context::set('tablets_as_mobile', config('mobile.tablets') ? true : false); Context::set('tablets_as_mobile', config('mobile.tablets') ? true : false);
Context::set('mobile_viewport', config('mobile.viewport') ?: 'width=device-width, initial-scale=1.0, user-scalable=yes');
Context::set('use_ssl', Rhymix\Framework\Config::get('url.ssl')); Context::set('use_ssl', Rhymix\Framework\Config::get('url.ssl'));
Context::set('delay_session', Rhymix\Framework\Config::get('session.delay')); Context::set('delay_session', Rhymix\Framework\Config::get('session.delay'));
Context::set('use_session_keys', Rhymix\Framework\Config::get('session.use_keys')); Context::set('use_session_keys', Rhymix\Framework\Config::get('session.use_keys'));
@ -661,7 +662,7 @@ class adminAdminView extends admin
$domain_info = getModel('module')->getSiteInfo($domain_srl); $domain_info = getModel('module')->getSiteInfo($domain_srl);
if ($domain_info->domain_srl != $domain_srl) if ($domain_info->domain_srl != $domain_srl)
{ {
return new Object(-1, 'msg_domain_not_found'); return $this->setError('msg_domain_not_found');
} }
} }
Context::set('domain_info', $domain_info); Context::set('domain_info', $domain_info);

View file

@ -20,11 +20,11 @@ class admin extends ModuleObject
/** /**
* Install admin module * Install admin module
* @return Object * @return void
*/ */
function moduleInstall() function moduleInstall()
{ {
return new Object();
} }
/** /**
@ -44,7 +44,7 @@ class admin extends ModuleObject
/** /**
* Update module * Update module
* @return Object * @return void
*/ */
function moduleUpdate() function moduleUpdate()
{ {
@ -68,7 +68,6 @@ class admin extends ModuleObject
} }
} }
} }
return new Object();
} }
/** /**

View file

@ -248,6 +248,8 @@ $lang->timezone = 'Time Zone';
$lang->use_mobile_view = 'Enable Mobile View'; $lang->use_mobile_view = 'Enable Mobile View';
$lang->about_use_mobile_view = 'Show mobile page when visitors access with mobile devices.'; $lang->about_use_mobile_view = 'Show mobile page when visitors access with mobile devices.';
$lang->tablets_as_mobile = 'Treat Tablets as Mobile'; $lang->tablets_as_mobile = 'Treat Tablets as Mobile';
$lang->mobile_viewport = 'Mobile viewport Setting';
$lang->about_mobile_viewport = 'The settings entered above will be output in a &lt;meta name=&quot;viewport&quot;&gt; tag for mobile visitors.';
$lang->thumbnail_target = 'Extract Thumbnail From'; $lang->thumbnail_target = 'Extract Thumbnail From';
$lang->thumbnail_target_all = 'All images'; $lang->thumbnail_target_all = 'All images';
$lang->thumbnail_target_attachment = 'Attached images only'; $lang->thumbnail_target_attachment = 'Attached images only';

View file

@ -244,6 +244,8 @@ $lang->timezone = '표준 시간대';
$lang->use_mobile_view = '모바일 뷰 사용'; $lang->use_mobile_view = '모바일 뷰 사용';
$lang->about_use_mobile_view = '모바일 기기로 접속시 모바일 페이지를 보여줍니다.'; $lang->about_use_mobile_view = '모바일 기기로 접속시 모바일 페이지를 보여줍니다.';
$lang->tablets_as_mobile = '태블릿도 모바일 취급'; $lang->tablets_as_mobile = '태블릿도 모바일 취급';
$lang->mobile_viewport = '모바일 viewport 설정';
$lang->about_mobile_viewport = '모바일 접속시 여기 입력한 내용이 &lt;meta name=&quot;viewport&quot;&gt; 태그로 출력됩니다.';
$lang->thumbnail_target = '썸네일 생성 대상'; $lang->thumbnail_target = '썸네일 생성 대상';
$lang->thumbnail_target_all = '모든 이미지 (외부 이미지 포함)'; $lang->thumbnail_target_all = '모든 이미지 (외부 이미지 포함)';
$lang->thumbnail_target_attachment = '첨부된 이미지'; $lang->thumbnail_target_attachment = '첨부된 이미지';

View file

@ -80,6 +80,13 @@
</select> </select>
</div> </div>
</div> </div>
<div class="x_control-group">
<label class="x_control-label" for="mobile_viewport">{$lang->mobile_viewport}</label>
<div class="x_controls">
<input type="text" name="mobile_viewport" id="mobile_viewport" value="{$mobile_viewport}" style="min-width: 80%" />
<p class="x_help-block">{$lang->about_mobile_viewport}</p>
</div>
</div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->use_db_session}</label> <label class="x_control-label">{$lang->use_db_session}</label>
<div class="x_controls"> <div class="x_controls">

View file

@ -14,11 +14,11 @@ class adminlogging extends ModuleObject
/** /**
* Install adminlogging module * Install adminlogging module
* @return Object * @return void
*/ */
function moduleInstall() function moduleInstall()
{ {
return new Object();
} }
/** /**
@ -32,11 +32,11 @@ class adminlogging extends ModuleObject
/** /**
* Update module * Update module
* @return Object * @return void
*/ */
function moduleUpdate() function moduleUpdate()
{ {
return new Object();
} }
/** /**

View file

@ -61,7 +61,7 @@ class Advanced_MailerAdminController extends Advanced_Mailer
{ {
if ($method !== 'default' && !isset($sending_methods[$method])) if ($method !== 'default' && !isset($sending_methods[$method]))
{ {
return new Object(-1, 'msg_advanced_mailer_sending_method_is_invalid'); return $this->setError('msg_advanced_mailer_sending_method_is_invalid');
} }
if ($method !== 'default') if ($method !== 'default')
{ {
@ -69,9 +69,7 @@ class Advanced_MailerAdminController extends Advanced_Mailer
{ {
if (!Rhymix\Framework\Config::get("mail.$method.$conf_name")) if (!Rhymix\Framework\Config::get("mail.$method.$conf_name"))
{ {
return new Object(-1, sprintf( return $this->setError('msg_advanced_mailer_sending_method_is_not_configured', lang('cmd_advanced_mailer_sending_method_' . $method));
Context::getLang('msg_advanced_mailer_sending_method_is_not_configured'),
Context::getLang('cmd_advanced_mailer_sending_method_' . $method)));
} }
} }
} }
@ -157,11 +155,11 @@ class Advanced_MailerAdminController extends Advanced_Mailer
$clear_before_days = intval(Context::get('clear_before_days')); $clear_before_days = intval(Context::get('clear_before_days'));
if (!in_array($status, array('success', 'error'))) if (!in_array($status, array('success', 'error')))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
if ($clear_before_days < 0) if ($clear_before_days < 0)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$obj = new stdClass(); $obj = new stdClass();
@ -188,11 +186,11 @@ class Advanced_MailerAdminController extends Advanced_Mailer
$clear_before_days = intval(Context::get('clear_before_days')); $clear_before_days = intval(Context::get('clear_before_days'));
if (!in_array($status, array('success', 'error'))) if (!in_array($status, array('success', 'error')))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
if ($clear_before_days < 0) if ($clear_before_days < 0)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$obj = new stdClass(); $obj = new stdClass();

View file

@ -302,7 +302,7 @@ class Advanced_MailerAdminView extends Advanced_Mailer
$total_count = $count->data->count; $total_count = $count->data->count;
$total_page = max(1, ceil($total_count / 20)); $total_page = max(1, ceil($total_count / 20));
$output = new Object(); $output = new stdClass;
$output->total_count = $total_count; $output->total_count = $total_count;
$output->total_page = $total_page; $output->total_page = $total_page;
$output->page = $page; $output->page = $page;

View file

@ -208,7 +208,6 @@ class Advanced_Mailer extends ModuleObject
public function moduleInstall() public function moduleInstall()
{ {
$this->registerTriggers(); $this->registerTriggers();
return new Object();
} }
/** /**
@ -242,7 +241,6 @@ class Advanced_Mailer extends ModuleObject
public function moduleUpdate() public function moduleUpdate()
{ {
$this->registerTriggers(); $this->registerTriggers();
return new Object(0, 'success_updated');
} }
public function recompileCache() public function recompileCache()

View file

@ -83,7 +83,7 @@ class autoinstallAdminController extends autoinstall
$this->checkInstalled(); $this->checkInstalled();
$oAdminController = getAdminController('admin'); $oAdminController = getAdminController('admin');
$output = $oAdminController->cleanFavorite(); $oAdminController->cleanFavorite();
} }
/** /**
@ -404,7 +404,7 @@ class autoinstallAdminController extends autoinstall
$this->setMessage('success_deleted', 'update'); $this->setMessage('success_deleted', 'update');
return new Object(); return new BaseObject();
} }
} }

View file

@ -354,7 +354,7 @@ class autoinstallAdminModel extends autoinstall
$packageSrl = Context::get('package_srl'); $packageSrl = Context::get('package_srl');
if(!$packageSrl) if(!$packageSrl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$package = $this->getInstallInfo($packageSrl); $package = $this->getInstallInfo($packageSrl);
@ -389,12 +389,12 @@ class autoinstallAdminModel extends autoinstall
if($directModuleInstall==FALSE) if($directModuleInstall==FALSE)
{ {
$output = new Object(-1, 'msg_direct_inall_invalid'); $output = new BaseObject(-1, 'msg_direct_inall_invalid');
$output->add('path', $arrUnwritableDir); $output->add('path', $arrUnwritableDir);
return $output; return $output;
} }
return new Object(); return new BaseObject();
} }
public function isWritableDir($path) public function isWritableDir($path)
@ -414,11 +414,11 @@ class autoinstallAdminModel extends autoinstall
if(FileHandler::isWritableDir($check_path)==FALSE) if(FileHandler::isWritableDir($check_path)==FALSE)
{ {
$output = new Object(-1, 'msg_unwritable_directory'); $output = new BaseObject(-1, 'msg_unwritable_directory');
$output->add('path', FileHandler::getRealPath($check_path)); $output->add('path', FileHandler::getRealPath($check_path));
return $output; return $output;
} }
return new Object(); return new BaseObject();
} }
} }

View file

@ -156,8 +156,6 @@ class autoinstall extends ModuleObject
{ {
$oDB->addColumn('autoinstall_packages', 'have_instance', 'char', '1', 'N', TRUE); $oDB->addColumn('autoinstall_packages', 'have_instance', 'char', '1', 'N', TRUE);
} }
return new Object(0, 'success_updated');
} }
/** /**

View file

@ -156,15 +156,15 @@ class ModuleInstaller
$oModule = getModule($target_name, "class"); $oModule = getModule($target_name, "class");
if(!$oModule) if(!$oModule)
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
if(!method_exists($oModule, "moduleUninstall")) if(!method_exists($oModule, "moduleUninstall"))
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
$output = $oModule->moduleUninstall(); $output = $oModule->moduleUninstall();
if($output instanceof Object && !$output->toBool()) if($output instanceof BaseObject && !$output->toBool())
{ {
return $output; return $output;
} }
@ -181,7 +181,7 @@ class ModuleInstaller
$oDB->dropTable($filename); $oDB->dropTable($filename);
} }
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -241,7 +241,7 @@ class ModuleInstaller
$this->installModule(); $this->installModule();
FileHandler::removeDir($this->temp_dir); FileHandler::removeDir($this->temp_dir);
return new Object(); return new BaseObject();
} }
/** /**
@ -359,12 +359,12 @@ class SFTPModuleInstaller extends ModuleInstaller
{ {
if(!function_exists('ssh2_connect')) if(!function_exists('ssh2_connect'))
{ {
return new Object(-1, 'msg_sftp_not_supported'); return new BaseObject(-1, 'msg_sftp_not_supported');
} }
if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y') if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
{ {
return new Object(-1, 'msg_ftp_invalid_auth_info'); return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
} }
if($this->ftp_info->ftp_host) if($this->ftp_info->ftp_host)
@ -378,11 +378,11 @@ class SFTPModuleInstaller extends ModuleInstaller
$this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port); $this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port);
if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password)) if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
{ {
return new Object(-1, 'msg_ftp_invalid_auth_info'); return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
} }
$_SESSION['ftp_password'] = $this->ftp_password; $_SESSION['ftp_password'] = $this->ftp_password;
$this->sftp = ssh2_sftp($this->connection); $this->sftp = ssh2_sftp($this->connection);
return new Object(); return new BaseObject();
} }
/** /**
@ -411,9 +411,9 @@ class SFTPModuleInstaller extends ModuleInstaller
if(!@ssh2_sftp_unlink($this->sftp, $target_path)) if(!@ssh2_sftp_unlink($this->sftp, $target_path))
{ {
return new Object(-1, sprintf(lang('msg_delete_file_failed'), $path)); return new BaseObject(-1, sprintf(lang('msg_delete_file_failed'), $path));
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -432,9 +432,9 @@ class SFTPModuleInstaller extends ModuleInstaller
if(!@ssh2_sftp_rmdir($this->sftp, $target_path)) if(!@ssh2_sftp_rmdir($this->sftp, $target_path))
{ {
return new Object(-1, sprintf(lang('msg_delete_dir_failed'), $path)); return new BaseObject(-1, sprintf(lang('msg_delete_dir_failed'), $path));
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -447,7 +447,7 @@ class SFTPModuleInstaller extends ModuleInstaller
{ {
if(!$this->ftp_password) if(!$this->ftp_password)
{ {
return new Object(-1, 'msg_ftp_password_input'); return new BaseObject(-1, 'msg_ftp_password_input');
} }
$output = $this->_connect(); $output = $this->_connect();
@ -477,7 +477,7 @@ class SFTPModuleInstaller extends ModuleInstaller
ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file); ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
} }
} }
return new Object(); return new BaseObject();
} }
} }
@ -532,14 +532,14 @@ class PHPFTPModuleInstaller extends ModuleInstaller
$this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port); $this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port);
if(!$this->connection) if(!$this->connection)
{ {
return new Object(-1, sprintf(lang('msg_ftp_not_connected'), 'host')); return new BaseObject(-1, sprintf(lang('msg_ftp_not_connected'), 'host'));
} }
$login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password); $login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password);
if(!$login_result) if(!$login_result)
{ {
$this->_close(); $this->_close();
return new Object(-1, 'msg_ftp_invalid_auth_info'); return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
} }
$_SESSION['ftp_password'] = $this->ftp_password; $_SESSION['ftp_password'] = $this->ftp_password;
@ -547,7 +547,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
{ {
ftp_pasv($this->connection, TRUE); ftp_pasv($this->connection, TRUE);
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -566,9 +566,9 @@ class PHPFTPModuleInstaller extends ModuleInstaller
if(!@ftp_delete($this->connection, $target_path)) if(!@ftp_delete($this->connection, $target_path))
{ {
return new Object(-1, "failed to delete file " . $path); return new BaseObject(-1, "failed to delete file " . $path);
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -587,9 +587,9 @@ class PHPFTPModuleInstaller extends ModuleInstaller
if(!@ftp_rmdir($this->connection, $target_path)) if(!@ftp_rmdir($this->connection, $target_path))
{ {
return new Object(-1, "failed to delete directory " . $path); return new BaseObject(-1, "failed to delete directory " . $path);
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -612,7 +612,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
{ {
if(!$this->ftp_password) if(!$this->ftp_password)
{ {
return new Object(-1, 'msg_ftp_password_input'); return new BaseObject(-1, 'msg_ftp_password_input');
} }
$output = $this->_connect(); $output = $this->_connect();
@ -662,7 +662,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
{ {
if(!@ftp_mkdir($this->connection, $ftp_path)) if(!@ftp_mkdir($this->connection, $ftp_path))
{ {
return new Object(-1, "msg_make_directory_failed"); return new BaseObject(-1, "msg_make_directory_failed");
} }
if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
@ -671,14 +671,14 @@ class PHPFTPModuleInstaller extends ModuleInstaller
{ {
if(!ftp_chmod($this->connection, 0755, $ftp_path)) if(!ftp_chmod($this->connection, 0755, $ftp_path))
{ {
return new Object(-1, "msg_permission_adjust_failed"); return new BaseObject(-1, "msg_permission_adjust_failed");
} }
} }
else else
{ {
if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path)) if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
{ {
return new Object(-1, "msg_permission_adjust_failed"); return new BaseObject(-1, "msg_permission_adjust_failed");
} }
} }
} }
@ -686,12 +686,12 @@ class PHPFTPModuleInstaller extends ModuleInstaller
} }
if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY)) if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY))
{ {
return new Object(-1, "msg_ftp_upload_failed"); return new BaseObject(-1, "msg_ftp_upload_failed");
} }
} }
} }
$this->_close(); $this->_close();
return new Object(); return new BaseObject();
} }
} }
@ -745,15 +745,15 @@ class FTPModuleInstaller extends ModuleInstaller
$this->oFtp = new ftp(); $this->oFtp = new ftp();
if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port)) if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
{ {
return new Object(-1, sprintf(lang('msg_ftp_not_connected'), 'host')); return new BaseObject(-1, sprintf(lang('msg_ftp_not_connected'), 'host'));
} }
if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
{ {
$this->_close(); $this->_close();
return new Object(-1, 'msg_ftp_invalid_auth_info'); return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
} }
$_SESSION['ftp_password'] = $this->ftp_password; $_SESSION['ftp_password'] = $this->ftp_password;
return new Object(); return new BaseObject();
} }
/** /**
@ -772,9 +772,9 @@ class FTPModuleInstaller extends ModuleInstaller
if(!$this->oFtp->ftp_delete($target_path)) if(!$this->oFtp->ftp_delete($target_path))
{ {
return new Object(-1, sprintf(lang('msg_delete_file_failed'), $path)); return new BaseObject(-1, sprintf(lang('msg_delete_file_failed'), $path));
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -792,9 +792,9 @@ class FTPModuleInstaller extends ModuleInstaller
if(!$this->oFtp->ftp_rmdir($target_path)) if(!$this->oFtp->ftp_rmdir($target_path))
{ {
return new Object(-1, sprintf(lang('msg_delete_dir_failed'), $path)); return new BaseObject(-1, sprintf(lang('msg_delete_dir_failed'), $path));
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -817,7 +817,7 @@ class FTPModuleInstaller extends ModuleInstaller
{ {
if(!$this->ftp_password) if(!$this->ftp_password)
{ {
return new Object(-1, 'msg_ftp_password_input'); return new BaseObject(-1, 'msg_ftp_password_input');
} }
$output = $this->_connect(); $output = $this->_connect();
@ -864,7 +864,7 @@ class FTPModuleInstaller extends ModuleInstaller
$this->_close(); $this->_close();
return new Object(); return new BaseObject();
} }
} }
@ -892,7 +892,7 @@ class DirectModuleInstaller extends ModuleInstaller
*/ */
function _connect() function _connect()
{ {
return new Object(); return new BaseObject();
} }
/** /**
@ -911,9 +911,9 @@ class DirectModuleInstaller extends ModuleInstaller
if(!FileHandler::removeFile($target_path)) if(!FileHandler::removeFile($target_path))
{ {
return new Object(-1, sprintf(lang('msg_delete_file_failed'), $path)); return new BaseObject(-1, sprintf(lang('msg_delete_file_failed'), $path));
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -931,7 +931,7 @@ class DirectModuleInstaller extends ModuleInstaller
FileHandler::removeDir($target_path); FileHandler::removeDir($target_path);
return new Object(); return new BaseObject();
} }
/** /**
@ -989,7 +989,7 @@ class DirectModuleInstaller extends ModuleInstaller
$this->_close(); $this->_close();
return new Object(); return new BaseObject();
} }
} }

View file

@ -166,7 +166,7 @@ class boardAdminController extends board {
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if($module_info->mid != $mid) if($module_info->mid != $mid)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$module_info->hide_category = Context::get('hide_category') == 'Y' ? 'Y' : 'N'; $module_info->hide_category = Context::get('hide_category') == 'Y' ? 'Y' : 'N';

View file

@ -75,8 +75,6 @@ class board extends ModuleObject
$oModuleController->updateSite($site_args); $oModuleController->updateSite($site_args);
} }
} }
return new Object();
} }
/** /**
@ -113,14 +111,12 @@ class board extends ModuleObject
{ {
$oModuleController->insertTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after'); $oModuleController->insertTrigger('menu.getModuleListInSitemap', 'board', 'model', 'triggerModuleListInSitemap', 'after');
} }
return new Object(0, 'success_updated');
} }
function moduleUninstall() function moduleUninstall()
{ {
$output = executeQueryArray("board.getAllBoard"); $output = executeQueryArray("board.getAllBoard");
if(!$output->data) return new Object(); if(!$output->data) return new BaseObject();
@set_time_limit(0); @set_time_limit(0);
$oModuleController = getController('module'); $oModuleController = getController('module');
@ -130,6 +126,6 @@ class board extends ModuleObject
$oModuleController->deleteModule($board->module_srl); $oModuleController->deleteModule($board->module_srl);
} }
return new Object(); return new BaseObject();
} }
} }

View file

@ -24,7 +24,7 @@ class boardController extends board
// check grant // check grant
if(!$this->grant->write_document) if(!$this->grant->write_document)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
// setup variables // setup variables
@ -35,7 +35,7 @@ class boardController extends board
// Return error if content is empty. // Return error if content is empty.
if (is_empty_html_content($obj->content)) if (is_empty_html_content($obj->content))
{ {
return new Object(-1, 'msg_empty_content'); return $this->setError('msg_empty_content');
} }
// unset document style if not manager // unset document style if not manager
@ -100,14 +100,14 @@ class boardController extends board
{ {
if(!$oDocument->isGranted()) if(!$oDocument->isGranted())
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
// Protect admin document // Protect admin document
$member_info = getModel('member')->getMemberInfoByMemberSrl($oDocument->get('member_srl')); $member_info = getModel('member')->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_admin_document_no_modify'); return $this->setError('msg_admin_document_no_modify');
} }
// if document status is temp // if document status is temp
@ -131,7 +131,7 @@ class boardController extends board
{ {
if($oDocument->get('comment_count') > 0 && !$this->grant->manager) if($oDocument->get('comment_count') > 0 && !$this->grant->manager)
{ {
return new Object(-1, 'msg_protect_update_content'); return $this->setError('msg_protect_update_content');
} }
} }
@ -140,7 +140,7 @@ class boardController extends board
{ {
if($oDocument->get('regdate') < date('YmdHis', strtotime('-' . $this->module_info->protect_document_regdate . ' day'))) if($oDocument->get('regdate') < date('YmdHis', strtotime('-' . $this->module_info->protect_document_regdate . ' day')))
{ {
return new Object(-1, sprintf(lang('msg_protect_regdate_document'), $this->module_info->protect_document_regdate)); return $this->setError(sprintf(lang('msg_protect_regdate_document'), $this->module_info->protect_document_regdate));
} }
} }
@ -228,7 +228,7 @@ class boardController extends board
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
if(!$update_id) if(!$update_id)
{ {
return new Object(-1, 'msg_no_update_id'); return $this->setError('msg_no_update_id');
} }
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
@ -240,13 +240,13 @@ class boardController extends board
$Exists_log = $oDocumentModel->getUpdateLogAdminisExists($update_log->document_srl); $Exists_log = $oDocumentModel->getUpdateLogAdminisExists($update_log->document_srl);
if($Exists_log === true) if($Exists_log === true)
{ {
return new Object(-1, 'msg_admin_update_log'); return $this->setError('msg_admin_update_log');
} }
} }
if(!$update_log) if(!$update_log)
{ {
return new Object(-1, 'msg_no_update_log'); return $this->setError('msg_no_update_log');
} }
$oDocument = $oDocumentModel->getDocument($update_log->document_srl); $oDocument = $oDocumentModel->getDocument($update_log->document_srl);
@ -275,7 +275,7 @@ class boardController extends board
// if the document is not existed // if the document is not existed
if(!$document_srl) if(!$document_srl)
{ {
return new Object(-1, 'msg_invalid_document'); return $this->setError('msg_invalid_document');
} }
$oDocumentModel = &getModel('document'); $oDocumentModel = &getModel('document');
@ -285,7 +285,7 @@ class boardController extends board
{ {
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false) if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{ {
return new Object(-1, 'msg_protect_delete_content'); return $this->setError('msg_protect_delete_content');
} }
} }
@ -295,7 +295,7 @@ class boardController extends board
{ {
$format = lang('msg_protect_regdate_document'); $format = lang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate); $massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage); return $this->setError($massage);
} }
} }
// generate document module controller object // generate document module controller object
@ -349,7 +349,7 @@ class boardController extends board
// check grant // check grant
if(!$this->grant->write_comment) if(!$this->grant->write_comment)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -378,7 +378,7 @@ class boardController extends board
$oDocument = $oDocumentModel->getDocument($obj->document_srl); $oDocument = $oDocumentModel->getDocument($obj->document_srl);
if(!$oDocument->isExists()) if(!$oDocument->isExists())
{ {
return new Object(-1,'msg_not_founded'); return $this->setError('msg_not_founded');
} }
// For anonymous use, remove writer's information and notifying information // For anonymous use, remove writer's information and notifying information
@ -416,7 +416,7 @@ class boardController extends board
$childs = $oCommentModel->getChildComments($obj->comment_srl); $childs = $oCommentModel->getChildComments($obj->comment_srl);
if(count($childs) > 0) if(count($childs) > 0)
{ {
return new Object(-1, 'msg_board_update_protect_comment'); return $this->setError('msg_board_update_protect_comment');
} }
} }
} }
@ -426,7 +426,7 @@ class boardController extends board
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_admin_comment_no_modify'); return $this->setError('msg_admin_comment_no_modify');
} }
// INSERT if comment_srl does not exist. // INSERT if comment_srl does not exist.
@ -441,7 +441,7 @@ class boardController extends board
$parent_comment = $oCommentModel->getComment($obj->parent_srl); $parent_comment = $oCommentModel->getComment($obj->parent_srl);
if(!$parent_comment->comment_srl) if(!$parent_comment->comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
if($parent_comment->isSecret() && $this->module_info->secret === 'Y') if($parent_comment->isSecret() && $this->module_info->secret === 'Y')
{ {
@ -470,13 +470,13 @@ class boardController extends board
{ {
$format = lang('msg_protect_regdate_comment'); $format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate); $massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage); return $this->setError($massage);
} }
} }
// check the grant // check the grant
if(!$comment->isGranted()) if(!$comment->isGranted())
{ {
return new Object(-1,'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$obj->parent_srl = $comment->parent_srl; $obj->parent_srl = $comment->parent_srl;
$output = $oCommentController->updateComment($obj, $this->grant->manager); $output = $oCommentController->updateComment($obj, $this->grant->manager);
@ -510,7 +510,7 @@ class boardController extends board
if(!$comment_srl) if(!$comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$oCommentModel = getModel('comment'); $oCommentModel = getModel('comment');
@ -520,7 +520,7 @@ class boardController extends board
$childs = $oCommentModel->getChildComments($comment_srl); $childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0) if(count($childs) > 0)
{ {
return new Object(-1, 'msg_board_delete_protect_comment'); return $this->setError('msg_board_delete_protect_comment');
} }
} }
$comment = $oCommentModel->getComment($comment_srl, $this->grant->manager); $comment = $oCommentModel->getComment($comment_srl, $this->grant->manager);
@ -530,7 +530,7 @@ class boardController extends board
{ {
$format = lang('msg_protect_regdate_comment'); $format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate); $massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage); return $this->setError($massage);
} }
} }
// generate comment controller object // generate comment controller object
@ -642,13 +642,13 @@ class boardController extends board
$oComment = $oCommentModel->getComment($comment_srl); $oComment = $oCommentModel->getComment($comment_srl);
if(!$oComment->isExists()) if(!$oComment->isExists())
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// compare the comment password and the user input password // compare the comment password and the user input password
if(!$oMemberModel->isValidPassword($oComment->get('password'),$password)) if(!$oMemberModel->isValidPassword($oComment->get('password'),$password))
{ {
return new Object(-1, 'msg_invalid_password'); return $this->setError('msg_invalid_password');
} }
$oComment->setGrantForSession(); $oComment->setGrantForSession();
@ -658,13 +658,13 @@ class boardController extends board
$oDocument = $oDocumentModel->getDocument($document_srl); $oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists()) if(!$oDocument->isExists())
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// compare the document password and the user input password // compare the document password and the user input password
if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password)) if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password))
{ {
return new Object(-1, 'msg_invalid_password'); return $this->setError('msg_invalid_password');
} }
$oDocument->setGrantForSession(); $oDocument->setGrantForSession();
@ -681,7 +681,7 @@ class boardController extends board
if(!$member_srl || !$mid) if(!$member_srl || !$mid)
{ {
return new Object(); return;
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -693,7 +693,7 @@ class boardController extends board
if($cur_module_info->module != 'board') if($cur_module_info->module != 'board')
{ {
return new Object(); return;
} }
// get the member information // get the member information
@ -707,15 +707,13 @@ class boardController extends board
if(!$member_info->user_id) if(!$member_info->user_id)
{ {
return new Object(); return;
} }
//search //search
$url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name); $url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name);
$oMemberController = getController('member'); $oMemberController = getController('member');
$oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', ''); $oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', '');
return new Object();
} }
/** /**

View file

@ -1,8 +1,6 @@
<?php <?php
/* Copyright (C) NAVER <http://www.navercorp.com> */ /* Copyright (C) NAVER <http://www.navercorp.com> */
require_once(_XE_PATH_.'modules/board/board.view.php');
class boardMobile extends boardView class boardMobile extends boardView
{ {
function init() function init()
@ -87,36 +85,12 @@ class boardMobile extends boardView
Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml');
} }
function dispBoardCategory()
{
$this->dispBoardCategoryList();
$category_list = Context::get('category_list');
$this->setTemplateFile('category.html');
}
function getBoardCommentPage() function getBoardCommentPage()
{ {
$document_srl = Context::get('document_srl'); $this->dispBoardCommentPage();
$oDocumentModel =& getModel('document'); $oTemplate = TemplateHandler::getInstance();
if(!$document_srl) $html = $oTemplate->compile($this->getTemplatePath(), 'comment.html');
{ $this->add('html', $html);
return new Object(-1, "msg_invalid_request");
}
if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))
{
return new Object(-1, "msg_not_permitted");
}
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists())
{
return new Object(-1, "msg_invalid_request");
}
Context::set('oDocument', $oDocument);
$oTemplate = TemplateHandler::getInstance();
$html = $oTemplate->compile($this->getTemplatePath(), "comment.html");
$this->add("html", $html);
} }
function dispBoardMessage($msg_code) function dispBoardMessage($msg_code)

View file

@ -351,8 +351,6 @@ class boardView extends board
* add javascript filters * add javascript filters
**/ **/
Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml');
// return new Object();
} }
/** /**
@ -642,6 +640,43 @@ class boardView extends board
$this->setTemplateFile('tag_list'); $this->setTemplateFile('tag_list');
} }
/**
* @brief display category list
*/
function dispBoardCategory()
{
$this->dispBoardCategoryList();
$this->setTemplateFile('category.html');
}
/**
* @brief display comment page
*/
function dispBoardCommentPage()
{
$document_srl = Context::get('document_srl');
if(!$document_srl)
{
return $this->setError("msg_invalid_request");
}
if($this->grant->view == false || ($this->module_info->consultation == 'Y' && !$this->grant->manager && !$this->grant->consultation_read))
{
return $this->setError("msg_not_permitted");
}
$oDocument = getModel('document')->getDocument($document_srl);
if(!$oDocument->isExists())
{
return $this->setError("msg_invalid_request");
}
Context::set('oDocument', $oDocument);
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('default_layout');
$this->setTemplateFile('comment.html');
}
/** /**
* @brief display document write form * @brief display document write form
**/ **/
@ -730,20 +765,20 @@ class boardView extends board
{ {
$format = lang('msg_protect_regdate_document'); $format = lang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate); $massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage); return $this->setError($massage);
} }
} }
if($this->module_info->protect_content == "Y" || $this->module_info->protect_update_content == 'Y') if($this->module_info->protect_content == "Y" || $this->module_info->protect_update_content == 'Y')
{ {
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false) if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{ {
return new Object(-1, 'msg_protect_update_content'); return $this->setError('msg_protect_update_content');
} }
} }
} }
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_admin_document_no_modify'); return $this->setError('msg_admin_document_no_modify');
} }
// if the document is not granted, then back to the password input form // if the document is not granted, then back to the password input form
@ -857,7 +892,7 @@ class boardView extends board
{ {
$format = lang('msg_protect_regdate_document'); $format = lang('msg_protect_regdate_document');
$massage = sprintf($format, $this->module_info->protect_document_regdate); $massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage); return $this->setError($massage);
} }
} }
@ -865,7 +900,7 @@ class boardView extends board
{ {
if($oDocument->get('comment_count')>0 && $this->grant->manager == false) if($oDocument->get('comment_count')>0 && $this->grant->manager == false)
{ {
return new Object(-1,'msg_protect_delete_content'); return $this->setError('msg_protect_delete_content');
} }
} }
@ -942,7 +977,7 @@ class boardView extends board
// if the parent comment is not existed // if the parent comment is not existed
if(!$parent_srl) if(!$parent_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// get the comment // get the comment
@ -1004,7 +1039,7 @@ class boardView extends board
// if the comment is not existed // if the comment is not existed
if(!$comment_srl) if(!$comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// get comment information // get comment information
@ -1019,7 +1054,7 @@ class boardView extends board
{ {
$format = lang('msg_protect_regdate_comment'); $format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate); $massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage); return $this->setError($massage);
} }
} }
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false) if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
@ -1027,13 +1062,13 @@ class boardView extends board
$childs = $oCommentModel->getChildComments($comment_srl); $childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0) if(count($childs) > 0)
{ {
return new Object(-1, 'msg_board_update_protect_comment'); return $this->setError('msg_board_update_protect_comment');
} }
} }
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_admin_comment_no_modify'); return $this->setError('msg_admin_comment_no_modify');
} }
// if the comment is not exited, alert an error message // if the comment is not exited, alert an error message
@ -1087,7 +1122,7 @@ class boardView extends board
{ {
$format = lang('msg_protect_regdate_comment'); $format = lang('msg_protect_regdate_comment');
$massage = sprintf($format, $this->module_info->protect_document_regdate); $massage = sprintf($format, $this->module_info->protect_document_regdate);
return new Object(-1, $massage); return $this->setError($massage);
} }
} }
@ -1097,7 +1132,7 @@ class boardView extends board
$childs = $oCommentModel->getChildComments($comment_srl); $childs = $oCommentModel->getChildComments($comment_srl);
if(count($childs) > 0) if(count($childs) > 0)
{ {
return new Object(-1, 'msg_board_delete_protect_comment'); return $this->setError('msg_board_delete_protect_comment');
} }
} }
@ -1177,7 +1212,7 @@ class boardView extends board
if($this->grant->update_view !== true) if($this->grant->update_view !== true)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$updatelog = $oDocumentModel->getDocumentUpdateLog($document_srl); $updatelog = $oDocumentModel->getDocumentUpdateLog($document_srl);
@ -1197,7 +1232,7 @@ class boardView extends board
if($this->grant->update_view !== true) if($this->grant->update_view !== true)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$update_log = $oDocumentModel->getUpdateLog($update_id); $update_log = $oDocumentModel->getUpdateLog($update_id);
@ -1233,7 +1268,7 @@ class boardView extends board
{ {
iF($this->grant->vote_log_view !== true) iF($this->grant->vote_log_view !== true)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$oMemberModel = getModel('member'); $oMemberModel = getModel('member');
@ -1254,7 +1289,7 @@ class boardView extends board
} }
else else
{ {
return new Object(-1, 'msg_not_target'); return $this->setError('msg_not_target');
} }
$output = executeQueryArray($queryId, $args); $output = executeQueryArray($queryId, $args);

View file

@ -75,7 +75,8 @@
<action name="dispBoardContentCommentList" type="view" permission="view" standalone="false" /> <action name="dispBoardContentCommentList" type="view" permission="view" standalone="false" />
<action name="dispBoardContentFileList" type="view" permission="view" standalone="false" /> <action name="dispBoardContentFileList" type="view" permission="view" standalone="false" />
<action name="dispBoardTagList" type="view" permission="list" standalone="false" /> <action name="dispBoardTagList" type="view" permission="list" standalone="false" />
<action name="dispBoardCategory" type="mobile" permission="list" standalone="false" /> <action name="dispBoardCategory" type="view" permission="list" standalone="false" />
<action name="dispBoardCommentPage" type="view" permission="view" standalone="false" />
<action name="getBoardCommentPage" type="mobile" permission="view" standalone="false" /> <action name="getBoardCommentPage" type="mobile" permission="view" standalone="false" />
<action name="procBoardInsertDocument" type="controller" permission="write_document" standalone="false" ruleset="insertDocument" /> <action name="procBoardInsertDocument" type="controller" permission="write_document" standalone="false" ruleset="insertDocument" />

View file

@ -0,0 +1 @@
<include target="_comment.html" />

View file

@ -101,10 +101,9 @@
</div> </div>
<div class="tns"> <div class="tns">
{@ $tag_list = $oDocument->get('tag_list') } {@ $tag_list = $oDocument->get('tag_list') }
<span class="tags" cond="count($tag_list)"> <span class="tags" cond="$tag_list">
<i class="xi-tags"></i> <i class="xi-tags"></i>
<!--@for($i=0;$i<count($tag_list);$i++)--> <!--@foreach($tag_list as $tag)-->
{@ $tag = $tag_list[$i]; }
<a href="{getUrl('search_target','tag','search_keyword',$tag,'document_srl','')}" class="tag" rel="tag">{htmlspecialchars($tag)}</a><span>,</span> <a href="{getUrl('search_target','tag','search_keyword',$tag,'document_srl','')}" class="tag" rel="tag">{htmlspecialchars($tag)}</a><span>,</span>
<!--@end--> <!--@end-->
</span> </span>

View file

@ -0,0 +1 @@
<include target="_comment.html" />

View file

@ -2,9 +2,9 @@
<include cond="$oDocument->isExists()" target="_read.html" /> <include cond="$oDocument->isExists()" target="_read.html" />
<ul class="cTab" cond="$module_info->use_category=='Y'"> <ul class="cTab" cond="$module_info->use_category=='Y'">
<li class="on"|cond="!$category"><a href="{getUrl('category','','page','')}">{$lang->total}</a></li> <li class="on"|cond="!$category"><a href="{getUrl('category','','page','')}">{$lang->total}</a></li>
<li loop="$cate_list=>$key,$val" class="on"|cond="$category==$val->category_srl"><a href="{getUrl(category,$val->category_srl,'document_srl','', 'page', '')}">{$val->title}<!--<em cond="$val->document_count">[{$val->document_count}]</em>--></a> <li loop="$cate_list=>$key,$val" class="on"|cond="$category==$val->category_srl"><a href="{getUrl('category',$val->category_srl,'document_srl','', 'page', '')}">{$val->title}<!--<em cond="$val->document_count">[{$val->document_count}]</em>--></a>
<ul cond="count($val->children)"> <ul cond="count($val->children)">
<li loop="$val->children=>$idx,$item" class="on_"|cond="$category==$item->category_srl"><a href="{getUrl(category,$item->category_srl,'document_srl','', 'page', '')}">{$item->title}<!--<em cond="$val->document_count">[{$item->document_count}]</em>--></a></li> <li loop="$val->children=>$idx,$item" class="on_"|cond="$category==$item->category_srl"><a href="{getUrl('category',$item->category_srl,'document_srl','', 'page', '')}">{$item->title}<!--<em cond="$val->document_count">[{$item->document_count}]</em>--></a></li>
</ul> </ul>
</li> </li>
</ul> </ul>

View file

@ -47,11 +47,7 @@
<div class="x_clearfix"> <div class="x_clearfix">
<form cond="$page_navigation" action="./" class="x_pagination x_pull-left" no-error-return-url="true" style="margin-top:0"> <form cond="$page_navigation" action="./" class="x_pagination x_pull-left" no-error-return-url="true" style="margin-top:0">
{@ <input type="hidden" name="module" value="{$module}" />
$urlInfo = parse_url(getRequestUriByServerEnviroment());
parse_str($urlInfo['query'], $param);
}
<input loop="$param => $key, $val" cond="!in_array($key, array('mid', 'vid', 'act'))" type="hidden" name="{$key}" value="{$val}" />
<ul> <ul>
<li class="x_disabled"|cond="!$page || $page == 1"><a href="{getUrl('page', '')}">&laquo; {$lang->first_page}</a></li> <li class="x_disabled"|cond="!$page || $page == 1"><a href="{getUrl('page', '')}">&laquo; {$lang->first_page}</a></li>
<block cond="$page_navigation->first_page != 1 && $page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page - 1 && $page_navigation->page_count != $page_navigation->total_page"> <block cond="$page_navigation->first_page != 1 && $page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page - 1 && $page_navigation->page_count != $page_navigation->total_page">
@ -87,7 +83,7 @@
</span> </span>
</div> </div>
<form action="" class="search x_input-append center" no-error-return-url="true"> <form action="" class="search x_input-append center" no-error-return-url="true">
<input loop="$param => $key, $val" cond="!in_array($key, array('mid', 'vid', 'act', 'page', 'search_target', 'search_keyword'))" type="hidden" name="{$key}" value="{$val}" /> <input type="hidden" name="module" value="{$module}" />
<select cond="count($module_category)" name="module_category_srl" title="{$lang->module_category}" style="margin-right:4px"> <select cond="count($module_category)" name="module_category_srl" title="{$lang->module_category}" style="margin-right:4px">
<option value="" selected="selected"|cond="!$module_category_srl">{$lang->all}</option> <option value="" selected="selected"|cond="!$module_category_srl">{$lang->all}</option>
<option value="0" selected="selected"|cond="$module_category_srl==='0'">{$lang->not_exists}</option> <option value="0" selected="selected"|cond="$module_category_srl==='0'">{$lang->not_exists}</option>

View file

@ -96,7 +96,7 @@ class commentAdminController extends comment
$comment = $oCommentModel->getComment($comment_srl); $comment = $oCommentModel->getComment($comment_srl);
if($comment->comment_srl != $comment_srl) if($comment->comment_srl != $comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$document_srl = $comment->document_srl; $document_srl = $comment->document_srl;
if(!in_array($document_srl, $updated_documents_arr)) if(!in_array($document_srl, $updated_documents_arr))

View file

@ -33,8 +33,6 @@ class comment extends ModuleObject
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'); $oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
// 2008. 02. 22 add comment setting when a new module added // 2008. 02. 22 add comment setting when a new module added
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
return new Object();
} }
/** /**
@ -194,8 +192,6 @@ class comment extends ModuleObject
{ {
$oDB->addIndex('comments', 'idx_parent_srl', array('parent_srl')); $oDB->addIndex('comments', 'idx_parent_srl', array('parent_srl'));
} }
return new Object(0, 'success_updated');
} }
/** /**

View file

@ -29,13 +29,13 @@ class commentController extends comment
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$comment_srl = Context::get('target_srl'); $comment_srl = Context::get('target_srl');
if(!$comment_srl) if(!$comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$oCommentModel = getModel('comment'); $oCommentModel = getModel('comment');
@ -43,14 +43,14 @@ class commentController extends comment
$module_srl = $oComment->get('module_srl'); $module_srl = $oComment->get('module_srl');
if(!$module_srl) if(!$module_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
if($comment_config->use_vote_up == 'N') if($comment_config->use_vote_up == 'N')
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$point = 1; $point = 1;
@ -61,21 +61,21 @@ class commentController extends comment
function procCommentVoteUpCancel() function procCommentVoteUpCancel()
{ {
if(!Context::get('logged_info')) return new Object(-1, 'msg_invalid_request'); if(!Context::get('logged_info')) return $this->setError('msg_invalid_request');
$comment_srl = Context::get('target_srl'); $comment_srl = Context::get('target_srl');
if(!$comment_srl) return new Object(-1, 'msg_invalid_request'); if(!$comment_srl) return $this->setError('msg_invalid_request');
$oCommentModel = getModel('comment'); $oCommentModel = getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
if($oComment->get('voted_count') <= 0) if($oComment->get('voted_count') <= 0)
{ {
return new Object(-1, 'msg_comment_voted_cancel_not'); return $this->setError('msg_comment_voted_cancel_not');
} }
$point = 1; $point = 1;
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point); $output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
$output = new Object(); $output = new BaseObject();
$output->setMessage('success_voted_canceled'); $output->setMessage('success_voted_canceled');
return $output; return $output;
@ -90,13 +90,13 @@ class commentController extends comment
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$comment_srl = Context::get('target_srl'); $comment_srl = Context::get('target_srl');
if(!$comment_srl) if(!$comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$oCommentModel = getModel('comment'); $oCommentModel = getModel('comment');
@ -104,14 +104,14 @@ class commentController extends comment
$module_srl = $oComment->get('module_srl'); $module_srl = $oComment->get('module_srl');
if(!$module_srl) if(!$module_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl); $comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
if($comment_config->use_vote_down == 'N') if($comment_config->use_vote_down == 'N')
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$point = -1; $point = -1;
@ -122,21 +122,21 @@ class commentController extends comment
function procCommentVoteDownCancel() function procCommentVoteDownCancel()
{ {
if(!Context::get('logged_info')) return new Object(-1, 'msg_invalid_request'); if(!Context::get('logged_info')) return $this->setError('msg_invalid_request');
$comment_srl = Context::get('target_srl'); $comment_srl = Context::get('target_srl');
if(!$comment_srl) return new Object(-1, 'msg_invalid_request'); if(!$comment_srl) return $this->setError('msg_invalid_request');
$oCommentModel = getModel('comment'); $oCommentModel = getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE); $oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
if($oComment->get('blamed_count') >= 0) if($oComment->get('blamed_count') >= 0)
{ {
return new Object(-1, 'msg_comment_blamed_cancel_not'); return $this->setError('msg_comment_blamed_cancel_not');
} }
$point = -1; $point = -1;
$output = $this->updateVotedCountCancel($comment_srl, $oComment, $point); $output = $this->updateVotedCountCancel($comment_srl, $oComment, $point);
$output = new Object(); $output = new BaseObject();
$output->setMessage('success_blamed_canceled'); $output->setMessage('success_blamed_canceled');
return $output; return $output;
@ -193,13 +193,13 @@ class commentController extends comment
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$comment_srl = Context::get('target_srl'); $comment_srl = Context::get('target_srl');
if(!$comment_srl) if(!$comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// if an user select message from options, message would be the option. // if an user select message from options, message would be the option.
@ -226,7 +226,7 @@ class commentController extends comment
$document_srl = $obj->document_srl; $document_srl = $obj->document_srl;
if(!$document_srl) if(!$document_srl)
{ {
return new Object(); return;
} }
return $this->deleteComments($document_srl, $obj); return $this->deleteComments($document_srl, $obj);
@ -241,7 +241,7 @@ class commentController extends comment
$module_srl = $obj->module_srl; $module_srl = $obj->module_srl;
if(!$module_srl) if(!$module_srl)
{ {
return new Object(); return;
} }
$oCommentController = getAdminController('comment'); $oCommentController = getAdminController('comment');
@ -297,7 +297,7 @@ class commentController extends comment
{ {
if(!$manual_inserted && !checkCSRF()) if(!$manual_inserted && !checkCSRF())
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
if(!is_object($obj)) if(!is_object($obj))
@ -345,6 +345,9 @@ class commentController extends comment
} }
$obj->__isupdate = FALSE; $obj->__isupdate = FALSE;
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
unset($obj->manual_member_info);
// call a trigger (before) // call a trigger (before)
$output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj); $output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj);
if(!$output->toBool()) if(!$output->toBool())
@ -356,7 +359,7 @@ class commentController extends comment
$document_srl = $obj->document_srl; $document_srl = $obj->document_srl;
if(!$document_srl) if(!$document_srl)
{ {
return new Object(-1, 'msg_invalid_document'); return new BaseObject(-1, 'msg_invalid_document');
} }
// creat the comment model object // creat the comment model object
@ -377,11 +380,11 @@ class commentController extends comment
if($document_srl != $oDocument->document_srl) if($document_srl != $oDocument->document_srl)
{ {
return new Object(-1, 'msg_invalid_document'); return new BaseObject(-1, 'msg_invalid_document');
} }
if($oDocument->isLocked()) if($oDocument->isLocked())
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
if($obj->homepage) if($obj->homepage)
@ -394,9 +397,9 @@ class commentController extends comment
} }
// input the member's information if logged-in // input the member's information if logged-in
if(Context::get('is_logged')) $logged_info = Context::get('logged_info');
if(Context::get('is_logged') && !$obj->manual_member_info)
{ {
$logged_info = Context::get('logged_info');
$obj->member_srl = $logged_info->member_srl; $obj->member_srl = $logged_info->member_srl;
// user_id, user_name and nick_name already encoded // user_id, user_name and nick_name already encoded
@ -411,7 +414,7 @@ class commentController extends comment
// error display if neither of log-in info and user name exist. // error display if neither of log-in info and user name exist.
if(!$logged_info->member_srl && !$obj->nick_name) if(!$logged_info->member_srl && !$obj->nick_name)
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
if(!$obj->comment_srl) if(!$obj->comment_srl)
@ -420,7 +423,7 @@ class commentController extends comment
} }
elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl)) elseif(!$is_admin && !$manual_inserted && !checkUserSequence($obj->comment_srl))
{ {
return new Object(-1, 'msg_not_permitted'); return new BaseObject(-1, 'msg_not_permitted');
} }
// determine the order // determine the order
@ -432,7 +435,7 @@ class commentController extends comment
// Return error if content is empty. // Return error if content is empty.
if (!$manual_inserted && is_empty_html_content($obj->content)) if (!$manual_inserted && is_empty_html_content($obj->content))
{ {
return new Object(-1, 'msg_empty_content'); return new BaseObject(-1, 'msg_empty_content');
} }
// if use editor of nohtml, Remove HTML tags from the contents. // if use editor of nohtml, Remove HTML tags from the contents.
@ -697,7 +700,7 @@ class commentController extends comment
{ {
if(!$manual_updated && !checkCSRF()) if(!$manual_updated && !checkCSRF())
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
if(!is_object($obj)) if(!is_object($obj))
@ -707,6 +710,9 @@ class commentController extends comment
$obj->__isupdate = TRUE; $obj->__isupdate = TRUE;
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
unset($obj->manual_member_info);
// call a trigger (before) // call a trigger (before)
$output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj); $output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj);
if(!$output->toBool()) if(!$output->toBool())
@ -731,7 +737,7 @@ class commentController extends comment
// check if permission is granted // check if permission is granted
if(!$is_admin && !$source_obj->isGranted()) if(!$is_admin && !$source_obj->isGranted())
{ {
return new Object(-1, 'msg_not_permitted'); return new BaseObject(-1, 'msg_not_permitted');
} }
if($obj->password) if($obj->password)
@ -750,7 +756,7 @@ class commentController extends comment
// set modifier's information if logged-in and posting author and modifier are matched. // set modifier's information if logged-in and posting author and modifier are matched.
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
if(Context::get('is_logged')) if(Context::get('is_logged') && !$obj->manual_member_info)
{ {
if($source_obj->member_srl == $logged_info->member_srl) if($source_obj->member_srl == $logged_info->member_srl)
{ {
@ -763,7 +769,7 @@ class commentController extends comment
} }
// if nick_name of the logged-in author doesn't exist // if nick_name of the logged-in author doesn't exist
if($source_obj->get('member_srl') && !$obj->nick_name) if($source_obj->get('member_srl') && !$obj->nick_name && !$obj->manual_member_info)
{ {
$obj->member_srl = $source_obj->get('member_srl'); $obj->member_srl = $source_obj->get('member_srl');
$obj->user_name = $source_obj->get('user_name'); $obj->user_name = $source_obj->get('user_name');
@ -782,7 +788,7 @@ class commentController extends comment
// Return error if content is empty. // Return error if content is empty.
if (!$manual_inserted && is_empty_html_content($obj->content)) if (!$manual_inserted && is_empty_html_content($obj->content))
{ {
return new Object(-1, 'msg_empty_content'); return new BaseObject(-1, 'msg_empty_content');
} }
// if use editor of nohtml, Remove HTML tags from the contents. // if use editor of nohtml, Remove HTML tags from the contents.
@ -831,7 +837,7 @@ class commentController extends comment
{ {
if (!$obj->comment_srl) if (!$obj->comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
// call a trigger (before) // call a trigger (before)
@ -898,7 +904,7 @@ class commentController extends comment
{ {
if (!$obj->comment_srl) if (!$obj->comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
// begin transaction // begin transaction
@ -957,7 +963,7 @@ class commentController extends comment
$comment = $oCommentModel->getComment($comment_srl); $comment = $oCommentModel->getComment($comment_srl);
if($comment->comment_srl != $comment_srl) if($comment->comment_srl != $comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
$oMemberModel = getModel('member'); $oMemberModel = getModel('member');
@ -975,7 +981,7 @@ class commentController extends comment
// check if permission is granted // check if permission is granted
if(!$is_admin && !$comment->isGranted()) if(!$is_admin && !$comment->isGranted())
{ {
return new Object(-1, 'msg_not_permitted'); return new BaseObject(-1, 'msg_not_permitted');
} }
// check if child comment exists on the comment // check if child comment exists on the comment
@ -1015,11 +1021,11 @@ class commentController extends comment
if(!$deleteAllComment) if(!$deleteAllComment)
{ {
return new Object(-1, 'fail_to_delete_have_children'); return new BaseObject(-1, 'fail_to_delete_have_children');
} }
elseif(!$deleteAdminComment) elseif(!$deleteAdminComment)
{ {
return new Object(-1, 'msg_admin_c_comment_no_delete'); return new BaseObject(-1, 'msg_admin_c_comment_no_delete');
} }
else else
{ {
@ -1036,7 +1042,7 @@ class commentController extends comment
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_admin_comment_no_delete'); return new BaseObject(-1, 'msg_admin_comment_no_delete');
} }
// begin transaction // begin transaction
$oDB = DB::getInstance(); $oDB = DB::getInstance();
@ -1126,7 +1132,7 @@ class commentController extends comment
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oComment->get('member_srl')); $member_info = $oMemberModel->getMemberInfoByMemberSrl($oComment->get('member_srl'));
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_admin_comment_no_move_to_trash'); return new BaseObject(-1, 'msg_admin_comment_no_move_to_trash');
} }
$trash_args->module_srl = $oComment->variables['module_srl']; $trash_args->module_srl = $oComment->variables['module_srl'];
@ -1134,7 +1140,7 @@ class commentController extends comment
if($trash_args->module_srl === 0) if($trash_args->module_srl === 0)
{ {
return new Object(-1, 'msg_module_srl_not_exists'); return new BaseObject(-1, 'msg_module_srl_not_exists');
} }
$trash_args->document_srl = $obj->document_srl; $trash_args->document_srl = $obj->document_srl;
$trash_args->comment_srl = $obj->comment_srl; $trash_args->comment_srl = $obj->comment_srl;
@ -1226,7 +1232,7 @@ class commentController extends comment
{ {
$this->_deleteDeclaredComments($args); $this->_deleteDeclaredComments($args);
$this->_deleteVotedComments($args); $this->_deleteVotedComments($args);
return new Object(0, 'success'); return new BaseObject(0, 'success');
} }
/** /**
@ -1253,7 +1259,7 @@ class commentController extends comment
if(!$oDocument->isExists() || !$oDocument->isGranted()) if(!$oDocument->isExists() || !$oDocument->isGranted())
{ {
return new Object(-1, 'msg_not_permitted'); return new BaseObject(-1, 'msg_not_permitted');
} }
// get a list of comments and then execute a trigger(way to reduce the processing cost for delete all) // get a list of comments and then execute a trigger(way to reduce the processing cost for delete all)
@ -1345,7 +1351,7 @@ class commentController extends comment
// invalid vote if vote info exists in the session info. // invalid vote if vote info exists in the session info.
if($_SESSION['voted_comment'][$comment_srl]) if($_SESSION['voted_comment'][$comment_srl])
{ {
return new Object(-1, $failed_voted); return new BaseObject(-1, $failed_voted);
} }
$oCommentModel = getModel('comment'); $oCommentModel = getModel('comment');
@ -1355,7 +1361,7 @@ class commentController extends comment
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
{ {
$_SESSION['voted_comment'][$comment_srl] = false; $_SESSION['voted_comment'][$comment_srl] = false;
return new Object(-1, $failed_voted); return new BaseObject(-1, $failed_voted);
} }
// if the comment author is a member // if the comment author is a member
@ -1369,7 +1375,7 @@ class commentController extends comment
if($member_srl && $member_srl == abs($oComment->get('member_srl'))) if($member_srl && $member_srl == abs($oComment->get('member_srl')))
{ {
$_SESSION['voted_comment'][$comment_srl] = false; $_SESSION['voted_comment'][$comment_srl] = false;
return new Object(-1, $failed_voted); return new BaseObject(-1, $failed_voted);
} }
} }
@ -1392,7 +1398,7 @@ class commentController extends comment
if($output->data->count) if($output->data->count)
{ {
$_SESSION['voted_comment'][$comment_srl] = false; $_SESSION['voted_comment'][$comment_srl] = false;
return new Object(-1, $failed_voted); return new BaseObject(-1, $failed_voted);
} }
// begin transaction // begin transaction
@ -1431,7 +1437,7 @@ class commentController extends comment
$oDB->commit(); $oDB->commit();
// Return the result // Return the result
$output = new Object(0, $success_message); $output = new BaseObject(0, $success_message);
if($point > 0) if($point > 0)
{ {
$output->add('voted_count', $obj->after_point); $output->add('voted_count', $obj->after_point);
@ -1455,7 +1461,7 @@ class commentController extends comment
// Fail if session information already has a reported document // Fail if session information already has a reported document
if($_SESSION['declared_comment'][$comment_srl]) if($_SESSION['declared_comment'][$comment_srl])
{ {
return new Object(-1, 'failed_declared'); return new BaseObject(-1, 'failed_declared');
} }
// check if already reported // check if already reported
@ -1490,7 +1496,7 @@ class commentController extends comment
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
{ {
$_SESSION['declared_comment'][$comment_srl] = TRUE; $_SESSION['declared_comment'][$comment_srl] = TRUE;
return new Object(-1, 'failed_declared'); return new BaseObject(-1, 'failed_declared');
} }
// if the comment author is a member // if the comment author is a member
@ -1504,7 +1510,7 @@ class commentController extends comment
if($member_srl && $member_srl == abs($oComment->get('member_srl'))) if($member_srl && $member_srl == abs($oComment->get('member_srl')))
{ {
$_SESSION['declared_comment'][$comment_srl] = TRUE; $_SESSION['declared_comment'][$comment_srl] = TRUE;
return new Object(-1, 'failed_declared'); return new BaseObject(-1, 'failed_declared');
} }
} }
@ -1526,7 +1532,7 @@ class commentController extends comment
if($log_output->data->count) if($log_output->data->count)
{ {
$_SESSION['declared_comment'][$comment_srl] = TRUE; $_SESSION['declared_comment'][$comment_srl] = TRUE;
return new Object(-1, 'failed_declared'); return new BaseObject(-1, 'failed_declared');
} }
// begin transaction // begin transaction
@ -1616,13 +1622,13 @@ class commentController extends comment
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
if (!$module_info->module_srl) if (!$module_info->module_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$module_grant = $oModuleModel->getGrant($module_info, $logged_info); $module_grant = $oModuleModel->getGrant($module_info, $logged_info);
if (!$module_grant->manager) if (!$module_grant->manager)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$module_srl[] = $srl; $module_srl[] = $srl;
@ -1675,7 +1681,7 @@ class commentController extends comment
{ {
$oModuleController = getController('module'); $oModuleController = getController('module');
$oModuleController->insertModulePartConfig('comment', $srl, $comment_config); $oModuleController->insertModulePartConfig('comment', $srl, $comment_config);
return new Object(); return new BaseObject();
} }
/** /**
@ -1686,7 +1692,7 @@ class commentController extends comment
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$commentSrls = Context::get('comment_srls'); $commentSrls = Context::get('comment_srls');

View file

@ -9,7 +9,7 @@
* @package /modules/comment * @package /modules/comment
* @version 0.1 * @version 0.1
*/ */
class commentItem extends Object class commentItem extends BaseObject
{ {
/** /**
@ -77,7 +77,7 @@ class commentItem extends Object
$this->adds($attribute); $this->adds($attribute);
// define vars on the object for backward compatibility of skins // define vars on the object for backward compatibility of skins
if(count($attribute)) if(countobj($attribute))
{ {
foreach($attribute as $key => $val) foreach($attribute as $key => $val)
{ {

View file

@ -512,6 +512,13 @@ class commentModel extends comment
$args->status = 1; $args->status = 1;
} }
// call trigger (before)
$trigger_output = ModuleHandler::triggerCall('comment.getCommentList', 'before', $args);
if($trigger_output instanceof BaseObject && !$trigger_output->toBool())
{
return $output;
}
$output = executeQueryArray('comment.getCommentPageList', $args); $output = executeQueryArray('comment.getCommentPageList', $args);
// return if an error occurs in the query results // return if an error occurs in the query results
@ -531,6 +538,13 @@ class commentModel extends comment
} }
} }
// call trigger (after)
$trigger_output = ModuleHandler::triggerCall('comment.getCommentList', 'after', $output);
if($trigger_output instanceof BaseObject && !$trigger_output->toBool())
{
return $trigger_output;
}
return $output; return $output;
} }
@ -962,7 +976,7 @@ class commentModel extends comment
$comment_srl = Context::get('comment_srl'); $comment_srl = Context::get('comment_srl');
if(!$comment_srl) if(!$comment_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$point = Context::get('point'); $point = Context::get('point');
@ -976,7 +990,7 @@ class commentModel extends comment
$module_srl = $oComment->get('module_srl'); $module_srl = $oComment->get('module_srl');
if(!$module_srl) if(!$module_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
@ -988,7 +1002,7 @@ class commentModel extends comment
{ {
if($comment_config->use_vote_down != 'S') if($comment_config->use_vote_down != 'S')
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$args->below_point = 0; $args->below_point = 0;
@ -997,7 +1011,7 @@ class commentModel extends comment
{ {
if($comment_config->use_vote_up != 'S') if($comment_config->use_vote_up != 'S')
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$args->more_point = 0; $args->more_point = 0;

View file

@ -38,7 +38,7 @@ class commentView extends comment
$current_module_srl = $current_module_info->module_srl; $current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) if(!$current_module_srl)
{ {
return new Object(); return new BaseObject();
} }
} }
@ -57,7 +57,7 @@ class commentView extends comment
$tpl = $oTemplate->compile($this->module_path . 'tpl', 'comment_module_config'); $tpl = $oTemplate->compile($this->module_path . 'tpl', 'comment_module_config');
$obj .= $tpl; $obj .= $tpl;
return new Object(); return new BaseObject();
} }
/** /**
@ -82,12 +82,12 @@ class commentView extends comment
$oComment = $oCommentModel->getComment($comment_srl); $oComment = $oCommentModel->getComment($comment_srl);
if(!$oComment->isExists()) if(!$oComment->isExists())
{ {
return new Object(-1,'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// Check permissions // Check permissions
if(!$oComment->isAccessible()) if(!$oComment->isAccessible())
{ {
return new Object(-1,'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
// Browser title settings // Browser title settings

View file

@ -30,8 +30,6 @@ class communication extends ModuleObject
// Create a temporary file storage for one new private message notification // Create a temporary file storage for one new private message notification
FileHandler::makeDir('./files/member_extra_info/new_message_flags'); FileHandler::makeDir('./files/member_extra_info/new_message_flags');
return new Object();
} }
/** /**
@ -96,8 +94,6 @@ class communication extends ModuleObject
{ {
FileHandler::makeDir('./files/member_extra_info/new_message_flags'); FileHandler::makeDir('./files/member_extra_info/new_message_flags');
} }
return new Object(0, 'success_updated');
} }
/** /**

View file

@ -24,7 +24,7 @@ class communicationController extends communication
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$args = new stdClass(); $args = new stdClass();
@ -54,7 +54,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -63,19 +63,19 @@ class communicationController extends communication
$receiver_srl = Context::get('receiver_srl'); $receiver_srl = Context::get('receiver_srl');
if(!$receiver_srl) if(!$receiver_srl)
{ {
return new Object(-1, 'msg_not_exists_member'); return $this->setError('msg_not_exists_member');
} }
$title = trim(Context::get('title')); $title = trim(Context::get('title'));
if(!$title) if(!$title)
{ {
return new Object(-1, 'msg_title_is_null'); return $this->setError('msg_title_is_null');
} }
$content = trim(Context::get('content')); $content = trim(Context::get('content'));
if(!$content) if(!$content)
{ {
return new Object(-1, 'msg_content_is_null'); return $this->setError('msg_content_is_null');
} }
$send_mail = Context::get('send_mail'); $send_mail = Context::get('send_mail');
@ -91,13 +91,13 @@ class communicationController extends communication
if(!$oCommunicationModel->checkGrant($config->grant_send)) if(!$oCommunicationModel->checkGrant($config->grant_send))
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl); $receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
if($receiver_member_info->member_srl != $receiver_srl) if($receiver_member_info->member_srl != $receiver_srl)
{ {
return new Object(-1, 'msg_not_exists_member'); return $this->setError('msg_not_exists_member');
} }
// check whether to allow to receive the message(pass if a top-administrator) // check whether to allow to receive the message(pass if a top-administrator)
@ -107,12 +107,12 @@ class communicationController extends communication
{ {
if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl))
{ {
return new object(-1, 'msg_allow_message_to_friend'); return $this->setError('msg_allow_message_to_friend');
} }
} }
else if($receiver_member_info->allow_message == 'N') else if($receiver_member_info->allow_message == 'N')
{ {
return new object(-1, 'msg_disallow_message'); return $this->setError('msg_disallow_message');
} }
} }
@ -257,7 +257,7 @@ class communicationController extends communication
// create a flag that message is sent (in file format) // create a flag that message is sent (in file format)
$this->updateFlagFile($receiver_srl); $this->updateFlagFile($receiver_srl);
return new Object(0, 'success_sended'); return new BaseObject(0, 'success_sended');
} }
/** /**
@ -269,7 +269,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -277,7 +277,7 @@ class communicationController extends communication
$message_srl = Context::get('message_srl'); $message_srl = Context::get('message_srl');
if(!$message_srl) if(!$message_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// get the message // get the message
@ -285,7 +285,7 @@ class communicationController extends communication
$message = $oCommunicationModel->getSelectedMessage($message_srl); $message = $oCommunicationModel->getSelectedMessage($message_srl);
if(!$message || $message->message_type != 'R') if(!$message || $message->message_type != 'R')
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$args = new stdClass(); $args = new stdClass();
@ -309,7 +309,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -319,7 +319,7 @@ class communicationController extends communication
$message_srl = Context::get('message_srl'); $message_srl = Context::get('message_srl');
if(!$message_srl) if(!$message_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// Get the message // Get the message
@ -327,7 +327,7 @@ class communicationController extends communication
$message = $oCommunicationModel->getSelectedMessage($message_srl); $message = $oCommunicationModel->getSelectedMessage($message_srl);
if(!$message) if(!$message)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// Check the grant // Check the grant
@ -336,14 +336,14 @@ class communicationController extends communication
case 'S': case 'S':
if($message->sender_srl != $member_srl) if($message->sender_srl != $member_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
break; break;
case 'R': case 'R':
if($message->receiver_srl != $member_srl) if($message->receiver_srl != $member_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
break; break;
} }
@ -369,7 +369,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -378,7 +378,7 @@ class communicationController extends communication
// check variables // check variables
if(!Context::get('message_srl_list')) if(!Context::get('message_srl_list'))
{ {
return new Object(-1, 'msg_cart_is_null'); return $this->setError('msg_cart_is_null');
} }
$message_srl_list = Context::get('message_srl_list'); $message_srl_list = Context::get('message_srl_list');
@ -389,13 +389,13 @@ class communicationController extends communication
if(!count($message_srl_list)) if(!count($message_srl_list))
{ {
return new Object(-1, 'msg_cart_is_null'); return $this->setError('msg_cart_is_null');
} }
$message_type = Context::get('message_type'); $message_type = Context::get('message_type');
if(!$message_type || !in_array($message_type, array('R', 'S', 'T'))) if(!$message_type || !in_array($message_type, array('R', 'S', 'T')))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$message_count = count($message_srl_list); $message_count = count($message_srl_list);
@ -412,7 +412,7 @@ class communicationController extends communication
} }
if(!count($target)) if(!count($target))
{ {
return new Object(-1, 'msg_cart_is_null'); return $this->setError('msg_cart_is_null');
} }
// Delete // Delete
@ -450,7 +450,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -458,11 +458,11 @@ class communicationController extends communication
$target_srl = (int) trim(Context::get('target_srl')); $target_srl = (int) trim(Context::get('target_srl'));
if(!$target_srl) if(!$target_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
if($target_srl == $logged_info->member_srl) if($target_srl == $logged_info->member_srl)
{ {
return new Object(-1, 'msg_no_self_friend'); return $this->setError('msg_no_self_friend');
} }
// Check duplicate friend // Check duplicate friend
@ -472,7 +472,7 @@ class communicationController extends communication
$output = executeQuery('communication.isAddedFriend', $args); $output = executeQuery('communication.isAddedFriend', $args);
if($output->data->count) if($output->data->count)
{ {
return new Object(-1, 'msg_already_friend'); return $this->setError('msg_already_friend');
} }
// Variable // Variable
@ -512,7 +512,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -521,7 +521,7 @@ class communicationController extends communication
$friend_srl_list = Context::get('friend_srl_list'); $friend_srl_list = Context::get('friend_srl_list');
if(!$friend_srl_list) if(!$friend_srl_list)
{ {
return new Object(-1, 'msg_cart_is_null'); return $this->setError('msg_cart_is_null');
} }
if(!is_array($friend_srl_list)) if(!is_array($friend_srl_list))
@ -531,7 +531,7 @@ class communicationController extends communication
if(!count($friend_srl_list)) if(!count($friend_srl_list))
{ {
return new Object(-1, 'msg_cart_is_null'); return $this->setError('msg_cart_is_null');
} }
$friend_count = count($friend_srl_list); $friend_count = count($friend_srl_list);
@ -549,7 +549,7 @@ class communicationController extends communication
if(!count($target)) if(!count($target))
{ {
return new Object(-1, 'msg_cart_is_null'); return $this->setError('msg_cart_is_null');
} }
// Variables // Variables
@ -579,7 +579,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -595,7 +595,7 @@ class communicationController extends communication
if(!count($friend_srl_list)) if(!count($friend_srl_list))
{ {
return new Object(-1, 'msg_cart_is_null'); return $this->setError('msg_cart_is_null');
} }
$friend_count = count($friend_srl_list); $friend_count = count($friend_srl_list);
@ -614,7 +614,7 @@ class communicationController extends communication
if(!count($target)) if(!count($target))
{ {
return new Object(-1, 'msg_cart_is_null'); return $this->setError('msg_cart_is_null');
} }
// Delete // Delete
@ -642,7 +642,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -656,7 +656,7 @@ class communicationController extends communication
if(!$args->title) if(!$args->title)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// modify if friend_group_srl exists. // modify if friend_group_srl exists.
@ -718,7 +718,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -732,7 +732,7 @@ class communicationController extends communication
if(!$args->title) if(!$args->title)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$output = executeQuery('communication.renameFriendGroup', $args); $output = executeQuery('communication.renameFriendGroup', $args);
@ -753,7 +753,7 @@ class communicationController extends communication
// Check login information // Check login information
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -831,7 +831,7 @@ class communicationController extends communication
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(); return;
} }
$oCommunicationModel = getModel('communication'); $oCommunicationModel = getModel('communication');
@ -839,11 +839,11 @@ class communicationController extends communication
if($config->enable_message == 'N' && $config->enable_friend == 'N') if($config->enable_message == 'N' && $config->enable_friend == 'N')
{ {
return new Object(); return;
} }
if(!$oCommunicationModel->checkGrant($config->grant_send)) if(!$oCommunicationModel->checkGrant($config->grant_send))
{ {
return new Object(); return;
} }
$mid = Context::get('cur_mid'); $mid = Context::get('cur_mid');
@ -874,7 +874,7 @@ class communicationController extends communication
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
if(!$target_member_info->member_srl) if(!$target_member_info->member_srl)
{ {
return new Object(); return;
} }
// Add a menu for sending message // Add a menu for sending message

View file

@ -1,8 +1,6 @@
<?php <?php
/* Copyright (C) NAVER <http://www.navercorp.com> */ /* Copyright (C) NAVER <http://www.navercorp.com> */
require_once(_XE_PATH_ . 'modules/communication/communication.view.php');
/** /**
* @class communicationMobile * @class communicationMobile
* @author NAVER (developers@xpressengine.com) * @author NAVER (developers@xpressengine.com)
@ -32,100 +30,6 @@ class communicationMobile extends communicationView
} }
} }
/**
* Display message box
* @return Object (void : success, Object : fail)
*/
function dispCommunicationMessages()
{
// Error appears if not logged-in
if(!Context::get('is_logged'))
{
return new Object(-1,'msg_not_logged');
}
$logged_info = Context::get('logged_info');
if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list))
{
return new Object(-1,'msg_invalid_request');
}
// Set the variables
$message_srl = Context::get('message_srl');
$message_type = Context::get('message_type');
if(!in_array($message_type, array('R', 'S', 'T', 'N')))
{
$message_type = 'R';
Context::set('message_type', $message_type);
}
$oCommunicationModel = getModel('communication');
// extract contents if message_srl exists
if($message_srl)
{
$templateFile = 'read_message';
$columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate');
$message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList);
switch($message->message_type)
{
case 'R':
if($message->receiver_srl != $logged_info->member_srl)
{
return $this->stop('msg_invalid_request');
}
break;
case 'S':
if($message->sender_srl != $logged_info->member_srl)
{
return $this->stop('msg_invalid_request');
}
break;
case 'T':
if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
{
return $this->stop('msg_invalid_request');
}
break;
case 'N':
if($message->receiver_srl != $logged_info->member_srl)
{
return new Object(-1, 'msg_invalid_request');
}
break;
}
if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl))
{
stripEmbedTagForAdmin($message->content, $message->sender_srl);
Context::set('message', $message);
}
}
else
{
$templateFile = 'messages';
}
// Extract a list
$columnList = array('message_srl', 'readed', 'title', 'member.member_srl', 'member.nick_name', 'message.regdate', 'readed_date');
$output = $oCommunicationModel->getMessages($message_type, $columnList);
// set a template file
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('message_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
$oSecurity = new Security();
$oSecurity->encodeHTML('message_list..nick_name');
$this->setTemplateFile($templateFile);
}
/** /**
* Display list of message box * Display list of message box
* @return void * @return void
@ -134,64 +38,6 @@ class communicationMobile extends communicationView
{ {
$this->setTemplateFile('message_box'); $this->setTemplateFile('message_box');
} }
/**
* Display message sending
* @return void|Object (void : success, Object : fail)
*/
function dispCommunicationSendMessage()
{
$oCommunicationModel = getModel('communication');
$oMemberModel = getModel('member');
// Error appears if not logged-in
if(!Context::get('is_logged'))
{
return $this->stop('msg_not_logged');
}
$logged_info = Context::get('logged_info');
// get receipient's information
// check inalid request
$receiver_srl = Context::get('receiver_srl');
if(!$receiver_srl)
{
return $this->stop('msg_invalid_request');
}
// check receiver and sender are same
if($logged_info->member_srl == $receiver_srl)
{
return $this->stop('msg_cannot_send_to_yourself');
}
// get message_srl of the original message if it is a reply
$message_srl = Context::get('message_srl');
if($message_srl)
{
$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
if($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl)
{
if(strncasecmp('[re]', $source_message->title, 4) !== 0)
{
$source_message->title = '[re] ' . $source_message->title;
}
$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">" . trim($source_message->content) . "</div>";
Context::set('source_message', $source_message);
}
}
$receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
if(!$receiver_info)
{
return $this->stop('msg_invalid_request');
}
Context::set('receiver_info', $receiver_info);
$this->setTemplateFile('send_message');
}
} }
/* End of file communication.mobile.php */ /* End of file communication.mobile.php */
/* Location: ./modules/comment/communication.mobile.php */ /* Location: ./modules/comment/communication.mobile.php */

View file

@ -52,13 +52,13 @@ class communicationView extends communication
{ {
if($this->config->enable_message == 'N') if($this->config->enable_message == 'N')
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// Error appears if not logged-in // Error appears if not logged-in
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -73,9 +73,9 @@ class communicationView extends communication
Context::set('message_type', $message_type); Context::set('message_type', $message_type);
} }
$oCommunicationModel = getModel('communication');
// extract contents if message_srl exists // extract contents if message_srl exists
$oCommunicationModel = getModel('communication');
$template_filename = 'messages';
if($message_srl) if($message_srl)
{ {
$columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate'); $columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate');
@ -86,28 +86,28 @@ class communicationView extends communication
case 'R': case 'R':
if($message->receiver_srl != $logged_info->member_srl) if($message->receiver_srl != $logged_info->member_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
break; break;
case 'S': case 'S':
if($message->sender_srl != $logged_info->member_srl) if($message->sender_srl != $logged_info->member_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
break; break;
case 'T': case 'T':
if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl) if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
break; break;
case 'N': case 'N':
if($message->receiver_srl != $logged_info->member_srl) if($message->receiver_srl != $logged_info->member_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
break; break;
} }
@ -116,6 +116,10 @@ class communicationView extends communication
{ {
stripEmbedTagForAdmin($message->content, $message->sender_srl); stripEmbedTagForAdmin($message->content, $message->sender_srl);
Context::set('message', $message); Context::set('message', $message);
if(Context::get('m'))
{
$template_filename = 'read_message';
}
} }
} }
@ -133,7 +137,7 @@ class communicationView extends communication
$oSecurity = new Security(); $oSecurity = new Security();
$oSecurity->encodeHTML('message_list..nick_name'); $oSecurity->encodeHTML('message_list..nick_name');
$this->setTemplateFile('messages'); $this->setTemplateFile($template_filename);
} }
/** /**
@ -178,8 +182,11 @@ class communicationView extends communication
*/ */
function dispCommunicationSendMessage() function dispCommunicationSendMessage()
{ {
$this->setLayoutPath('./common/tpl/'); if(!Context::get('m'))
$this->setLayoutFile("popup_layout"); {
$this->setLayoutPath('./common/tpl/');
$this->setLayoutFile("popup_layout");
}
if($this->config->enable_message == 'N') if($this->config->enable_message == 'N')
{ {
@ -253,6 +260,7 @@ class communicationView extends communication
$option->height = 300; $option->height = 300;
$option->skin = $this->config->editor_skin; $option->skin = $this->config->editor_skin;
$option->colorset = $this->config->editor_colorset; $option->colorset = $this->config->editor_colorset;
$option->editor_focus = Context::get('source_message') ? 'Y' : 'N';
$editor = $oEditorModel->getEditor($logged_info->member_srl, $option); $editor = $oEditorModel->getEditor($logged_info->member_srl, $option);
Context::set('editor', $editor); Context::set('editor', $editor);

View file

@ -43,3 +43,7 @@ $lang->cmd_manage_base = '기본 정보';
$lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?'; $lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?';
$lang->enable_communication_friend = '친구기능 사용'; $lang->enable_communication_friend = '친구기능 사용';
$lang->enable_communication_message = '쪽지기능 사용'; $lang->enable_communication_message = '쪽지기능 사용';
$lang->warning = '알려드립니다!';
$lang->msg_allow_message_friend = '현재 회원님은 친구에게만 수신 가능한 상태입니다.';
$lang->msg_allow_meesage_Block = '현재 회원님은 수신거부 상태입니다.';
$lang->msg_allow_message_please = '전송하는 쪽지에 대한 답변을 받기 위해서는 모두에게 전송을 허용해야합니다.';

View file

@ -126,3 +126,22 @@ input[type=radio]{width:13px;height:13px;margin:0;padding:0}
.sh select{width:80px;font-size:14px;margin:0 0 5px 0} .sh select{width:80px;font-size:14px;margin:0 0 5px 0}
.sh input[type=text]{width:160px;margin:0;font-size:14px;padding:5px} .sh input[type=text]{width:160px;margin:0;font-size:14px;padding:5px}
.sh .shbn{width:28px;height:28px;border:1px solid #666;background:#777 url(../img/mx.png) no-repeat 5px -60px;box-shadow:0 0 1px #fff inset;-moz-box-shadow:0 0 1px #fff inset;-webkit-box-shadow:0 0 1px #fff inset;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;cursor:pointer} .sh .shbn{width:28px;height:28px;border:1px solid #666;background:#777 url(../img/mx.png) no-repeat 5px -60px;box-shadow:0 0 1px #fff inset;-moz-box-shadow:0 0 1px #fff inset;-webkit-box-shadow:0 0 1px #fff inset;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;cursor:pointer}
/**
* warning label from modules\admin\tpl\css\admin.bootstrap.css
*/
.warning_label{
display:inline-block;
margin-top:10px;
padding:2px 4px;
font-size:11.844px;
font-weight:bold;
line-height:14px;
color:#ffffff;
text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
box-sizing:border-box;
}
.warning_label-important{background-color:#b94a48}

View file

@ -7,6 +7,16 @@
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/m.skins/default/send_message/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}"> <div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/m.skins/default/send_message/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p> <p>{$XE_VALIDATOR_MESSAGE}</p>
</div> </div>
<div class="warning_label warning_label-important" cond="$logged_info->allow_message !== 'Y'">
{$lang->warning}
<br>
<!--@if($logged_info->allow_message == 'F')-->
{$lang->msg_allow_message_friend}
<!--@elseif($logged_info->allow_message == 'N')-->
{$lang->msg_allow_meesage_Block}
<!--@end-->
<br>{$lang->msg_allow_message_please}
</div>
<form ruleset="sendMessage" action="./" method="post" class="ff" id="fo_comm"> <form ruleset="sendMessage" action="./" method="post" class="ff" id="fo_comm">
<input type="hidden" name="module" value="communication" /> <input type="hidden" name="module" value="communication" />
<input type="hidden" name="is_popup" value="Y" /> <input type="hidden" name="is_popup" value="Y" />

View file

@ -465,3 +465,21 @@ script, style
} }
} }
/**
* warning label from modules\admin\tpl\css\admin.bootstrap.css
*/
.warning_label{
display:inline-block;
margin:5px 15px !important;
padding:2px 4px;
font-size:11.844px;
font-weight:bold;
line-height:14px;
color:#ffffff;
text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);
-webkit-border-radius:3px;
-moz-border-radius:3px;
border-radius:3px;
box-sizing:border-box;
}
.warning_label-important{background-color:#b94a48}

View file

@ -6,6 +6,16 @@
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/skins/rx_prn/send_message/1'" class="rx_prn-notice {$XE_VALIDATOR_MESSAGE_TYPE}"> <div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/skins/rx_prn/send_message/1'" class="rx_prn-notice {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p> <p>{$XE_VALIDATOR_MESSAGE}</p>
</div> </div>
<div class="warning_label warning_label-important" cond="$logged_info->allow_message !== 'Y'">
{$lang->warning}
<br>
<!--@if($logged_info->allow_message == 'F')-->
{$lang->msg_allow_message_friend}
<!--@elseif($logged_info->allow_message == 'N')-->
{$lang->msg_allow_meesage_Block}
<!--@end-->
<br>{$lang->msg_allow_message_please}
</div>
<form ruleset="sendMessage" action="./" method="post"> <form ruleset="sendMessage" action="./" method="post">
<input type="hidden" name="module" value="communication" /> <input type="hidden" name="module" value="communication" />
<input type="hidden" name="act" value="procCommunicationSendMessage" /> <input type="hidden" name="act" value="procCommunicationSendMessage" />

View file

@ -5,6 +5,16 @@
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/skins/default/send_message/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}"> <div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/skins/default/send_message/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p> <p>{$XE_VALIDATOR_MESSAGE}</p>
</div> </div>
<div class="x_label x_label-important" cond="$logged_info->allow_message !== 'Y'">
{$lang->warning}
<br>
<!--@if($logged_info->allow_message == 'F')-->
{$lang->msg_allow_message_friend}
<!--@elseif($logged_info->allow_message == 'N')-->
{$lang->msg_allow_meesage_Block}
<!--@end-->
<br>{$lang->msg_allow_message_please}
</div>
<form ruleset="sendMessage" action="./" method="post"> <form ruleset="sendMessage" action="./" method="post">
<input type="hidden" name="module" value="communication" /> <input type="hidden" name="module" value="communication" />
<input type="hidden" name="act" value="procCommunicationSendMessage" /> <input type="hidden" name="act" value="procCommunicationSendMessage" />

View file

@ -18,6 +18,16 @@
<input type="text" name="title" id="message_title" value="{$source_message->title}" /> <input type="text" name="title" id="message_title" value="{$source_message->title}" />
<label for="message_send_mail"><input type="checkbox" value="Y" name="send_mail" id="message_send_mail" /> {$lang->cmd_send_mail}</label> <label for="message_send_mail"><input type="checkbox" value="Y" name="send_mail" id="message_send_mail" /> {$lang->cmd_send_mail}</label>
<div class="rx_member-notice info">{$lang->msg_send_mail_privacy}</div> <div class="rx_member-notice info">{$lang->msg_send_mail_privacy}</div>
<div class="rx_member-notice info" cond="$logged_info->allow_message !== 'Y'">
{$lang->warning}
<br>
<!--@if($logged_info->allow_message == 'F')-->
{$lang->msg_allow_message_friend}
<!--@elseif($logged_info->allow_message == 'N')-->
{$lang->msg_allow_meesage_Block}
<!--@end-->
<br>{$lang->msg_allow_message_please}
</div>
</div> </div>
{$editor} {$editor}
<div class="control-group"> <div class="control-group">
@ -25,4 +35,4 @@
</div> </div>
</form> </form>
</section> </section>
<include target="./common_footer.html" /> <include target="./common_footer.html" />

View file

@ -22,8 +22,6 @@ class counter extends ModuleObject
// add a row for today's status // add a row for today's status
//$oCounterController->insertTodayStatus(); //$oCounterController->insertTodayStatus();
return new Object();
} }
/** /**
@ -67,8 +65,6 @@ class counter extends ModuleObject
{ {
$oDB->addIndex('counter_log', 'idx_site_counter_log', array('site_srl', 'ipaddress'), FALSE); $oDB->addIndex('counter_log', 'idx_site_counter_log', array('site_srl', 'ipaddress'), FALSE);
} }
return new Object(0, 'success_updated');
} }
/** /**

View file

@ -213,7 +213,7 @@ class documentAdminController extends document
{ {
Rhymix\Framework\Cache::delete('document_item:'. getNumberingPath($document_srl) . $document_srl); Rhymix\Framework\Cache::delete('document_item:'. getNumberingPath($document_srl) . $document_srl);
} }
return new Object(); return new BaseObject();
} }
/** /**
@ -426,7 +426,7 @@ class documentAdminController extends document
$oDB->commit(); $oDB->commit();
$output = new Object(); $output = new BaseObject();
$output->add('copied_srls', $copied_srls); $output->add('copied_srls', $copied_srls);
return $output; return $output;
} }
@ -471,13 +471,21 @@ class documentAdminController extends document
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig(); $config = $oDocumentModel->getDocumentConfig();
$config->view_count_option = Context::get('view_count_option'); $config->view_count_option = Context::get('view_count_option');
$config->icons = Context::get('icons');
$config->micons = Context::get('micons');
// Insert by creating the module Controller object // Insert by creating the module Controller object
$oModuleController = getController('module'); $oModuleController = getController('module');
$output = $oModuleController->insertModuleConfig('document',$config); $output = $oModuleController->insertModuleConfig('document',$config);
if(!$output->toBool())
{
return $output;
}
$this->setMessage('success_updated');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminConfig'); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminConfig');
return $this->setRedirectUrl($returnUrl, $output); $this->setRedirectUrl($returnUrl, $output);
} }
/** /**
@ -503,10 +511,11 @@ class documentAdminController extends document
*/ */
function procDocumentAdminDeleteAllThumbnail() function procDocumentAdminDeleteAllThumbnail()
{ {
// delete all of thumbnail_ *. jpg files from files/attaches/images/ directory (prior versions to 1.0.4) $temp_cache_dir = './files/thumbnails_' . $_SERVER['REQUEST_TIME'];
$this->deleteThumbnailFile('./files/attach/images'); FileHandler::rename('./files/thumbnails', $temp_cache_dir);
// delete a directory itself, files/thumbnails (thumbnail policies have changed since version 1.0.5) FileHandler::makeDir('./files/thumbnails');
FileHandler::removeFilesInDir('./files/thumbnails');
FileHandler::removeDir($temp_cache_dir);
$this->setMessage('success_deleted'); $this->setMessage('success_deleted');
} }
@ -548,7 +557,7 @@ class documentAdminController extends document
$eid = Context::get('eid'); $eid = Context::get('eid');
$obj = new stdClass(); $obj = new stdClass();
if(!$module_srl || !$name || !$eid) return new Object(-1,'msg_invalid_request'); if(!$module_srl || !$name || !$eid) return $this->setError('msg_invalid_request');
// set the max value if idx is not specified // set the max value if idx is not specified
if(!$var_idx) if(!$var_idx)
{ {
@ -564,7 +573,7 @@ class documentAdminController extends document
$output = executeQuery('document.isExistsExtraKey', $obj); $output = executeQuery('document.isExistsExtraKey', $obj);
if(!$output->toBool() || $output->data->count) if(!$output->toBool() || $output->data->count)
{ {
return new Object(-1, 'msg_extra_name_exists'); return $this->setError('msg_extra_name_exists');
} }
// insert or update // insert or update
@ -586,7 +595,7 @@ class documentAdminController extends document
{ {
$module_srl = Context::get('module_srl'); $module_srl = Context::get('module_srl');
$var_idx = Context::get('var_idx'); $var_idx = Context::get('var_idx');
if(!$module_srl || !$var_idx) return new Object(-1,'msg_invalid_request'); if(!$module_srl || !$var_idx) return $this->setError('msg_invalid_request');
$oDocumentController = getController('document'); $oDocumentController = getController('document');
$output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx); $output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx);
@ -605,26 +614,26 @@ class documentAdminController extends document
$module_srl = Context::get('module_srl'); $module_srl = Context::get('module_srl');
$var_idx = Context::get('var_idx'); $var_idx = Context::get('var_idx');
if(!$type || !$module_srl || !$var_idx) return new Object(-1,'msg_invalid_request'); if(!$type || !$module_srl || !$var_idx) return $this->setError('msg_invalid_request');
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$module_info->module_srl) return new Object(-1,'msg_invalid_request'); if(!$module_info->module_srl) return $this->setError('msg_invalid_request');
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
$extra_keys = $oDocumentModel->getExtraKeys($module_srl); $extra_keys = $oDocumentModel->getExtraKeys($module_srl);
if(!$extra_keys[$var_idx]) return new Object(-1,'msg_invalid_request'); if(!$extra_keys[$var_idx]) return $this->setError('msg_invalid_request');
if($type == 'up') $new_idx = $var_idx-1; if($type == 'up') $new_idx = $var_idx-1;
else $new_idx = $var_idx+1; else $new_idx = $var_idx+1;
if($new_idx<1) return new Object(-1,'msg_invalid_request'); if($new_idx<1) return $this->setError('msg_invalid_request');
$args = new stdClass(); $args = new stdClass();
$args->module_srl = $module_srl; $args->module_srl = $module_srl;
$args->var_idx = $new_idx; $args->var_idx = $new_idx;
$output = executeQuery('document.getDocumentExtraKeys', $args); $output = executeQuery('document.getDocumentExtraKeys', $args);
if (!$output->toBool()) return $output; if (!$output->toBool()) return $output;
if (!$output->data) return new Object(-1, 'msg_invalid_request'); if (!$output->data) return $this->setError('msg_invalid_request');
unset($args); unset($args);
// update immediately if there is no idx to change // update immediately if there is no idx to change
@ -728,7 +737,7 @@ class documentAdminController extends document
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl')); $member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_admin_document_no_move_to_trash'); return $this->setError('msg_admin_document_no_move_to_trash');
} }
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
@ -873,7 +882,7 @@ class documentAdminController extends document
//DB restore //DB restore
$output = $oDocumentController->insertDocument($originObject, false, true, false); $output = $oDocumentController->insertDocument($originObject, false, true, false);
if(!$output->toBool()) return new Object(-1, $output->getMessage()); if(!$output->toBool()) return $this->setError($output->getMessage());
//FILE restore //FILE restore
$oDocument = $oDocumentModel->getDocument($originObject->document_srl); $oDocument = $oDocumentModel->getDocument($originObject->document_srl);
@ -891,7 +900,7 @@ class documentAdminController extends document
// commit // commit
$oDB->commit(); $oDB->commit();
return new Object(0, 'success'); return new BaseObject(0, 'success');
} }
/** /**

View file

@ -148,6 +148,13 @@ class documentAdminView extends document
$config = $oDocumentModel->getDocumentConfig(); $config = $oDocumentModel->getDocumentConfig();
Context::set('config',$config); Context::set('config',$config);
$oModuleModel = getModel('module');
$pcIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'icons');
$mobileIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'micons');
Context::set('pcIconSkinList', $pcIconSkinList);
Context::set('mobileIconSkinList', $mobileIconSkinList);
// Set the template file // Set the template file
$this->setTemplatePath($this->module_path.'tpl'); $this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('document_config'); $this->setTemplateFile('document_config');

View file

@ -47,8 +47,6 @@ class document extends ModuleObject
// 2009. 01. 29 Added a trigger for additional setup // 2009. 01. 29 Added a trigger for additional setup
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
return new Object();
} }
/** /**
@ -341,8 +339,6 @@ class document extends ModuleObject
$oDB->addColumn('document_update_log', 'is_admin', 'varchar', 1); $oDB->addColumn('document_update_log', 'is_admin', 'varchar', 1);
$oDB->addIndex('document_update_log', 'idx_is_admin', array('is_admin')); $oDB->addIndex('document_update_log', 'idx_is_admin', array('is_admin'));
} }
return new Object(0,'success_updated');
} }
/** /**

View file

@ -28,21 +28,21 @@ class documentController extends document
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
} }
$document_srl = Context::get('target_srl'); $document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request'); if(!$document_srl) return $this->setError('msg_invalid_request');
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false); $oDocument = $oDocumentModel->getDocument($document_srl, false, false);
$module_srl = $oDocument->get('module_srl'); $module_srl = $oDocument->get('module_srl');
if(!$module_srl) return new Object(-1, 'msg_invalid_request'); if(!$module_srl) return $this->setError('msg_invalid_request');
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl); $document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
if($document_config->use_vote_up=='N') return new Object(-1, 'msg_invalid_request'); if($document_config->use_vote_up=='N') return $this->setError('msg_invalid_request');
$point = 1; $point = 1;
$output = $this->updateVotedCount($document_srl, $point); $output = $this->updateVotedCount($document_srl, $point);
@ -60,18 +60,18 @@ class documentController extends document
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
} }
$document_srl = Context::get('target_srl'); $document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request'); if(!$document_srl) return $this->setError('msg_invalid_request');
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false); $oDocument = $oDocumentModel->getDocument($document_srl, false, false);
if($oDocument->get('voted_count') <= 0) if($oDocument->get('voted_count') <= 0)
{ {
return new Object(-1, 'msg_document_voted_cancel_not'); return $this->setError('msg_document_voted_cancel_not');
} }
$point = 1; $point = 1;
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point); $output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
@ -80,7 +80,7 @@ class documentController extends document
return $output; return $output;
} }
$output = new Object(); $output = new BaseObject();
$output->setMessage('success_voted_canceled'); $output->setMessage('success_voted_canceled');
return $output; return $output;
} }
@ -114,21 +114,21 @@ class documentController extends document
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
} }
$document_srl = Context::get('target_srl'); $document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request'); if(!$document_srl) return $this->setError('msg_invalid_request');
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false); $oDocument = $oDocumentModel->getDocument($document_srl, false, false);
$module_srl = $oDocument->get('module_srl'); $module_srl = $oDocument->get('module_srl');
if(!$module_srl) return new Object(-1, 'msg_invalid_request'); if(!$module_srl) return $this->setError('msg_invalid_request');
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl); $document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
if($document_config->use_vote_down=='N') return new Object(-1, 'msg_invalid_request'); if($document_config->use_vote_down=='N') return $this->setError('msg_invalid_request');
$point = -1; $point = -1;
$output = $this->updateVotedCount($document_srl, $point); $output = $this->updateVotedCount($document_srl, $point);
@ -146,18 +146,18 @@ class documentController extends document
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
} }
$document_srl = Context::get('target_srl'); $document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request'); if(!$document_srl) return $this->setError('msg_invalid_request');
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false); $oDocument = $oDocumentModel->getDocument($document_srl, false, false);
if($oDocument->get('blamed_count') >= 0) if($oDocument->get('blamed_count') >= 0)
{ {
return new Object(-1, 'msg_document_voted_cancel_not'); return $this->setError('msg_document_voted_cancel_not');
} }
$point = -1; $point = -1;
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point); $output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
@ -166,7 +166,7 @@ class documentController extends document
return $output; return $output;
} }
$output = new Object(); $output = new BaseObject();
$output->setMessage('success_blamed_canceled'); $output->setMessage('success_blamed_canceled');
return $output; return $output;
} }
@ -229,13 +229,13 @@ class documentController extends document
{ {
if(!Context::get('is_logged')) if(!Context::get('is_logged'))
{ {
return new Object(-1, 'msg_not_logged'); return $this->setError('msg_not_logged');
} }
$document_srl = intval(Context::get('target_srl')); $document_srl = intval(Context::get('target_srl'));
if(!$document_srl) if(!$document_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// if an user select message from options, message would be the option. // if an user select message from options, message would be the option.
@ -302,7 +302,7 @@ class documentController extends document
function triggerDeleteModuleDocuments(&$obj) function triggerDeleteModuleDocuments(&$obj)
{ {
$module_srl = $obj->module_srl; $module_srl = $obj->module_srl;
if(!$module_srl) return new Object(); if(!$module_srl) return;
// Delete the document // Delete the document
$oDocumentAdminController = getAdminController('document'); $oDocumentAdminController = getAdminController('document');
$output = $oDocumentAdminController->deleteModuleDocument($module_srl); $output = $oDocumentAdminController->deleteModuleDocument($module_srl);
@ -319,8 +319,6 @@ class documentController extends document
// remove histories // remove histories
$this->deleteDocumentHistory(null, null, $module_srl); $this->deleteDocumentHistory(null, null, $module_srl);
return new Object();
} }
/** /**
@ -349,7 +347,7 @@ class documentController extends document
{ {
if(!$manual_inserted && !checkCSRF()) if(!$manual_inserted && !checkCSRF())
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
// begin transaction // begin transaction
@ -396,41 +394,59 @@ class documentController extends document
// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid // Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars); if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
// Remove the columns for automatic saving // Remove the columns for automatic saving
unset($obj->_saved_doc_srl); unset($obj->_saved_doc_srl);
unset($obj->_saved_doc_title); unset($obj->_saved_doc_title);
unset($obj->_saved_doc_content); unset($obj->_saved_doc_content);
unset($obj->_saved_doc_message); unset($obj->_saved_doc_message);
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
unset($obj->manual_member_info);
// Call a trigger (before) // Call a trigger (before)
$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj); $output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
if(!$output->toBool()) return $output; if(!$output->toBool())
// Register it if no given document_srl exists {
if(!$obj->document_srl) $obj->document_srl = getNextSequence(); return $output;
elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new Object(-1, 'msg_not_permitted'); }
// Register it if no given document_srl exists
if(!$obj->document_srl)
{
$obj->document_srl = getNextSequence();
}
elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl))
{
return new BaseObject(-1, 'msg_not_permitted');
}
$oDocumentModel = getModel('document');
// Set to 0 if the category_srl doesn't exist // Set to 0 if the category_srl doesn't exist
$oDocumentModel = getModel('document');
if($obj->category_srl) if($obj->category_srl)
{ {
$category_list = $oDocumentModel->getCategoryList($obj->module_srl); $category_list = $oDocumentModel->getCategoryList($obj->module_srl);
if(count($category_list) > 0 && !$category_list[$obj->category_srl]->grant) if(count($category_list) > 0 && !$category_list[$obj->category_srl]->grant)
{ {
return new Object(-1, 'msg_not_permitted'); return new BaseObject(-1, 'msg_not_permitted');
} }
if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0; if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
} }
// Set the read counts and update order. // Set the read counts and update order.
if(!$obj->readed_count) $obj->readed_count = 0; if(!$obj->readed_count) $obj->readed_count = 0;
if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1; if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
else $obj->update_order = $obj->list_order; else $obj->update_order = $obj->list_order;
// Check the status of password hash for manually inserting. Apply hashing for otherwise. // Check the status of password hash for manually inserting. Apply hashing for otherwise.
if($obj->password && !$obj->password_is_hashed) if($obj->password && !$obj->password_is_hashed)
{ {
$obj->password = getModel('member')->hashPassword($obj->password); $obj->password = getModel('member')->hashPassword($obj->password);
} }
// Insert member's information only if the member is logged-in and not manually registered. // Insert member's information only if the member is logged-in and not manually registered.
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
if(Context::get('is_logged') && !$manual_inserted && !$isRestore) if(Context::get('is_logged') && !$manual_inserted && !$isRestore && !$obj->manual_member_info)
{ {
$obj->member_srl = $logged_info->member_srl; $obj->member_srl = $logged_info->member_srl;
@ -441,19 +457,27 @@ class documentController extends document
$obj->email_address = $logged_info->email_address; $obj->email_address = $logged_info->email_address;
$obj->homepage = $logged_info->homepage; $obj->homepage = $logged_info->homepage;
} }
// If the tile is empty, extract string from the contents. // If the tile is empty, extract string from the contents.
$obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); $obj->title = escape($obj->title, false);
settype($obj->title, "string"); if($obj->title == '')
if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...'); {
// If no tile extracted from the contents, leave it untitled. $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
if($obj->title == '') $obj->title = 'Untitled'; }
if($obj->title == '')
{
$obj->title = 'Untitled';
}
// Remove XE's own tags from the contents. // Remove XE's own tags from the contents.
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
// Return error if content is empty. // Return error if content is empty.
if (!$manual_inserted && is_empty_html_content($obj->content)) if (!$manual_inserted && is_empty_html_content($obj->content))
{ {
return new Object(-1, 'msg_empty_content'); return new BaseObject(-1, 'msg_empty_content');
} }
// if use editor of nohtml, Remove HTML tags from the contents. // if use editor of nohtml, Remove HTML tags from the contents.
if(!$manual_inserted) if(!$manual_inserted)
{ {
@ -462,8 +486,9 @@ class documentController extends document
// Remove iframe and script if not a top adminisrator in the session. // Remove iframe and script if not a top adminisrator in the session.
if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
// An error appears if both log-in info and user name don't exist. // An error appears if both log-in info and user name don't exist.
if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request'); if(!$logged_info->member_srl && !$obj->nick_name) return new BaseObject(-1, 'msg_invalid_request');
// Fix encoding of non-BMP UTF-8 characters. // Fix encoding of non-BMP UTF-8 characters.
$obj->title = utf8_mbencode($obj->title); $obj->title = utf8_mbencode($obj->title);
@ -478,6 +503,7 @@ class documentController extends document
$oDB->rollback(); $oDB->rollback();
return $output; return $output;
} }
// Insert extra variables if the document successfully inserted. // Insert extra variables if the document successfully inserted.
$extra_vars = array(); $extra_vars = array();
$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl); $extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
@ -550,10 +576,10 @@ class documentController extends document
{ {
if(!$manual_updated && !checkCSRF()) if(!$manual_updated && !checkCSRF())
{ {
return new Object(-1, 'msg_invalid_request'); return new BaseObject(-1, 'msg_invalid_request');
} }
if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request'); if(!$source_obj->document_srl || !$obj->document_srl) return new BaseObject(-1, 'msg_invalied_request');
// Default Status // Default Status
if($obj->status) if($obj->status)
@ -574,9 +600,15 @@ class documentController extends document
$this->_checkDocumentStatusForOldVersion($obj); $this->_checkDocumentStatusForOldVersion($obj);
} }
// Remove manual member info to prevent forgery. This variable can be set by triggers only.
unset($obj->manual_member_info);
// Call a trigger (before) // Call a trigger (before)
$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj); $output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
if(!$output->toBool()) return $output; if(!$output->toBool())
{
return $output;
}
// begin transaction // begin transaction
$oDB = &DB::getInstance(); $oDB = &DB::getInstance();
@ -610,6 +642,7 @@ class documentController extends document
{ {
$obj->ipaddress = $source_obj->get('ipaddress'); $obj->ipaddress = $source_obj->get('ipaddress');
} }
// List variables // List variables
if($obj->comment_status) $obj->commentStatus = $obj->comment_status; if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
if(!$obj->commentStatus) $obj->commentStatus = 'DENY'; if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
@ -635,21 +668,24 @@ class documentController extends document
// Serialize the $extra_vars // Serialize the $extra_vars
if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars); if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
// Remove the columns for automatic saving // Remove the columns for automatic saving
unset($obj->_saved_doc_srl); unset($obj->_saved_doc_srl);
unset($obj->_saved_doc_title); unset($obj->_saved_doc_title);
unset($obj->_saved_doc_content); unset($obj->_saved_doc_content);
unset($obj->_saved_doc_message); unset($obj->_saved_doc_message);
$oDocumentModel = getModel('document');
// Set the category_srl to 0 if the changed category is not exsiting. // Set the category_srl to 0 if the changed category is not exsiting.
$oDocumentModel = getModel('document');
if($source_obj->get('category_srl')!=$obj->category_srl) if($source_obj->get('category_srl')!=$obj->category_srl)
{ {
$category_list = $oDocumentModel->getCategoryList($obj->module_srl); $category_list = $oDocumentModel->getCategoryList($obj->module_srl);
if(!$category_list[$obj->category_srl]) $obj->category_srl = 0; if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
} }
// Change the update order // Change the update order
$obj->update_order = getNextSequence() * -1; $obj->update_order = getNextSequence() * -1;
// Hash the password if it exists // Hash the password if it exists
if($obj->password) if($obj->password)
{ {
@ -658,7 +694,7 @@ class documentController extends document
// If an author is identical to the modifier or history is used, use the logged-in user's information. // If an author is identical to the modifier or history is used, use the logged-in user's information.
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
if(Context::get('is_logged') && !$manual_updated) if(Context::get('is_logged') && !$manual_updated && !$obj->manual_member_info)
{ {
if($source_obj->get('member_srl')==$logged_info->member_srl) if($source_obj->get('member_srl')==$logged_info->member_srl)
{ {
@ -671,7 +707,7 @@ class documentController extends document
} }
// For the document written by logged-in user however no nick_name exists // For the document written by logged-in user however no nick_name exists
if($source_obj->get('member_srl')&& !$obj->nick_name) if($source_obj->get('member_srl')&& !$obj->nick_name && !$obj->manual_member_info)
{ {
$obj->member_srl = $source_obj->get('member_srl'); $obj->member_srl = $source_obj->get('member_srl');
$obj->user_name = $source_obj->get('user_name'); $obj->user_name = $source_obj->get('user_name');
@ -679,19 +715,27 @@ class documentController extends document
$obj->email_address = $source_obj->get('email_address'); $obj->email_address = $source_obj->get('email_address');
$obj->homepage = $source_obj->get('homepage'); $obj->homepage = $source_obj->get('homepage');
} }
// If the tile is empty, extract string from the contents. // If the tile is empty, extract string from the contents.
$obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); $obj->title = escape($obj->title, false);
settype($obj->title, "string"); if($obj->title == '')
if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); {
// If no tile extracted from the contents, leave it untitled. $obj->title = cut_str(strip_tags($obj->content),20,'...');
if($obj->title == '') $obj->title = 'Untitled'; }
if($obj->title == '')
{
$obj->title = 'Untitled';
}
// Remove XE's own tags from the contents. // Remove XE's own tags from the contents.
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
// Return error if content is empty. // Return error if content is empty.
if (!$manual_inserted && is_empty_html_content($obj->content)) if (!$manual_inserted && is_empty_html_content($obj->content))
{ {
return new Object(-1, 'msg_empty_content'); return new BaseObject(-1, 'msg_empty_content');
} }
// if use editor of nohtml, Remove HTML tags from the contents. // if use editor of nohtml, Remove HTML tags from the contents.
if(!$manual_updated) if(!$manual_updated)
{ {
@ -722,11 +766,13 @@ class documentController extends document
$obj->content = $document_output->data->content; $obj->content = $document_output->data->content;
} }
} }
// Remove iframe and script if not a top adminisrator in the session. // Remove iframe and script if not a top adminisrator in the session.
if($logged_info->is_admin != 'Y') if($logged_info->is_admin != 'Y')
{ {
$obj->content = removeHackTag($obj->content); $obj->content = removeHackTag($obj->content);
} }
// if temporary document, regdate is now setting // if temporary document, regdate is now setting
if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis'); if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
@ -768,6 +814,7 @@ class documentController extends document
$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
} }
} }
// Inert extra vars for multi-language support of title and contents. // Inert extra vars for multi-language support of title and contents.
if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
@ -799,6 +846,7 @@ class documentController extends document
// commit // commit
$oDB->commit(); $oDB->commit();
// Remove the thumbnail file // Remove the thumbnail file
FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3))); FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
@ -876,7 +924,7 @@ class documentController extends document
// Check if the documnet exists // Check if the documnet exists
$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin); $oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
} }
else if($isEmptyTrash && $oDocument == null) return new Object(-1, 'document is not exists'); else if($isEmptyTrash && $oDocument == null) return new BaseObject(-1, 'document is not exists');
$oMemberModel = getModel('member'); $oMemberModel = getModel('member');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl')); $member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
@ -884,13 +932,13 @@ class documentController extends document
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_document_is_admin_not_permitted'); return new BaseObject(-1, 'msg_document_is_admin_not_permitted');
} }
if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document'); if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new BaseObject(-1, 'msg_invalid_document');
// Check if a permossion is granted // Check if a permossion is granted
if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted'); if(!$oDocument->isGranted()) return new BaseObject(-1, 'msg_not_permitted');
//if empty trash, document already deleted, therefore document not delete //if empty trash, document already deleted, therefore document not delete
$args = new stdClass(); $args = new stdClass();
@ -995,7 +1043,7 @@ class documentController extends document
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl')); $member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{ {
return new Object(-1, 'msg_admin_document_no_move_to_trash'); return new BaseObject(-1, 'msg_admin_document_no_move_to_trash');
} }
$trash_args->module_srl = $oDocument->get('module_srl'); $trash_args->module_srl = $oDocument->get('module_srl');
@ -1195,7 +1243,7 @@ class documentController extends document
*/ */
function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid) function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid)
{ {
if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1,'msg_invalid_request'); if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new BaseObject(-1, 'msg_invalid_request');
$obj = new stdClass(); $obj = new stdClass();
$obj->module_srl = $module_srl; $obj->module_srl = $module_srl;
@ -1232,7 +1280,7 @@ class documentController extends document
*/ */
function deleteDocumentExtraKeys($module_srl, $var_idx = null) function deleteDocumentExtraKeys($module_srl, $var_idx = null)
{ {
if(!$module_srl) return new Object(-1,'msg_invalid_request'); if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
$obj = new stdClass(); $obj = new stdClass();
$obj->module_srl = $module_srl; $obj->module_srl = $module_srl;
if(!is_null($var_idx)) $obj->var_idx = $var_idx; if(!is_null($var_idx)) $obj->var_idx = $var_idx;
@ -1277,7 +1325,7 @@ class documentController extends document
$oDB->commit(); $oDB->commit();
Rhymix\Framework\Cache::delete("site_and_module:module_document_extra_keys:$module_srl"); Rhymix\Framework\Cache::delete("site_and_module:module_document_extra_keys:$module_srl");
return new Object(); return new BaseObject();
} }
/** /**
@ -1292,7 +1340,7 @@ class documentController extends document
*/ */
function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '') function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '')
{ {
if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request'); if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new BaseObject(-1, 'msg_invalid_request');
if(!$lang_code) $lang_code = Context::getLangType(); if(!$lang_code) $lang_code = Context::getLangType();
$obj = new stdClass; $obj = new stdClass;
@ -1347,7 +1395,7 @@ class documentController extends document
// Return fail if session already has information about votes // Return fail if session already has information about votes
if($_SESSION['voted_document'][$document_srl]) if($_SESSION['voted_document'][$document_srl])
{ {
return new Object(-1, $failed_voted); return new BaseObject(-1, $failed_voted);
} }
// Get the original document // Get the original document
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
@ -1356,7 +1404,7 @@ class documentController extends document
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
{ {
$_SESSION['voted_document'][$document_srl] = false; $_SESSION['voted_document'][$document_srl] = false;
return new Object(-1, $failed_voted); return new BaseObject(-1, $failed_voted);
} }
// Create a member model object // Create a member model object
$oMemberModel = getModel('member'); $oMemberModel = getModel('member');
@ -1369,7 +1417,7 @@ class documentController extends document
if($member_srl && $member_srl == abs($oDocument->get('member_srl'))) if($member_srl && $member_srl == abs($oDocument->get('member_srl')))
{ {
$_SESSION['voted_document'][$document_srl] = false; $_SESSION['voted_document'][$document_srl] = false;
return new Object(-1, $failed_voted); return new BaseObject(-1, $failed_voted);
} }
} }
// Use member_srl for logged-in members and IP address for non-members. // Use member_srl for logged-in members and IP address for non-members.
@ -1388,7 +1436,7 @@ class documentController extends document
if($output->data->count) if($output->data->count)
{ {
$_SESSION['voted_document'][$document_srl] = false; $_SESSION['voted_document'][$document_srl] = false;
return new Object(-1, $failed_voted); return new BaseObject(-1, $failed_voted);
} }
// begin transaction // begin transaction
$oDB = DB::getInstance(); $oDB = DB::getInstance();
@ -1432,7 +1480,7 @@ class documentController extends document
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl); Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
// Return result // Return result
$output = new Object(); $output = new BaseObject();
if($point > 0) if($point > 0)
{ {
$output->setMessage('success_voted'); $output->setMessage('success_voted');
@ -1458,7 +1506,7 @@ class documentController extends document
// Fail if session information already has a reported document // Fail if session information already has a reported document
if($_SESSION['declared_document'][$document_srl]) if($_SESSION['declared_document'][$document_srl])
{ {
return new Object(-1, 'failed_declared'); return new BaseObject(-1, 'failed_declared');
} }
// Check if previously reported // Check if previously reported
@ -1493,7 +1541,7 @@ class documentController extends document
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
{ {
$_SESSION['declared_document'][$document_srl] = true; $_SESSION['declared_document'][$document_srl] = true;
return new Object(-1, 'failed_declared'); return new BaseObject(-1, 'failed_declared');
} }
// Check if document's author is a member. // Check if document's author is a member.
@ -1506,7 +1554,7 @@ class documentController extends document
if($member_srl && $member_srl == abs($oDocument->get('member_srl'))) if($member_srl && $member_srl == abs($oDocument->get('member_srl')))
{ {
$_SESSION['declared_document'][$document_srl] = true; $_SESSION['declared_document'][$document_srl] = true;
return new Object(-1, 'failed_declared'); return new BaseObject(-1, 'failed_declared');
} }
} }
@ -1529,7 +1577,7 @@ class documentController extends document
if($output->data->count) if($output->data->count)
{ {
$_SESSION['declared_document'][$document_srl] = true; $_SESSION['declared_document'][$document_srl] = true;
return new Object(-1, 'failed_declared'); return new BaseObject(-1, 'failed_declared');
} }
// begin transaction // begin transaction
@ -1715,7 +1763,7 @@ class documentController extends document
// Display an error that the category cannot be deleted if it has a child // Display an error that the category cannot be deleted if it has a child
$output = executeQuery('document.getChildCategoryCount', $args); $output = executeQuery('document.getChildCategoryCount', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child'); if($output->data->count>0) return new BaseObject(-1, 'msg_cannot_delete_for_child');
// Delete a category information // Delete a category information
$output = executeQuery('document.deleteCategory', $args); $output = executeQuery('document.deleteCategory', $args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
@ -1784,7 +1832,7 @@ class documentController extends document
// Seek a full list of categories // Seek a full list of categories
$category_list = $oDocumentModel->getCategoryList($module_srl); $category_list = $oDocumentModel->getCategoryList($module_srl);
$category_srl_list = array_keys($category_list); $category_srl_list = array_keys($category_list);
if(count($category_srl_list)<2) return new Object(); if(count($category_srl_list)<2) return new BaseObject();
$prev_category = NULL; $prev_category = NULL;
foreach($category_list as $key => $val) foreach($category_list as $key => $val)
@ -1793,9 +1841,9 @@ class documentController extends document
$prev_category = $val; $prev_category = $val;
} }
// Return if the previous category doesn't exist // Return if the previous category doesn't exist
if(!$prev_category) return new Object(-1,lang('msg_category_not_moved')); if(!$prev_category) return new BaseObject(-1, 'msg_category_not_moved');
// Return if the selected category is the top level // Return if the selected category is the top level
if($category_srl_list[0]==$category_srl) return new Object(-1,lang('msg_category_not_moved')); if($category_srl_list[0]==$category_srl) return new BaseObject(-1, 'msg_category_not_moved');
// Information of the selected category // Information of the selected category
$cur_args = new stdClass; $cur_args = new stdClass;
$cur_args->category_srl = $category_srl; $cur_args->category_srl = $category_srl;
@ -1809,7 +1857,7 @@ class documentController extends document
$prev_args->title = $prev_category->title; $prev_args->title = $prev_category->title;
$this->updateCategory($prev_args); $this->updateCategory($prev_args);
return new Object(); return new BaseObject();
} }
/** /**
@ -1831,7 +1879,7 @@ class documentController extends document
// Seek a full list of categories // Seek a full list of categories
$category_list = $oDocumentModel->getCategoryList($module_srl); $category_list = $oDocumentModel->getCategoryList($module_srl);
$category_srl_list = array_keys($category_list); $category_srl_list = array_keys($category_list);
if(count($category_srl_list)<2) return new Object(); if(count($category_srl_list)<2) return new BaseObject();
for($i=0;$i<count($category_srl_list);$i++) for($i=0;$i<count($category_srl_list);$i++)
{ {
@ -1839,7 +1887,7 @@ class documentController extends document
} }
$next_category_srl = $category_srl_list[$i+1]; $next_category_srl = $category_srl_list[$i+1];
if(!$category_list[$next_category_srl]) return new Object(-1,lang('msg_category_not_moved')); if(!$category_list[$next_category_srl]) return new BaseObject(-1, 'msg_category_not_moved');
$next_category = $category_list[$next_category_srl]; $next_category = $category_list[$next_category_srl];
// Information of the selected category // Information of the selected category
$cur_args = new stdClass; $cur_args = new stdClass;
@ -1854,7 +1902,7 @@ class documentController extends document
$next_args->title = $next_category->title; $next_args->title = $next_category->title;
$this->updateCategory($next_args); $this->updateCategory($next_args);
return new Object(); return new BaseObject();
} }
/** /**
@ -1919,7 +1967,7 @@ class documentController extends document
$columnList = array('module_srl', 'module'); $columnList = array('module_srl', 'module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList); $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if(!$grant->manager) return new Object(-1,'msg_not_permitted'); if(!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
if($args->expand !="Y") $args->expand = "N"; if($args->expand !="Y") $args->expand = "N";
if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls); if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls);
@ -1989,7 +2037,7 @@ class documentController extends document
$columnList = array('module_srl', 'module'); $columnList = array('module_srl', 'module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList); $module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList);
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if(!$grant->manager) return new Object(-1,'msg_not_permitted'); if(!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
// First child of the parent_category_srl // First child of the parent_category_srl
$source_args = new stdClass; $source_args = new stdClass;
@ -2050,14 +2098,14 @@ class documentController extends document
$columnList = array('module_srl', 'module'); $columnList = array('module_srl', 'module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList); $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if(!$grant->manager) return new Object(-1,'msg_not_permitted'); if(!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
// Get original information // Get original information
$category_info = $oDocumentModel->getCategory($args->category_srl); $category_info = $oDocumentModel->getCategory($args->category_srl);
if($category_info->parent_srl) $parent_srl = $category_info->parent_srl; if($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
// Display an error that the category cannot be deleted if it has a child node // Display an error that the category cannot be deleted if it has a child node
if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child'); if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new BaseObject(-1, 'msg_cannot_delete_for_child');
// Remove from the DB // Remove from the DB
$output = $this->deleteCategory($args->category_srl); $output = $this->deleteCategory($args->category_srl);
if(!$output->toBool()) if(!$output->toBool())
@ -2091,7 +2139,7 @@ class documentController extends document
$columnList = array('module_srl', 'module'); $columnList = array('module_srl', 'module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if(!$grant->manager) return new Object(-1,'msg_not_permitted'); if(!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
$xml_file = $this->makeCategoryFile($module_srl); $xml_file = $this->makeCategoryFile($module_srl);
// Set return value // Set return value
@ -2249,7 +2297,7 @@ class documentController extends document
{ {
foreach($langs as $key => $val) foreach($langs as $key => $val)
{ {
$xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false))); $xml_header_buff .= sprintf('$_titles[%d][%s] = %s; ', $category_srl, var_export($key, true), var_export(escape($val, false), true));
} }
} }
@ -2258,12 +2306,12 @@ class documentController extends document
{ {
foreach($langx as $key => $val) foreach($langx as $key => $val)
{ {
$xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false))); $xml_header_buff .= sprintf('$_descriptions[%d][%s] = %s; ', $category_srl, var_export($key, true), var_export(escape($val, false), true));
} }
} }
$attribute = sprintf( $attribute = sprintf(
'mid="%s" module_srl="%d" node_srl="%d" parent_srl="%d" category_srl="%d" text="<?php echo (%s?($_titles[%d][$lang_type]):"")?>" url="%s" expand="%s" color="%s" description="<?php echo (%s?($_descriptions[%d][$lang_type]):"")?>" document_count="%d" ', 'mid="%s" module_srl="%d" node_srl="%d" parent_srl="%d" category_srl="%d" text="<?php echo (%s?($_titles[%d][$lang_type]):"")?>" url=%s expand=%s color=%s description="<?php echo (%s?($_descriptions[%d][$lang_type]):"")?>" document_count="%d" ',
$mid, $mid,
$module_srl, $module_srl,
$category_srl, $category_srl,
@ -2271,9 +2319,9 @@ class documentController extends document
$category_srl, $category_srl,
$group_check_code, $group_check_code,
$category_srl, $category_srl,
getUrl('','mid',$node->mid,'category',$category_srl), str_replace("'", '"', var_export(getUrl('','mid',$node->mid,'category',$category_srl), true)),
$expand, str_replace("'", '"', var_export($expand, true)),
htmlspecialchars($color, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), str_replace("'", '"', var_export(escape($color, false), true)),
$group_check_code, $group_check_code,
$category_srl, $category_srl,
$node->document_count $node->document_count
@ -2338,10 +2386,10 @@ class documentController extends document
{ {
$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
$php_header_buff .= sprintf( $php_header_buff .= sprintf(
'$_titles[%d]["%s"] = "%s"; ', '$_titles[%d][%s] = %s; ',
$category_srl, $category_srl,
$key, var_export($key, true),
str_replace('"','\\"', $val) var_export($val, true)
); );
} }
} }
@ -2354,17 +2402,17 @@ class documentController extends document
{ {
$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); $val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
$php_header_buff .= sprintf( $php_header_buff .= sprintf(
'$_descriptions[%d]["%s"] = "%s"; ', '$_descriptions[%d][%s] = %s; ',
$category_srl, $category_srl,
$key, var_export($key, true),
str_replace('"','\\"', $val) var_export($val, true)
); );
} }
} }
// Create attributes(Use the category_srl_list to check whether to belong to the menu's node. It seems to be tricky but fast fast and powerful;) // Create attributes(Use the category_srl_list to check whether to belong to the menu's node. It seems to be tricky but fast fast and powerful;)
$attribute = sprintf( $attribute = sprintf(
'"mid" => "%s", "module_srl" => "%d","node_srl"=>"%s","category_srl"=>"%s","parent_srl"=>"%s","text"=>$_titles[%d][$lang_type],"selected"=>(in_array(Context::get("category"),array(%s))?1:0),"expand"=>"%s","color"=>"%s","description"=>$_descriptions[%d][$lang_type],"list"=>array(%s),"document_count"=>"%d","grant"=>%s?true:false', '"mid" => "%s", "module_srl" => "%d","node_srl"=>"%d","category_srl"=>"%d","parent_srl"=>"%d","text"=>$_titles[%d][$lang_type],"selected"=>(in_array(Context::get("category"),array(%s))?1:0),"expand"=>%s,"color"=>%s,"description"=>$_descriptions[%d][$lang_type],"list"=>array(%s),"document_count"=>"%d","grant"=>%s?true:false',
$node->mid, $node->mid,
$node->module_srl, $node->module_srl,
$node->category_srl, $node->category_srl,
@ -2372,8 +2420,8 @@ class documentController extends document
$node->parent_srl, $node->parent_srl,
$node->category_srl, $node->category_srl,
$selected, $selected,
$expand, var_export($expand, true),
$node->color, var_export($node->color, true),
$node->category_srl, $node->category_srl,
$child_buff, $child_buff,
$node->document_count, $node->document_count,
@ -2416,7 +2464,7 @@ class documentController extends document
*/ */
function procDocumentAddCart() function procDocumentAddCart()
{ {
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
// Get document_srl // Get document_srl
$srls = explode(',',Context::get('srls')); $srls = explode(',',Context::get('srls'));
@ -2436,14 +2484,14 @@ class documentController extends document
$args->document_srls = implode(',',$document_srls); $args->document_srls = implode(',',$document_srls);
$args->order_type = 'asc'; $args->order_type = 'asc';
$output = executeQueryArray('document.getDocuments', $args); $output = executeQueryArray('document.getDocuments', $args);
if(!$output->data) return new Object(); if(!$output->data) return new BaseObject();
unset($document_srls); unset($document_srls);
foreach($output->data as $key => $val) foreach($output->data as $key => $val)
{ {
$document_srls[$val->module_srl][] = $val->document_srl; $document_srls[$val->module_srl][] = $val->document_srl;
} }
if(!$document_srls || !count($document_srls)) return new Object(); if(!$document_srls || !count($document_srls)) return new BaseObject();
// Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents) // Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents)
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
@ -2468,7 +2516,7 @@ class documentController extends document
} }
} }
} }
if(!count($document_srls)) return new Object(); if(!count($document_srls)) return new BaseObject();
foreach($document_srls as $module_srl => $documents) foreach($document_srls as $module_srl => $documents)
{ {
@ -2490,7 +2538,7 @@ class documentController extends document
function procDocumentManageCheckedDocument() function procDocumentManageCheckedDocument()
{ {
@set_time_limit(0); @set_time_limit(0);
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
// Get request parameters. // Get request parameters.
@ -2546,13 +2594,13 @@ class documentController extends document
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if (!$module_info->module_srl) if (!$module_info->module_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$module_grant = $oModuleModel->getGrant($module_info, $logged_info); $module_grant = $oModuleModel->getGrant($module_info, $logged_info);
if (!$module_grant->manager) if (!$module_grant->manager)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
} }
@ -2562,22 +2610,22 @@ class documentController extends document
if($type == 'move') if($type == 'move')
{ {
if(!$target_module_srl) return new Object(-1, 'fail_to_move'); if(!$target_module_srl) return $this->setError('fail_to_move');
$oDocumentAdminController = getAdminController('document'); $oDocumentAdminController = getAdminController('document');
$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $target_module_srl, $target_category_srl); $output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $target_module_srl, $target_category_srl);
if(!$output->toBool()) return new Object(-1, 'fail_to_move'); if(!$output->toBool()) return $this->setError('fail_to_move');
$msg_code = 'success_moved'; $msg_code = 'success_moved';
} }
else if($type == 'copy') else if($type == 'copy')
{ {
if(!$target_module_srl) return new Object(-1, 'fail_to_move'); if(!$target_module_srl) return $this->setError('fail_to_move');
$oDocumentAdminController = getAdminController('document'); $oDocumentAdminController = getAdminController('document');
$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $target_module_srl, $target_category_srl); $output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $target_module_srl, $target_category_srl);
if(!$output->toBool()) return new Object(-1, 'fail_to_move'); if(!$output->toBool()) return $this->setError('fail_to_move');
$msg_code = 'success_copied'; $msg_code = 'success_copied';
} }
@ -2588,7 +2636,7 @@ class documentController extends document
foreach ($document_srl_list as $document_srl) foreach ($document_srl_list as $document_srl)
{ {
$output = $this->deleteDocument($document_srl, true); $output = $this->deleteDocument($document_srl, true);
if(!$output->toBool()) return new Object(-1, 'fail_to_delete'); if(!$output->toBool()) return $this->setError('fail_to_delete');
} }
$oDB->commit(); $oDB->commit();
$msg_code = 'success_deleted'; $msg_code = 'success_deleted';
@ -2604,7 +2652,7 @@ class documentController extends document
{ {
$args->document_srl = $document_srl; $args->document_srl = $document_srl;
$output = $this->moveDocumentToTrash($args); $output = $this->moveDocumentToTrash($args);
if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash'); if(!$output || !$output->toBool()) return $this->setError('fail_to_trash');
} }
$oDB->commit(); $oDB->commit();
$msg_code = 'success_trashed'; $msg_code = 'success_trashed';
@ -2662,13 +2710,13 @@ class documentController extends document
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
if (!$module_info->module_srl) if (!$module_info->module_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$module_grant = $oModuleModel->getGrant($module_info, $logged_info); $module_grant = $oModuleModel->getGrant($module_info, $logged_info);
if (!$module_grant->manager) if (!$module_grant->manager)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$module_srl[] = $srl; $module_srl[] = $srl;
@ -2707,7 +2755,7 @@ class documentController extends document
{ {
if(!$this->module_srl) if(!$this->module_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$obj = Context::getRequestVars(); $obj = Context::getRequestVars();
@ -2730,12 +2778,12 @@ class documentController extends document
{ {
if(!$oDocument->isGranted()) if(!$oDocument->isGranted())
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
if($oDocument->get('status') != $this->getConfigStatus('temp')) if($oDocument->get('status') != $this->getConfigStatus('temp'))
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$output = $this->updateDocument($oDocument, $obj); $output = $this->updateDocument($oDocument, $obj);
@ -2767,7 +2815,7 @@ class documentController extends document
*/ */
function procDocumentGetList() function procDocumentGetList()
{ {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
$documentSrls = Context::get('document_srls'); $documentSrls = Context::get('document_srls');
if($documentSrls) $documentSrlList = explode(',', $documentSrls); if($documentSrls) $documentSrlList = explode(',', $documentSrls);

View file

@ -8,7 +8,7 @@
* @package /modules/document * @package /modules/document
* @version 0.1 * @version 0.1
*/ */
class documentItem extends Object class documentItem extends BaseObject
{ {
/** /**
* Document number * Document number
@ -917,6 +917,9 @@ class documentItem extends Object
Context::set($cpageStr, $output->page_navigation->cur_page); Context::set($cpageStr, $output->page_navigation->cur_page);
Context::set('cpage', $output->page_navigation->cur_page); Context::set('cpage', $output->page_navigation->cur_page);
if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
// Call trigger (after)
$output = ModuleHandler::triggerCall('document.getComments', 'after', $comment_list);
return $comment_list; return $comment_list;
} }
@ -1185,9 +1188,27 @@ class documentItem extends Object
*/ */
function printExtraImages($time_check = 43200) function printExtraImages($time_check = 43200)
{ {
if(!$this->document_srl) return; if (!$this->document_srl)
// Get the icon directory {
$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/'); return;
}
$oDocumentModel = getModel('document');
$documentConfig = $oDocumentModel->getDocumentConfig();
if(Mobile::isFromMobilePhone())
{
$iconSkin = $documentConfig->micons;
}
else
{
$iconSkin = $documentConfig->icons;
}
if($iconSkin == null)
{
$iconSkin = 'default';
}
$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
$buffs = $this->getExtraImages($time_check); $buffs = $this->getExtraImages($time_check);
if(!count($buffs)) return; if(!count($buffs)) return;

View file

@ -10,6 +10,8 @@
*/ */
class documentModel extends document class documentModel extends document
{ {
private $documentConfig = NULL;
/** /**
* Initialization * Initialization
* @return void * @return void
@ -37,7 +39,7 @@ class documentModel extends document
{ {
if(!is_array($documentSrls) || count($documentSrls) == 0) if(!is_array($documentSrls) || count($documentSrls) == 0)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$args = new stdClass(); $args = new stdClass();
@ -226,13 +228,13 @@ class documentModel extends document
// Call trigger (before) // Call trigger (before)
// This trigger can be used to set an alternative output using a different search method // This trigger can be used to set an alternative output using a different search method
$output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj); $output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj);
if($output instanceof Object && !$output->toBool()) if($output instanceof BaseObject && !$output->toBool())
{ {
return $output; return $output;
} }
// If an alternate output is set, use it instead of running the default queries // If an alternate output is set, use it instead of running the default queries
$use_alternate_output = (isset($obj->use_alternate_output) && $obj->use_alternate_output instanceof Object); $use_alternate_output = (isset($obj->use_alternate_output) && $obj->use_alternate_output instanceof BaseObject);
if (!$use_alternate_output) if (!$use_alternate_output)
{ {
$this->_setSearchOption($obj, $args, $query_id, $use_division); $this->_setSearchOption($obj, $args, $query_id, $use_division);
@ -506,7 +508,7 @@ class documentModel extends document
$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
$module_srl = $oDocument->get('module_srl'); $module_srl = $oDocument->get('module_srl');
$member_srl = $oDocument->get('member_srl'); $member_srl = $oDocument->get('member_srl');
if(!$module_srl) return new Object(-1, 'msg_invalid_request'); if(!$module_srl) return $this->setError('msg_invalid_request');
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl); $document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
@ -913,7 +915,7 @@ class documentModel extends document
*/ */
function getDocumentCategories() function getDocumentCategories()
{ {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
$module_srl = Context::get('module_srl'); $module_srl = Context::get('module_srl');
$categories= $this->getCategoryList($module_srl); $categories= $this->getCategoryList($module_srl);
$lang = Context::get('lang'); $lang = Context::get('lang');
@ -935,15 +937,18 @@ class documentModel extends document
*/ */
function getDocumentConfig() function getDocumentConfig()
{ {
if(!$GLOBALS['__document_config__']) if ($this->documentConfig === NULL)
{ {
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('document'); $config = $oModuleModel->getModuleConfig('document');
if(!$config) $config = new stdClass(); if (!$config)
$GLOBALS['__document_config__'] = $config; {
$config = new stdClass();
}
$this->documentConfig = $config;
} }
return $GLOBALS['__document_config__']; return $this->documentConfig;
} }
/** /**
@ -1005,13 +1010,13 @@ class documentModel extends document
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
// Check permissions // Check permissions
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if(!$grant->manager) return new Object(-1,'msg_not_permitted'); if(!$grant->manager) return $this->setError('msg_not_permitted');
$category_srl = Context::get('category_srl'); $category_srl = Context::get('category_srl');
$category_info = $this->getCategory($category_srl); $category_info = $this->getCategory($category_srl);
if(!$category_info) if(!$category_info)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$this->add('category_info', $category_info); $this->add('category_info', $category_info);
@ -1193,7 +1198,7 @@ class documentModel extends document
{ {
$args = new stdClass; $args = new stdClass;
$document_srl = Context::get('document_srl'); $document_srl = Context::get('document_srl');
if(!$document_srl) return new Object(-1,'msg_invalid_request'); if(!$document_srl) return $this->setError('msg_invalid_request');
$point = Context::get('point'); $point = Context::get('point');
if($point != -1) $point = 1; if($point != -1) $point = 1;
@ -1202,18 +1207,18 @@ class documentModel extends document
$columnList = array('document_srl', 'module_srl'); $columnList = array('document_srl', 'module_srl');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList); $oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
$module_srl = $oDocument->get('module_srl'); $module_srl = $oDocument->get('module_srl');
if(!$module_srl) return new Object(-1, 'msg_invalid_request'); if(!$module_srl) return $this->setError('msg_invalid_request');
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl); $document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
if($point == -1) if($point == -1)
{ {
if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request'); if($document_config->use_vote_down!='S') return $this->setError('msg_invalid_request');
$args->below_point = 0; $args->below_point = 0;
} }
else else
{ {
if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request'); if($document_config->use_vote_up!='S') return $this->setError('msg_invalid_request');
$args->more_point = 0; $args->more_point = 0;
} }
@ -1610,6 +1615,22 @@ class documentModel extends document
return false; return false;
} }
function getDocumentExtraImagePath()
{
$documentConfig = getModel('document')->getDocumentConfig();
if(Mobile::isFromMobilePhone())
{
$iconSkin = $documentConfig->micons;
}
else
{
$iconSkin = $documentConfig->icons;
}
$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
return $path;
}
} }
/* End of file document.model.php */ /* End of file document.model.php */
/* Location: ./modules/document/document.model.php */ /* Location: ./modules/document/document.model.php */

View file

@ -36,9 +36,9 @@ class documentView extends document
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
// Creates an object for displaying the selected document // Creates an object for displaying the selected document
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager); $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request'); if(!$oDocument->isExists()) return $this->setError('msg_invalid_request');
// Check permissions // Check permissions
if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted'); if(!$oDocument->isAccessible()) return $this->setError('msg_not_permitted');
// Information setting module // Information setting module
//Context::set('module_info', $module_info); //module_info not use in UI //Context::set('module_info', $module_info); //module_info not use in UI
// Browser title settings // Browser title settings
@ -58,7 +58,7 @@ class documentView extends document
{ {
if(!checkCSRF()) if(!checkCSRF())
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$content = Context::get('content'); $content = Context::get('content');
@ -87,7 +87,7 @@ class documentView extends document
*/ */
function dispDocumentManageDocument() function dispDocumentManageDocument()
{ {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
// Taken from a list of selected sessions // Taken from a list of selected sessions
$flag_list = $_SESSION['document_management']; $flag_list = $_SESSION['document_management'];
if(count($flag_list)) if(count($flag_list))
@ -140,7 +140,7 @@ class documentView extends document
// Get information of the current module // Get information of the current module
$current_module_info = Context::get('current_module_info'); $current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl; $current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object(); if(!$current_module_srl) return new BaseObject();
} }
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
@ -159,7 +159,7 @@ class documentView extends document
$tpl = $oTemplate->compile($this->module_path.'tpl', 'document_module_config'); $tpl = $oTemplate->compile($this->module_path.'tpl', 'document_module_config');
$obj .= $tpl; $obj .= $tpl;
return new Object(); return new BaseObject();
} }
/** /**
@ -215,12 +215,12 @@ class documentView extends document
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager, FALSE); $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager, FALSE);
if(!$oDocument->isExists()) if(!$oDocument->isExists())
{ {
return new Object(-1,'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
// Check permissions // Check permissions
if(!$oDocument->isAccessible()) if(!$oDocument->isAccessible())
{ {
return new Object(-1,'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
// Browser title settings // Browser title settings

View file

@ -10,6 +10,8 @@ $lang->category_color = 'Category Font Color';
$lang->expand = 'Expand'; $lang->expand = 'Expand';
$lang->category_group_srls = 'Accessable Group'; $lang->category_group_srls = 'Accessable Group';
$lang->cmd_make_child = 'Add Child Category'; $lang->cmd_make_child = 'Add Child Category';
$lang->cmd_pc_icon_setting = 'PC icon setting';
$lang->cmd_mobile_icon_setting = 'Mobile icon setting';
$lang->cmd_enable_move_category = 'Change category position (Select a category and drag it to the position you want.)'; $lang->cmd_enable_move_category = 'Change category position (Select a category and drag it to the position you want.)';
$lang->about_category_title = 'Please enter a category name.'; $lang->about_category_title = 'Please enter a category name.';
$lang->about_expand = 'Select this option, and they will stay expanded.'; $lang->about_expand = 'Select this option, and they will stay expanded.';

View file

@ -6,6 +6,8 @@ $lang->view_count_option_some = '일부 계산';
$lang->view_count_option_once = '중복 금지'; $lang->view_count_option_once = '중복 금지';
$lang->view_count_option_none = '계산 안함'; $lang->view_count_option_none = '계산 안함';
$lang->cmd_delete_all_thumbnail = '섬네일 모두 삭제'; $lang->cmd_delete_all_thumbnail = '섬네일 모두 삭제';
$lang->cmd_pc_icon_setting = 'PC아이콘 설정';
$lang->cmd_mobile_icon_setting = '모바일 아이콘 설정';
$lang->title_bold = '제목 굵게'; $lang->title_bold = '제목 굵게';
$lang->title_color = '제목 색깔'; $lang->title_color = '제목 색깔';
$lang->new_document_count = '새 글'; $lang->new_document_count = '새 글';
@ -21,6 +23,8 @@ $lang->about_view_count_option = '조회수설정에 따라 중복 조회수 카
$lang->about_expand = '선택하면 늘 펼쳐진 상태로 있게 합니다.'; $lang->about_expand = '선택하면 늘 펼쳐진 상태로 있게 합니다.';
$lang->about_category_group_srls = '선택한 그룹만 현재 카테고리를 지정할 수 있도록 합니다.'; $lang->about_category_group_srls = '선택한 그룹만 현재 카테고리를 지정할 수 있도록 합니다.';
$lang->about_category_color = '분류 폰트색깔을 지정합니다. 예) red 또는 #ff0000'; $lang->about_category_color = '분류 폰트색깔을 지정합니다. 예) red 또는 #ff0000';
$lang->about_cmd_pc_icon_setting = '게시판 새로운 글 혹은 수정되었을 때 출력하는 아이콘입니다. 기본값은 default 입니다. 사용않함을 선택할 경우 default 스킨이 기본값으로 출력됩니다.';
$lang->about_cmd_mobile_icon_setting = '게시판 새로운 글 혹은 수정되었을 때 출력하는 아이콘입니다. 기본값은 default 입니다. 사용않함을 선택할 경우 default 스킨이 기본값으로 출력됩니다.';
$lang->cmd_search_next = '계속 검색'; $lang->cmd_search_next = '계속 검색';
$lang->cmd_temp_save = '임시 저장'; $lang->cmd_temp_save = '임시 저장';
$lang->cmd_toggle_checked_document = '선택항목 반전'; $lang->cmd_toggle_checked_document = '선택항목 반전';

View file

@ -19,6 +19,28 @@
</div> </div>
</div> </div>
</div> </div>
<div class="x_control-group">
<label class="x_control-label" for="icons">{$lang->cmd_pc_icon_setting}</label>
<div class="x_controls">
<select name="icons" id="icons">
<option value="">{$lang->notuse}</option>
<option loop="$pcIconSkinList => $key, $val" value="{$val->title}" selected="selected"|cond="$config->icons == $val->title">{$val->title}</option>
</select>
<a href="#icons_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="icons_help" class="x_help-block" hidden>{$lang->about_cmd_pc_icon_setting}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="micons">{$lang->cmd_mobile_icon_setting}</label>
<div class="x_controls">
<select name="micons" id="micons">
<option value="">{$lang->notuse}</option>
<option loop="$pcIconSkinList => $key, $val" value="{$val->title}" selected="selected"|cond="$config->micons == $val->title">{$val->title}</option>
</select>
<a href="#micons_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="micons_help" class="x_help-block" hidden>{$lang->about_cmd_mobile_icon_setting}</p>
</div>
</div>
<div class="btnArea x_clearfix"> <div class="btnArea x_clearfix">
<span class="x_pull-right" style="margin-left:10px;"><input class="btn" type="button" value="{$lang->cmd_delete_all_thumbnail}" onclick="doDeleteAllThumbnail()"/></span> <span class="x_pull-right" style="margin-left:10px;"><input class="btn" type="button" value="{$lang->cmd_delete_all_thumbnail}" onclick="doDeleteAllThumbnail()"/></span>

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

View file

@ -28,7 +28,7 @@ class emoticon extends EditorHandler
function getEmoticonList() function getEmoticonList()
{ {
$emoticon = Context::get('emoticon'); $emoticon = Context::get('emoticon');
if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) return new Object(-1,'msg_invalid_request'); if(!$emoticon || !preg_match("/^([a-z0-9\_]+)$/i",$emoticon)) return new BaseObject(-1,'msg_invalid_request');
$list = $this->getEmoticons($emoticon); $list = $this->getEmoticons($emoticon);

View file

@ -39,10 +39,10 @@ class editorAdminController extends editor
} }
$output = $this->editorListOrder($component_names,$site_module_info->site_srl); $output = $this->editorListOrder($component_names,$site_module_info->site_srl);
if(!$output->toBool()) return new Object(); if(!$output->toBool()) return new BaseObject();
$output = $this->editorCheckUse($componentList,$site_module_info->site_srl); $output = $this->editorCheckUse($componentList,$site_module_info->site_srl);
if(!$output->toBool()) return new Object(); if(!$output->toBool()) return new BaseObject();
$oEditorController = getController('editor'); $oEditorController = getController('editor');
$oEditorController->removeCache($site_module_info->site_srl); $oEditorController->removeCache($site_module_info->site_srl);
@ -70,7 +70,7 @@ class editorAdminController extends editor
$output = executeQuery('editor.updateSiteComponent', $args); $output = executeQuery('editor.updateSiteComponent', $args);
} }
} }
if(!$output->toBool()) return new Object(); if(!$output->toBool()) return new BaseObject();
unset($componentList); unset($componentList);
return $output; return $output;
@ -99,7 +99,7 @@ class editorAdminController extends editor
$output = executeQuery('editor.updateSiteComponent', $args); $output = executeQuery('editor.updateSiteComponent', $args);
} }
if(!$output->toBool()) return new Object(); if(!$output->toBool()) return new BaseObject();
$list_order_num++; $list_order_num++;
} }
} }
@ -251,7 +251,7 @@ class editorAdminController extends editor
// Check if the component exists // Check if the component exists
if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args); if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args);
else $output = executeQuery('editor.isSiteComponentInserted', $args); else $output = executeQuery('editor.isSiteComponentInserted', $args);
if($output->data->count) return new Object(-1, 'msg_component_is_not_founded'); if($output->data->count) return $this->setError('msg_component_is_not_founded');
// Inert a component // Inert a component
$args->list_order = getNextSequence(); $args->list_order = getNextSequence();
if(!$site_srl) $output = executeQuery('editor.insertComponent', $args); if(!$site_srl) $output = executeQuery('editor.insertComponent', $args);

View file

@ -47,6 +47,7 @@ class editor extends ModuleObject
'content_word_break' => 'normal', 'content_word_break' => 'normal',
'enable_autosave' => 'Y', 'enable_autosave' => 'Y',
'allow_html' => 'Y', 'allow_html' => 'Y',
'editor_focus' => 'N',
'autoinsert_image' => 'paragraph', 'autoinsert_image' => 'paragraph',
'additional_css' => array(), 'additional_css' => array(),
'additional_mobile_css' => array(), 'additional_mobile_css' => array(),
@ -82,8 +83,6 @@ class editor extends ModuleObject
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'); $oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
// 2009. 04. 14 Add a trigger from compiled codes of the editor component // 2009. 04. 14 Add a trigger from compiled codes of the editor component
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'); $oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
return new Object();
} }
/** /**
@ -150,8 +149,6 @@ class editor extends ModuleObject
{ {
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after'); $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'editor', 'controller', 'triggerCopyModule', 'after');
} }
return new Object(0, 'success_updated');
} }
/** /**

View file

@ -47,20 +47,20 @@ class editorController extends editor
{ {
$component = Context::get('component'); $component = Context::get('component');
$method = Context::get('method'); $method = Context::get('method');
if(!$component) return new Object(-1, sprintf(lang('msg_component_is_not_founded'), $component)); if(!$component) return $this->setError('msg_component_is_not_founded', $component);
$oEditorModel = getModel('editor'); $oEditorModel = getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($component); $oComponent = &$oEditorModel->getComponentObject($component);
if(!$oComponent->toBool()) return $oComponent; if(!$oComponent->toBool()) return $oComponent;
if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(lang('msg_component_is_not_founded'), $component)); if(!method_exists($oComponent, $method)) return $this->setError('msg_component_is_not_founded', $component);
//$output = call_user_method($method, $oComponent); //$output = call_user_method($method, $oComponent);
//$output = call_user_func(array($oComponent, $method)); //$output = call_user_func(array($oComponent, $method));
if(method_exists($oComponent, $method)) $output = $oComponent->{$method}(); if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
else return new Object(-1,sprintf('%s method is not exists', $method)); else return $this->setError('%s method is not exists', $method);
if($output instanceof Object && !$output->toBool()) return $output; if($output instanceof BaseObject && !$output->toBool()) return $output;
$this->setError($oComponent->getError()); $this->setError($oComponent->getError());
$this->setMessage($oComponent->getMessage()); $this->setMessage($oComponent->getMessage());
@ -93,13 +93,13 @@ class editorController extends editor
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl); $module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
if (!$module_info->module_srl) if (!$module_info->module_srl)
{ {
return new Object(-1, 'msg_invalid_request'); return $this->setError('msg_invalid_request');
} }
$module_grant = $oModuleModel->getGrant($module_info, $logged_info); $module_grant = $oModuleModel->getGrant($module_info, $logged_info);
if (!$module_grant->manager) if (!$module_grant->manager)
{ {
return new Object(-1, 'msg_not_permitted'); return $this->setError('msg_not_permitted');
} }
$module_srl[] = $srl; $module_srl[] = $srl;
@ -171,7 +171,7 @@ class editorController extends editor
*/ */
function triggerEditorComponentCompile(&$content) function triggerEditorComponentCompile(&$content)
{ {
if(Context::getResponseMethod()!='HTML') return new Object(); if(Context::getResponseMethod() !== 'HTML') return;
$module_info = Context::get('module_info'); $module_info = Context::get('module_info');
$module_srl = $module_info->module_srl; $module_srl = $module_info->module_srl;
@ -253,7 +253,6 @@ class editorController extends editor
} }
$content = $this->transComponent($content); $content = $this->transComponent($content);
return new Object();
} }
/** /**
@ -350,7 +349,6 @@ class editorController extends editor
function triggerDeleteSavedDoc(&$obj) function triggerDeleteSavedDoc(&$obj)
{ {
$this->deleteSavedDoc(false); $this->deleteSavedDoc(false);
return new Object();
} }
/** /**

View file

@ -169,8 +169,9 @@ class editorModel extends editor
} }
Context::set('enable_autosave', $option->enable_autosave); Context::set('enable_autosave', $option->enable_autosave);
// Set allow html // Set allow html and focus
Context::set('allow_html', ($option->allow_html === false || $option->allow_html === 'N') ? false : true); Context::set('allow_html', ($option->allow_html === false || $option->allow_html === 'N') ? false : true);
Context::set('editor_focus', toBool($option->editor_focus));
// Load editor components. // Load editor components.
$site_srl = Context::get('site_module_info')->site_srl ?: 0; $site_srl = Context::get('site_module_info')->site_srl ?: 0;
@ -465,11 +466,11 @@ class editorModel extends editor
// Create an object of the component and execute // Create an object of the component and execute
$class_path = sprintf('%scomponents/%s/', $this->module_path, $component); $class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
$class_file = sprintf('%s%s.class.php', $class_path, $component); $class_file = sprintf('%s%s.class.php', $class_path, $component);
if(!file_exists($class_file)) return new Object(-1, sprintf(lang('msg_component_is_not_founded'), $component)); if(!file_exists($class_file)) return $this->setError('msg_component_is_not_founded', $component);
// Create an object after loading the class file // Create an object after loading the class file
require_once($class_file); require_once($class_file);
$oComponent = new $component($editor_sequence, $class_path); $oComponent = new $component($editor_sequence, $class_path);
if(!$oComponent) return new Object(-1, sprintf(lang('msg_component_is_not_founded'), $component)); if(!$oComponent) return $this->setError('msg_component_is_not_founded', $component);
// Add configuration information // Add configuration information
$component_info = $this->getComponent($component, $site_srl); $component_info = $this->getComponent($component, $site_srl);
$oComponent->setInfo($component_info); $oComponent->setInfo($component_info);
@ -526,7 +527,7 @@ class editorModel extends editor
$group_list = array(); $group_list = array();
} }
if(count($component_list)) if(countobj($component_list))
{ {
foreach($component_list as $key => $val) foreach($component_list as $key => $val)
{ {

View file

@ -88,7 +88,7 @@ class editorView extends editor
// Get information of the current module // Get information of the current module
$current_module_info = Context::get('current_module_info'); $current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl; $current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object(); if(!$current_module_srl) return new BaseObject();
} }
// Get editors settings // Get editors settings
$oEditorModel = getModel('editor'); $oEditorModel = getModel('editor');
@ -135,7 +135,7 @@ class editorView extends editor
$tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config'); $tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config');
$obj .= $tpl; $obj .= $tpl;
return new Object(); return new BaseObject();
} }

View file

@ -104,6 +104,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
fontSize_sizes: font_sizes, fontSize_sizes: font_sizes,
toolbarCanCollapse: true, toolbarCanCollapse: true,
allowedContent: true, allowedContent: true,
startupFocus: {json_encode($editor_focus)},
language: "{str_replace('jp','ja',$lang_type)}" language: "{str_replace('jp','ja',$lang_type)}"
}, },
loadXeComponent: true, loadXeComponent: true,

Some files were not shown because too many files have changed in this diff Show more