Merge branch 'rhymix:master' into master
Some checks failed
PHP Lint & Codeception / PHP 7.4 (push) Has been cancelled
PHP Lint & Codeception / PHP 8.0 (push) Has been cancelled
PHP Lint & Codeception / PHP 8.1 (push) Has been cancelled
PHP Lint & Codeception / PHP 8.2 (push) Has been cancelled
PHP Lint & Codeception / PHP 8.3 (push) Has been cancelled
PHP Lint & Codeception / PHP 8.4 (push) Has been cancelled

This commit is contained in:
Lastorder 2025-06-02 21:32:36 +09:00 committed by GitHub
commit 7fec210203
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 1133 additions and 909 deletions

View file

@ -467,7 +467,7 @@ class FileHandler
{ {
$K64 = 65536; $K64 = 65536;
$TWEAKFACTOR = 2.0; $TWEAKFACTOR = 2.0;
$channels = $imageInfo['channels']; $channels = $imageInfo['channels'] ?? 6;
if(!$channels) if(!$channels)
{ {
$channels = 6; //for png $channels = 6; //for png

View file

@ -15,7 +15,7 @@ class Image
*/ */
public static function isImage(string $filename): bool public static function isImage(string $filename): bool
{ {
return array_shift(explode('/', MIME::getContentType($filename))) === 'image'; return preg_match('!^image/!', MIME::getContentType($filename));
} }
/** /**

View file

@ -110,9 +110,10 @@ abstract class BaseParser
* @param \SimpleXMLElement $extra_vars * @param \SimpleXMLElement $extra_vars
* @param string $lang * @param string $lang
* @param string $type * @param string $type
* @param array $options
* @return object * @return object
*/ */
protected static function _getExtraVars(\SimpleXMLElement $extra_vars, string $lang, string $type = ''): \stdClass protected static function _getExtraVars(\SimpleXMLElement $extra_vars, string $lang, string $type = '', array $options = []): \stdClass
{ {
$result = new \stdClass; $result = new \stdClass;
@ -120,7 +121,7 @@ abstract class BaseParser
$group_name = $extra_vars->getName() === 'group' ? self::_getChildrenByLang($extra_vars, 'title', $lang) : null; $group_name = $extra_vars->getName() === 'group' ? self::_getChildrenByLang($extra_vars, 'title', $lang) : null;
foreach ($extra_vars->group ?: [] as $group) foreach ($extra_vars->group ?: [] as $group)
{ {
$group_result = self::_getExtraVars($group, $lang, $type); $group_result = self::_getExtraVars($group, $lang, $type, $options);
foreach ($group_result as $key => $val) foreach ($group_result as $key => $val)
{ {
$result->{$key} = $val; $result->{$key} = $val;
@ -172,13 +173,36 @@ abstract class BaseParser
{ {
$item->default = self::_getChildrenByLang($var, 'default', $lang); $item->default = self::_getChildrenByLang($var, 'default', $lang);
} }
$item->value = null; if ($type === 'skin')
{
$item->value = trim($var['value'] ?? '') ?: null;
if ($item->value && preg_match('/(,|\|@\|)/', $item->value ?? '', $delimiter))
{
$item->value = explode($delimiter[1], $item->value);
}
if ($item->type === 'mid_list' && !is_array($item->value))
{
$item->value = [$item->value];
}
}
else
{
$item->value = null;
}
// Options // Options
if ($var->options) if ($type === 'skin' && $options['version'] === '0.1')
{ {
$item->options = array(); $xml_options = $var->default ?? null;
foreach ($var->options as $option) }
else
{
$xml_options = $var->options ?? null;
}
if ($xml_options)
{
$item->options = [];
foreach ($xml_options as $option)
{ {
if ($type === 'widget' || $type === 'widgetstyle') if ($type === 'widget' || $type === 'widgetstyle')
{ {
@ -193,16 +217,58 @@ abstract class BaseParser
$item->init_options[$value] = true; $item->init_options[$value] = true;
} }
} }
elseif ($type === 'layout')
{
$option_item = new \stdClass;
if (!empty($option['src']))
{
$thumbnail_path = $options['layout_path'] . $option['src'];
if (file_exists($thumbnail_path))
{
$option_item->thumbnail = $thumbnail_path;
$item->thumbnail_exist = true;
}
}
$title = self::_getChildrenByLang($option, 'title', $lang);
$value = trim($option['value'] ?? '');
$option_item->val = $title;
$item->options[$value] = $option_item;
}
elseif ($type === 'skin' && $options['version'] === '0.1')
{
$option_item = new \stdClass;
$option_item->title = trim($option);
$option_item->value = trim($option);
$item->options[] = $option_item; // Numeric keys only
}
elseif ($type === 'skin' && $options['version'] === '0.2')
{
$option_item = new \stdClass;
$option_item->title = self::_getChildrenByLang($option, 'title', $lang);
$option_item->value = trim($option['value'] ?? '');
$item->options[] = $option_item; // Numeric keys only
}
else else
{ {
$option_item = new \stdClass; $option_item = new \stdClass;
$option_item->title = self::_getChildrenByLang($option, 'title', $lang); $option_item->title = self::_getChildrenByLang($option, 'title', $lang);
$option_item->value = trim($option['value'] ?? '') ?: trim($option->value ?? ''); $option_item->value = trim($option['value'] ?? '') ?: trim($option->value ?? '');
$item->options[$option_item->value] = $option_item; $item->options[trim($option_item->value ?? '')] = $option_item;
} }
} }
} }
// Other attributes
if ($type === 'skin' && $options['version'] === '0.1')
{
$item->width = intval($var['width'] ?? 0) ?: null;
$item->height = intval($var['height'] ?? 0) ?: null;
if (isset($item->options) && count($item->options))
{
$item->default = reset($item->options)->value;
}
}
// Add to list of variables // Add to list of variables
if ($type === 'widget' || $type === 'widgetstyle') if ($type === 'widget' || $type === 'widgetstyle')
{ {

View file

@ -286,6 +286,7 @@ class DBQueryParser extends BaseParser
$group->conditions = self::_parseConditions($tag); $group->conditions = self::_parseConditions($tag);
$group->pipe = strtoupper($attribs['pipe'] ?? '') ?: 'AND'; $group->pipe = strtoupper($attribs['pipe'] ?? '') ?: 'AND';
$group->ifvar = $attribs['if'] ?? null; $group->ifvar = $attribs['if'] ?? null;
$group->not_null = ($attribs['notnull'] ?? false) ? true : false;
$result[] = $group; $result[] = $group;
} }
elseif ($name === 'query') elseif ($name === 'query')

View file

@ -0,0 +1,128 @@
<?php
namespace Rhymix\Framework\Parsers;
/**
* Layout (info.xml) parser class for XE compatibility.
*/
class LayoutInfoParser extends BaseParser
{
/**
* Load an XML file.
*
* @param string $filename
* @param string $layout_name
* @param string $layout_path
* @param string $lang
* @return ?object
*/
public static function loadXML(string $filename, string $layout_name, string $layout_path, string $lang = ''): ?object
{
// Load the XML file.
$xml = simplexml_load_string(file_get_contents($filename));
if ($xml === false)
{
return null;
}
// Get the current language.
$lang = $lang ?: (\Context::getLangType() ?: 'en');
// Initialize the layout definition.
$info = new \stdClass;
$info->layout = $layout_name;
$info->type = trim($xml['type'] ?? '');
$info->path = $layout_path;
// Get the XML schema version.
$version = strval($xml['version']) ?: '0.1';
// Parse version 0.2
if ($version === '0.2')
{
$info->title = self::_getChildrenByLang($xml, 'title', $lang) ?: $layout_name;
$info->description = self::_getChildrenByLang($xml, 'description', $lang);
$info->version = trim($xml->version);
$info->date = ($xml->date === 'RX_CORE') ? '' : date('Ymd', strtotime($xml->date . 'T12:00:00Z'));
$info->homepage = trim($xml->link);
$info->license = trim($xml->license);
$info->license_link = trim($xml->license['link'] ?? '');
$info->author = array();
foreach ($xml->author as $author)
{
$author_info = new \stdClass;
$author_info->name = self::_getChildrenByLang($author, 'name', $lang);
$author_info->email_address = trim($author['email_address'] ?? '');
$author_info->homepage = trim($author['link'] ?? '');
$info->author[] = $author_info;
}
}
// Parse version 0.1
else
{
$info->title = self::_getChildrenByLang($xml, 'title', $lang) ?: $layout_name;
$info->description = self::_getChildrenByLang($xml->author, 'description', $lang);
$info->version = trim($xml['version'] ?? '');
$info->date = date('Ymd', strtotime($xml->author['date'] . 'T12:00:00Z'));
$info->homepage = trim($xml->link);
$info->license = trim($xml->license);
$info->license_link = trim($xml->license['link'] ?? '');
$info->author = array();
$author_info = new \stdClass;
$author_info->name = self::_getChildrenByLang($xml->author, 'name', $lang);
$author_info->email_address = trim($xml->author['email_address']);
$author_info->homepage = trim($xml->author['link'] ?? '');
$info->author[] = $author_info;
}
// Get extra_vars.
$info->extra_var_count = 0;
if ($xml->extra_vars)
{
$info->extra_var = self::_getExtraVars($xml->extra_vars, $lang, 'layout', ['layout_path' => $layout_path]);
}
else
{
$info->extra_var = new \stdClass;
}
// Count extra vars.
$info->extra_var_count = count(get_object_vars($info->extra_var));
// Get menus.
$info->menu_count = 0;
if (isset($xml->menus->menu))
{
$info->menu = new \stdClass;
foreach ($xml->menus->menu as $menu)
{
$menu_item = new \stdClass;
$menu_item->name = trim($menu['name'] ?? '');
$menu_item->title = self::_getChildrenByLang($menu, 'title', $lang);
$menu_item->maxdepth = intval($menu['maxdepth'] ?? 0);
$menu_item->menu_srl = null;
$menu_item->xml_file = '';
$menu_item->php_file = '';
$info->menu->{$menu_item->name} = $menu_item;
$info->menu_count++;
}
}
else
{
$info->menu = null;
}
$info->menu_name_list = null;
// Prepare additional fields that will be filled in later.
$info->site_srl = 0;
$info->layout_srl = 0;
$info->layout_title = '';
$info->header_script = '';
// Return the complete result.
return $info;
}
}

View file

@ -0,0 +1,122 @@
<?php
namespace Rhymix\Framework\Parsers;
/**
* Skin (info.xml) parser class for XE compatibility.
*/
class SkinInfoParser extends BaseParser
{
/**
* Load an XML file.
*
* @param string $filename
* @param string $skin_name
* @param string $skin_path
* @param string $lang
* @return ?object
*/
public static function loadXML(string $filename, string $skin_name, string $skin_path, string $lang = ''): ?object
{
// Load the XML file.
$xml = simplexml_load_string(file_get_contents($filename));
if ($xml === false)
{
return null;
}
// Get the current language.
$lang = $lang ?: (\Context::getLangType() ?: 'en');
// Initialize the layout definition.
$info = new \stdClass;
$info->skin = $skin_name;
$info->path = $skin_path;
// Get the XML schema version.
$version = strval($xml['version']) ?: '0.1';
// Parse version 0.2
if ($version === '0.2')
{
$info->title = self::_getChildrenByLang($xml, 'title', $lang) ?: $skin_name;
$info->description = self::_getChildrenByLang($xml, 'description', $lang);
$info->version = trim($xml->version);
$info->date = ($xml->date === 'RX_CORE') ? '' : date('Ymd', strtotime($xml->date . 'T12:00:00Z'));
$info->homepage = trim($xml->link);
$info->license = trim($xml->license);
$info->license_link = trim($xml->license['link'] ?? '');
$info->author = array();
foreach ($xml->author as $author)
{
$author_info = new \stdClass;
$author_info->name = self::_getChildrenByLang($author, 'name', $lang);
$author_info->email_address = trim($author['email_address'] ?? '');
$author_info->homepage = trim($author['link'] ?? '');
$info->author[] = $author_info;
}
}
// Parse version 0.1
else
{
$info->title = self::_getChildrenByLang($xml, 'title', $lang) ?: $skin_name;
$info->description = self::_getChildrenByLang($xml->maker, 'description', $lang);
$info->version = trim($xml['version'] ?? '');
$info->date = date('Ymd', strtotime($xml->maker['date'] . 'T12:00:00Z'));
$info->homepage = trim($xml->link);
$info->license = trim($xml->license);
$info->license_link = trim($xml->license['link'] ?? '');
$info->author = array();
$author_info = new \stdClass;
$author_info->name = self::_getChildrenByLang($xml->maker, 'name', $lang);
$author_info->email_address = trim($xml->maker['email_address']);
$author_info->homepage = trim($xml->maker['link'] ?? '');
$info->author[] = $author_info;
}
// Get extra_vars.
if ($xml->extra_vars)
{
$info->extra_vars = get_object_vars(self::_getExtraVars($xml->extra_vars, $lang, 'skin', ['version' => $version]));
}
else
{
$info->extra_vars = [];
}
// Get colorsets.
if ($xml->colorset && $xml->colorset->color)
{
$info->colorset = [];
foreach ($xml->colorset->color as $color)
{
$color_item = new \stdClass;
$color_item->name = trim($color['name'] ?? '');
$color_item->title = self::_getChildrenByLang($color, 'title', $lang);
$screenshot = trim($color['src'] ?? '');
if ($screenshot)
{
$screenshot = $info->path . $screenshot;
}
$color_item->screenshot = $screenshot;
$info->colorset[] = $color_item;
}
}
// Get thumbnail path.
if (file_exists($info->path . 'thumbnail.png'))
{
$info->thumbnail = $info->path . 'thumbnail.png';
}
else
{
$info->thumbnail = '';
}
// Return the complete result.
return $info;
}
}

View file

@ -10,4 +10,5 @@ class ConditionGroup
public $conditions = array(); public $conditions = array();
public $pipe = 'AND'; public $pipe = 'AND';
public $ifvar; public $ifvar;
public $not_null;
} }

View file

@ -580,6 +580,10 @@ class Query extends VariableBase
{ {
$result .= ($result === '' ? '' : (' ' . $condition->pipe . ' ')) . '(' . $condition_string . ')'; $result .= ($result === '' ? '' : (' ' . $condition->pipe . ' ')) . '(' . $condition_string . ')';
} }
elseif ($condition->not_null)
{
throw new \Rhymix\Framework\Exceptions\QueryError('Condition group marked as NOT NULL must contain at least one valid condition');
}
} }
// Simple condition // Simple condition

View file

@ -403,11 +403,18 @@ Rhymix.modal.close = function(id) {
*/ */
Rhymix.ajax = function(action, params, success, error) { Rhymix.ajax = function(action, params, success, error) {
// Extract action info // Extract module and act
let isFormData = params instanceof FormData;
let module, act;
if (!action) { if (!action) {
if (params instanceof FormData) { if (isFormData) {
action = (params.get('module') || params.get('mid')) + '.' + params.get('act'); module = params.get('module');
if (action === '.') { act = params.get('act');
if (module && act) {
action = module + '.' + act;
} else if (act) {
action = act;
} else {
action = null; action = null;
} }
} else { } else {
@ -416,13 +423,16 @@ Rhymix.ajax = function(action, params, success, error) {
} else { } else {
action = action.split('.'); action = action.split('.');
params = params || {}; params = params || {};
params.module = action[0]; params.module = module = action[0];
params.act = action[1]; params.act = act = action[1];
action = action.join('.'); action = action.join('.');
} }
// Add action to URL if the current rewrite level supports it // Add action to URL if the current rewrite level supports it
let url = this.URI(window.request_uri).pathname(); let url = this.URI(window.request_uri).pathname() + 'index.php';
if (act) {
url = url + '?act=' + act;
}
/* /*
if (this.getRewriteLevel() >= 2 && action !== null) { if (this.getRewriteLevel() >= 2 && action !== null) {
url = url + action.replace('.', '/'); url = url + action.replace('.', '/');
@ -431,31 +441,36 @@ Rhymix.ajax = function(action, params, success, error) {
} }
*/ */
// Add a CSRF token. // Add a CSRF token to the header, and remove it from the parameters
const headers = {}; const headers = {
if (action !== null) { 'X-CSRF-Token': getCSRFToken()
headers['X-CSRF-Token'] = getCSRFToken(); };
if (isFormData && params.has('_rx_csrf_token') && params.get('_rx_csrf_token') === headers['X-CSRF-Token']) {
params.delete('_rx_csrf_token');
}
if (typeof params._rx_csrf_token !== 'undefined' && params._rx_csrf_token === headers['X-CSRF-Token']) {
delete params._rx_csrf_token;
}
// Generate AJAX parameters
const args = {
type: 'POST',
dataType: 'json',
url: url,
data: isFormData ? params : JSON.stringify(params),
contentType: isFormData ? false : 'application/json; charset=UTF-8',
processData: false,
headers: headers,
success: function(data, textStatus, xhr) {
Rhymix._ajaxSuccessHandler(xhr, textStatus, action, data, params, success, error);
},
error: function(xhr, textStatus, errorThrown) {
Rhymix._ajaxErrorHandler(xhr, textStatus, action, url, params, success, error);
}
}; };
// Send the AJAX request // Send the AJAX request
try { try {
const args = {
type: 'POST',
dataType: 'json',
url: url,
data: params,
processData: (action !== null && !(params instanceof FormData)),
headers : headers,
success : function(data, textStatus, xhr) {
Rhymix.ajaxSuccessHandler(xhr, textStatus, action, data, params, success, error);
},
error : function(xhr, textStatus, errorThrown) {
Rhymix.ajaxErrorHandler(xhr, textStatus, action, url, params, success, error);
}
};
if (params instanceof FormData) {
args.contentType = false;
}
$.ajax(args); $.ajax(args);
} catch(e) { } catch(e) {
alert(e); alert(e);
@ -474,7 +489,7 @@ Rhymix.ajax = function(action, params, success, error) {
* @param function errror * @param function errror
* @return void * @return void
*/ */
Rhymix.ajaxSuccessHandler = function(xhr, textStatus, action, data, params, success, error) { Rhymix._ajaxSuccessHandler = function(xhr, textStatus, action, data, params, success, error) {
// Add debug information. // Add debug information.
if (data._rx_debug) { if (data._rx_debug) {
@ -541,7 +556,7 @@ Rhymix.ajaxSuccessHandler = function(xhr, textStatus, action, data, params, succ
* @param function errror * @param function errror
* @return void * @return void
*/ */
Rhymix.ajaxErrorHandler = function(xhr, textStatus, action, url, params, success, error) { Rhymix._ajaxErrorHandler = function(xhr, textStatus, action, url, params, success, error) {
// If the user is navigating away, don't do anything. // If the user is navigating away, don't do anything.
if (xhr.status == 0 && this.unloading) { if (xhr.status == 0 && this.unloading) {
@ -555,7 +570,7 @@ Rhymix.ajaxErrorHandler = function(xhr, textStatus, action, url, params, success
data = JSON.parse(xhr.responseText); data = JSON.parse(xhr.responseText);
} catch (e) { } } catch (e) { }
if (data && typeof data.error !== 'undefined') { if (data && typeof data.error !== 'undefined') {
this.ajaxSuccessHandler(xhr, textStatus, action, data, params, success, error); this._ajaxSuccessHandler(xhr, textStatus, action, data, params, success, error);
return; return;
} }
} }

View file

@ -574,7 +574,7 @@ function zgap($timestamp = null): int
*/ */
function ztime($str): ?int function ztime($str): ?int
{ {
$len = strlen($str); $len = strlen($str ?? '');
if (!$len) if (!$len)
{ {
return null; return null;

View file

@ -185,8 +185,8 @@ class Dashboard extends Base
$params["act"] = "getResourceapiLastupdate"; $params["act"] = "getResourceapiLastupdate";
$body = \XmlGenerater::generate($params); $body = \XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml"); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml");
$lUpdateDoc = \Rhymix\Framework\Parsers\XEXMLParser::loadXMLString($buff); $lUpdateDoc = simplexml_load_string($buff);
$updateDate = $lUpdateDoc->response->updatedate->body; $updateDate = trim($lUpdateDoc->updatedate);
if(!$updateDate) if(!$updateDate)
{ {

View file

@ -175,13 +175,12 @@ class ServerEnv extends Base
// Widgets // Widgets
$info[] = '[Widgets]'; $info[] = '[Widgets]';
$info['widget'] = array(); $info['widget'] = array();
$oWidgetModel = WidgetModel::getInstance(); $widget_list = WidgetModel::getDownloadedWidgetList() ?: array();
$widget_list = $oWidgetModel->getDownloadedWidgetList() ?: array();
foreach ($widget_list as $widget) foreach ($widget_list as $widget)
{ {
if (!in_array($widget->widget, $skip['widget'])) if (!in_array($widget->widget, $skip['widget']))
{ {
$widgetInfo = $oWidgetModel->getWidgetInfo($widget->widget); $widgetInfo = WidgetModel::getWidgetInfo($widget->widget);
if ($widgetInfo->version === 'RX_VERSION') if ($widgetInfo->version === 'RX_VERSION')
{ {
$info['widget'][] = $widget->widget; $info['widget'][] = $widget->widget;
@ -198,13 +197,12 @@ class ServerEnv extends Base
// Widgetstyles // Widgetstyles
$info[] = '[Widgetstyles]'; $info[] = '[Widgetstyles]';
$info['widgetstyle'] = array(); $info['widgetstyle'] = array();
$oWidgetModel = WidgetModel::getInstance(); $widgetstyle_list = WidgetModel::getDownloadedWidgetStyleList() ?: array();
$widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList() ?: array();
foreach ($widgetstyle_list as $widgetstyle) foreach ($widgetstyle_list as $widgetstyle)
{ {
if (!in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) if (!in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
{ {
$widgetstyleInfo = $oWidgetModel->getWidgetStyleInfo($widgetstyle->widgetStyle); $widgetstyleInfo = WidgetModel::getWidgetStyleInfo($widgetstyle->widgetStyle);
if ($widgetstyleInfo->version === 'RX_VERSION') if ($widgetstyleInfo->version === 'RX_VERSION')
{ {
$info['widgetstyle'][] = $widgetstyle->widgetStyle; $info['widgetstyle'][] = $widgetstyle->widgetStyle;

View file

@ -300,16 +300,32 @@ class Cleanup extends Base
'classes/db/DBSqlite3_pdo.class.php' => 'deleted:xe', 'classes/db/DBSqlite3_pdo.class.php' => 'deleted:xe',
'classes/db/queryparts/' => 'deleted:xe', 'classes/db/queryparts/' => 'deleted:xe',
'classes/object/BaseObject.class.php' => 'deleted:xe', 'classes/object/BaseObject.class.php' => 'deleted:xe',
'classes/security/conf/' => 'deleted:xe',
'classes/security/htmlpurifier/' => 'deleted:xe',
'classes/security/phphtmlparser/' => 'deleted:xe',
'classes/xml/XmlQueryParser.class.php' => 'deleted:xe', 'classes/xml/XmlQueryParser.class.php' => 'deleted:xe',
'classes/xml/xmlquery/' => 'deleted:xe', 'classes/xml/xmlquery/' => 'deleted:xe',
'common/css/mobile.css' => 'deleted',
'common/css/mobile.min.css' => 'deleted',
'common/css/rhymix.less' => 'deleted', 'common/css/rhymix.less' => 'deleted',
'common/css/xe.css' => 'deleted:xe',
'common/css/xe.min.css' => 'deleted:xe',
'common/framework/drivers/cache/wincache.php' => 'deleted', 'common/framework/drivers/cache/wincache.php' => 'deleted',
'common/framework/drivers/cache/xcache.php' => 'deleted', 'common/framework/drivers/cache/xcache.php' => 'deleted',
'common/img/flvplayer.swf' => 'deleted:xe', 'common/img/flvplayer.swf' => 'deleted:xe',
'common/js/URI.js' => 'moved:common/js/plugins/uri/URI.min.js',
'common/js/blankshield.min.js' => 'moved:common/js/plugins/blankshield/blankshield.min.js',
'common/js/html5.js' => 'deleted', 'common/js/html5.js' => 'deleted',
'common/js/jquery-1.12.4.min.js' => 'deleted', 'common/js/jquery-1.12.4.min.js' => 'deleted',
'common/js/jquery-1.12.4.js' => 'deleted', 'common/js/jquery-1.12.4.js' => 'deleted',
'common/js/jquery-1.x.js' => 'deleted',
'common/js/jquery-1.x.min.js' => 'deleted',
'common/js/jquery.js' => 'deleted',
'common/js/jquery.min.js' => 'deleted',
'common/js/respond.min.js' => 'deleted', 'common/js/respond.min.js' => 'deleted',
'common/js/x.min.js' => 'deleted',
'common/js/xe.js' => 'deleted:xe',
'common/js/xe.min.js' => 'deleted:xe',
'common/js/plugins/jquery.migrate/jquery-migrate-1.4.1.js' => 'deleted', 'common/js/plugins/jquery.migrate/jquery-migrate-1.4.1.js' => 'deleted',
'common/js/plugins/spectrum/bower.json' => 'deleted', 'common/js/plugins/spectrum/bower.json' => 'deleted',
'common/js/plugins/spectrum/Gruntfile.js' => 'deleted', 'common/js/plugins/spectrum/Gruntfile.js' => 'deleted',
@ -319,12 +335,22 @@ class Cleanup extends Base
'common/js/plugins/spectrum/docs/' => 'deleted', 'common/js/plugins/spectrum/docs/' => 'deleted',
'common/js/plugins/spectrum/example/' => 'deleted', 'common/js/plugins/spectrum/example/' => 'deleted',
'common/js/plugins/spectrum/test/' => 'deleted', 'common/js/plugins/spectrum/test/' => 'deleted',
'common/lang/lang.info' => 'deleted:xe',
'common/libraries/bmp.php' => 'deleted', 'common/libraries/bmp.php' => 'deleted',
'common/manual/server_config/rhymix-nginx-help.md' => 'deleted', 'common/manual/server_config/rhymix-nginx-help.md' => 'deleted',
'common/tpl/mobile_layout.html' => 'deleted:xe',
'common/tpl/redirect.html' => 'deleted:xe', 'common/tpl/redirect.html' => 'deleted:xe',
'common/tpl/sitelock.html' => 'deleted:xe',
'config/func.inc.php' => 'deleted:xe', 'config/func.inc.php' => 'deleted:xe',
'config/package.inc.php' => 'deleted:xe', 'config/package.inc.php' => 'deleted:xe',
'doxygen/' => 'deleted:xe', 'doxygen/' => 'deleted:xe',
'layouts/xedition/css/layout.min.css' => 'deleted',
'layouts/xedition/css/webfont.min.css' => 'deleted',
'layouts/xedition/css/welcome.min.css' => 'deleted',
'layouts/xedition/css/widget.login.min.css' => 'deleted',
'layouts/xedition/css/xeicon.min.css' => 'deleted',
'layouts/xedition/js/layout.min.js' => 'deleted',
'layouts/xedition/js/welcome.min.js' => 'deleted',
'libs/' => 'deleted:xe', 'libs/' => 'deleted:xe',
'modules/admin/ruleset/toggleFavorite.xml' => 'deleted', 'modules/admin/ruleset/toggleFavorite.xml' => 'deleted',
'modules/admin/tpl/config_ftp.html' => 'deleted', 'modules/admin/tpl/config_ftp.html' => 'deleted',
@ -335,6 +361,12 @@ class Cleanup extends Base
'modules/admin/tpl/img/bgDragable.gif' => 'deleted', 'modules/admin/tpl/img/bgDragable.gif' => 'deleted',
'modules/admin/tpl/img/faviconSample.png' => 'deleted', 'modules/admin/tpl/img/faviconSample.png' => 'deleted',
'modules/admin/tpl/img/mobiconSample.png' => 'deleted', 'modules/admin/tpl/img/mobiconSample.png' => 'deleted',
'modules/admin/tpl/check_env.html' => 'deleted',
'modules/admin/tpl/config_general.html' => 'deleted',
'modules/admin/tpl/css/admin.bootstrap.min.css' => 'deleted',
'modules/admin/tpl/css/admin_en.css' => 'deleted:xe',
'modules/admin/tpl/css/admin_jp.css' => 'deleted:xe',
'modules/admin/tpl/css/admin_ko.css' => 'deleted:xe',
'modules/autoinstall/ruleset/' => 'deleted:xe', 'modules/autoinstall/ruleset/' => 'deleted:xe',
'modules/autoinstall/tpl/filter/uninstall_package.xml' => 'deleted:xe', 'modules/autoinstall/tpl/filter/uninstall_package.xml' => 'deleted:xe',
'modules/board/board.wap.php' => 'deleted:xe', 'modules/board/board.wap.php' => 'deleted:xe',
@ -349,6 +381,13 @@ class Cleanup extends Base
'modules/counter/queries/updateSiteCounterUnique.xml' => 'deleted:xe', 'modules/counter/queries/updateSiteCounterUnique.xml' => 'deleted:xe',
'modules/counter/queries/updateSiteTotalCounterUnique.xml' => 'deleted:xe', 'modules/counter/queries/updateSiteTotalCounterUnique.xml' => 'deleted:xe',
'modules/editor/components/emoticon/tpl/popup.less' => 'deleted', 'modules/editor/components/emoticon/tpl/popup.less' => 'deleted',
'modules/editor/components/emoticon/tpl/popup.css' => 'deleted',
'modules/editor/components/image_gallery/tpl/gallery.min.js' => 'deleted',
'modules/editor/components/image_gallery/tpl/list_gallery.min.js' => 'deleted',
'modules/editor/components/image_gallery/tpl/popup.min.css' => 'deleted',
'modules/editor/components/image_gallery/tpl/popup.min.js' => 'deleted',
'modules/editor/components/image_gallery/tpl/slide_gallery.min.css' => 'deleted',
'modules/editor/components/image_gallery/tpl/slide_gallery.min.js' => 'deleted',
'modules/editor/skins/ckeditor/js/default.js' => 'deleted', 'modules/editor/skins/ckeditor/js/default.js' => 'deleted',
'modules/editor/skins/ckeditor/js/default.min.js' => 'deleted', 'modules/editor/skins/ckeditor/js/default.min.js' => 'deleted',
'modules/editor/skins/ckeditor/js/xe_interface.js' => 'deleted', 'modules/editor/skins/ckeditor/js/xe_interface.js' => 'deleted',
@ -357,13 +396,65 @@ class Cleanup extends Base
'modules/editor/skins/simpleeditor/css/simpleeditor.less' => 'deleted', 'modules/editor/skins/simpleeditor/css/simpleeditor.less' => 'deleted',
'modules/editor/skins/xpresseditor/' => 'deleted:xe', 'modules/editor/skins/xpresseditor/' => 'deleted:xe',
'modules/editor/styles/' => 'deleted:xe', 'modules/editor/styles/' => 'deleted:xe',
'modules/editor/tpl/js/editor.js' => 'deleted:xe',
'modules/editor/tpl/js/editor.min.js' => 'deleted:xe',
'modules/editor/tpl/js/swfupload.js' => 'deleted:xe',
'modules/editor/tpl/js/swfupload.min.js' => 'deleted:xe',
'modules/editor/tpl/js/uploader.js' => 'deleted:xe',
'modules/editor/tpl/js/uploader.min.js' => 'deleted:xe',
'modules/editor/tpl/preview.html' => 'deleted', 'modules/editor/tpl/preview.html' => 'deleted',
'modules/file/ruleset/imageResize.xml' => 'deleted', 'modules/file/ruleset/imageResize.xml' => 'deleted',
'modules/importer/tpl/js/importer_admin.min.js' => 'deleted',
'modules/install/ruleset/config.xml' => 'deleted:xe',
'modules/install/ruleset/cubrid.xml' => 'deleted:xe',
'modules/install/ruleset/firebird.xml' => 'deleted:xe',
'modules/install/ruleset/installFtpInfo.xml' => 'deleted:xe',
'modules/install/ruleset/mssql.xml' => 'deleted:xe',
'modules/install/ruleset/mysql.xml' => 'deleted:xe',
'modules/install/ruleset/postgresql.xml' => 'deleted:xe',
'modules/install/ruleset/sqlite.xml' => 'deleted:xe',
'modules/install/script/welcome_content/welcome_content_de.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_en.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_es.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_fr.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_jp.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_ko.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_mn.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_ru.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_tr.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_vi.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_zh-CN.html' => 'deleted',
'modules/install/script/welcome_content/welcome_content_zh-TW.html' => 'deleted',
'modules/install/tpl/admin_form.html' => 'deleted:xe',
'modules/install/tpl/after_upload_config_image.html' => 'deleted:xe',
'modules/install/tpl/config_form.html' => 'deleted:xe',
'modules/install/tpl/form.cubrid.html' => 'deleted:xe',
'modules/install/tpl/form.mssql.html' => 'deleted:xe',
'modules/install/tpl/form.mysql.html' => 'deleted:xe',
'modules/install/tpl/form.mysql_innodb.html' => 'deleted:xe',
'modules/install/tpl/form.mysqli.html' => 'deleted:xe',
'modules/install/tpl/form.mysqli_innodb.html' => 'deleted:xe',
'modules/install/tpl/ftp.html' => 'deleted:xe',
'modules/install/tpl/select_db.html' => 'deleted:xe',
'modules/install/tpl/js/install_admin.js' => 'deleted:xe',
'modules/integration_search/skins/default/trackback.html' => 'deleted', 'modules/integration_search/skins/default/trackback.html' => 'deleted',
'modules/member/skins/default/filter/find_member_account_by_question.xml' => 'deleted:xe',
'modules/module/schemas/site_admin.xml' => 'deleted', 'modules/module/schemas/site_admin.xml' => 'deleted',
'modules/module/tpl/css/module_admin.less' => 'deleted', 'modules/module/tpl/css/module_admin.less' => 'deleted',
'modules/page/page.wap.php' => 'deleted:xe', 'modules/page/page.wap.php' => 'deleted:xe',
'modules/page/tpl/css/mpage.css' => 'deleted', 'modules/page/tpl/css/mpage.css' => 'deleted',
'modules/poll/skins/default/css/poll.min.css' => 'deleted',
'modules/poll/skins/simple/css/poll.min.css' => 'deleted',
'modules/poll/tpl/css/poll.min.css' => 'deleted',
'modules/poll/tpl/js/poll.min.js' => 'deleted',
'modules/poll/tpl/js/poll_admin.min.js' => 'deleted',
'modules/rss/tpl/atom10.html' => 'deleted',
'modules/rss/tpl/display.html' => 'deleted',
'modules/rss/tpl/index.html' => 'deleted',
'modules/rss/tpl/rss10.html' => 'deleted',
'modules/rss/tpl/rss20.html' => 'deleted',
'modules/rss/tpl/top_refresh.html' => 'deleted',
'modules/rss/tpl/xe_rss.html' => 'deleted',
'modules/spamfilter/spamfilter.lib.php' => 'deleted', 'modules/spamfilter/spamfilter.lib.php' => 'deleted',
'modules/spamfilter/ruleset/' => 'deleted', 'modules/spamfilter/ruleset/' => 'deleted',
'phpDoc/' => 'deleted:xe', 'phpDoc/' => 'deleted:xe',

View file

@ -142,6 +142,9 @@ class BoardAdminView extends Board {
return $this->alertMessage('msg_invalid_request'); return $this->alertMessage('msg_invalid_request');
} }
// Fix missing module configuration values
BoardModel::fixModuleConfig($this->module_info);
// get the skins list // get the skins list
$oModuleModel = getModel('module'); $oModuleModel = getModel('module');
$skin_list = $oModuleModel->getSkins($this->module_path); $skin_list = $oModuleModel->getSkins($this->module_path);
@ -199,6 +202,10 @@ class BoardAdminView extends Board {
* additonal setup panel is for connecting the service modules with other modules * additonal setup panel is for connecting the service modules with other modules
**/ **/
function dispBoardAdminBoardAdditionSetup() { function dispBoardAdminBoardAdditionSetup() {
// Fix missing module configuration values
BoardModel::fixModuleConfig($this->module_info);
// sice content is obtained from other modules via call by reference, declare it first // sice content is obtained from other modules via call by reference, declare it first
$content = ''; $content = '';

View file

@ -20,6 +20,9 @@ class BoardController extends Board
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
// Fix any missing module configurations
BoardModel::fixModuleConfig($this->module_info);
// setup variables // setup variables
$obj = Context::getRequestVars(); $obj = Context::getRequestVars();
$obj->module_srl = $this->module_srl; $obj->module_srl = $this->module_srl;
@ -27,7 +30,7 @@ class BoardController extends Board
unset($obj->extra_vars); unset($obj->extra_vars);
// Remove disallowed Unicode symbols. // Remove disallowed Unicode symbols.
if ($this->module_info->filter_specialchars !== 'N') if ($this->module_info->filter_specialchars === 'Y')
{ {
if (isset($obj->title)) if (isset($obj->title))
{ {
@ -50,15 +53,15 @@ class BoardController extends Board
} }
// Return error if content is too large. // Return error if content is too large.
$document_length_limit = ($this->module_info->document_length_limit ?: 1024) * 1024; $document_length_limit = $this->module_info->document_length_limit * 1024;
if (strlen($obj->content) > $document_length_limit && !$this->grant->manager) if (strlen($obj->content) > $document_length_limit && !$this->grant->manager)
{ {
throw new Rhymix\Framework\Exception('msg_content_too_long'); throw new Rhymix\Framework\Exception('msg_content_too_long');
} }
// Return error if content conains excessively large data URLs. // Return error if content conains excessively large data URLs.
$inline_data_url_limit = ($this->module_info->inline_data_url_limit ?: 64) * 1024; $inline_data_url_limit = $this->module_info->inline_data_url_limit * 1024;
preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=%$!._-]+)!i', (string)$obj->content, $matches); preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=\%\$\!._-]+)!i', (string)$obj->content, $matches);
foreach ($matches[1] as $match) foreach ($matches[1] as $match)
{ {
if (strlen($match) > $inline_data_url_limit) if (strlen($match) > $inline_data_url_limit)
@ -85,7 +88,7 @@ class BoardController extends Board
$obj->category_srl = 0; $obj->category_srl = 0;
} }
} }
if (!$obj->category_srl && ($this->module_info->allow_no_category ?? 'N') !== 'Y') if (!$obj->category_srl && $this->module_info->allow_no_category !== 'Y')
{ {
if (!$this->grant->manager) if (!$this->grant->manager)
{ {
@ -113,7 +116,7 @@ class BoardController extends Board
$use_status = explode('|@|', $this->module_info->use_status); $use_status = explode('|@|', $this->module_info->use_status);
// Set status // Set status
if(($obj->is_secret == 'Y' || $obj->status == $secret_status) && is_array($use_status) && in_array($secret_status, $use_status)) if((($obj->is_secret ?? 'N') == 'Y' || $obj->status == $secret_status) && is_array($use_status) && in_array($secret_status, $use_status))
{ {
$obj->status = $secret_status; $obj->status = $secret_status;
} }
@ -135,7 +138,7 @@ class BoardController extends Board
$oDocument = DocumentModel::getDocument($obj->document_srl); $oDocument = DocumentModel::getDocument($obj->document_srl);
// Set anonymous information when insert mode or status is temp // Set anonymous information when insert mode or status is temp
if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || ($this->module_info->anonymous_except_admin ?? 'N') !== 'Y') && (!$oDocument->isExists() || $oDocument->get('status') == DocumentModel::getConfigStatus('temp'))) if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || $this->module_info->anonymous_except_admin === 'N') && (!$oDocument->isExists() || $oDocument->get('status') == DocumentModel::getConfigStatus('temp')))
{ {
if(!$obj->document_srl) if(!$obj->document_srl)
{ {
@ -143,7 +146,7 @@ class BoardController extends Board
} }
$manual = true; $manual = true;
$anonymous_name = $this->module_info->anonymous_name ?: 'anonymous'; $anonymous_name = $this->module_info->anonymous_name ?: BoardModel::DEFAULT_MODULE_CONFIG['anonymous_name'];
$anonymous_name = $this->createAnonymousName($anonymous_name, $logged_info->member_srl, $obj->document_srl); $anonymous_name = $this->createAnonymousName($anonymous_name, $logged_info->member_srl, $obj->document_srl);
$obj->notify_message = 'N'; $obj->notify_message = 'N';
@ -172,7 +175,7 @@ class BoardController extends Board
} }
// Protect admin document // Protect admin document
if ($this->module_info->protect_admin_content_update !== 'N') if ($this->module_info->protect_admin_content_update === 'Y')
{ {
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl')); $member_info = MemberModel::getMemberInfo($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')
@ -221,7 +224,14 @@ class BoardController extends Board
$obj->title_bold = $oDocument->get('title_bold'); $obj->title_bold = $oDocument->get('title_bold');
} }
$obj->reason_update = escape($obj->reason_update); if (isset($obj->reason_update))
{
$obj->reason_update = escape($obj->reason_update);
}
else
{
$obj->reason_update = '';
}
} }
// Update // Update
@ -361,6 +371,9 @@ class BoardController extends Board
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
// Fix any missing module configurations
BoardModel::fixModuleConfig($this->module_info);
// check protect content // check protect content
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_delete_content == 'Y') if($this->module_info->protect_content == 'Y' || $this->module_info->protect_delete_content == 'Y')
{ {
@ -370,7 +383,7 @@ class BoardController extends Board
} }
} }
if ($this->module_info->protect_admin_content_delete !== 'N' && $this->user->is_admin !== 'Y') if ($this->module_info->protect_admin_content_delete === 'Y' && $this->user->is_admin !== 'Y')
{ {
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl')); $member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
if($member_info->is_admin === 'Y') if($member_info->is_admin === 'Y')
@ -462,8 +475,11 @@ class BoardController extends Board
// Comments belong in the same module_srl as the document. // Comments belong in the same module_srl as the document.
$obj->module_srl = $oDocument->get('module_srl'); $obj->module_srl = $oDocument->get('module_srl');
// Fix any missing module configurations
BoardModel::fixModuleConfig($this->module_info);
// Remove disallowed Unicode symbols. // Remove disallowed Unicode symbols.
if ($this->module_info->filter_specialchars !== 'N') if ($this->module_info->filter_specialchars === 'Y')
{ {
if (isset($obj->content)) if (isset($obj->content))
{ {
@ -486,7 +502,7 @@ class BoardController extends Board
// Return error if content conains excessively large data URLs. // Return error if content conains excessively large data URLs.
$inline_data_url_limit = ($this->module_info->inline_data_url_limit ?: 64) * 1024; $inline_data_url_limit = ($this->module_info->inline_data_url_limit ?: 64) * 1024;
preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=%$!._-]+)!i', (string)$obj->content, $matches); preg_match_all('!src="\s*(data:[^,]*,[a-z0-9+/=\%\$\!._-]+)!i', (string)$obj->content, $matches);
foreach ($matches[1] as $match) foreach ($matches[1] as $match)
{ {
if (strlen($match) > $inline_data_url_limit) if (strlen($match) > $inline_data_url_limit)
@ -495,12 +511,14 @@ class BoardController extends Board
} }
} }
if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC'; if(!$this->module_info->use_status)
{
$this->module_info->use_status = 'PUBLIC';
}
if(!is_array($this->module_info->use_status)) if(!is_array($this->module_info->use_status))
{ {
$this->module_info->use_status = explode('|@|', $this->module_info->use_status); $this->module_info->use_status = explode('|@|', $this->module_info->use_status);
} }
if(in_array('SECRET', $this->module_info->use_status)) if(in_array('SECRET', $this->module_info->use_status))
{ {
$this->module_info->secret = 'Y'; $this->module_info->secret = 'Y';
@ -512,7 +530,7 @@ class BoardController extends Board
} }
// For anonymous use, remove writer's information and notifying information // For anonymous use, remove writer's information and notifying information
if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || ($this->module_info->anonymous_except_admin ?? 'N') !== 'Y')) if($this->module_info->use_anonymous == 'Y' && (!$this->grant->manager || $this->module_info->anonymous_except_admin === 'N'))
{ {
$obj->notify_message = 'N'; $obj->notify_message = 'N';
$obj->member_srl = -1*$logged_info->member_srl; $obj->member_srl = -1*$logged_info->member_srl;
@ -547,7 +565,7 @@ class BoardController extends Board
} }
} }
if ($this->module_info->protect_admin_content_update !== 'N') if ($this->module_info->protect_admin_content_update === 'Y')
{ {
$member_info = MemberModel::getMemberInfo($comment->member_srl); $member_info = MemberModel::getMemberInfo($comment->member_srl);
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
@ -563,7 +581,7 @@ class BoardController extends Board
$update_document = $this->module_info->update_order_on_comment === 'N' ? false : true; $update_document = $this->module_info->update_order_on_comment === 'N' ? false : true;
// Check parent comment. // Check parent comment.
if($obj->parent_srl) if (!empty($obj->parent_srl))
{ {
$parent_comment = CommentModel::getComment($obj->parent_srl); $parent_comment = CommentModel::getComment($obj->parent_srl);
if(!$parent_comment->comment_srl || $parent_comment->get('document_srl') != $oDocument->get('document_srl')) if(!$parent_comment->comment_srl || $parent_comment->get('document_srl') != $oDocument->get('document_srl'))
@ -651,6 +669,9 @@ class BoardController extends Board
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
// Fix any missing module configurations
BoardModel::fixModuleConfig($this->module_info);
$childs = null; $childs = null;
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false) if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
{ {
@ -661,7 +682,7 @@ class BoardController extends Board
} }
} }
if ($this->module_info->protect_admin_content_delete !== 'N' && $this->user->is_admin !== 'Y') if ($this->module_info->protect_admin_content_delete === 'Y' && $this->user->is_admin !== 'Y')
{ {
$member_info = MemberModel::getMemberInfo($comment->get('member_srl')); $member_info = MemberModel::getMemberInfo($comment->get('member_srl'));
if($member_info->is_admin === 'Y') if($member_info->is_admin === 'Y')

View file

@ -8,6 +8,101 @@
*/ */
class BoardModel extends Board class BoardModel extends Board
{ {
/**
* Default cofiguration for each module instance.
*/
public const DEFAULT_MODULE_CONFIG = [
// Title and SEO settings
'browser_title' => '',
'meta_keywords' => '',
'meta_description' => '',
'robots_tag' => 'all',
// PC and common display settings
'layout_srl' => -1,
'skin' => '/USE_DEFAULT/',
'list_count' => 20,
'search_list_count' => 20,
'page_count' => 10,
'header_text' => '',
'footer_text' => '',
// Mobile display settings
'use_mobile' => 'N',
'mlayout_srl' => -2,
'mskin' => '/USE_DEFAULT/',
'mobile_list_count' => 20,
'mobile_search_list_count' => 20,
'mobile_page_count' => 5,
'mobile_header_text' => '',
'mobile_footer_text' => '',
// List settings
'order_target' => 'list_order',
'order_type' => 'asc',
'except_notice' => 'Y',
'use_bottom_list' => 'Y',
'skip_bottom_list_for_olddoc' => 'N',
'skip_bottom_list_days' => 30,
'skip_bottom_list_for_robot' => 'Y',
// Feature settings
'consultation' => 'N',
'use_anonymous' => 'N',
'anonymous_except_admin' => 'N',
'anonymous_name' => 'anonymous',
'update_log' => 'N',
'update_order_on_comment' => 'N',
'comment_delete_message' => 'no',
'trash_use' => 'N',
'use_status' => 'PUBLIC',
'use_category' => 'N',
'allow_no_category' => 'N',
// Limits and protections
'document_length_limit' => 1024,
'comment_length_limit' => 128,
'inline_data_url_limit' => 64,
'filter_specialchars' => 'Y',
'protect_delete_content' => 'N',
'protect_update_content' => 'N',
'protect_delete_comment' => 'N',
'protect_update_comment' => 'N',
'protect_admin_content_delete' => 'Y',
'protect_admin_content_update' => 'Y',
'protect_document_regdate' => '',
'protect_comment_regdate' => '',
// Extra settings
'admin_mail' => '',
'module_category_srl' => 0,
'description' => '',
];
/**
* Fix module configuration so that there are no missing values.
*
* The return value will be set to true if any values were added.
* The object will be modified in place.
*
* @param object $module_info
* @return bool
*/
public static function fixModuleConfig(object $module_info): bool
{
$fixed = false;
foreach (self::DEFAULT_MODULE_CONFIG as $key => $value)
{
if (!isset($module_info->{$key}))
{
$module_info->{$key} = $value;
$fixed = true;
}
}
return $fixed;
}
/** /**
* @brief get the list configuration * @brief get the list configuration
*/ */

View file

@ -853,10 +853,13 @@ class BoardView extends Board
return $this->dispBoardMessage($this->user->isMember() ? 'msg_not_permitted' : 'msg_not_logged'); return $this->dispBoardMessage($this->user->isMember() ? 'msg_not_permitted' : 'msg_not_logged');
} }
// Fix any missing module configurations
BoardModel::fixModuleConfig($this->module_info);
/** /**
* check if the category option is enabled not not * check if the category option is enabled not not
*/ */
if($this->module_info->use_category=='Y') if ($this->module_info->use_category === 'Y')
{ {
// get the user group information // get the user group information
if(Context::get('is_logged')) if(Context::get('is_logged'))
@ -867,7 +870,6 @@ class BoardView extends Board
{ {
$group_srls = array(); $group_srls = array();
} }
$group_srls_count = count($group_srls);
// check the grant after obtained the category list // check the grant after obtained the category list
$category_list = array(); $category_list = array();
@ -917,9 +919,9 @@ class BoardView extends Board
$oDocument->add('origin_module_srl', $oDocument->get('module_srl')); $oDocument->add('origin_module_srl', $oDocument->get('module_srl'));
$oDocument->add('module_srl', $this->module_srl); $oDocument->add('module_srl', $this->module_srl);
if($oDocument->isExists()) if ($oDocument->isExists())
{ {
if(($this->module_info->protect_document_regdate ?? 0) > 0 && $this->grant->manager == false) if ($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{ {
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')))
{ {
@ -928,7 +930,7 @@ class BoardView extends Board
throw new Rhymix\Framework\Exception($massage); throw new Rhymix\Framework\Exception($massage);
} }
} }
if(($this->module_info->protect_content ?? 'N') === 'Y' || ($this->module_info->protect_update_content ?? 'N') == '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)
{ {
@ -936,7 +938,7 @@ class BoardView extends Board
} }
} }
if (($this->module_info->protect_admin_content_update ?? 'N') !== 'N') if ($this->module_info->protect_admin_content_update === 'Y')
{ {
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl')); $member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
if(isset($member_info->is_admin) && $member_info->is_admin == 'Y' && $this->user->is_admin != 'Y') if(isset($member_info->is_admin) && $member_info->is_admin == 'Y' && $this->user->is_admin != 'Y')
@ -1082,6 +1084,9 @@ class BoardView extends Board
} }
} }
// Fix any missing module configurations
BoardModel::fixModuleConfig($this->module_info);
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false) if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{ {
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')))
@ -1276,6 +1281,9 @@ class BoardView extends Board
} }
} }
// Fix any missing module configurations
BoardModel::fixModuleConfig($this->module_info);
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false) if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{ {
if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day'))) if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
@ -1360,6 +1368,9 @@ class BoardView extends Board
} }
} }
// Fix any missing module configurations
BoardModel::fixModuleConfig($this->module_info);
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false) if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{ {
if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day'))) if($oComment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))

View file

@ -28,15 +28,15 @@
<div class="x_control-group"> <div class="x_control-group">
<label for="include_days" class="x_control-label">{$lang->cmd_board_include_days}</label> <label for="include_days" class="x_control-label">{$lang->cmd_board_include_days}</label>
<div class="x_controls"> <div class="x_controls">
<input name="include_days" id="include_days" type="number" min="0" step="0.01" value="{$module_info->include_days ?: 0}" /> {$lang->unit_day} <input name="include_days" id="include_days" type="number" min="0" step="0.01" value="{$module_info->include_days ?? 0}" /> {$lang->unit_day}
<p class="x_help-block">{$lang->about_board_include_days}</p> <p class="x_help-block">{$lang->about_board_include_days}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->cmd_board_include_notice}</label> <label class="x_control-label">{$lang->cmd_board_include_notice}</label>
<div class="x_controls"> <div class="x_controls">
<label class="x_inline"><input name="include_notice" type="radio" value="Y" checked="checked"|cond="$module_info->include_notice !== 'N'" /> {$lang->cmd_yes} </label> <label class="x_inline"><input name="include_notice" type="radio" value="Y" checked="checked"|cond="!isset($module_info->include_notice) || $module_info->include_notice !== 'N'" /> {$lang->cmd_yes} </label>
<label class="x_inline"><input name="include_notice" type="radio" value="N" checked="checked"|cond="$module_info->include_notice === 'N'" /> {$lang->cmd_no} </label> <label class="x_inline"><input name="include_notice" type="radio" value="N" checked="checked"|cond="isset($module_info->include_notice) && $module_info->include_notice === 'N'" /> {$lang->cmd_no} </label>
</div> </div>
</div> </div>
<div class="btnArea"> <div class="btnArea">

View file

@ -9,7 +9,7 @@
<input type="hidden" name="act" value="procBoardAdminInsertBoard" /> <input type="hidden" name="act" value="procBoardAdminInsertBoard" />
<input type="hidden" name="page" value="{$page}" /> <input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="module_srl" value="{$module_info->module_srl}" /> <input type="hidden" name="module_srl" value="{$module_info->module_srl}" />
<input cond="$mid || $module_srl" type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" /> <input cond="!empty($mid) || !empty($module_srl)" type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
<input cond="$logged_info->is_admin != 'Y'" type="hidden" name="board_name" value="{$module_info->mid}" /> <input cond="$logged_info->is_admin != 'Y'" type="hidden" name="board_name" value="{$module_info->mid}" />
<input type="hidden" name="xe_validator_id" value="modules/board/tpl/board_insert/1" /> <input type="hidden" name="xe_validator_id" value="modules/board/tpl/board_insert/1" />
<section class="section"> <section class="section">
@ -38,7 +38,7 @@
<div class="x_controls"> <div class="x_controls">
<input type="text" name="browser_title" id="browser_title" value="{$module_info->browser_title}" class="lang_code" /> <input type="text" name="browser_title" id="browser_title" value="{$module_info->browser_title}" class="lang_code" />
<a href="#browser_title_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a> <a href="#browser_title_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="browser_title_help" class="x_help-block" hidden>{$lang->about_browser_title}</p> <p id="browser_title_help" class="x_help-block x_hide">{$lang->about_browser_title}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
@ -66,38 +66,38 @@
<div class="x_controls"> <div class="x_controls">
<select name="layout_srl" id="layout_srl"> <select name="layout_srl" id="layout_srl">
<option value="0">{$lang->notuse}</option> <option value="0">{$lang->notuse}</option>
<option loop="$layout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="$module_info->layout_srl== $val->layout_srl">{$val->title} ({$val->layout})</option> <option loop="$layout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="$module_info->layout_srl == $val->layout_srl">{$val->title} ({$val->layout})</option>
</select> </select>
<a href="#layout_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a> <a href="#layout_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="layout_help" class="x_help-block" hidden>{$lang->about_layout}</p> <p id="layout_help" class="x_help-block x_hide">{$lang->about_layout}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label" for="skin">{$lang->skin}</label> <label class="x_control-label" for="skin">{$lang->skin}</label>
<div class="x_controls"> <div class="x_controls">
<select name="skin" id="skin" style="width:auto"> <select name="skin" id="skin" style="width:auto">
<option loop="$skin_list=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->skin== $key || (!$module_info->skin && $key=='default')">{$val->title}</option> <option loop="$skin_list=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->skin == $key || (!$module_info->skin && $key == 'default')">{$val->title}</option>
</select> </select>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label" for="list_count">{$lang->list_count}</label> <label class="x_control-label" for="list_count">{$lang->list_count}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="list_count" id="list_count" value="{$module_info->list_count?$module_info->list_count:20}" /> <input type="number" min="1" name="list_count" id="list_count" value="{$module_info->list_count ?: BoardModel::DEFAULT_MODULE_CONFIG['list_count']}" />
<p class="x_help-inline">{$lang->about_list_count}</p> <p class="x_help-inline">{$lang->about_list_count}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label" for="search_list_count">{$lang->search_list_count}</label> <label class="x_control-label" for="search_list_count">{$lang->search_list_count}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="search_list_count" id="search_list_count" value="{$module_info->search_list_count?$module_info->search_list_count:20}" /> <input type="number" min="1" name="search_list_count" id="search_list_count" value="{$module_info->search_list_count ?: BoardModel::DEFAULT_MODULE_CONFIG['search_list_count']}" />
<p class="x_help-inline">{$lang->about_search_list_count}</p> <p class="x_help-inline">{$lang->about_search_list_count}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label" for="page_count">{$lang->page_count}</label> <label class="x_control-label" for="page_count">{$lang->page_count}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="page_count" id="page_count" value="{$module_info->page_count?$module_info->page_count:10}" /> <input type="number" min="1" name="page_count" id="page_count" value="{$module_info->page_count ?: BoardModel::DEFAULT_MODULE_CONFIG['page_count']}" />
<p class="x_help-inline">{$lang->about_page_count}</p> <p class="x_help-inline">{$lang->about_page_count}</p>
</div> </div>
</div> </div>
@ -138,40 +138,40 @@
<div class="x_controls"> <div class="x_controls">
<select name="mlayout_srl" id="mlayout_srl"> <select name="mlayout_srl" id="mlayout_srl">
<option value="0">{$lang->notuse}</option> <option value="0">{$lang->notuse}</option>
<option loop="$mlayout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="$module_info->mlayout_srl== $val->layout_srl">{$val->title} <block cond="$val->layout">({$val->layout})</block></option> <option loop="$mlayout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="$module_info->mlayout_srl == $val->layout_srl">{$val->title} <block cond="$val->layout">({$val->layout})</block></option>
</select> </select>
<a href="#mobile_layout_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a> <a href="#mobile_layout_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="mobile_layout_help" class="x_help-block" hidden>{$lang->about_layout}</p> <p id="mobile_layout_help" class="x_help-block x_hide">{$lang->about_layout}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label" for="mskin">{$lang->mobile_skin}</label> <label class="x_control-label" for="mskin">{$lang->mobile_skin}</label>
<div class="x_controls"> <div class="x_controls">
<select name="mskin" id="mskin"> <select name="mskin" id="mskin">
<option loop="$mskin_list=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->mskin== $key || (!$module_info->skin && $key=='default')">{$val->title}</option> <option loop="$mskin_list=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->mskin == $key || (!$module_info->skin && $key == 'default')">{$val->title}</option>
</select> </select>
<a href="#mobile_skin_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a> <a href="#mobile_skin_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="mobile_skin_help" class="x_help-block" hidden>{$lang->about_skin}</p> <p id="mobile_skin_help" class="x_help-block x_hide">{$lang->about_skin}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label" for="mobile_list_count">{$lang->list_count}</label> <label class="x_control-label" for="mobile_list_count">{$lang->list_count}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="mobile_list_count" id="mobile_list_count" value="{$module_info->mobile_list_count?$module_info->mobile_list_count:20}" /> <input type="number" min="1" name="mobile_list_count" id="mobile_list_count" value="{$module_info->mobile_list_count ?: BoardModel::DEFAULT_MODULE_CONFIG['mobile_list_count']}" />
<p class="x_help-inline">{$lang->about_list_count}</p> <p class="x_help-inline">{$lang->about_list_count}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label" for="mobile_search_list_count">{$lang->search_list_count}</label> <label class="x_control-label" for="mobile_search_list_count">{$lang->search_list_count}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="mobile_search_list_count" id="mobile_search_list_count" value="{$module_info->mobile_search_list_count?$module_info->mobile_search_list_count:20}" /> <input type="number" min="1" name="mobile_search_list_count" id="mobile_search_list_count" value="{$module_info->mobile_search_list_count ?: BoardModel::DEFAULT_MODULE_CONFIG['mobile_search_list_count']}" />
<p class="x_help-inline">{$lang->about_search_list_count}</p> <p class="x_help-inline">{$lang->about_search_list_count}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label" for="mobile_page_count">{$lang->page_count}</label> <label class="x_control-label" for="mobile_page_count">{$lang->page_count}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="mobile_page_count" id="mobile_page_count" value="{$module_info->mobile_page_count?$module_info->mobile_page_count:5}" /> <input type="number" min="1" name="mobile_page_count" id="mobile_page_count" value="{$module_info->mobile_page_count ?: BoardModel::DEFAULT_MODULE_CONFIG['mobile_page_count']}" />
<p class="x_help-inline">{$lang->about_mobile_page_count}</p> <p class="x_help-inline">{$lang->about_mobile_page_count}</p>
</div> </div>
</div> </div>
@ -201,7 +201,7 @@
<p style="padding:3px 0 0 0">{$lang->about_list_config}</p> <p style="padding:3px 0 0 0">{$lang->about_list_config}</p>
<div style="display:inline-block"> <div style="display:inline-block">
<select class="multiorder_show" size="8" multiple="multiple" style="width:220px;vertical-align:top;margin-bottom:8px"> <select class="multiorder_show" size="8" multiple="multiple" style="width:220px;vertical-align:top;margin-bottom:8px">
<option loop="$extra_vars => $key, $val" cond="!$list_config[$key]" value="{$key}">{Context::replaceUserLang($val->name)}</option> <option loop="$extra_vars => $key, $val" cond="empty($list_config[$key])" value="{$key}">{Context::replaceUserLang($val->name)}</option>
</select><br /> </select><br />
<button type="button" class="x_btn multiorder_add" style="vertical-align:top">{$lang->cmd_insert}</button> <button type="button" class="x_btn multiorder_add" style="vertical-align:top">{$lang->cmd_insert}</button>
</div> </div>
@ -224,9 +224,9 @@
<label class="x_control-label">{$lang->order_type}</label> <label class="x_control-label">{$lang->order_type}</label>
<div class="x_controls"> <div class="x_controls">
<select name="order_target" id="order_target" title="{$lang->order_target}"> <select name="order_target" id="order_target" title="{$lang->order_target}">
<option loop="$order_target=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->order_target== $key">{$val}</option> <option loop="$order_target=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->order_target == $key">{$val}</option>
<block cond="$extra_order_target"> <block cond="$extra_order_target">
<option loop="$extra_order_target=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->order_target== $key">{Context::replaceUserLang($val)}</option> <option loop="$extra_order_target=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->order_target == $key">{Context::replaceUserLang($val)}</option>
</block> </block>
</select> </select>
<select name="order_type" id="order_type" title="{$lang->order_type}"> <select name="order_type" id="order_type" title="{$lang->order_type}">
@ -293,28 +293,28 @@
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->anonymous_name}</label> <label class="x_control-label">{$lang->anonymous_name}</label>
<div class="x_controls"> <div class="x_controls">
<input type="text" name="anonymous_name" id="anonymous_name" value="{$module_info->anonymous_name ?: 'anonymous'}" /> <input type="text" name="anonymous_name" id="anonymous_name" value="{$module_info->anonymous_name ?: BoardModel::DEFAULT_MODULE_CONFIG['anonymous_name']}" />
<p class="x_help-block">{$lang->about_anonymous_name}</p> <p class="x_help-block">{$lang->about_anonymous_name}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->document_length_limit}</label> <label class="x_control-label">{$lang->document_length_limit}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="document_length_limit" id="document_length_limit" value="{$module_info->document_length_limit ?: 1024}" /> KB <input type="number" min="1" name="document_length_limit" id="document_length_limit" value="{$module_info->document_length_limit ?: BoardModel::DEFAULT_MODULE_CONFIG['document_length_limit']}" /> KB
<p class="x_help-block">{$lang->about_document_length_limit}</p> <p class="x_help-block">{$lang->about_document_length_limit}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->comment_length_limit}</label> <label class="x_control-label">{$lang->comment_length_limit}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="comment_length_limit" id="comment_length_limit" value="{$module_info->comment_length_limit ?: 128}" /> KB <input type="number" min="1" name="comment_length_limit" id="comment_length_limit" value="{$module_info->comment_length_limit ?: BoardModel::DEFAULT_MODULE_CONFIG['comment_length_limit']}" /> KB
<p class="x_help-block">{$lang->about_comment_length_limit}</p> <p class="x_help-block">{$lang->about_comment_length_limit}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->inline_data_url_limit}</label> <label class="x_control-label">{$lang->inline_data_url_limit}</label>
<div class="x_controls"> <div class="x_controls">
<input type="number" min="1" name="inline_data_url_limit" id="inline_data_url_limit" value="{$module_info->inline_data_url_limit ?: 64}" /> KB <input type="number" min="1" name="inline_data_url_limit" id="inline_data_url_limit" value="{$module_info->inline_data_url_limit ?: BoardModel::DEFAULT_MODULE_CONFIG['inline_data_url_limit']}" /> KB
<p class="x_help-block">{$lang->about_inline_data_url_limit}</p> <p class="x_help-block">{$lang->about_inline_data_url_limit}</p>
</div> </div>
</div> </div>
@ -424,7 +424,7 @@
<div class="x_controls"> <div class="x_controls">
<input type="text" name="admin_mail" id="admin_mail" value="{$module_info->admin_mail}" /> <input type="text" name="admin_mail" id="admin_mail" value="{$module_info->admin_mail}" />
<a href="#admin_mail_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a> <a href="#admin_mail_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="admin_mail_help" class="x_help-block" hidden>{$lang->about_admin_mail}</p> <p id="admin_mail_help" class="x_help-block x_hide">{$lang->about_admin_mail}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
@ -435,7 +435,7 @@
<option loop="$module_category => $key, $val" value="{$key}" selected="selected"|cond="$module_info->module_category_srl == $key">{$val->title}</option> <option loop="$module_category => $key, $val" value="{$key}" selected="selected"|cond="$module_info->module_category_srl == $key">{$val->title}</option>
</select> </select>
<a href="#module_category_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a> <a href="#module_category_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="module_category_help" class="x_help-block" hidden>{$lang->about_module_category}</p> <p id="module_category_help" class="x_help-block x_hide">{$lang->about_module_category}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
@ -443,7 +443,7 @@
<div class="x_controls"> <div class="x_controls">
<textarea name="description" id="description" rows="4" cols="42" placeholder="{$lang->about_description}" style="vertical-align:top">{$module_info->description}</textarea> <textarea name="description" id="description" rows="4" cols="42" placeholder="{$lang->about_description}" style="vertical-align:top">{$module_info->description}</textarea>
<a href="#description_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a> <a href="#description_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="description_help" class="x_help-block" hidden>{$lang->about_description}</p> <p id="description_help" class="x_help-block x_hide">{$lang->about_description}</p>
</div> </div>
</div> </div>
</section> </section>

View file

@ -2,15 +2,15 @@
<div class="x_page-header"> <div class="x_page-header">
<h1> <h1>
{$lang->board_management} {$lang->board_management}
<span class="path" cond="$module_info->mid"> <span class="path" cond="!empty($module_info->mid)">
&gt; <a href="{getSiteUrl($module_info->domain ?? '', '', 'mid', $module_info->mid)}" target="_blank"|cond="$module=='admin'">{$module_info->mid}<block cond="$module_info->is_default=='Y'">({$lang->is_default})</block></a> &gt; <a href="{getSiteUrl($module_info->domain ?? '', '', 'mid', $module_info->mid)}" target="_blank"|cond="Context::get('module') == 'admin'">{$module_info->mid}<block cond="$module_info->is_default == 'Y'">({$lang->is_default})</block></a>
</span> </span>
<a href="#aboutModule" data-toggle class="x_icon-question-sign">{$lang->help}</a> <a href="#aboutModule" data-toggle class="x_icon-question-sign">{$lang->help}</a>
</h1> </h1>
</div> </div>
<p class="x_alert x_alert-info" id="aboutModule" hidden>{$lang->about_board}</p> <p class="x_alert x_alert-info x_hide" id="aboutModule">{$lang->about_board}</p>
<ul class="x_nav x_nav-tabs" cond="$module_info && $act != 'dispBoardAdminContent' && $act != 'dispBoardAdminDeleteBoard'"> <ul class="x_nav x_nav-tabs" cond="$module_info && $act != 'dispBoardAdminContent' && $act != 'dispBoardAdminDeleteBoard'">
<li cond="$module=='admin'" class="x_active"|cond="$act=='dispBoardAdminContent'"><a href="{getUrl('act','dispBoardAdminContent','module_srl','', 'selected_var_idx', '', 'type', '')}">{$lang->cmd_board_list}</a></li> <li cond="Context::get('module') == 'admin'" class="x_active"|cond="$act=='dispBoardAdminContent'"><a href="{getUrl('act','dispBoardAdminContent','module_srl','', 'selected_var_idx', '', 'type', '')}">{$lang->cmd_board_list}</a></li>
<!--<li class="x_active" cond="$act=='dispBoardAdminInsertBoard'"><a href="{getUrl('act','dispBoardAdminInsertBoard', 'selected_var_idx', '', 'type', '')}">{$lang->cmd_create_board}</a></li>--> <!--<li class="x_active" cond="$act=='dispBoardAdminInsertBoard'"><a href="{getUrl('act','dispBoardAdminInsertBoard', 'selected_var_idx', '', 'type', '')}">{$lang->cmd_create_board}</a></li>-->
<li cond="$module_srl" class="x_active"|cond="$act=='dispBoardAdminBoardInfo'"><a href="{getUrl('act','dispBoardAdminBoardInfo', 'selected_var_idx', '', 'type', '')}">{$lang->cmd_board_info}</a></li> <li cond="$module_srl" class="x_active"|cond="$act=='dispBoardAdminBoardInfo'"><a href="{getUrl('act','dispBoardAdminBoardInfo', 'selected_var_idx', '', 'type', '')}">{$lang->cmd_board_info}</a></li>
<li cond="$module_srl" class="x_active"|cond="$act=='dispBoardAdminCategoryInfo'"><a href="{getUrl('act','dispBoardAdminCategoryInfo', 'selected_var_idx', '', 'type', '')}">{$lang->cmd_manage_category}</a></li> <li cond="$module_srl" class="x_active"|cond="$act=='dispBoardAdminCategoryInfo'"><a href="{getUrl('act','dispBoardAdminCategoryInfo', 'selected_var_idx', '', 'type', '')}">{$lang->cmd_manage_category}</a></li>

View file

@ -571,7 +571,7 @@ class CommentController extends Comment
$obj->comment_srl = intval($obj->comment_srl); $obj->comment_srl = intval($obj->comment_srl);
$obj->module_srl = intval($obj->module_srl); $obj->module_srl = intval($obj->module_srl);
$obj->document_srl = intval($obj->document_srl); $obj->document_srl = intval($obj->document_srl);
$obj->parent_srl = intval($obj->parent_srl); $obj->parent_srl = intval($obj->parent_srl ?? 0);
// Only managers can customize dates. // Only managers can customize dates.
$grant = Context::get('grant'); $grant = Context::get('grant');
@ -615,7 +615,7 @@ class CommentController extends Comment
} }
// even for manual_inserted if password exists, hash it. // even for manual_inserted if password exists, hash it.
if($obj->password) if(!empty($obj->password))
{ {
$obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm()); $obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm());
} }
@ -876,7 +876,7 @@ class CommentController extends Comment
$module_info = ModuleModel::getModuleInfoByDocumentSrl($obj->document_srl); $module_info = ModuleModel::getModuleInfoByDocumentSrl($obj->document_srl);
// If there is no problem to register comment then send an email to all admin were set in module admin panel // If there is no problem to register comment then send an email to all admin were set in module admin panel
if($module_info->admin_mail && $member_info->is_admin != 'Y') if(isset($module_info->admin_mail) && $module_info->admin_mail && $member_info->is_admin != 'Y')
{ {
$browser_title = Context::replaceUserLang($module_info->browser_title); $browser_title = Context::replaceUserLang($module_info->browser_title);
$mail_title = sprintf(lang('msg_comment_notify_mail'), $browser_title, cut_str($oDocument->getTitleText(), 20, '...')); $mail_title = sprintf(lang('msg_comment_notify_mail'), $browser_title, cut_str($oDocument->getTitleText(), 20, '...'));
@ -1007,12 +1007,12 @@ class CommentController extends Comment
return new BaseObject(-1, 'msg_not_permitted'); return new BaseObject(-1, 'msg_not_permitted');
} }
if($obj->password) if(!empty($obj->password))
{ {
$obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm()); $obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm());
} }
if($obj->homepage) if(!empty($obj->homepage))
{ {
$obj->homepage = escape($obj->homepage); $obj->homepage = escape($obj->homepage);
if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage)) if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
@ -1021,7 +1021,7 @@ class CommentController extends Comment
} }
} }
if(!$obj->content) if(!isset($obj->content) || !$obj->content)
{ {
$obj->content = $source_obj->get('content'); $obj->content = $source_obj->get('content');
} }
@ -1521,12 +1521,12 @@ class CommentController extends Comment
} }
// 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)
$commentSrlList = array();
$args = new stdClass(); $args = new stdClass();
$args->document_srl = $document_srl; $args->document_srl = $document_srl;
$comments = executeQueryArray('comment.getAllComments', $args); $comments = executeQueryArray('comment.getAllComments', $args);
if($comments->data) if($comments->data)
{ {
$commentSrlList = array();
foreach($comments->data as $comment) foreach($comments->data as $comment)
{ {
$commentSrlList[] = $comment->comment_srl; $commentSrlList[] = $comment->comment_srl;

View file

@ -612,17 +612,39 @@ class DocumentController extends Document
*/ */
function insertDocument($obj, $manual_inserted = false, $isRestore = false, $isLatest = true) function insertDocument($obj, $manual_inserted = false, $isRestore = false, $isLatest = true)
{ {
if(!$manual_inserted && !checkCSRF()) if (!$manual_inserted && !checkCSRF())
{ {
return new BaseObject(-1, 'msg_security_violation'); return new BaseObject(-1, 'msg_security_violation');
} }
// List variables // Comment status
if($obj->comment_status) $obj->commentStatus = $obj->comment_status; if (isset($obj->comment_status) && $obj->comment_status)
if(!$obj->commentStatus) $obj->commentStatus = 'DENY'; {
if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj); $obj->commentStatus = $obj->comment_status;
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; }
if($obj->homepage) if (!isset($obj->commentStatus) || !$obj->commentStatus)
{
$obj->commentStatus = 'DENY';
}
if ($obj->commentStatus === 'DENY')
{
$this->_checkCommentStatusForOldVersion($obj);
}
if (!isset($obj->allow_trackback) || $obj->allow_trackback !== 'Y')
{
$obj->allow_trackback = 'N';
}
if (!isset($obj->notify_message) || $obj->notify_message !== 'Y')
{
$obj->notify_message = 'N';
}
if (!isset($obj->email_address))
{
$obj->email_address = '';
}
if (!empty($obj->homepage))
{ {
$obj->homepage = escape($obj->homepage); $obj->homepage = escape($obj->homepage);
if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage)) if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
@ -631,20 +653,21 @@ class DocumentController extends Document
} }
} }
if($obj->notify_message != 'Y') $obj->notify_message = 'N'; if (!$isRestore)
if(!$obj->email_address) $obj->email_address = ''; {
if(!$isRestore) $obj->ipaddress = \RX_CLIENT_IP; $obj->ipaddress = \RX_CLIENT_IP;
}
$obj->isRestore = $isRestore ? true : false; $obj->isRestore = $isRestore ? true : false;
// Sanitize variables // Sanitize variables
$obj->document_srl = intval($obj->document_srl); $obj->document_srl = intval($obj->document_srl ?? 0);
$obj->category_srl = intval($obj->category_srl); $obj->category_srl = intval($obj->category_srl ?? 0);
$obj->module_srl = intval($obj->module_srl); $obj->module_srl = intval($obj->module_srl ?? 0);
// Default Status // Default Status
if($obj->status) if (isset($obj->status) && $obj->status)
{ {
if(!in_array($obj->status, $this->getStatusList())) if (!in_array($obj->status, $this->getStatusList()))
{ {
$obj->status = $this->getDefaultStatus(); $obj->status = $this->getDefaultStatus();
} }
@ -657,16 +680,16 @@ class DocumentController extends Document
// Check publish status // Check publish status
$is_publish = $obj->status !== 'TEMP'; $is_publish = $obj->status !== 'TEMP';
// can modify regdate only manager // Dates can only be manipulated by administrators.
$grant = Context::get('grant'); $grant = Context::get('grant');
if(!$grant->manager) if (!$grant->manager)
{ {
unset($obj->regdate); unset($obj->regdate);
unset($obj->last_update); unset($obj->last_update);
unset($obj->last_updater); unset($obj->last_updater);
} }
// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid // Serialize the $extra_vars, but avoid duplicate serialization.
if (!isset($obj->extra_vars)) if (!isset($obj->extra_vars))
{ {
$obj->extra_vars = new stdClass; $obj->extra_vars = new stdClass;
@ -749,18 +772,27 @@ class DocumentController extends Document
} }
// Set the read counts and update order. // Set the read counts and update order.
if(!$obj->readed_count) $obj->readed_count = 0; if (!isset($obj->readed_count))
if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1; {
else $obj->update_order = $obj->list_order; $obj->readed_count = 0;
}
if ($isLatest)
{
$obj->update_order = $obj->list_order = $obj->document_srl * -1;
}
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(!empty($obj->password) && !$obj->password_is_hashed)
{ {
$obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm()); $obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm());
} }
// If the tile is empty, extract string from the contents. // If the tile is empty, extract string from the contents.
$obj->title = escape($obj->title, false); $obj->title = escape($obj->title ?? '', false);
if ($obj->title === '') if ($obj->title === '')
{ {
$obj->title = escape(cut_str(trim(utf8_normalize_spaces(strip_tags($obj->content))), 20, '...'), false); $obj->title = escape(cut_str(trim(utf8_normalize_spaces(strip_tags($obj->content))), 20, '...'), false);
@ -1096,7 +1128,7 @@ class DocumentController extends Document
} }
// Hash the password if it exists // Hash the password if it exists
if($obj->password) if (!empty($obj->password))
{ {
$obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm()); $obj->password = \Rhymix\Framework\Password::hashPassword($obj->password, \Rhymix\Framework\Password::getBackwardCompatibleAlgorithm());
} }
@ -1331,7 +1363,7 @@ class DocumentController extends Document
if($obj->update_log_setting === 'Y') if($obj->update_log_setting === 'Y')
{ {
$obj->extra_vars = serialize($extra_vars); $obj->extra_vars = serialize($extra_vars);
if($this->grant->manager) if($grant->manager)
{ {
$obj->is_admin = 'Y'; $obj->is_admin = 'Y';
} }
@ -1399,13 +1431,13 @@ class DocumentController extends Document
$update_args->document_srl = $obj->document_srl; $update_args->document_srl = $obj->document_srl;
$update_args->update_member_srl = intval($logged_info->member_srl ?? 0); $update_args->update_member_srl = intval($logged_info->member_srl ?? 0);
$update_args->title = $obj->title; $update_args->title = $obj->title;
$update_args->title_bold = $obj->title_bold; $update_args->title_bold = $obj->title_bold ?? 'N';
$update_args->title_color = $obj->title_color; $update_args->title_color = $obj->title_color ?? null;
$update_args->content = $obj->content; $update_args->content = $obj->content;
$update_args->update_nick_name = strval($logged_info->nick_name ?? $obj->nick_name); $update_args->update_nick_name = strval($logged_info->nick_name ?? $obj->nick_name);
$update_args->tags = $obj->tags; $update_args->tags = $obj->tags;
$update_args->extra_vars = $obj->extra_vars; $update_args->extra_vars = $obj->extra_vars;
$update_args->reason_update = $obj->reason_update; $update_args->reason_update = $obj->reason_update ?? '';
$update_args->is_admin = $obj->is_admin; $update_args->is_admin = $obj->is_admin;
$update_output = executeQuery('document.insertDocumentUpdateLog', $update_args); $update_output = executeQuery('document.insertDocumentUpdateLog', $update_args);
@ -2740,7 +2772,7 @@ class DocumentController extends Document
if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','is_default','group_srls','category_color','mid'); if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','is_default','group_srls','category_color','mid');
$args->title = trim($args->category_title); $args->title = trim($args->category_title);
$args->description = trim($args->category_description); $args->description = trim($args->category_description);
$args->color = $args->category_color; $args->color = trim($args->category_color);
$args->expand = (isset($args->expand) && $args->expand === 'Y') ? 'Y' : 'N'; $args->expand = (isset($args->expand) && $args->expand === 'Y') ? 'Y' : 'N';
$args->is_default = (isset($args->is_default) && $args->is_default === 'Y') ? 'Y' : 'N'; $args->is_default = (isset($args->is_default) && $args->is_default === 'Y') ? 'Y' : 'N';

View file

@ -280,7 +280,10 @@ class EditorModel extends Editor
} }
FileController::setUploadInfo($option->editor_sequence, $upload_target_srl, $option->module_srl ?? 0, $upload_config); FileController::setUploadInfo($option->editor_sequence, $upload_target_srl, $option->module_srl ?? 0, $upload_config);
// Set editor mid // Set editor_mid, which may be different from current_mid on the client side.
// While current_mid follows the URL that the user is currently viewing,
// editor_mid unambiguously refers to the module to which files should be uploaded.
// This difference may be significant when a document from one module is shown in another module.
if (!empty($option->module_srl)) if (!empty($option->module_srl))
{ {
$option->mid = ModuleModel::getModuleInfoByModuleSrl($option->module_srl)->mid ?? null; $option->mid = ModuleModel::getModuleInfoByModuleSrl($option->module_srl)->mid ?? null;
@ -776,7 +779,7 @@ class EditorModel extends Editor
// if not inserted converter, Get converter from skin // if not inserted converter, Get converter from skin
if (!$converter) if (!$converter)
{ {
$converter = self::getSkinConfig($skin)->converter; $converter = self::getSkinConfig($skin)->converter ?? null;
} }
// if not inserted converter, Check // if not inserted converter, Check
@ -786,7 +789,7 @@ class EditorModel extends Editor
{ {
$converter = 'text'; $converter = 'text';
} }
elseif (strpos($type == 'comment' ? $config->sel_comment_editor_colorset : $config->sel_editor_colorset, 'nohtml') !== false) elseif (strpos($type == 'comment' ? ($config->sel_comment_editor_colorset ?? '') : ($config->sel_editor_colorset ?? ''), 'nohtml') !== false)
{ {
$converter = 'text'; $converter = 'text';
} }

View file

@ -147,8 +147,8 @@
<input type="radio" name="content_font" id="font_{$name}" value="{$detail}" checked="checked"|cond="$editor_config->content_font == $detail && $editor_config->font_defined != 'Y'" /> {$fontname_simplified} <input type="radio" name="content_font" id="font_{$name}" value="{$detail}" checked="checked"|cond="$editor_config->content_font == $detail && $editor_config->font_defined != 'Y'" /> {$fontname_simplified}
</label> </label>
<label> <label>
<input type="radio" class="fontSelector" name="font_defined" id="font_defined" value="Y" checked="checked"|cond="$editor_config->font_defined== 'Y'" /> {$lang->by_you} : <input type="radio" class="fontSelector" name="font_defined" id="font_defined" value="Y" checked="checked"|cond="isset($editor_config->font_defined) && $editor_config->font_defined == 'Y'" /> {$lang->by_you} :
<input type="text" name="content_font_defined" value="{$editor_config->content_font}"|cond="$editor_config->font_defined == 'Y'" /> <input type="text" name="content_font_defined" value="{$editor_config->content_font}"|cond="isset($editor_config->font_defined) && $editor_config->font_defined == 'Y'" />
</label> </label>
</td> </td>
</tr> </tr>

View file

@ -1,7 +1,7 @@
<input type="password" name="{{ $input_name }}" <input type="password" name="{{ $input_name }}"
id="{{ $input_id }}"|if="$input_id" class="password rx_ev_password" id="{{ $input_id }}"|if="$input_id" class="password rx_ev_password"
style="{{ $definition->style }}"|if="$definition->style" style="{{ $definition->style }}"|if="$definition->style"
value="{{ strval($value) !== '' ? $value : $default }}" value="{{ strval($value) !== '' ? $value : strval($default) }}"
@required(toBool($definition->is_required)) @required(toBool($definition->is_required))
@disabled(toBool($definition->is_disabled)) @disabled(toBool($definition->is_disabled))
@readonly(toBool($definition->is_readonly)) @readonly(toBool($definition->is_readonly))

View file

@ -2,7 +2,7 @@
<input type="url" name="{{ $input_name }}" <input type="url" name="{{ $input_name }}"
id="{{ $input_id }}"|if="$input_id" class="homepage rx_ev_url" id="{{ $input_id }}"|if="$input_id" class="homepage rx_ev_url"
style="{{ $definition->style }}"|if="$definition->style" style="{{ $definition->style }}"|if="$definition->style"
value="{{ strval($value) !== '' ? $value : $default }}" value="{{ strval($value) !== '' ? $value : strval($default) }}"
@required(toBool($definition->is_required)) @required(toBool($definition->is_required))
@disabled(toBool($definition->is_disabled)) @disabled(toBool($definition->is_disabled))
@readonly(toBool($definition->is_readonly)) @readonly(toBool($definition->is_readonly))
@ -11,7 +11,7 @@
<input type="email" name="{{ $input_name }}" <input type="email" name="{{ $input_name }}"
id="{{ $input_id }}"|if="$input_id" class="email_address rx_ev_email" id="{{ $input_id }}"|if="$input_id" class="email_address rx_ev_email"
style="{{ $definition->style }}"|if="$definition->style" style="{{ $definition->style }}"|if="$definition->style"
value="{{ strval($value) !== '' ? $value : $default }}" value="{{ strval($value) !== '' ? $value : strval($default) }}"
@required(toBool($definition->is_required)) @required(toBool($definition->is_required))
@disabled(toBool($definition->is_disabled)) @disabled(toBool($definition->is_disabled))
@readonly(toBool($definition->is_readonly)) @readonly(toBool($definition->is_readonly))
@ -20,7 +20,7 @@
<input type="number" name="{{ $input_name }}" <input type="number" name="{{ $input_name }}"
id="{{ $input_id }}"|if="$input_id" class="number rx_ev_number" id="{{ $input_id }}"|if="$input_id" class="number rx_ev_number"
style="{{ $definition->style }}"|if="$definition->style" style="{{ $definition->style }}"|if="$definition->style"
value="{{ strval($value) !== '' ? $value : $default }}" value="{{ strval($value) !== '' ? $value : strval($default) }}"
@required(toBool($definition->is_required)) @required(toBool($definition->is_required))
@disabled(toBool($definition->is_disabled)) @disabled(toBool($definition->is_disabled))
@readonly(toBool($definition->is_readonly)) @readonly(toBool($definition->is_readonly))
@ -29,7 +29,7 @@
<input type="text" name="{{ $input_name }}" <input type="text" name="{{ $input_name }}"
id="{{ $input_id }}"|if="$input_id" class="text rx_ev_text" id="{{ $input_id }}"|if="$input_id" class="text rx_ev_text"
style="{{ $definition->style }}"|if="$definition->style" style="{{ $definition->style }}"|if="$definition->style"
value="{{ strval($value) !== '' ? $value : $default }}" value="{{ strval($value) !== '' ? $value : strval($default) }}"
@required(toBool($definition->is_required)) @required(toBool($definition->is_required))
@disabled(toBool($definition->is_disabled)) @disabled(toBool($definition->is_disabled))
@readonly(toBool($definition->is_readonly)) @readonly(toBool($definition->is_readonly))

View file

@ -4,4 +4,4 @@
@required(toBool($definition->is_required)) @required(toBool($definition->is_required))
@disabled(toBool($definition->is_disabled)) @disabled(toBool($definition->is_disabled))
@readonly(toBool($definition->is_readonly)) @readonly(toBool($definition->is_readonly))
rows="8" cols="42">{{ $value !== null ? $value : $definition->getDefaultValue() }}</textarea> rows="8" cols="42">{{ $value !== null ? $value : strval($definition->getDefaultValue()) }}</textarea>

View file

@ -240,14 +240,21 @@ class FileAdminController extends File
if(!Context::get('use_image_default_file_config')) if(!Context::get('use_image_default_file_config'))
{ {
$config->use_image_default_file_config = 'N'; $config->use_image_default_file_config = 'N';
$config->image_autoconv['bmp2jpg'] = Context::get('image_autoconv_bmp2jpg') === 'Y' ? true : false; foreach (Context::get('image_autoconv') ?: [] as $source_type => $target_type)
$config->image_autoconv['png2jpg'] = Context::get('image_autoconv_png2jpg') === 'Y' ? true : false; {
$config->image_autoconv['webp2jpg'] = Context::get('image_autoconv_webp2jpg') === 'Y' ? true : false; if (in_array($target_type, ['Y', 'N']))
$config->image_autoconv['gif2mp4'] = Context::get('image_autoconv_gif2mp4') === 'Y' ? true : false; {
$config->image_autoconv[$source_type] = tobool($target_type);
}
elseif (in_array($target_type, ['', 'jpg', 'png', 'webp']))
{
$config->image_autoconv[$source_type] = $target_type;
}
}
$config->max_image_width = intval(Context::get('max_image_width')) ?: ''; $config->max_image_width = intval(Context::get('max_image_width')) ?: '';
$config->max_image_height = intval(Context::get('max_image_height')) ?: ''; $config->max_image_height = intval(Context::get('max_image_height')) ?: '';
$config->max_image_size_action = Context::get('max_image_size_action') ?: ''; $config->max_image_size_action = Context::get('max_image_size_action') ?: '';
$config->max_image_size_same_format = Context::get('max_image_size_same_format') === 'Y' ? 'Y' : 'N'; $config->max_image_size_same_format = strval(Context::get('max_image_size_same_format'));
$config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N'; $config->max_image_size_admin = Context::get('max_image_size_admin') === 'Y' ? 'Y' : 'N';
$config->image_quality_adjustment = max(50, min(100, intval(Context::get('image_quality_adjustment')))); $config->image_quality_adjustment = max(50, min(100, intval(Context::get('image_quality_adjustment'))));
$config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false; $config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false;

View file

@ -60,7 +60,7 @@ class FileController extends File
} }
// Handle chunking // Handle chunking
if (preg_match('!^bytes (\d+)-(\d+)/(\d+)$!', $_SERVER['HTTP_CONTENT_RANGE'], $matches)) if (preg_match('!^bytes (\d+)-(\d+)/(\d+)$!', $_SERVER['HTTP_CONTENT_RANGE'] ?? '', $matches))
{ {
// Check basic sanity // Check basic sanity
$chunk_start = intval($matches[1]); $chunk_start = intval($matches[1]);
@ -325,7 +325,7 @@ class FileController extends File
// Not allow the file outlink // Not allow the file outlink
$file_module_config = FileModel::getFileConfig($file_obj->module_srl); $file_module_config = FileModel::getFileConfig($file_obj->module_srl);
if($file_module_config->allow_outlink == 'N' && $_SERVER["HTTP_REFERER"]) if($file_module_config->allow_outlink == 'N' && !empty($_SERVER['HTTP_REFERER']))
{ {
// Handles extension to allow outlink // Handles extension to allow outlink
if($file_module_config->allow_outlink_format) if($file_module_config->allow_outlink_format)
@ -886,7 +886,7 @@ class FileController extends File
$file_info['name'] = Rhymix\Framework\Filters\FilenameFilter::clean($file_info['name']); $file_info['name'] = Rhymix\Framework\Filters\FilenameFilter::clean($file_info['name']);
$file_info['type'] = Rhymix\Framework\MIME::getContentType($file_info['tmp_name']); $file_info['type'] = Rhymix\Framework\MIME::getContentType($file_info['tmp_name']);
$file_info['original_type'] = $file_info['type']; $file_info['original_type'] = $file_info['type'];
$file_info['extension'] = strtolower(array_pop(explode('.', $file_info['name']))); $file_info['extension'] = strtolower(array_last(explode('.', $file_info['name'])));
$file_info['original_extension'] = $file_info['extension']; $file_info['original_extension'] = $file_info['extension'];
$file_info['width'] = null; $file_info['width'] = null;
$file_info['height'] = null; $file_info['height'] = null;

View file

@ -36,8 +36,21 @@ class FileView extends File
// Get file configurations of the module // Get file configurations of the module
$config = FileModel::getFileConfig($current_module_srl); $config = FileModel::getFileConfig($current_module_srl);
if (!isset($config->use_default_file_config))
{
$config->use_default_file_config = 'Y';
}
if (!isset($config->use_image_default_file_config))
{
$config->use_image_default_file_config = 'Y';
}
if (!isset($config->use_video_default_file_config))
{
$config->use_video_default_file_config = 'Y';
}
Context::set('config', $config); Context::set('config', $config);
Context::set('is_ffmpeg', function_exists('exec') && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command)); Context::set('is_ffmpeg', function_exists('exec') && !empty($config->ffmpeg_command) && Rhymix\Framework\Storage::isExecutable($config->ffmpeg_command) && !empty($config->ffprobe_command) && Rhymix\Framework\Storage::isExecutable($config->ffprobe_command));
Context::set('is_magick', function_exists('exec') && !empty($config->magick_command) && Rhymix\Framework\Storage::isExecutable($config->magick_command));
// Get a permission for group setting // Get a permission for group setting
$group_list = MemberModel::getGroups(); $group_list = MemberModel::getGroups();

View file

@ -55,19 +55,24 @@
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->image_autoconv}</label> <label class="x_control-label">{$lang->image_autoconv}</label>
<div class="x_controls"> <div class="x_controls">
<label for="image_autoconv_bmp2jpg"> {@ $source_types = ['bmp', 'jpg', 'png', 'webp', 'avif', 'heic']}
<input type="checkbox" name="image_autoconv_bmp2jpg" id="image_autoconv_bmp2jpg" value="Y" checked="checked"|cond="$config->image_autoconv['bmp2jpg']" disabled="disabled"|cond="!function_exists('imagebmp')" /> <!--@foreach($source_types as $source_type)-->
{$lang->image_autoconv_bmp2jpg} <div class="image_autoconv_types">
</label> <label for="image_autoconv_{$source_type}" class="x_inline">
<label for="image_autoconv_png2jpg"> {strtoupper($source_type)}
<input type="checkbox" name="image_autoconv_png2jpg" id="image_autoconv_png2jpg" value="Y" checked="checked"|cond="$config->image_autoconv['png2jpg']" disabled="disabled"|cond="!function_exists('imagepng')" /> </label>
{$lang->image_autoconv_png2jpg} <select name="image_autoconv[{$source_type}]" id="image_autoconv_{$source_type}" disabled="disabled"|cond="!$is_magick && in_array($source_type, ['avif', 'heic'])">
</label> <option value=""></option>
<label for="image_autoconv_webp2jpg"> <option value="jpg" selected="selected"|cond="($config->image_autoconv[$source_type] ?? '') === 'jpg' || !empty($config->image_autoconv[$source_type . '2jpg'])">JPG</option>
<input type="checkbox" name="image_autoconv_webp2jpg" id="image_autoconv_webp2jpg" value="Y" checked="checked"|cond="$config->image_autoconv['webp2jpg']" disabled="disabled"|cond="!function_exists('imagewebp')" /> <option value="png" selected="selected"|cond="($config->image_autoconv[$source_type] ?? '') === 'png'">PNG</option>
{$lang->image_autoconv_webp2jpg} <option value="webp" selected="selected"|cond="($config->image_autoconv[$source_type] ?? '') === 'webp'">WebP</option>
</label> </select>
<p class="x_help-block">{$lang->about_image_autoconv}</p> </div>
<!--@endforeach-->
<p class="x_help-block">
{$lang->about_image_autoconv}<br />
{$lang->msg_need_magick}
</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
@ -85,12 +90,16 @@
</p> </p>
<p class="x_help-block"> <p class="x_help-block">
<label class="x_inline" for="max_image_size_same_format_Y"> <label class="x_inline" for="max_image_size_same_format_Y">
<input type="radio" name="max_image_size_same_format" id="max_image_size_same_format_Y" value="Y" checked="checked"|cond="$config->max_image_size_same_format === 'Y'" /> <input type="radio" name="max_image_size_same_format" id="max_image_size_same_format_Y" value="Y" checked="checked"|cond="!isset($config->max_image_size_same_format) || $config->max_image_size_same_format === 'Y'" />
{$lang->max_image_size_same_format_Y} {$lang->max_image_size_same_format_Y}
</label> </label>
<label class="x_inline" for="max_image_size_same_format_N"> <label class="x_inline" for="max_image_size_same_format_to_jpg">
<input type="radio" name="max_image_size_same_format" id="max_image_size_same_format_N" value="N" checked="checked"|cond="$config->max_image_size_same_format !== 'Y'" /> <input type="radio" name="max_image_size_same_format" id="max_image_size_same_format_to_jpg" value="jpg" checked="checked"|cond="$config->max_image_size_same_format === 'jpg' || $config->max_image_size_same_format === 'N'" />
{$lang->max_image_size_same_format_N} {$lang->max_image_size_same_format_to_jpg}
</label>
<label class="x_inline" for="max_image_size_same_format_to_webp">
<input type="radio" name="max_image_size_same_format" id="max_image_size_same_format_to_webp" value="webp" checked="checked"|cond="$config->max_image_size_same_format === 'webp'" />
{$lang->max_image_size_same_format_to_webp}
</label> </label>
<label for="max_image_size_admin"> <label for="max_image_size_admin">
<input type="checkbox" name="max_image_size_admin" id="max_image_size_admin" value="Y" checked="checked"|cond="$config->max_image_size_admin === 'Y'" /> <input type="checkbox" name="max_image_size_admin" id="max_image_size_admin" value="Y" checked="checked"|cond="$config->max_image_size_admin === 'Y'" />
@ -144,11 +153,11 @@
<label class="x_control-label">{$lang->image_autoconv_gif2mp4}</label> <label class="x_control-label">{$lang->image_autoconv_gif2mp4}</label>
<div class="x_controls"> <div class="x_controls">
<label for="image_autoconv_gif2mp4_Y" class="x_inline"> <label for="image_autoconv_gif2mp4_Y" class="x_inline">
<input type="radio" name="image_autoconv_gif2mp4" id="image_autoconv_gif2mp4_Y" value="Y" checked="checked"|cond="$config->image_autoconv['gif2mp4'] === true" disabled="disabled"|cond="!$is_ffmpeg" /> <input type="radio" name="image_autoconv[gif2mp4]" id="image_autoconv_gif2mp4_Y" value="Y" checked="checked"|cond="$config->image_autoconv['gif2mp4'] === true" disabled="disabled"|cond="!$is_ffmpeg" />
{$lang->cmd_yes} {$lang->cmd_yes}
</label> </label>
<label for="image_autoconv_gif2mp4_N" class="x_inline"> <label for="image_autoconv_gif2mp4_N" class="x_inline">
<input type="radio" name="image_autoconv_gif2mp4" id="image_autoconv_gif2mp4_N" value="N" checked="checked"|cond="$config->image_autoconv['gif2mp4'] !== true" disabled="disabled"|cond="!$is_ffmpeg" /> <input type="radio" name="image_autoconv[gif2mp4]" id="image_autoconv_gif2mp4_N" value="N" checked="checked"|cond="$config->image_autoconv['gif2mp4'] !== true" disabled="disabled"|cond="!$is_ffmpeg" />
{$lang->cmd_no} {$lang->cmd_no}
</label> </label>
<p class="x_help-block">{$lang->about_image_autoconv_gif2mp4}</p> <p class="x_help-block">{$lang->about_image_autoconv_gif2mp4}</p>

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ruleset version="1.5.0">
<customrules>
</customrules>
<fields>
<field name="ftp_host" required="true" default="127.0.0.1" />
<field name="ftp_user" required="true" />
<field name="ftp_port" required="true" filter="number" default="21" />
<field name="ftp_root_path" required="true" />
<field name="sftp" required="true" />
</fields>
</ruleset>

View file

@ -1,56 +0,0 @@
<include target="header.html" />
<form id="body" action="./" method="post" onsubmit="return doInstallFTPInfo(this);" id="ftp_form">
<include target="progress_menu.html" />
<div id="content">
<h2>{$lang->install_progress_menu['ftp']}</h2>
<div class="x_control-group">
<label for="ftphost" class="x_control-label">{$lang->ftp_host}</label>
<div class="x_controls">
<input name="ftp_host" value="{$server_ip_address}" type="text" id="ftphost" />
</div>
</div>
<div class="x_control-group">
<label for="ftpport" class="x_control-label">{$lang->ftp_port}</label>
<div class="x_controls">
<input name="ftp_port" type="text" id="ftpport" value="21" />
</div>
</div>
<div class="x_control-group">
<label for="ftpid" class="x_control-label">{$lang->user_id}</label>
<div class="x_controls">
<input name="ftp_user" type="text" id="ftpid" class="focus" value="{$server_ftp_user}" />
</div>
</div>
<div class="x_control-group">
<label for="ftppw" class="x_control-label">{$lang->password}</label>
<div class="x_controls">
<input name="ftp_password" type="password" id="ftppw" value="" />
</div>
</div>
<div class="x_control-group">
<label for="ftppath" class="x_control-label">{$lang->msg_ftp_installed_ftp_realpath}</label>
<div class="x_controls">
<input name="ftp_root_path" value="{$ftp_info->ftp_root_path}" type="text" id="ftppath" />
</div>
</div>
<p class="install_help">{$lang->msg_ftp_installed_realpath}: {\RX_BASEDIR}</p>
<p>
<button type="button" class="x_btn x_btn-small" id="task-ftp-list" onclick="getFTPList();return false;">{$lang->ftp_get_list}</button>
<button type="button" class="x_btn x_btn-small x_btn-inverse" id="task-ftp-check" onclick="doCheckFTPInfo();return false">{$lang->cmd_check_ftp_connect}</button>
</p>
<ul id="ftplist"></ul>
<p class="install_help">{$lang->install_ftp_reason}</p>
</div>
<div id="buttons">
<div class="align-left">
<a href="{getUrl('', 'act','dispInstallCheckEnv')}" class="button grey">&laquo; {$lang->cmd_back}</a>
</div>
<div class="align-right">
<button type="submit" id="task-ftp-skip" value="">{$lang->cmd_pass_step} &raquo;</button>
<button type="submit" id="task-ftp-confirm" value="">{$lang->cmd_next} &raquo;</button>
</div>
</div>
</form>
<include target="footer.html" />

View file

@ -92,12 +92,17 @@ class LayoutAdminController extends Layout
// Consider the rest of items as extra vars, except module, act, layout_srl, layout, and title .. Some gurida .. // Consider the rest of items as extra vars, except module, act, layout_srl, layout, and title .. Some gurida ..
$extra_vars = Context::getRequestVars(); $extra_vars = Context::getRequestVars();
unset($extra_vars->module); unset($extra_vars->module);
unset($extra_vars->module);
unset($extra_vars->act); unset($extra_vars->act);
unset($extra_vars->layout_srl); unset($extra_vars->layout_srl);
unset($extra_vars->layout); unset($extra_vars->layout);
unset($extra_vars->title); unset($extra_vars->title);
unset($extra_vars->apply_layout); unset($extra_vars->apply_layout);
unset($extra_vars->apply_mobile_view); unset($extra_vars->apply_mobile_view);
unset($extra_vars->success_return_url);
unset($extra_vars->error_return_url);
unset($extra_vars->xe_validator_id);
unset($extra_vars->ruleset);
$is_sitemap = $extra_vars->is_sitemap; $is_sitemap = $extra_vars->is_sitemap;
unset($extra_vars->is_sitemap); unset($extra_vars->is_sitemap);

View file

@ -494,7 +494,7 @@ class LayoutModel extends Layout
$layout = $info->layout; $layout = $info->layout;
$layout_srl = $info->layout_srl; $layout_srl = $info->layout_srl;
$site_srl = $info->site_srl; $site_srl = $info->site_srl;
$vars = unserialize($info->extra_vars); $vars = $info->extra_vars ? unserialize($info->extra_vars) : null;
if($info->module_srl) if($info->module_srl)
{ {
@ -550,10 +550,19 @@ class LayoutModel extends Layout
if(file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file)) if(file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file))
{ {
// Read cache file in a way that is compatible with the old format.
// The old format sets $layout_info directly, while the new format returns an object.
$layout_info = new stdClass; $layout_info = new stdClass;
include($cache_file); if (is_object($output = include($cache_file)))
{
$layout_info = $output;
}
if (empty($layout_info->layout))
{
return;
}
if($layout_info->extra_var && $vars) if ($layout_info->extra_var && $vars)
{ {
foreach($vars as $key => $value) foreach($vars as $key => $value)
{ {
@ -563,252 +572,41 @@ class LayoutModel extends Layout
} }
} }
} }
if(!$layout_info->title)
{
$layout_info->title = $layout;
}
return $layout_info; return $layout_info;
} }
// If no cache file exists, parse the xml and then return the variable. // If no cache file exists, parse the xml and then return the variable.
$tmp_xml_obj = Rhymix\Framework\Parsers\XEXMLParser::loadXMLFile($xml_file); $xml_info = Rhymix\Framework\Parsers\LayoutInfoParser::loadXML($xml_file, $layout, $layout_path);
if (!$tmp_xml_obj) if (!$xml_info)
{ {
return; return;
} }
$xml_obj = !empty($tmp_xml_obj->layout) ? $tmp_xml_obj->layout : $tmp_xml_obj->skin; // Fill in user configuration
if (!$xml_obj) foreach ($xml_info->extra_var ?: [] as $key => $value)
{ {
return; if (isset($vars->{$key}))
}
$buff = array();
$buff[] = '$layout_info = new stdClass;';
$buff[] = sprintf('$layout_info->site_srl = %s;', var_export($site_srl ?? 0, true));
if($xml_obj->version && $xml_obj->attrs->version == '0.2')
{
// Layout title, version and other information
$date_obj = new stdClass;
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$buff[] = sprintf('$layout_info->layout = %s;', var_export($layout, true));
$buff[] = sprintf('$layout_info->type = %s;', var_export($xml_obj->attrs->type ?? null, true));
$buff[] = sprintf('$layout_info->path = %s;', var_export($layout_path, true));
$buff[] = sprintf('$layout_info->title = %s;', var_export($xml_obj->title->body ?? null, true));
$buff[] = sprintf('$layout_info->description = %s;', var_export($xml_obj->description->body ?? null, true));
$buff[] = sprintf('$layout_info->version = %s;', var_export($xml_obj->version->body ?? null, true));
$buff[] = sprintf('$layout_info->date = %s;', var_export($date, true));
$buff[] = sprintf('$layout_info->homepage = %s;', var_export($xml_obj->link->body ?? null, true));
$buff[] = sprintf('$layout_info->layout_srl = $layout_srl;');
$buff[] = sprintf('$layout_info->layout_title = $layout_title;');
$buff[] = sprintf('$layout_info->license = %s;', var_export($xml_obj->license->body ?? null, true));
$buff[] = sprintf('$layout_info->license_link = %s;', var_export($xml_obj->license->attrs->link ?? null, true));
$buff[] = sprintf('$layout_info->layout_type = %s;', var_export($layout_type, true));
// Author information
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
else $author_list = $xml_obj->author;
$buff[] = '$layout_info->author = array();';
for($i=0, $c=count($author_list); $i<$c; $i++)
{ {
$buff[] = sprintf('$layout_info->author[%d] = new stdClass;', $i); $value->value = $vars->{$key};
$buff[] = sprintf('$layout_info->author[%d]->name = %s;', $i, var_export($author_list[$i]->name->body, true));
$buff[] = sprintf('$layout_info->author[%d]->email_address = %s;', $i, var_export($author_list[$i]->attrs->email_address, true));
$buff[] = sprintf('$layout_info->author[%d]->homepage = %s;', $i, var_export($author_list[$i]->attrs->link, true));
}
// Extra vars (user defined variables to use in a template)
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
$buff[] = '$layout_info->extra_var = new stdClass;';
$extra_var_count = 0;
foreach($extra_var_groups as $group)
{
$extra_vars = $group->var;
if($extra_vars)
{
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
$count = count($extra_vars);
$extra_var_count += $count;
for($i=0;$i<$count;$i++)
{
unset($var, $options);
$var = $extra_vars[$i];
$name = $var->attrs->name;
$buff[] = sprintf('$layout_info->extra_var->%s = new stdClass;', $name);
$buff[] = sprintf('$layout_info->extra_var->%s->group = %s;', $name, var_export($group->title->body ?? null, true));
$buff[] = sprintf('$layout_info->extra_var->%s->title = %s;', $name, var_export($var->title->body ?? null, true));
$buff[] = sprintf('$layout_info->extra_var->%s->type = %s;', $name, var_export($var->attrs->type ?? null, true));
$buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s ?? null;', $name, $name);
$buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body ?? null, true));
$options = $var->options;
if(!$options) continue;
if(!is_array($options)) $options = array($options);
$buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name);
$options_count = count($options);
$thumbnail_exist = false;
for($j=0; $j < $options_count; $j++)
{
$buff[] = sprintf('$layout_info->extra_var->%s->options[%s] = new stdClass;', $var->attrs->name, var_export($options[$j]->attrs->value, true));
$thumbnail = $options[$j]->attrs->src;
if($thumbnail)
{
$thumbnail = $layout_path.$thumbnail;
if(file_exists($thumbnail))
{
$buff[] = sprintf('$layout_info->extra_var->%s->options[%s]->thumbnail = %s;', $var->attrs->name, var_export($options[$j]->attrs->value, true), var_export($thumbnail, true));
if(!$thumbnail_exist)
{
$buff[] = sprintf('$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name);
$thumbnail_exist = true;
}
}
}
$buff[] = sprintf('$layout_info->extra_var->%s->options[%s]->val = %s;', $var->attrs->name, var_export($options[$j]->attrs->value, true), var_export($options[$j]->title->body, true));
}
}
}
}
$buff[] = sprintf('$layout_info->extra_var_count = %d;', $extra_var_count);
// Menu
if($xml_obj->menus->menu)
{
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
$menu_count = count($menus);
$buff[] = sprintf('$layout_info->menu_count = %d;', $menu_count);
$buff[] = '$layout_info->menu = new stdClass;';
for($i=0;$i<$menu_count;$i++)
{
$name = $menus[$i]->attrs->name;
if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
$buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name);
$buff[] = sprintf('$layout_info->menu->%s->name = %s;', $name, var_export($menus[$i]->attrs->name, true));
$buff[] = sprintf('$layout_info->menu->%s->title = %s;', $name, var_export($menus[$i]->title->body, true));
$buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;', $name, var_export($menus[$i]->attrs->maxdepth, true));
$buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name);
$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name);
$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name);
}
} }
} }
else foreach ($xml_info->menu ?: [] as $key => $value)
{ {
// Layout title, version and other information if (isset($vars->{$key}) && $vars->{$key})
$date_obj = new stdClass;
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$buff[] = sprintf('$layout_info->layout = %s;', var_export($layout, true));
$buff[] = sprintf('$layout_info->path = %s;', var_export($layout_path, true));
$buff[] = sprintf('$layout_info->title = %s;', var_export($xml_obj->title->body ?? null, true));
$buff[] = sprintf('$layout_info->description = %s;', var_export($xml_obj->author->description->body ?? null, true));
$buff[] = sprintf('$layout_info->version = %s;', var_export($xml_obj->attrs->version ?? null, true));
$buff[] = sprintf('$layout_info->date = %s;', var_export($date, true));
$buff[] = sprintf('$layout_info->layout_srl = $layout_srl;');
$buff[] = sprintf('$layout_info->layout_title = $layout_title;');
// Author information
$buff[] = '$layout_info->author[0] = new stdClass();';
$buff[] = sprintf('$layout_info->author[0]->name = %s;', var_export($xml_obj->author->name->body ?? null, true));
$buff[] = sprintf('$layout_info->author[0]->email_address = %s;', var_export($xml_obj->author->attrs->email_address ?? null, true));
$buff[] = sprintf('$layout_info->author[0]->homepage = %s;', var_export($xml_obj->author->attrs->link ?? null, true));
// Extra vars (user defined variables to use in a template)
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
$extra_var_count = 0;
$buff[] = '$layout_info->extra_var = new stdClass;';
foreach($extra_var_groups as $group)
{ {
$extra_vars = $group->var; $value->menu_srl = $vars->{$key};
if($extra_vars) $value->xml_file = sprintf('./files/cache/menu/%s.xml.php', $vars->{$key});
{ $value->php_file = sprintf('./files/cache/menu/%s.php', $vars->{$key});
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
$count = count($extra_vars);
$extra_var_count += $count;
for($i=0;$i<$count;$i++)
{
unset($var, $options);
$var = $extra_vars[$i];
$name = $var->attrs->name;
$buff[] = sprintf('$layout_info->extra_var->%s = new stdClass();', $name);
$buff[] = sprintf('$layout_info->extra_var->%s->group = %s;', $name, var_export($group->title->body ?? null, true));
$buff[] = sprintf('$layout_info->extra_var->%s->title = %s;', $name, var_export($var->title->body ?? null, true));
$buff[] = sprintf('$layout_info->extra_var->%s->type = %s;', $name, var_export($var->attrs->type ?? null, true));
$buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s ?? null;', $name, $name);
$buff[] = sprintf('$layout_info->extra_var->%s->description = %s ?? null;', $name, var_export($var->description->body ?? null, true));
$options = $var->options;
if(!$options) continue;
if(!is_array($options)) $options = array($options);
$options_count = count($options);
for($j=0;$j<$options_count;$j++)
{
$buff[] = sprintf('$layout_info->extra_var->%s->options[%s] = new stdClass;', $var->attrs->name, var_export($options[$j]->value->body, true));
$buff[] = sprintf('$layout_info->extra_var->%s->options[%s]->val = %s;', $var->attrs->name, var_export($options[$j]->value->body, true), var_export($options[$j]->title->body, true));
}
}
}
}
$buff[] = sprintf('$layout_info->extra_var_count = %d;', $extra_var_count);
// Menu
if($xml_obj->menus->menu)
{
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
$menu_count = count($menus);
$buff[] = sprintf('$layout_info->menu_count = %d;', $menu_count);
$buff[] = '$layout_info->menu = new stdClass();';
for($i=0;$i<$menu_count;$i++)
{
$name = $menus[$i]->attrs->name;
if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true));
$buff[] = sprintf('$layout_info->menu->%s = new stdClass();', $name);
$buff[] = sprintf('$layout_info->menu->%s->name = %s;', $name, var_export($name, true));
$buff[] = sprintf('$layout_info->menu->%s->title = %s;', $name, var_export($menus[$i]->title->body ?? null, true));
$buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;', $name, var_export($menus[$i]->maxdepth->body ?? null, true));
$buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name);
$buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name);
$buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name);
}
} }
} }
// header_script
$layout_config = ModuleModel::getModulePartConfig('layout', $layout_srl); $layout_config = ModuleModel::getModulePartConfig('layout', $layout_srl);
$header_script = trim($layout_config->header_script ?? ''); $xml_info->header_script = trim($layout_config->header_script ?? '');
$xml_info->layout_srl = $layout_srl;
$xml_info->layout_title = $layout_title;
if(!empty($header_script)) Rhymix\Framework\Storage::writePHPData($cache_file, $xml_info, null, false);
{ return $xml_info;
$buff[] = sprintf(' $layout_info->header_script = %s; ', var_export($header_script, true));
}
FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff));
if(FileHandler::exists($cache_file)) include($cache_file);
if(!$layout_info->title)
{
$layout_info->title = $layout;
}
return $layout_info;
} }
/** /**

View file

@ -388,7 +388,11 @@ class Member extends ModuleObject
} }
if(!$oDB->isIndexExists('member_auth_mail', 'unique_auth_key')) if(!$oDB->isIndexExists('member_auth_mail', 'unique_auth_key'))
{ {
$oDB->addIndex('member_auth_mail', 'unique_auth_key', ['auth_key'], true); $output = $oDB->addIndex('member_auth_mail', 'unique_auth_key', ['auth_key'], true);
if (!$output->toBool())
{
return $output;
}
} }
if(!$oDB->isIndexExists('member_auth_mail', 'idx_member_srl')) if(!$oDB->isIndexExists('member_auth_mail', 'idx_member_srl'))
{ {

View file

@ -172,6 +172,7 @@ class ModuleAdminModel extends Module
$grant_list->manager->default = 'manager'; $grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list); Context::set('grant_list', $grant_list);
// Get a permission group granted to the current module // Get a permission group granted to the current module
$selected_group = array();
$default_grant = array(); $default_grant = array();
$args = new stdClass(); $args = new stdClass();
$args->module_srl = $module_srl; $args->module_srl = $module_srl;
@ -375,21 +376,24 @@ class ModuleAdminModel extends Module
$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
} }
if($skin_info->extra_vars) if($skin_info && $skin_info->extra_vars)
{ {
foreach($skin_info->extra_vars as $key => $val) foreach($skin_info->extra_vars as $key => $val)
{ {
$group = $val->group; $group = $val->group;
$name = $val->name; $name = $val->name;
$type = $val->type; $type = $val->type;
if($skin_vars[$name]) if (isset($skin_vars[$name]) && $skin_vars[$name])
{ {
$value = $skin_vars[$name]->value; $value = $skin_vars[$name]->value;
} }
else $value = ''; else
if($type=="checkbox")
{ {
$value = $value?unserialize($value):array(); $value = '';
}
if ($type === 'checkbox')
{
$value = $value ? unserialize($value) : [];
} }
$value = empty($value) ? $val->default : $value; $value = empty($value) ? $val->default : $value;

View file

@ -73,10 +73,8 @@ class Module extends ModuleObject
// Add domain_srl column // Add domain_srl column
if (!$oDB->isColumnExists('modules', 'domain_srl')) return true; if (!$oDB->isColumnExists('modules', 'domain_srl')) return true;
if (!$oDB->isIndexExists('modules', 'idx_domain_srl')) return true; if (!$oDB->isIndexExists('modules', 'idx_domain_srl')) return true;
if (!$oDB->isIndexExists('modules', 'idx_mid') && !$oDB->isIndexExists('modules', 'unique_mid')) if (!$oDB->isIndexExists('modules', 'unique_mid')) return true;
{ if ($oDB->isIndexExists('modules', 'idx_mid')) return true;
return true;
}
// check fix mskin // check fix mskin
if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true; if(!$oDB->isColumnExists("modules", "is_mskin_fix")) return true;
@ -206,11 +204,15 @@ class Module extends ModuleObject
// Try adding a unique index on mid, but fall back to a regular index if not possible. // Try adding a unique index on mid, but fall back to a regular index if not possible.
if (!$oDB->isIndexExists('modules', 'unique_mid')) if (!$oDB->isIndexExists('modules', 'unique_mid'))
{ {
$oDB->addIndex('modules', 'unique_mid', array('mid'), true); $output = $oDB->addIndex('modules', 'unique_mid', array('mid'), true);
if (!$output->toBool())
{
return $output;
}
} }
elseif (!$oDB->isIndexExists('modules', 'idx_mid')) if ($oDB->isIndexExists('modules', 'unique_mid') && $oDB->isIndexExists('modules', 'idx_mid'))
{ {
$oDB->addIndex('modules', 'idx_mid', array('mid')); $oDB->dropIndex('modules', 'idx_mid');
} }
// check ruleset directory // check ruleset directory
@ -247,8 +249,8 @@ class Module extends ModuleObject
} }
if(!$oDB->isIndexExists('module_part_config', 'unique_module_part_config')) if(!$oDB->isIndexExists('module_part_config', 'unique_module_part_config'))
{ {
$oDB->addIndex('module_part_config', 'unique_module_part_config', array('module', 'module_srl'), true); $output = $oDB->addIndex('module_part_config', 'unique_module_part_config', array('module', 'module_srl'), true);
if(!$oDB->isIndexExists('module_part_config', 'unique_module_part_config')) if (!$output->toBool())
{ {
$oDB->addIndex('module_part_config', 'unique_module_part_config', array('module', 'module_srl'), false); $oDB->addIndex('module_part_config', 'unique_module_part_config', array('module', 'module_srl'), false);
} }

View file

@ -424,14 +424,14 @@ class ModuleModel extends Module
* *
* @param stdClass $moduleInfo Module information * @param stdClass $moduleInfo Module information
*/ */
private static function _applyDefaultSkin(&$module_info) private static function _applyDefaultSkin($module_info)
{ {
if($module_info->is_skin_fix == 'N') if(isset($module_info->is_skin_fix) && $module_info->is_skin_fix == 'N')
{ {
$module_info->skin = '/USE_DEFAULT/'; $module_info->skin = '/USE_DEFAULT/';
} }
if($module_info->is_mskin_fix == 'N' && $module_info->mskin !== '/USE_RESPONSIVE/') if(isset($module_info->is_mskin_fix) && $module_info->is_mskin_fix == 'N' && $module_info->mskin !== '/USE_RESPONSIVE/')
{ {
$module_info->mskin = '/USE_DEFAULT/'; $module_info->mskin = '/USE_DEFAULT/';
} }
@ -529,6 +529,10 @@ class ModuleModel extends Module
foreach($target_module_info as $key => $val) foreach($target_module_info as $key => $val)
{ {
if (!isset($val->module_srl) || !$val->module_srl)
{
continue;
}
if (!isset($extra_vars[$val->module_srl])) if (!isset($extra_vars[$val->module_srl]))
{ {
continue; continue;
@ -1019,245 +1023,23 @@ class ModuleModel extends Module
public static function loadSkinInfo($path, $skin, $dir = 'skins') public static function loadSkinInfo($path, $skin, $dir = 'skins')
{ {
// Read xml file having skin information // Read xml file having skin information
if(substr($path,-1)!='/') $path .= '/'; if (!str_ends_with($path, '/'))
if(!preg_match('/^[a-zA-Z0-9_-]+$/', $skin ?? ''))
{ {
return; $path .= '/';
} }
$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); if (!preg_match('/^[a-zA-Z0-9_-]+$/', $skin ?? ''))
if(!file_exists($skin_xml_file))
{ {
return; return;
} }
// Create XmlParser object $skin_path = sprintf("%s%s/%s/", $path, $dir, $skin);
$_xml_obj = Rhymix\Framework\Parsers\XEXMLParser::loadXMLFile($skin_xml_file); $skin_xml_file = $skin_path . 'skin.xml';
// Return if no skin information is if (!file_exists($skin_xml_file))
if(!$_xml_obj->skin) return;
$xml_obj = $_xml_obj->skin;
// Skin Name
$skin_info = new stdClass();
$skin_info->title = $xml_obj->title->body;
$skin_info->author = array();
$skin_info->extra_vars = array();
$skin_info->colorset = array();
// Author information
if($xml_obj->version && $xml_obj->attrs->version == '0.2')
{ {
// skin format v0.2 return;
$date_obj = (object)array('y' => 0, 'm' => 0, 'd' => 0);
sscanf($xml_obj->date->body ?? null, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$skin_info->version = $xml_obj->version->body ?? null;
$skin_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$skin_info->homepage = $xml_obj->link->body ?? null;
$skin_info->license = $xml_obj->license->body ?? null;
$skin_info->license_link = $xml_obj->license->attrs->link ?? null;
$skin_info->description = $xml_obj->description->body ?? null;
if(!is_array($xml_obj->author ?? null)) $author_list = array($xml_obj->author);
else $author_list = $xml_obj->author;
foreach($author_list as $author)
{
$author_obj = new stdClass();
$author_obj->name = $author->name->body ?? null;
$author_obj->email_address = $author->attrs->email_address ?? null;
$author_obj->homepage = $author->attrs->link ?? null;
$skin_info->author[] = $author_obj;
}
// List extra vars
if($xml_obj->extra_vars)
{
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
foreach($extra_var_groups as $group)
{
$extra_vars = $group->var;
if(!$extra_vars)
{
continue;
}
if(!is_array($group->var))
{
$extra_vars = array($group->var);
}
foreach($extra_vars as $key => $val)
{
$obj = new stdClass;
$obj->group = $group->title->body ?? null;
$obj->name = $val->attrs->name ?? null;
$obj->title = $val->title->body ?? null;
$obj->type = ($val->attrs->type ?? null) ?: 'text';
$obj->description = $val->description->body ?? null;
$obj->value = $val->attrs->value ?? null;
$obj->default = $val->attrs->default ?? null;
if(preg_match('/,|\|@\|/', $obj->value ?? '', $delimiter) && $delimiter[0])
{
$obj->value = explode($delimiter[0], $obj->value);
}
if($obj->type == 'mid_list' && !is_array($obj->value))
{
$obj->value = array($obj->value);
}
// Get an option list from 'select'type
if(is_array($val->options))
{
$option_count = count($val->options);
for($i = 0; $i < $option_count; $i++)
{
$obj->options[$i] = new stdClass();
$obj->options[$i]->title = $val->options[$i]->title->body ?? null;
$obj->options[$i]->value = $val->options[$i]->attrs->value ?? null;
}
}
else
{
$obj->options[0] = new stdClass();
$obj->options[0]->title = $val->options->title->body ?? null;
$obj->options[0]->value = $val->options->attrs->value ?? null;
}
$skin_info->extra_vars[] = $obj;
}
}
}
}
else
{
// skin format v0.1
$date_obj = (object)array('y' => 0, 'm' => 0, 'd' => 0);
if (isset($xml_obj->maker->attrs->date))
{
sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
}
$skin_info->version = $xml_obj->version->body ?? null;
$skin_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$skin_info->homepage = $xml_obj->link->body ?? null;
$skin_info->license = $xml_obj->license->body ?? null;
$skin_info->license_link = $xml_obj->license->attrs->link ?? null;
$skin_info->description = $xml_obj->maker->description->body ?? null;
$skin_info->author[0] = new stdClass();
$skin_info->author[0]->name = $xml_obj->maker->name->body ?? null;
$skin_info->author[0]->email_address = $xml_obj->maker->attrs->email_address ?? null;
$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link ?? null;
// Variables used in the skin
$extra_var_groups = $xml_obj->extra_vars->group ?? null;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars ?? null;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
foreach($extra_var_groups as $group)
{
$extra_vars = $group->var ?? null;
if($extra_vars)
{
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
foreach($extra_vars as $var)
{
$options = array();
$group = $group->title->body;
$name = $var->attrs->name;
$type = $var->attrs->type;
$title = $var->title->body;
$description = $var->description->body;
// Get an option list from 'select'type.
if(is_array($var->default))
{
$option_count = count($var->default);
for($i = 0; $i < $option_count; $i++)
{
$options[$i] = new stdClass();
$options[$i]->title = $var->default[$i]->body;
$options[$i]->value = $var->default[$i]->body;
}
}
else
{
$options[0] = new stdClass();
$options[0]->title = $var->default->body;
$options[0]->value = $var->default->body;
}
$width = $var->attrs->width;
$height = $var->attrs->height;
$obj = new stdClass();
$obj->group = $group;
$obj->title = $title;
$obj->description = $description;
$obj->name = $name;
$obj->type = $type;
$obj->options = $options;
$obj->width = $width;
$obj->height = $height;
$obj->default = $options[0]->value;
$skin_info->extra_vars[] = $obj;
}
}
}
} }
// colorset $skin_info = Rhymix\Framework\Parsers\SkinInfoParser::loadXML($skin_xml_file, $skin, $skin_path);
$colorset = $xml_obj->colorset->color ?? null;
if($colorset)
{
if(!is_array($colorset)) $colorset = array($colorset);
foreach($colorset as $color)
{
$name = $color->attrs->name;
$title = $color->title->body;
$screenshot = $color->attrs->src;
if($screenshot)
{
$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
if(!file_exists($screenshot)) $screenshot = "";
}
else $screenshot = "";
$obj = new stdClass();
$obj->name = $name;
$obj->title = $title;
$obj->screenshot = $screenshot;
$skin_info->colorset[] = $obj;
}
}
// Menu type (settings for layout)
if($xml_obj->menus->menu ?? null)
{
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
$menu_count = count($menus);
$skin_info->menu_count = $menu_count;
for($i=0;$i<$menu_count;$i++)
{
unset($obj);
$obj->name = $menus[$i]->attrs->name;
if($menus[$i]->attrs->default == "true") $obj->default = true;
$obj->title = $menus[$i]->title->body;
$obj->maxdepth = $menus[$i]->maxdepth->body;
$skin_info->menu->{$obj->name} = $obj;
}
}
$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
return $skin_info; return $skin_info;
} }
@ -2421,8 +2203,7 @@ class ModuleModel extends Module
$param = explode("=",$param); $param = explode("=",$param);
if($param[0] == 'selected_widget') $selected_widget = $param[1]; if($param[0] == 'selected_widget') $selected_widget = $param[1];
} }
$oWidgetModel = getModel('widget'); if($selected_widget) $widget_info = WidgetModel::getWidgetInfo($selected_widget);
if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
$output = self::getModuleFileBoxList(); $output = self::getModuleFileBoxList();

View file

@ -58,16 +58,16 @@
<label for="{$grant_name}_default" class="x_control-label">{$grant_item->title}</label> <label for="{$grant_name}_default" class="x_control-label">{$grant_item->title}</label>
<div class="x_controls"> <div class="x_controls">
<select name="{$grant_name}_default" id="{$grant_name}_default" class="grant_default"> <select name="{$grant_name}_default" id="{$grant_name}_default" class="grant_default">
<option value="0" <!--@if($default_grant[$grant_name]=='all')-->selected="selected"<!--@end-->>{$lang->grant_to_all}</option> <option value="0" <!--@if(($default_grant[$grant_name] ?? '') == 'all')-->selected="selected"<!--@end-->>{$lang->grant_to_all}</option>
<option value="-1" <!--@if($default_grant[$grant_name]=='member' || $default_grant[$grant_name]=='site')-->selected="selected"<!--@end-->>{$lang->grant_to_login_user}</option> <option value="-1" <!--@if(($default_grant[$grant_name] ?? '') == 'member' || ($default_grant[$grant_name] ?? '') == 'site')-->selected="selected"<!--@end-->>{$lang->grant_to_login_user}</option>
<option value="-4" <!--@if($default_grant[$grant_name]=='not_member')-->selected="selected"<!--@end-->>{$lang->grant_to_non_login_user}</option> <option value="-4" <!--@if(($default_grant[$grant_name] ?? '') == 'not_member')-->selected="selected"<!--@end-->>{$lang->grant_to_non_login_user}</option>
<option value="-3" <!--@if($default_grant[$grant_name]=='manager')-->selected="selected"<!--@end-->>{$lang->grant_to_admin}</option> <option value="-3" <!--@if(($default_grant[$grant_name] ?? '') == 'manager')-->selected="selected"<!--@end-->>{$lang->grant_to_admin}</option>
<option value="" <!--@if($default_grant[$grant_name]=='group')-->selected="selected"<!--@end-->>{$lang->grant_to_group}</option> <option value="" <!--@if(($default_grant[$grant_name] ?? '') == 'group')-->selected="selected"<!--@end-->>{$lang->grant_to_group}</option>
</select> </select>
<div id="zone_{$grant_name}" hidden style="margin:8px 0 0 0"> <div id="zone_{$grant_name}" hidden style="margin:8px 0 0 0">
<!--@foreach($group_list as $group_srl => $group_item)--> <!--@foreach($group_list as $group_srl => $group_item)-->
<label for="grant_{$grant_name}_{$group_srl}" class="x_inline"> <label for="grant_{$grant_name}_{$group_srl}" class="x_inline">
<input type="checkbox" class="checkbox" name="{$grant_name}" value="{$group_item->group_srl}" id="grant_{$grant_name}_{$group_srl}" checked="checked"|cond="is_array($selected_group[$grant_name])&&in_array($group_srl,$selected_group[$grant_name])" /> <input type="checkbox" class="checkbox" name="{$grant_name}" value="{$group_item->group_srl}" id="grant_{$grant_name}_{$group_srl}" checked="checked"|cond="is_array($selected_group[$grant_name] ?? null) && in_array($group_srl, $selected_group[$grant_name])" />
{Context::replaceUserLang($group_item->title, true)} {Context::replaceUserLang($group_item->title, true)}
</label> </label>
<!--@end--> <!--@end-->

View file

@ -25,7 +25,7 @@
{$lang->skin_author} {$lang->skin_author}
</label> </label>
<div class="x_controls" style="padding-top:3px"> <div class="x_controls" style="padding-top:3px">
<block loop="$skin_info->author=>$author"> <block loop="$skin_info->author ?? [] => $author">
{$author->name} {$author->name}
<block cond="$author->homepage || $author->email_address"> <block cond="$author->homepage || $author->email_address">
(<a href="{$author->homepage}" target="_blank" cond="$author->homepage">{$author->homepage}</a> (<a href="{$author->homepage}" target="_blank" cond="$author->homepage">{$author->homepage}</a>
@ -41,16 +41,16 @@
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label class="x_control-label">{$lang->date}</label> <label class="x_control-label">{$lang->date}</label>
<div class="x_controls" style="padding-top:3px">{zdate($skin_info->date, 'Y-m-d')}</div> <div class="x_controls" style="padding-top:3px">{zdate($skin_info->date ?? '', 'Y-m-d')}</div>
</div> </div>
<div class="x_control-group" cond="$skin_info->license || $skin_info->license_link"> <div class="x_control-group" cond="!empty($skin_info->license) || !empty($skin_info->license_link)">
<label class="x_control-label">{$lang->skin_license}</label> <label class="x_control-label">{$lang->skin_license}</label>
<div class="x_controls" style="padding-top:3px"> <div class="x_controls" style="padding-top:3px">
{nl2br(trim($skin_info->license))} {nl2br(trim($skin_info->license))}
<p cond="$skin_info->license_link"><a href="{$skin_info->license_link}" target="_blank">{$skin_info->license_link}</a></p> <p cond="$skin_info->license_link"><a href="{$skin_info->license_link}" target="_blank">{$skin_info->license_link}</a></p>
</div> </div>
</div> </div>
<div class="x_control-group" cond="$skin_info->description"> <div class="x_control-group" cond="!empty($skin_info->description)">
<label class="x_control-label">{$lang->description}</label> <label class="x_control-label">{$lang->description}</label>
<div class="x_controls" style="padding-top:3px">{nl2br(trim($skin_info->description))}</div> <div class="x_controls" style="padding-top:3px">{nl2br(trim($skin_info->description))}</div>
</div> </div>
@ -79,7 +79,7 @@
</div> </div>
</div> </div>
<block loop="$skin_info->extra_vars => $key, $val"> <block loop="$skin_info->extra_vars => $key, $val">
<block cond="$val->group && ((!$group) || $group != $val->group)"> <block cond="$val->group && (empty($group) || $group != $val->group)">
{@$group = $val->group} {@$group = $val->group}
</section> </section>
<section class="section"> <section class="section">
@ -90,10 +90,10 @@
<label class="x_control-label" for="{$val->name}"|cond="$val->type!='text'&&$val->type!='textarea'" for="lang_{$val->name}"|cond="$val->type=='text'||$val->type=='textarea'">{$val->title}</label> <label class="x_control-label" for="{$val->name}"|cond="$val->type!='text'&&$val->type!='textarea'" for="lang_{$val->name}"|cond="$val->type=='text'||$val->type=='textarea'">{$val->title}</label>
<div class="x_controls"> <div class="x_controls">
<!--// text --> <!--// text -->
<input cond="$val->type == 'text'" type="text" name="{$val->name}" id="{$val->name}" value="<!--@if(strpos($val->value, '$user_lang->') === false)-->{$val->value}<!--@else-->{htmlspecialchars($val->value, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}<!--@end-->" class="lang_code" /> <input cond="$val->type == 'text'" type="text" name="{$val->name}" id="{$val->name}" value="<!--@if(strpos($val->value ?? '', '$user_lang->') === false)-->{$val->value}<!--@else-->{htmlspecialchars($val->value, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}<!--@end-->" class="lang_code" />
<!--// textarea --> <!--// textarea -->
<textarea cond="$val->type == 'textarea'" rows="8" cols="42" name="{$val->name}" id="{$val->name}" class="lang_code"><!--@if(strpos($val->value, '$user_lang->') === false)-->{$val->value}<!--@else-->{htmlspecialchars($val->value, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}<!--@end--></textarea> <textarea cond="$val->type == 'textarea'" rows="8" cols="42" name="{$val->name}" id="{$val->name}" class="lang_code"><!--@if(strpos($val->value ?? '', '$user_lang->') === false)-->{$val->value}<!--@else-->{htmlspecialchars($val->value, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}<!--@end--></textarea>
<!--// select --> <!--// select -->
<select cond="$val->type == 'select'" name="{$val->name}" id="{$val->name}"> <select cond="$val->type == 'select'" name="{$val->name}" id="{$val->name}">
@ -130,6 +130,6 @@
<button class="x_btn x_btn-primary x_pull-right" type="submit">{$lang->cmd_registration}</button> <button class="x_btn x_btn-primary x_pull-right" type="submit">{$lang->cmd_registration}</button>
</div> </div>
</form> </form>
<!--@if($use_colorpicker)--> <!--@if($use_colorpicker ?? false)-->
<!--%load_js_plugin("spectrum")--> <!--%load_js_plugin("spectrum")-->
<!--@end--> <!--@end-->

View file

@ -341,7 +341,7 @@ class NcenterliteController extends Ncenterlite
function triggerAfterInsertDocument(&$obj) function triggerAfterInsertDocument(&$obj)
{ {
if ($obj->disable_triggers[$this->module] === true) if (isset($obj->disable_triggers[$this->module]) && $obj->disable_triggers[$this->module] === true)
{ {
return; return;
} }

View file

@ -18,12 +18,10 @@ class PageAdminView extends Page
{ {
// Pre-check if module_srl exists. Set module_info if exists // Pre-check if module_srl exists. Set module_info if exists
$module_srl = Context::get('module_srl'); $module_srl = Context::get('module_srl');
// Create module model object
$oModuleModel = getModel('module');
// module_srl two come over to save the module, putting the information in advance // module_srl two come over to save the module, putting the information in advance
if($module_srl) if($module_srl)
{ {
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); $module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl);
if(!$module_info) if(!$module_info)
{ {
Context::set('module_srl',''); Context::set('module_srl','');
@ -37,7 +35,7 @@ class PageAdminView extends Page
} }
} }
// Get a list of module categories // Get a list of module categories
$module_category = $oModuleModel->getModuleCategories(); $module_category = ModuleModel::getModuleCategories();
Context::set('module_category', $module_category); Context::set('module_category', $module_category);
//Security //Security
$security = new Security(); $security = new Security();
@ -65,8 +63,7 @@ class PageAdminView extends Page
if(in_array($search_target,$search_target_list) && $search_keyword) $args->{$search_target} = $search_keyword; if(in_array($search_target,$search_target_list) && $search_keyword) $args->{$search_target} = $search_keyword;
$output = executeQuery('page.getPageList', $args); $output = executeQuery('page.getPageList', $args);
$oModuleModel = getModel('module'); $page_list = ModuleModel::addModuleExtraVars($output->data);
$page_list = $oModuleModel->addModuleExtraVars($output->data);
moduleModel::syncModuleToSite($page_list); moduleModel::syncModuleToSite($page_list);
$oModuleAdminModel = getAdminModel('module'); /* @var $oModuleAdminModel moduleAdminModel */ $oModuleAdminModel = getAdminModel('module'); /* @var $oModuleAdminModel moduleAdminModel */
@ -105,27 +102,24 @@ class PageAdminView extends Page
// If the layout is destined to add layout information haejum (layout_title, layout) // If the layout is destined to add layout information haejum (layout_title, layout)
if($module_info->layout_srl > 0) if($module_info->layout_srl > 0)
{ {
$oLayoutModel = getModel('layout'); $layout_info = LayoutModel::getLayout($module_info->layout_srl);
$layout_info = $oLayoutModel->getLayout($module_info->layout_srl);
$module_info->layout = $layout_info->layout; $module_info->layout = $layout_info->layout;
$module_info->layout_title = $layout_info->layout_title; $module_info->layout_title = $layout_info->layout_title;
} }
// Get a layout list // Get a layout list
$oLayoutModel = getModel('layout'); $layout_list = LayoutModel::getLayoutList();
$layout_list = $oLayoutModel->getLayoutList();
Context::set('layout_list', $layout_list); Context::set('layout_list', $layout_list);
$mobile_layout_list = $oLayoutModel->getLayoutList(0,"M"); $mobile_layout_list = LayoutModel::getLayoutList(0,"M");
Context::set('mlayout_list', $mobile_layout_list); Context::set('mlayout_list', $mobile_layout_list);
// Set a template file // Set a template file
if($this->module_info->page_type == 'ARTICLE') if($this->module_info->page_type == 'ARTICLE')
{ {
$oModuleModel = getModel('module'); $skin_list = ModuleModel::getSkins($this->module_path);
$skin_list = $oModuleModel->getSkins($this->module_path);
Context::set('skin_list',$skin_list); Context::set('skin_list',$skin_list);
$mskin_list = $oModuleModel->getSkins($this->module_path, "m.skins"); $mskin_list = ModuleModel::getSkins($this->module_path, "m.skins");
Context::set('mskin_list', $mskin_list); Context::set('mskin_list', $mskin_list);
} }
@ -179,8 +173,7 @@ class PageAdminView extends Page
{ {
if($method == '_getArticleContent' && $this->module_info->is_mskin_fix == 'N') if($method == '_getArticleContent' && $this->module_info->is_mskin_fix == 'N')
{ {
$oModuleModel = getModel('module'); $oPageMobile->module_info->mskin = ModuleModel::getModuleDefaultSkin('page', 'M');
$oPageMobile->module_info->mskin = $oModuleModel->getModuleDefaultSkin('page', 'M');
} }
$page_content = $oPageMobile->{$method}(); $page_content = $oPageMobile->{$method}();
} }
@ -246,13 +239,12 @@ class PageAdminView extends Page
Context::set('content', $content); Context::set('content', $content);
// Convert them to teach the widget // Convert them to teach the widget
$oWidgetController = getController('widget'); $oWidgetController = WidgetController::getInstance();
$content = $oWidgetController->transWidgetCode($content, true, !$isMobile); $content = $oWidgetController->transWidgetCode($content, true, !$isMobile);
// $content = str_replace('$', '&#36;', $content); // $content = str_replace('$', '&#36;', $content);
Context::set('page_content', $content); Context::set('page_content', $content);
// Set widget list // Set widget list
$oWidgetModel = getModel('widget'); $widget_list = WidgetModel::getDownloadedWidgetList();
$widget_list = $oWidgetModel->getDownloadedWidgetList();
Context::set('widget_list', $widget_list); Context::set('widget_list', $widget_list);
//Security //Security
@ -270,8 +262,7 @@ class PageAdminView extends Page
function _setArticleTypeContentModify($isMobile = false) function _setArticleTypeContentModify($isMobile = false)
{ {
$oDocumentModel = getModel('document'); $oDocument = DocumentModel::getDocument(0);
$oDocument = $oDocumentModel->getDocument(0);
if($isMobile) if($isMobile)
{ {
@ -326,9 +317,8 @@ class PageAdminView extends Page
$module_srl = Context::get('module_srl'); $module_srl = Context::get('module_srl');
if(!$module_srl) return $this->dispContent(); if(!$module_srl) return $this->dispContent();
$oModuleModel = getModel('module');
$columnList = array('module_srl', 'module', 'mid'); $columnList = array('module_srl', 'module', 'mid');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); $module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl, $columnList);
Context::set('module_info',$module_info); Context::set('module_info',$module_info);
// Set a template file // Set a template file
$this->setTemplateFile('page_delete'); $this->setTemplateFile('page_delete');

View file

@ -120,7 +120,7 @@ function doCartSetup(url) {
} }
jQuery(function($){ jQuery(function($){
$('#pageBtnArea').delay(1000).show(1); $('#pageBtnArea').delay(1000).removeAttr("hidden");
$('#opage_proc_php').on('change', function() { $('#opage_proc_php').on('change', function() {
if (!$(this).prop('checked')) { if (!$(this).prop('checked')) {
$('#opage_proc_tpl').prop('checked', false); $('#opage_proc_tpl').prop('checked', false);

View file

@ -1,13 +1,13 @@
<section class="section"> <section class="section">
<h1>{$lang->open_rss}</h1> <h1>{$lang->open_rss}</h1>
<p>{$lang->about_open_rss}</p> <p>{$lang->about_open_rss}</p>
<form ruleset="insertRssModuleConfig" action="./" method="post" class="x_form-horizontal"> <form ruleset="insertRssModuleConfig" action="./" method="post" class="x_form-horizontal">
<input type="hidden" name="module" value="rss" /> <input type="hidden" name="module" value="rss" />
<input type="hidden" name="act" value="procRssAdminInsertModuleConfig" /> <input type="hidden" name="act" value="procRssAdminInsertModuleConfig" />
<input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" /> <input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
<input type="hidden" name="target_module_srl" value="{$module_config->module_srl ?: $module_srls}" /> <input type="hidden" name="target_module_srl" value="{$module_config->module_srl ?: $module_srls}" />
<div class="x_control-group"> <div class="x_control-group">
<label for="open_rss" class="x_control-label">{$lang->open_rss}</label> <label for="open_rss" class="x_control-label">{$lang->open_rss}</label>
<div class="x_controls"> <div class="x_controls">
@ -28,14 +28,14 @@
<div class="x_control-group"> <div class="x_control-group">
<label for="feed_description" class="x_control-label">{$lang->description}</label> <label for="feed_description" class="x_control-label">{$lang->description}</label>
<div class="x_controls"> <div class="x_controls">
<textarea name="feed_description" id="feed_description" rows="4" cols="42" style="float:left;margin-right:8px">{escape($module_config->feed_description)}</textarea> <textarea name="feed_description" id="feed_description" rows="4" cols="42" style="float:left;margin-right:8px">{escape($module_config->feed_description ?? '')}</textarea>
<p class="x_help-block">{$lang->about_feed_description}</p> <p class="x_help-block">{$lang->about_feed_description}</p>
</div> </div>
</div> </div>
<div class="x_control-group"> <div class="x_control-group">
<label for="feed_copyright" class="x_control-label">{$lang->feed_copyright}</label> <label for="feed_copyright" class="x_control-label">{$lang->feed_copyright}</label>
<div class="x_controls"> <div class="x_controls">
<textarea name="feed_copyright" id="feed_copyright" rows="4" cols="42" style="float:left;margin-right:8px">{escape($module_config->feed_copyright)}</textarea> <textarea name="feed_copyright" id="feed_copyright" rows="4" cols="42" style="float:left;margin-right:8px">{escape($module_config->feed_copyright ?? '')}</textarea>
<p class="x_help-block">{$lang->about_feed_copyright}</p> <p class="x_help-block">{$lang->about_feed_copyright}</p>
</div> </div>
</div> </div>

View file

@ -38,7 +38,11 @@ class SpamfilterController extends Spamfilter
*/ */
function triggerInsertDocument(&$obj) function triggerInsertDocument(&$obj)
{ {
if($_SESSION['avoid_log']) return; if (!empty($_SESSION['avoid_log']))
{
return;
}
// Check the login status, login information, and permission // Check the login status, login information, and permission
$is_logged = Context::get('is_logged'); $is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -98,7 +102,11 @@ class SpamfilterController extends Spamfilter
*/ */
function triggerInsertComment(&$obj) function triggerInsertComment(&$obj)
{ {
if($_SESSION['avoid_log']) return; if (!empty($_SESSION['avoid_log']))
{
return;
}
// Check the login status, login information, and permission // Check the login status, login information, and permission
$is_logged = Context::get('is_logged'); $is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');

View file

@ -609,19 +609,19 @@ function doShowWidgetSizeSetup(px, py, obj) {
margin_bottom : _getInt($obj.css('marginBottom')), margin_bottom : _getInt($obj.css('marginBottom')),
border_top_color : transRGB2Hex($obj.css('borderTopColor')), border_top_color : transRGB2Hex($obj.css('borderTopColor')),
border_top_thick : $obj.css('borderTopWidth').replace(/px$/i, ''), border_top_thick : Math.round($obj.css('borderTopWidth').replace(/px$/i, '')),
border_top_type : $obj.css('borderTopStyle'), border_top_type : $obj.css('borderTopStyle'),
border_bottom_color : transRGB2Hex($obj.css('borderBottomColor')), border_bottom_color : transRGB2Hex($obj.css('borderBottomColor')),
border_bottom_thick : $obj.css('borderBottomWidth').replace(/px$/i, ''), border_bottom_thick : Math.round($obj.css('borderBottomWidth').replace(/px$/i, '')),
border_bottom_type : $obj.css('borderBottomStyle'), border_bottom_type : $obj.css('borderBottomStyle'),
border_right_color : transRGB2Hex($obj.css('borderRightColor')), border_right_color : transRGB2Hex($obj.css('borderRightColor')),
border_right_thick : $obj.css('borderRightWidth').replace(/px$/i, ''), border_right_thick : Math.round($obj.css('borderRightWidth').replace(/px$/i, '')),
border_right_type : $obj.css('borderRightStyle'), border_right_type : $obj.css('borderRightStyle'),
border_left_color : transRGB2Hex($obj.css('borderLeftColor')), border_left_color : transRGB2Hex($obj.css('borderLeftColor')),
border_left_thick : $obj.css('borderLeftWidth').replace(/px$/i, ''), border_left_thick : Math.round($obj.css('borderLeftWidth').replace(/px$/i, '')),
border_left_type : $obj.css('borderLeftStyle'), border_left_type : $obj.css('borderLeftStyle'),
background_color : transRGB2Hex($obj.css('backgroundColor')), background_color : transRGB2Hex($obj.css('backgroundColor')),

View file

@ -21,8 +21,7 @@ class WidgetAdminView extends Widget
function dispWidgetAdminDownloadedList() function dispWidgetAdminDownloadedList()
{ {
// Set widget list // Set widget list
$oWidgetModel = getModel('widget'); $widget_list = WidgetModel::getDownloadedWidgetList();
$widget_list = $oWidgetModel->getDownloadedWidgetList();
$security = new Security($widget_list); $security = new Security($widget_list);
$widget_list = $security->encodeHTML('..', '..author..'); $widget_list = $security->encodeHTML('..', '..author..');
@ -59,20 +58,21 @@ class WidgetAdminView extends Widget
function dispWidgetAdminAddContent() function dispWidgetAdminAddContent()
{ {
$module_srl = Context::get('module_srl'); $module_srl = Context::get('module_srl');
if(!$module_srl) throw new Rhymix\Framework\Exceptions\InvalidRequest; if (!$module_srl)
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
$document_srl = Context::get('document_srl'); $document_srl = Context::get('document_srl');
$oDocumentModel = getModel('document'); $oDocument = DocumentModel::getDocument($document_srl);
$oDocument = $oDocumentModel->getDocument($document_srl);
Context::set('oDocument', $oDocument); Context::set('oDocument', $oDocument);
$oModuleModel = getModel('module');
$columnList = array('module_srl', 'mid'); $columnList = array('module_srl', 'mid');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); $module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl, $columnList);
Context::set('module_info', $module_info); Context::set('module_info', $module_info);
// Editors settings of the module by calling getEditor // Editors settings of the module by calling getEditor
$oEditorModel = getModel('editor'); $editor = EditorModel::getModuleEditor('document', $module_srl, $module_srl, 'module_srl', 'content');
$editor = $oEditorModel->getModuleEditor('document',$module_srl, $module_srl,'module_srl','content');
Context::set('editor', $editor); Context::set('editor', $editor);
$security = new Security(); $security = new Security();

View file

@ -28,16 +28,18 @@ class WidgetController extends Widget
$skin = Context::get('skin'); $skin = Context::get('skin');
$path = sprintf('./widgets/%s/', $widget); $path = sprintf('./widgets/%s/', $widget);
$oModuleModel = getModel('module'); $skin_info = ModuleModel::loadSkinInfo($path, $skin);
$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
$colorset_list = []; $colorset_list = [];
foreach($skin_info->colorset ?: [] as $colorset) foreach ($skin_info->colorset ?: [] as $colorset)
{ {
$colorset_list[] = sprintf('%s|@|%s', $colorset->name, $colorset->title); $colorset_list[] = sprintf('%s|@|%s', $colorset->name, $colorset->title);
} }
if (count($colorset_list))
{
$colorsets = implode("\n", $colorset_list);
}
if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
$this->add('colorset_list', $colorsets); $this->add('colorset_list', $colorsets);
} }
@ -47,13 +49,18 @@ class WidgetController extends Widget
function procWidgetGenerateCode() function procWidgetGenerateCode()
{ {
$widget = Context::get('selected_widget'); $widget = Context::get('selected_widget');
if(!$widget) throw new Rhymix\Framework\Exceptions\InvalidRequest; if (!$widget)
if(!Context::get('skin')) throw new Rhymix\Framework\Exception('msg_widget_skin_is_null'); {
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
if (!Context::get('skin'))
{
throw new Rhymix\Framework\Exception('msg_widget_skin_is_null');
}
$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
$widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute)); $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute));
// Code output
$this->add('widget_code', $widget_code); $this->add('widget_code', $widget_code);
} }
@ -63,9 +70,14 @@ class WidgetController extends Widget
function procWidgetGenerateCodeInPage() function procWidgetGenerateCodeInPage()
{ {
$widget = Context::get('selected_widget'); $widget = Context::get('selected_widget');
if(!$widget) throw new Rhymix\Framework\Exceptions\InvalidRequest; if (!$widget)
{
if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) throw new Rhymix\Framework\Exception('msg_widget_skin_is_null'); throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
if (!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin'))
{
throw new Rhymix\Framework\Exception('msg_widget_skin_is_null');
}
$this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
@ -100,17 +112,23 @@ class WidgetController extends Widget
$editor_sequence = Context::get('editor_sequence'); $editor_sequence = Context::get('editor_sequence');
$err = 0; $err = 0;
$oLayoutModel = getModel('layout'); $layout_info = LayoutModel::getLayout($module_srl);
$layout_info = $oLayoutModel->getLayout($module_srl); if (!$layout_info || $layout_info->type != 'faceoff')
if(!$layout_info || $layout_info->type != 'faceoff') $err++; {
$err++;
}
// Destination Information Wanted page module // Destination Information Wanted page module
$oModuleModel = getModel('module');
$columnList = array('module_srl', 'module'); $columnList = array('module_srl', 'module');
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); $page_info = ModuleModel::getModuleInfoByModuleSrl($module_srl, $columnList);
if(!$page_info->module_srl || $page_info->module != 'page') $err++; if (!$page_info->module_srl || $page_info->module != 'page')
{
if($err > 1) throw new Rhymix\Framework\Exceptions\InvalidRequest; $err++;
}
if ($err > 1)
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
// Check permissions // Check permissions
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -118,23 +136,21 @@ class WidgetController extends Widget
{ {
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
$module_grant = $oModuleModel->getGrant($page_info, $logged_info); $module_grant = ModuleModel::getGrant($page_info, $logged_info);
if (!$module_grant->manager) if (!$module_grant->manager)
{ {
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
// Enter post // Enter post
$oDocumentModel = getModel('document');
$oDocumentController = getController('document');
$obj = new stdClass(); $obj = new stdClass();
$obj->module_srl = $module_srl; $obj->module_srl = $module_srl;
$obj->content = $content; $obj->content = $content;
$obj->document_srl = $document_srl; $obj->document_srl = $document_srl;
$obj->use_editor = 'Y'; $obj->use_editor = 'Y';
$oDocument = $oDocumentModel->getDocument($obj->document_srl); $oDocument = DocumentModel::getDocument($obj->document_srl);
$oDocumentController = DocumentController::getInstance();
if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
{ {
$output = $oDocumentController->updateDocument($oDocument, $obj); $output = $oDocumentController->updateDocument($oDocument, $obj);
@ -146,7 +162,10 @@ class WidgetController extends Widget
} }
// Stop when an error occurs // Stop when an error occurs
if(!$output->toBool()) return $output; if (!$output->toBool())
{
return $output;
}
// Return results // Return results
$this->add('document_srl', $obj->document_srl); $this->add('document_srl', $obj->document_srl);
@ -160,18 +179,16 @@ class WidgetController extends Widget
// Variable Wanted // Variable Wanted
$document_srl = Context::get('document_srl'); $document_srl = Context::get('document_srl');
$oDocumentModel = getModel('document'); $oDocument = DocumentModel::getDocument($document_srl);
$oDocumentController = getController('document'); if (!$oDocument->isExists())
$oDocumentAdminController = getAdminController('document'); {
throw new Rhymix\Framework\Exceptions\InvalidRequest;
$oDocument = $oDocumentModel->getDocument($document_srl); }
if(!$oDocument->isExists()) throw new Rhymix\Framework\Exceptions\InvalidRequest;
$module_srl = $oDocument->get('module_srl'); $module_srl = $oDocument->get('module_srl');
// Destination Information Wanted page module // Destination Information Wanted page module
$oModuleModel = getModel('module');
$columnList = array('module_srl', 'module'); $columnList = array('module_srl', 'module');
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); $page_info = ModuleModel::getModuleInfoByModuleSrl($module_srl, $columnList);
if(!$page_info->module_srl || $page_info->module != 'page') throw new Rhymix\Framework\Exceptions\InvalidRequest; if(!$page_info->module_srl || $page_info->module != 'page') throw new Rhymix\Framework\Exceptions\InvalidRequest;
// Check permissions // Check permissions
@ -180,14 +197,18 @@ class WidgetController extends Widget
{ {
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
$module_grant = $oModuleModel->getGrant($page_info, $logged_info); $module_grant = ModuleModel::getGrant($page_info, $logged_info);
if (!$module_grant->manager) if (!$module_grant->manager)
{ {
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
$oDocumentAdminController = DocumentAdminController::getInstance();
$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0);
if(!$output->toBool()) return $output; if (!$output->toBool())
{
return $output;
}
// Return results // Return results
$copied_srls = $output->get('copied_srls'); $copied_srls = $output->get('copied_srls');
@ -201,18 +222,19 @@ class WidgetController extends Widget
{ {
// Variable Wanted // Variable Wanted
$document_srl = Context::get('document_srl'); $document_srl = Context::get('document_srl');
$oDocument = DocumentModel::getDocument($document_srl);
$oDocumentModel = getModel('document'); if (!$oDocument->isExists())
$oDocumentController = getController('document'); {
return;
$oDocument = $oDocumentModel->getDocument($document_srl); }
if(!$oDocument->isExists()) return;
$module_srl = $oDocument->get('module_srl'); $module_srl = $oDocument->get('module_srl');
// Destination Information Wanted page module // Destination Information Wanted page module
$oModuleModel = getModel('module'); $page_info = ModuleModel::getModuleInfoByModuleSrl($module_srl);
$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); if (!$page_info->module_srl || $page_info->module != 'page')
if(!$page_info->module_srl || $page_info->module != 'page') throw new Rhymix\Framework\Exceptions\InvalidRequest; {
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}
// Check permissions // Check permissions
$logged_info = Context::get('logged_info'); $logged_info = Context::get('logged_info');
@ -220,14 +242,18 @@ class WidgetController extends Widget
{ {
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
$module_grant = $oModuleModel->getGrant($page_info, $logged_info); $module_grant = ModuleModel::getGrant($page_info, $logged_info);
if (!$module_grant->manager) if (!$module_grant->manager)
{ {
throw new Rhymix\Framework\Exceptions\NotPermitted; throw new Rhymix\Framework\Exceptions\NotPermitted;
} }
$oDocumentController = DocumentController::getInstance();
$output = $oDocumentController->deleteDocument($oDocument->get('document_srl')); $output = $oDocumentController->deleteDocument($oDocument->get('document_srl'));
if(!$output->toBool()) return $output; if (!$output->toBool())
{
return $output;
}
} }
/** /**
@ -258,11 +284,14 @@ class WidgetController extends Widget
{ {
$content = Context::replaceUserLang($content); $content = Context::replaceUserLang($content);
} }
// Check whether to include information about editing // Check whether to include information about editing
$this->javascript_mode = $javascript_mode; $this->javascript_mode = $javascript_mode;
// Widget code box change // Widget code box change
$content = preg_replace_callback('!<div([^>]*)widget=([^>]*?)><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content); $content = preg_replace_callback('!<div([^>]*)widget=([^>]*?)><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content);
// Widget code information byeogyeong
// Widget code information change
$content = preg_replace_callback('!<img([^>]*)widget=([^>]*?)>!is', array($this, 'transWidget'), $content); $content = preg_replace_callback('!<img([^>]*)widget=([^>]*?)>!is', array($this, 'transWidget'), $content);
return $content; return $content;
@ -519,8 +548,7 @@ class WidgetController extends Widget
case 'widgetContent' : case 'widgetContent' :
if($args->document_srl) if($args->document_srl)
{ {
$oDocumentModel = getModel('document'); $oDocument = DocumentModel::getDocument($args->document_srl, false, true);
$oDocument = $oDocumentModel->getDocument($args->document_srl, false, true);
$body = $oDocument->getContent(false, false, false, false); $body = $oDocument->getContent(false, false, false, false);
} }
else else
@ -528,7 +556,7 @@ class WidgetController extends Widget
$body = base64_decode($args->body); $body = base64_decode($args->body);
} }
// Change the editor component // Change the editor component
$oEditorController = getController('editor'); $oEditorController = EditorController::getInstance();
$body = $oEditorController->transComponent($body); $body = $oEditorController->transComponent($body);
$widget_content_header = sprintf('<div class="rhymix_content xe_content xe-widget-wrapper ' . ($args->css_class ?? '') . '" %sstyle="%s"><div style="%s">', $args->id ?? '', $style, $inner_style); $widget_content_header = sprintf('<div class="rhymix_content xe_content xe-widget-wrapper ' . ($args->css_class ?? '') . '" %sstyle="%s"><div style="%s">', $args->id ?? '', $style, $inner_style);
@ -559,8 +587,7 @@ class WidgetController extends Widget
case 'widgetContent' : case 'widgetContent' :
if($args->document_srl) if($args->document_srl)
{ {
$oDocumentModel = getModel('document'); $oDocument = DocumentModel::getDocument($args->document_srl, false, true);
$oDocument = $oDocumentModel->getDocument($args->document_srl, false, true);
$body = $oDocument->getContent(false, false, false, false); $body = $oDocument->getContent(false, false, false, false);
} }
else else
@ -694,24 +721,33 @@ class WidgetController extends Widget
if(!isset($GLOBALS['_xe_loaded_widgets_'][$widget])) if(!isset($GLOBALS['_xe_loaded_widgets_'][$widget]))
{ {
// Finding the location of a widget // Finding the location of a widget
$oWidgetModel = getModel('widget'); $path = WidgetModel::getWidgetPath($widget);
$path = $oWidgetModel->getWidgetPath($widget);
// If you do not find the class file error output widget (html output) // If you do not find the class file error output widget (html output)
$class_file = sprintf('%s%s.class.php', $path, $widget); $class_file = sprintf('%s%s.class.php', $path, $widget);
if(!file_exists($class_file)) return sprintf(lang('msg_widget_is_not_exists'), $widget); if (!file_exists($class_file))
{
return sprintf(lang('msg_widget_is_not_exists'), $widget);
}
// Widget classes include // Widget classes include
require_once($class_file); require_once($class_file);
// Creating Objects // Creating Objects
if(!class_exists($widget, false)) if (!class_exists($widget, false))
{ {
return sprintf(lang('msg_widget_object_is_null'), $widget); return sprintf(lang('msg_widget_object_is_null'), $widget);
} }
$oWidget = new $widget(); $oWidget = new $widget();
if(!is_object($oWidget)) return sprintf(lang('msg_widget_object_is_null'), $widget); if (!is_object($oWidget))
{
if(!method_exists($oWidget, 'proc')) return sprintf(lang('msg_widget_proc_is_null'), $widget); return sprintf(lang('msg_widget_object_is_null'), $widget);
}
if (!method_exists($oWidget, 'proc'))
{
return sprintf(lang('msg_widget_proc_is_null'), $widget);
}
$oWidget->widget_path = $path; $oWidget->widget_path = $path;
@ -722,12 +758,17 @@ class WidgetController extends Widget
function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode)
{ {
if(!$widgetStyle) return $widget_content_body; if (!$widgetStyle)
{
return $widget_content_body;
}
$oWidgetModel = getModel('widget');
// Bring extra_var widget style tie // Bring extra_var widget style tie
$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); $widgetstyle_info = WidgetModel::getWidgetStyleInfo($widgetStyle);
if(!$widgetstyle_info) return $widget_content_body; if (!$widgetstyle_info)
{
return $widget_content_body;
}
$widgetstyle_extra_var = new stdClass(); $widgetstyle_extra_var = new stdClass();
$widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info);
@ -742,7 +783,7 @@ class WidgetController extends Widget
// #18994272 오타를 수정했으나 하위 호환성을 위해 남겨둠 - deprecated // #18994272 오타를 수정했으나 하위 호환성을 위해 남겨둠 - deprecated
Context::set('widgetstyle_extar_var', $widgetstyle_extra_var); Context::set('widgetstyle_extar_var', $widgetstyle_extra_var);
if($javascript_mode && $widget=='widgetBox') if ($javascript_mode && $widget == 'widgetBox')
{ {
Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>');
} }
@ -750,8 +791,9 @@ class WidgetController extends Widget
{ {
Context::set('widget_content', $widget_content_body); Context::set('widget_content', $widget_content_body);
} }
// Compilation // Compilation
$widgetstyle_path = $oWidgetModel->getWidgetStylePath($widgetStyle); $widgetstyle_path = WidgetModel::getWidgetStylePath($widgetStyle);
$oTemplate = Rhymix\Framework\Template::getInstance(); $oTemplate = Rhymix\Framework\Template::getInstance();
$tpl = $oTemplate->compile($widgetstyle_path, 'widgetstyle'); $tpl = $oTemplate->compile($widgetstyle_path, 'widgetstyle');
@ -763,8 +805,7 @@ class WidgetController extends Widget
*/ */
function arrangeWidgetVars($widget, $request_vars, &$vars) function arrangeWidgetVars($widget, $request_vars, &$vars)
{ {
$oWidgetModel = getModel('widget'); $widget_info = WidgetModel::getWidgetInfo($widget);
$widget_info = $oWidgetModel->getWidgetInfo($widget);
if(!$vars) if(!$vars)
{ {
@ -800,7 +841,7 @@ class WidgetController extends Widget
// If the widget style // If the widget style
if($request_vars->widgetstyle) if($request_vars->widgetstyle)
{ {
$widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle); $widgetStyle_info = WidgetModel::getWidgetStyleInfo($request_vars->widgetstyle);
if(countobj($widgetStyle_info->extra_var)) if(countobj($widgetStyle_info->extra_var))
{ {
foreach($widgetStyle_info->extra_var as $key=>$val) foreach($widgetStyle_info->extra_var as $key=>$val)

View file

@ -8,41 +8,32 @@
*/ */
class WidgetModel extends Widget class WidgetModel extends Widget
{ {
/**
* @brief Initialization
*/
function init()
{
}
/** /**
* @brief Wanted widget's path * @brief Wanted widget's path
*/ */
function getWidgetPath($widget_name) public static function getWidgetPath($widget_name)
{ {
$path = sprintf('./widgets/%s/', $widget_name); $path = sprintf('./widgets/%s/', $widget_name);
if(is_dir($path)) return $path; if(is_dir($path)) return $path;
return ""; return "";
} }
/** /**
* @brief Wanted widget style path * @brief Wanted widget style path
*/ */
function getWidgetStylePath($widgetStyle_name) public static function getWidgetStylePath($widgetStyle_name)
{ {
$path = sprintf('./widgetstyles/%s/', $widgetStyle_name); $path = sprintf('./widgetstyles/%s/', $widgetStyle_name);
if(is_dir($path)) return $path; if(is_dir($path)) return $path;
return ""; return "";
} }
/** /**
* @brief Wanted widget style path * @brief Wanted widget style path
*/ */
function getWidgetStyleTpl($widgetStyle_name) public static function getWidgetStyleTpl($widgetStyle_name)
{ {
$path = $this->getWidgetStylePath($widgetStyle_name); $path = self::getWidgetStylePath($widgetStyle_name);
$tpl = sprintf('%swidgetstyle.html', $path); $tpl = sprintf('%swidgetstyle.html', $path);
return $tpl; return $tpl;
} }
@ -51,7 +42,7 @@ class WidgetModel extends Widget
* @brief Wanted photos of the type and information * @brief Wanted photos of the type and information
* Download a widget with type (generation and other means) * Download a widget with type (generation and other means)
*/ */
function getDownloadedWidgetList() public static function getDownloadedWidgetList()
{ {
$oAutoinstallModel = getModel('autoinstall'); $oAutoinstallModel = getModel('autoinstall');
@ -66,7 +57,7 @@ class WidgetModel extends Widget
// The name of the widget // The name of the widget
$widget = $searched_list[$i]; $widget = $searched_list[$i];
// Wanted information on the Widget // Wanted information on the Widget
$widget_info = $this->getWidgetInfo($widget); $widget_info = self::getWidgetInfo($widget);
if(!$widget_info) if(!$widget_info)
{ {
@ -96,7 +87,7 @@ class WidgetModel extends Widget
* @brief Wanted photos of the type and information * @brief Wanted photos of the type and information
* Download a widget with type (generation and other means) * Download a widget with type (generation and other means)
*/ */
function getDownloadedWidgetStyleList() public static function getDownloadedWidgetStyleList()
{ {
// 've Downloaded the widget and the widget's list of installed Wanted // 've Downloaded the widget and the widget's list of installed Wanted
$searched_list = FileHandler::readDir('./widgetstyles'); $searched_list = FileHandler::readDir('./widgetstyles');
@ -109,7 +100,7 @@ class WidgetModel extends Widget
// The name of the widget // The name of the widget
$widgetStyle = $searched_list[$i]; $widgetStyle = $searched_list[$i];
// Wanted information on the Widget // Wanted information on the Widget
$widgetStyle_info = $this->getWidgetStyleInfo($widgetStyle); $widgetStyle_info = self::getWidgetStyleInfo($widgetStyle);
$list[] = $widgetStyle_info; $list[] = $widgetStyle_info;
} }
@ -120,11 +111,11 @@ class WidgetModel extends Widget
* @brief Modules conf/info.xml wanted to read the information * @brief Modules conf/info.xml wanted to read the information
* It uses caching to reduce time for xml parsing .. * It uses caching to reduce time for xml parsing ..
*/ */
function getWidgetInfo($widget) public static function getWidgetInfo($widget)
{ {
// Check the widget path. // Check the widget path.
$widget = preg_replace('/[^a-zA-Z0-9-_]/', '', $widget); $widget = preg_replace('/[^a-zA-Z0-9-_]/', '', $widget);
$widget_path = $this->getWidgetPath($widget); $widget_path = self::getWidgetPath($widget);
if (!$widget_path) if (!$widget_path)
{ {
return; return;
@ -161,11 +152,11 @@ class WidgetModel extends Widget
* @brief Modules conf/info.xml wanted to read the information * @brief Modules conf/info.xml wanted to read the information
* It uses caching to reduce time for xml parsing .. * It uses caching to reduce time for xml parsing ..
*/ */
function getWidgetStyleInfo($widgetStyle) public static function getWidgetStyleInfo($widgetStyle)
{ {
// Check the widget style path. // Check the widget style path.
$widgetStyle = preg_replace('/[^a-zA-Z0-9-_]/', '', $widgetStyle); $widgetStyle = preg_replace('/[^a-zA-Z0-9-_]/', '', $widgetStyle);
$widgetStyle_path = $this->getWidgetStylePath($widgetStyle); $widgetStyle_path = self::getWidgetStylePath($widgetStyle);
if (!$widgetStyle_path) if (!$widgetStyle_path)
{ {
return; return;

View file

@ -21,13 +21,18 @@ class WidgetView extends Widget
function dispWidgetInfo() function dispWidgetInfo()
{ {
// If people have skin widget widget output as a function of the skin More Details // If people have skin widget widget output as a function of the skin More Details
if(Context::get('skin')) return $this->dispWidgetSkinInfo(); if (Context::get('skin'))
{
return $this->dispWidgetSkinInfo();
}
// Wanted widget is selected information // Wanted widget is selected information
$oWidgetModel = getModel('widget'); $widget_info = WidgetModel::getWidgetInfo(Context::get('selected_widget'));
$widget_info = $oWidgetModel->getWidgetInfo(Context::get('selected_widget'));
Context::set('widget_info', $widget_info); Context::set('widget_info', $widget_info);
// Specifies the widget to pop up // Specifies the widget to pop up
$this->setLayoutFile('popup_layout'); $this->setLayoutFile('popup_layout');
// Set a template file // Set a template file
$this->setTemplateFile('widget_detail_info'); $this->setTemplateFile('widget_detail_info');
} }
@ -40,14 +45,14 @@ class WidgetView extends Widget
$widget = Context::get('selected_widget'); $widget = Context::get('selected_widget');
$skin = preg_replace('/[^a-zA-Z0-9-_]/', '', Context::get('skin')); $skin = preg_replace('/[^a-zA-Z0-9-_]/', '', Context::get('skin'));
$path = sprintf('./widgets/%s/', $widget);
// Wanted widget is selected information // Wanted widget is selected information
$oModuleModel = getModel('module'); $path = sprintf('./widgets/%s/', $widget);
$skin_info = $oModuleModel->loadSkinInfo($path, $skin); $skin_info = ModuleModel::loadSkinInfo($path, $skin);
Context::set('skin_info',$skin_info); Context::set('skin_info',$skin_info);
// Specifies the widget to pop up // Specifies the widget to pop up
$this->setLayoutFile('popup_layout'); $this->setLayoutFile('popup_layout');
// Set a template file // Set a template file
$this->setTemplateFile('skin_info'); $this->setTemplateFile('skin_info');
} }
@ -58,31 +63,32 @@ class WidgetView extends Widget
function dispWidgetGenerateCode() function dispWidgetGenerateCode()
{ {
// Wanted widget is selected information // Wanted widget is selected information
$oWidgetModel = getModel('widget'); $widget_list = WidgetModel::getDownloadedWidgetList();
$widget_list = $oWidgetModel->getDownloadedWidgetList();
$selected_widget = Context::get('selected_widget'); $selected_widget = Context::get('selected_widget');
if(!$selected_widget) $selected_widget = $widget_list[0]->widget; if (!$selected_widget)
{
$selected_widget = $widget_list[0]->widget;
}
$widget_info = $oWidgetModel->getWidgetInfo($selected_widget); $widget_info = WidgetModel::getWidgetInfo($selected_widget);
Context::set('widget_info', $widget_info); Context::set('widget_info', $widget_info);
Context::set('widget_list', $widget_list); Context::set('widget_list', $widget_list);
Context::set('selected_widget', $selected_widget); Context::set('selected_widget', $selected_widget);
$oModuleModel = getModel('module');
// Get a list of module categories // Get a list of module categories
$module_categories = $oModuleModel->getModuleCategories(); $module_categories = ModuleModel::getModuleCategories();
// Get a mid list // Get a mid list
$site_module_info = Context::get('site_module_info'); $site_module_info = Context::get('site_module_info');
$args = new stdClass(); $args = new stdClass();
$args->site_srl = $site_module_info->site_srl; $args->site_srl = $site_module_info->site_srl;
$columnList = array('module_srl', 'module_category_srl', 'browser_title', 'mid'); $columnList = array('module_srl', 'module_category_srl', 'browser_title', 'mid');
$mid_list = $oModuleModel->getMidList($args, $columnList); $mid_list = ModuleModel::getMidList($args, $columnList);
// Get a list of groups // Get a list of groups
$oMemberModel = getModel('member'); $group_list = MemberModel::getGroups($site_module_info->site_srl);
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
Context::set('group_list', $group_list); Context::set('group_list', $group_list);
// module_category and module combination // module_category and module combination
if($module_categories) if($module_categories)
{ {
@ -102,14 +108,18 @@ class WidgetView extends Widget
} }
Context::set('mid_list',$module_categories); Context::set('mid_list',$module_categories);
// Menu Get a list // Menu Get a list
$output = executeQueryArray('menu.getMenus'); $output = executeQueryArray('menu.getMenus');
Context::set('menu_list',$output->data); Context::set('menu_list',$output->data);
// Wanted information on skin // Wanted information on skin
$skin_list = $oModuleModel->getSkins($widget_info->path); $skin_list = ModuleModel::getSkins($widget_info->path);
Context::set('skin_list', $skin_list); Context::set('skin_list', $skin_list);
// Specifies the widget to pop up // Specifies the widget to pop up
$this->setLayoutFile('popup_layout'); $this->setLayoutFile('popup_layout');
// Set a template file // Set a template file
$this->setTemplateFile('widget_generate_code'); $this->setTemplateFile('widget_generate_code');
} }
@ -119,11 +129,14 @@ class WidgetView extends Widget
*/ */
function dispWidgetGenerateCodeInPage() function dispWidgetGenerateCodeInPage()
{ {
$oWidgetModel = getModel('widget'); $widget_list = WidgetModel::getDownloadedWidgetList();
$widget_list = $oWidgetModel->getDownloadedWidgetList(); Context::set('widget_list', $widget_list);
Context::set('widget_list',$widget_list);
// When there is no widget is selected in the first widget // When there is no widget is selected in the first widget
if(!Context::get('selected_widget')) Context::set('selected_widget',$widget_list[0]->widget); if (!Context::get('selected_widget'))
{
Context::set('selected_widget', $widget_list[0]->widget);
}
$this->dispWidgetGenerateCode(); $this->dispWidgetGenerateCode();
$this->setLayoutFile('popup_layout'); $this->setLayoutFile('popup_layout');
@ -136,15 +149,15 @@ class WidgetView extends Widget
function dispWidgetStyleGenerateCodeInPage() function dispWidgetStyleGenerateCodeInPage()
{ {
// Widget-style list // Widget-style list
$oWidgetModel = getModel('widget'); $widgetStyle_list = WidgetModel::getDownloadedWidgetStyleList();
$widgetStyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
Context::set('widgetStyle_list',$widgetStyle_list); Context::set('widgetStyle_list',$widgetStyle_list);
// Selected list of widget styles // Selected list of widget styles
$widgetstyle = Context::get('widgetstyle'); $widgetstyle = Context::get('widgetstyle');
$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetstyle); $widgetstyle_info = WidgetModel::getWidgetStyleInfo($widgetstyle);
if($widgetstyle && $widgetstyle_info) if ($widgetstyle && $widgetstyle_info)
{ {
Context::set('widgetstyle_info',$widgetstyle_info); Context::set('widgetstyle_info', $widgetstyle_info);
} }
$this->dispWidgetGenerateCode(); $this->dispWidgetGenerateCode();

View file

@ -8,5 +8,9 @@
</columns> </columns>
<conditions> <conditions>
<condition operation="equal" column="document_srl" var="document_srl" /> <condition operation="equal" column="document_srl" var="document_srl" />
<group notnull="notnull">
<condition operation="equal" column="module_srl" var="module_srl" />
<condition operation="equal" column="member_srl" var="member_srl" pipe="or" />
</group>
</conditions> </conditions>
</query> </query>

View file

@ -512,32 +512,59 @@ class DBQueryParserTest extends \Codeception\Test\Unit
'user_name' => null, 'user_name' => null,
'nick_name' => 'TEST', 'nick_name' => 'TEST',
'document_srl' => 1234, 'document_srl' => 1234,
'module_srl' => 5678,
)); ));
$this->assertEquals('UPDATE `rx_documents` SET `nick_name` = ? WHERE `document_srl` = ?', $sql); $this->assertEquals('UPDATE `rx_documents` SET `nick_name` = ? WHERE `document_srl` = ? AND (`module_srl` = ?)', $sql);
$this->assertEquals(['TEST', 1234], $query->getQueryParams()); $this->assertEquals(['TEST', 1234, 5678], $query->getQueryParams());
$sql = $query->getQueryString('rx_', array( $sql = $query->getQueryString('rx_', array(
'user_name' => new \Rhymix\Framework\Parsers\DBQuery\NullValue, 'user_name' => new \Rhymix\Framework\Parsers\DBQuery\NullValue,
'nick_name' => 'TEST', 'nick_name' => 'TEST',
'document_srl' => 1234, 'document_srl' => 1234,
'module_srl' => 5678,
'member_srl' => 9000,
)); ));
$this->assertEquals('UPDATE `rx_documents` SET `user_name` = NULL, `nick_name` = ? WHERE `document_srl` = ?', $sql); $this->assertEquals('UPDATE `rx_documents` SET `user_name` = NULL, `nick_name` = ? WHERE `document_srl` = ? AND (`module_srl` = ? OR `member_srl` = ?)', $sql);
$this->assertEquals(['TEST', 1234], $query->getQueryParams()); $this->assertEquals(['TEST', 1234, 5678, 9000], $query->getQueryParams());
$this->tester->expectThrowable('Exception', function() use($query) { $this->tester->expectThrowable('Rhymix\Framework\Exceptions\QueryError', function() use($query) {
$query->getQueryString('rx_', array(
'nick_name' => 'TEST',
'document_srl' => 1234,
));
});
$this->tester->expectThrowable('Rhymix\Framework\Exceptions\QueryError', function() use($query) {
$query->getQueryString('rx_', array(
'nick_name' => 'TEST',
'document_srl' => 1234,
));
});
$this->tester->expectThrowable('Rhymix\Framework\Exceptions\QueryError', function() use($query) {
$query->getQueryString('rx_', array( $query->getQueryString('rx_', array(
'nick_name' => new \Rhymix\Framework\Parsers\DBQuery\NullValue, 'nick_name' => new \Rhymix\Framework\Parsers\DBQuery\NullValue,
'document_srl' => 1234, 'document_srl' => 1234,
'module_srl' => 5678,
)); ));
}); });
$this->tester->expectThrowable('Exception', function() use($query) { $this->tester->expectThrowable('Rhymix\Framework\Exceptions\QueryError', function() use($query) {
$query->getQueryString('rx_', array( $query->getQueryString('rx_', array(
'nick_name' => null, 'nick_name' => null,
'document_srl' => 1234, 'document_srl' => 1234,
'member_srl' => 5678,
)); ));
}); });
// No exception
$query->getQueryString('rx_', array(
'nick_name' => 'TEST',
'document_srl' => 1234,
'module_srl' => new \Rhymix\Framework\Parsers\DBQuery\NullValue,
'member_srl' => null,
));
$query = Rhymix\Framework\Parsers\DBQueryParser::loadXML(\RX_BASEDIR . 'tests/_data/dbquery/nullValueTest2.xml'); $query = Rhymix\Framework\Parsers\DBQueryParser::loadXML(\RX_BASEDIR . 'tests/_data/dbquery/nullValueTest2.xml');
$sql = $query->getQueryString('rx_', array( $sql = $query->getQueryString('rx_', array(