Merge branch 'master' of github.com:Lastorder-DC/rhymix
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-DC 2025-06-27 05:35:02 +00:00
commit d39d363334
48 changed files with 664 additions and 379 deletions

View file

@ -1,7 +1,6 @@
<config autoescape="on" />
<include target="./_admin_common.html" />
{@ Context::addMetaTag("viewport", "width=device-width, user-scalable=yes")}
<script>
var admin_menu_srl = "{$admin_menu_srl}";
xe.lang.cmd_find = "{$lang->cmd_find}";

View file

@ -41,11 +41,11 @@
<title xml:lang="zh-TW">發表評論</title>
<title xml:lang="es">yorum yaz</title>
</grant>
<grant name="vote_log_view" default="guest">
<grant name="vote_log_view" default="member">
<title xml:lang="ko">추천인 보기</title>
<title xml:lang="en">view recommender</title>
</grant>
<grant name="update_view" default="guest">
<grant name="update_view" default="member">
<title xml:lang="ko">수정 내역 보기</title>
<title xml:lang="en">view update history</title>
</grant>

View file

@ -2002,6 +2002,41 @@ class CommentController extends Comment
$this->setMessage('success_declared_cancel');
}
/**
* Update the number of uploaded files in the comment
*
* @param int|array $comment_srl_list
* @return void
*/
public function updateUploadedCount($comment_srl_list)
{
if (!is_array($comment_srl_list))
{
$comment_srl_list = array($comment_srl_list);
}
if (!count($comment_srl_list))
{
return;
}
$comment_srl_list = array_unique($comment_srl_list);
foreach($comment_srl_list as $comment_srl)
{
$comment_srl = (int)$comment_srl;
if ($comment_srl <= 0)
{
continue;
}
$args = new stdClass;
$args->comment_srl = $comment_srl;
$args->uploaded_count = FileModel::getFilesCount($comment_srl);
executeQuery('comment.updateUploadedCount', $args);
}
}
/**
* Method to add a pop-up menu when clicking for displaying child comments
* @param string $url

View file

@ -816,10 +816,15 @@ class CommentItem extends BaseObject
// Call trigger for custom thumbnails.
$trigger_obj = (object)[
'document_srl' => $this->document_srl, 'comment_srl' => $this->comment_srl,
'width' => $width, 'height' => $height,
'image_type' => 'jpg', 'type' => $thumbnail_type, 'quality' => $config->thumbnail_quality,
'filename' => $thumbnail_file, 'url' => $thumbnail_url,
'document_srl' => $this->document_srl,
'comment_srl' => $this->comment_srl,
'width' => $width,
'height' => $height,
'image_type' => 'jpg',
'type' => $thumbnail_type,
'quality' => $config->thumbnail_quality,
'filename' => $thumbnail_file,
'url' => $thumbnail_url,
];
$output = ModuleHandler::triggerCall('comment.getThumbnail', 'before', $trigger_obj);
clearstatcache(true, $thumbnail_file);
@ -877,8 +882,16 @@ class CommentItem extends BaseObject
// get an image file from the doc content if no file attached.
if(!$source_file && $config->thumbnail_target !== 'attachment')
{
$external_image_min_width = min(100, round($trigger_obj->width * 0.3));
$external_image_min_height = min(100, round($trigger_obj->height * 0.3));
$external_image_min_width = is_numeric($trigger_obj->width) ? min(100, round(intval($trigger_obj->width) * 0.3)) : 100;
if($trigger_obj->height === 'auto')
{
$external_image_min_height = min(100, $external_image_min_width * 0.5);
}
else
{
$external_image_min_height = is_numeric($trigger_obj->height) ? min(100, round(intval($trigger_obj->height) * 0.3)) : 100;
}
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $this->get('content'), $matches, PREG_SET_ORDER);
foreach($matches as $match)
{

View file

@ -0,0 +1,11 @@
<query id="updateUploadedCount" action="update">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="uploaded_count" var="uploaded_count" default="0" filter="number" />
</columns>
<conditions>
<condition operation="equal" column="comment_srl" var="comment_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -3307,16 +3307,23 @@ class DocumentController extends Document
}
// Get document_srl
$srls = explode(',',Context::get('srls'));
for($i = 0; $i < count($srls); $i++)
$srls = Context::get('srls');
if (is_array($srls))
{
$srl = trim($srls[$i]);
if(!$srl) continue;
$document_srls[] = $srl;
$document_srls = array_map('intval', $srls);
}
else
{
$document_srls = array_map('intval', explode(',', $srls));
}
$document_srls = array_unique(array_filter($document_srls, function($srl) {
return $srl > 0;
}));
if (!count($document_srls))
{
return;
}
if(!count($document_srls)) return;
// Get module_srl of the documents
$args = new stdClass;
@ -3787,7 +3794,17 @@ Content;
}
}
/**
* A typo of updateUploadedCount, maintained for backward compatibility.
*
* @deprecated
*/
public function updateUploaedCount($document_srl_list)
{
return $this->updateUploadedCount($document_srl_list);
}
public function updateUploadedCount($document_srl_list)
{
if(!is_array($document_srl_list))
{
@ -3803,7 +3820,8 @@ Content;
foreach($document_srl_list as $document_srl)
{
if(!$document_srl = (int) $document_srl)
$document_srl = (int)$document_srl;
if ($document_srl <= 0)
{
continue;
}
@ -3823,7 +3841,7 @@ Content;
return;
}
$this->updateUploaedCount($file->upload_target_srl);
$this->updateUploadedCount($file->upload_target_srl);
}
/**

View file

@ -1146,9 +1146,14 @@ class DocumentItem extends BaseObject
// Call trigger for custom thumbnails.
$trigger_obj = (object)[
'document_srl' => $this->document_srl, 'width' => $width, 'height' => $height,
'image_type' => 'jpg', 'type' => $thumbnail_type, 'quality' => $config->thumbnail_quality,
'filename' => $thumbnail_file, 'url' => $thumbnail_url,
'document_srl' => $this->document_srl,
'width' => $width,
'height' => $height,
'image_type' => 'jpg',
'type' => $thumbnail_type,
'quality' => $config->thumbnail_quality,
'filename' => $thumbnail_file,
'url' => $thumbnail_url,
];
$output = ModuleHandler::triggerCall('document.getThumbnail', 'before', $trigger_obj);
clearstatcache(true, $thumbnail_file);
@ -1220,8 +1225,16 @@ class DocumentItem extends BaseObject
// If not exists, file an image file from the content
if(!$source_file && $config->thumbnail_target !== 'attachment')
{
$external_image_min_width = min(100, round($trigger_obj->width * 0.3));
$external_image_min_height = min(100, round($trigger_obj->height * 0.3));
$external_image_min_width = is_numeric($trigger_obj->width) ? min(100, round(intval($trigger_obj->width) * 0.3)) : 100;
if($trigger_obj->height === 'auto')
{
$external_image_min_height = min(100, $external_image_min_width * 0.5);
}
else
{
$external_image_min_height = is_numeric($trigger_obj->height) ? min(100, round(intval($trigger_obj->height) * 0.3)) : 100;
}
preg_match_all("!<img\s[^>]*?src=(\"|')([^\"' ]*?)(\"|')!is", $content, $matches, PREG_SET_ORDER);
foreach($matches as $match)
{

View file

@ -61,7 +61,7 @@
<div class="x_control-group" data-invisible-types="file">
<label class="x_control-label" for="default">{$lang->default_value}</label>
<div class="x_controls">
<input type="text" name="default" id="default" value="{$selected_var->default}" />
<input type="text" name="default" id="default" value="{$selected_var ? $selected_var->getDefaultValue() : ''}" />
<p class="x_help-block">{$lang->about_extra_vars_default_value}</p>
</div>
</div>

View file

@ -195,9 +195,9 @@ class Value
{
return $this->default;
}
elseif ($this->default)
elseif ($this->default && $this->parent_type !== 'member' && !in_array($this->type, ['checkbox', 'radio']))
{
return array_first($this->getOptions());
return is_array($this->default) ? array_first($this->default) : array_first(explode(',', $this->default));
}
else
{

View file

@ -1,16 +1,16 @@
'use strict';
(function($) {
$(function() {
$('button.evFileRemover').on('click', function() {
const container = $(this).parents('.ev_file_upload');
$(function() {
$('.ev_file_upload').each(function() {
const container = $(this);
container.find('button.evFileRemover').on('click', function() {
container.find('span.filename').text('');
container.find('span.filesize').text('');
container.find('input[type=hidden][name^=_delete_]').val('Y');
container.find('input[type=file]').val('');
$(this).remove();
});
$('input.rx_ev_file').on('change', function() {
const container = $(this).parents('.ev_file_upload');
container.find('input.rx_ev_file').on('change', function() {
const max_size = parseInt($(this).data('allowedFilesize'), 10);
const file_count = this.files.length;
for (let i = 0; i < file_count; i++) {
@ -23,4 +23,4 @@
container.find('input[type=hidden][name^=_delete_]').val('N');
});
});
})(jQuery);
});

View file

@ -0,0 +1,7 @@
'use strict';
$(function() {
$('input.rx_ev_number').on('input', function() {
this.value = this.value.replace(/[^0-9]/g, '');
});
});

View file

@ -2,6 +2,7 @@
id="{{ $input_id }}"|if="$input_id" class="password rx_ev_password"
style="{{ $definition->style }}"|if="$definition->style"
value="{{ strval($value) !== '' ? $value : strval($default) }}"
autocomplete="off" autocapitalize="none"
@required(toBool($definition->is_required))
@disabled(toBool($definition->is_disabled))
@readonly(toBool($definition->is_readonly))

View file

@ -17,7 +17,8 @@
@readonly(toBool($definition->is_readonly))
/>
@elseif ($type === 'number')
<input type="number" name="{{ $input_name }}"
@load('../assets/number.js')
<input type="text" inputmode="numeric" name="{{ $input_name }}"
id="{{ $input_id }}"|if="$input_id" class="number rx_ev_number"
style="{{ $definition->style }}"|if="$definition->style"
value="{{ strval($value) !== '' ? $value : strval($default) }}"

View file

@ -2002,6 +2002,8 @@ class FileController extends File
}
$this->copyFiles($obj->source->document_srl, $obj->copied->module_srl, $obj->copied->document_srl, $obj->copied->content);
$this->setFilesValid($obj->copied->document_srl, 'doc');
DocumentController::getInstance()->updateUploadedCount($obj->copied->document_srl);
}
function triggerAddCopyCommentByDocument(&$obj)
@ -2012,6 +2014,8 @@ class FileController extends File
}
$this->copyFiles($obj->source->comment_srl, $obj->copied->module_srl, $obj->copied->comment_srl, $obj->copied->content);
$this->setFilesValid($obj->copied->comment_srl, 'com');
CommentController::getInstance()->updateUploadedCount($obj->copied->comment_srl);
}
function triggerCopyModule(&$obj)

View file

@ -878,21 +878,27 @@ class MemberAdminController extends Member
$args->column_type = Context::get('column_type');
$args->column_name = strtolower(Context::get('column_id'));
$args->column_title = Context::get('column_title');
$args->default_value = explode("\n", str_replace("\r", '', Context::get('default_value')));
$args->required = Context::get('required');
$args->is_active = (isset($args->required));
if(!in_array(strtoupper($args->required), array('Y','N')))$args->required = 'N';
$args->description = Context::get('description') ? Context::get('description') : '';
// Default values
if(in_array($args->column_type, array('checkbox','select','radio')) && count($args->default_value))
$args->default_value = trim(utf8_clean(Context::get('default_value')));
$args->options = trim(utf8_clean(Context::get('options')));
if ($args->options !== '')
{
$args->default_value = serialize($args->default_value);
$args->options = array_map('trim', explode("\n", $args->options));
$args->options = json_encode($args->options, \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES);
}
else
{
$args->default_value = '';
$args->options = null;
}
$args->required = Context::get('required');
if (!in_array(strtoupper($args->required), array('Y','N')))
{
$args->required = 'N';
}
$args->is_active = (isset($args->required));
$args->description = Context::get('description') ? Context::get('description') : '';
// Check ID duplicated
if (Context::isReservedWord($args->column_name))
{
@ -909,7 +915,7 @@ class MemberAdminController extends Member
}
}
// Fix if member_join_form_srl exists. Add if not exists.
$isInsert;
$isInsert = false;
if(!$args->member_join_form_srl)
{
$isInsert = true;

View file

@ -288,13 +288,24 @@ class MemberAdminModel extends Member
if($output->toBool() && $output->data)
{
$formInfo = $output->data;
$default_value = $formInfo->default_value;
if($default_value)
$default_value = '';
$options = '';
if (isset($formInfo->options) && $formInfo->options !== '')
{
$default_value = unserialize($default_value);
Context::set('default_value', $default_value);
$default_value = $formInfo->default_value;
$options = json_decode($formInfo->options, true);
}
elseif (preg_match('/^a:\d+:\{i:/', $formInfo->default_value))
{
$options = unserialize($formInfo->default_value);
}
else
{
$default_value = $formInfo->default_value;
}
Context::set('formInfo', $output->data);
Context::set('default_value', $default_value);
Context::set('options', $options);
}
$oMemberModel = getModel('member');
@ -314,7 +325,7 @@ class MemberAdminModel extends Member
$oTemplate = TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'insert_join_form');
$this->add('tpl', str_replace("\n"," ",$tpl));
$this->add('tpl', $tpl);
}
/**

View file

@ -486,7 +486,7 @@ class MemberAdminView extends Member
{
$extend_form_list = MemberModel::getCombineJoinForm($memberInfo);
$security = new Security($extend_form_list);
$security->encodeHTML('..column_title', '..description', '..default_value.');
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
if ($memberInfo)
{
@ -725,6 +725,7 @@ class MemberAdminView extends Member
$input->input_id = $extendForm->column_name;
$input->value = $extendForm->value ?? '';
$input->default = $extendForm->default_value ?? null;
$input->options = $extendForm->options ?? null;
if ($extendForm->column_type === 'tel' || $extendForm->column_type === 'tel_intl')
{
$input->style = 'width:33.3px';

View file

@ -167,6 +167,9 @@ class Member extends ModuleObject
if(!$oDB->isIndexExists('member_auth_mail', 'idx_member_srl')) return true;
if($oDB->isIndexExists('member_auth_mail', 'unique_key')) return true;
// Check join form options column
if(!$oDB->isColumnExists('member_join_form', 'options')) return true;
// Update status column
$output = executeQuery('member.getDeniedAndStatus');
if ($output->data->count)
@ -403,6 +406,12 @@ class Member extends ModuleObject
$oDB->dropIndex('member_auth_mail', 'unique_key');
}
// Check join form options column
if(!$oDB->isColumnExists('member_join_form', 'options'))
{
$oDB->addColumn('member_join_form', 'options', 'text', null, null, null, 'default_value');
}
// Update status column
$output = executeQuery('member.getDeniedAndStatus');
if ($output->data->count)

View file

@ -2867,7 +2867,7 @@ class MemberController extends Member
$extend_form_list = MemberModel::getJoinFormlist();
$security = new Security($extend_form_list);
$security->encodeHTML('..column_title', '..description', '..default_value.');
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
if($config->signupForm)
{
foreach($config->signupForm as $no => $formInfo)
@ -3163,7 +3163,7 @@ class MemberController extends Member
$extend_form_list = MemberModel::getJoinFormlist();
$security = new Security($extend_form_list);
$security->encodeHTML('..column_title', '..description', '..default_value.');
$security->encodeHTML('..column_title', '..description', '..default_value', '..options.');
if($config->signupForm)
{
foreach($config->signupForm as $no => $formInfo)

View file

@ -806,31 +806,38 @@ class MemberModel extends Member
if(!$join_form_list) return NULL;
// Need to unserialize because serialized array is inserted into DB in case of default_value
if(!is_array($join_form_list)) $join_form_list = array($join_form_list);
$join_form_count = count($join_form_list);
for($i=0;$i<$join_form_count;$i++)
foreach ($join_form_list as $i => $join_form)
{
$join_form_list[$i]->column_name = strtolower($join_form_list[$i]->column_name);
$join_form->column_name = strtolower($join_form->column_name);
$member_join_form_srl = $join_form_list[$i]->member_join_form_srl;
$column_type = $join_form_list[$i]->column_type;
$column_name = $join_form_list[$i]->column_name;
$column_title = $join_form_list[$i]->column_title;
$default_value = $join_form_list[$i]->default_value;
// Add language variable
if(!isset($lang->extend_vars)) $lang->extend_vars = array();
$lang->extend_vars[$column_name] = $column_title;
// unserialize if the data type if checkbox, select and so on
if(in_array($column_type, array('checkbox','select','radio')))
$column_name = $join_form->column_name;
$column_title = $join_form->column_title;
if (!isset($lang->extend_vars))
{
$join_form_list[$i]->default_value = unserialize($default_value);
if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
$lang->extend_vars = array();
}
$lang->extend_vars[$column_name] = $column_title;
// unserialize if the data type if checkbox, select and so on
if (in_array($join_form->column_type, ['checkbox','select','radio']))
{
if (isset($join_form->options) && $join_form->options !== '')
{
$join_form->options = json_decode($join_form->options, true);
}
elseif (preg_match('/^a:\d+:\{i:/', $join_form->default_value))
{
$join_form->options = unserialize($join_form->default_value);
$join_form->default_value = '';
}
}
else
{
$join_form_list[$i]->default_value = '';
$join_form->default_value = '';
}
$list[$member_join_form_srl] = $join_form_list[$i];
$list[$join_form->member_join_form_srl] = $join_form;
}
self::$_join_form_list = $list;
}
@ -958,12 +965,17 @@ class MemberModel extends Member
$join_form = $output->data;
if(!$join_form) return NULL;
$column_type = $join_form->column_type;
$default_value = $join_form->default_value;
if(in_array($column_type, array('checkbox','select','radio')))
if (in_array($join_form->column_type, ['checkbox','select','radio']))
{
$join_form->default_value = unserialize($default_value);
if (isset($join_form->options) && $join_form->options !== '')
{
$join_form->options = json_decode($join_form->options, true);
}
elseif (preg_match('/^a:\d+:\{i:/', $join_form->default_value))
{
$join_form->options = unserialize($join_form->default_value);
$join_form->default_value = '';
}
}
else
{

View file

@ -280,6 +280,7 @@ class MemberView extends Member
$extvalue->input_id = $formInfo->name;
$extvalue->value = $extendFormInfo[$formInfo->member_join_form_srl]->value ?? null;
$extvalue->default = $extendFormInfo[$formInfo->member_join_form_srl]->default_value ?? null;
$extvalue->options = $extendFormInfo[$formInfo->member_join_form_srl]->options ?? null;
$item->value = $extvalue->getValueHTML();
}

View file

@ -9,6 +9,7 @@
<column name="column_title" var="column_title" />
<column name="required" var="required" default="N" />
<column name="default_value" var="default_value" />
<column name="options" var="options" />
<column name="is_active" var="is_active" default="N" />
<column name="description" var="description" />
<column name="regdate" default="curdate()" />

View file

@ -8,6 +8,7 @@
<column name="column_title" var="column_title" />
<column name="required" var="required" default="N" />
<column name="default_value" var="default_value" />
<column name="options" var="options" />
<column name="is_active" var="is_active" default="N" />
<column name="description" var="description" />
</columns>

View file

@ -5,6 +5,7 @@
<column name="column_title" type="varchar" size="60" notnull="notnull" />
<column name="required" type="char" size="1" default="N" notnull="notnull" />
<column name="default_value" type="text" />
<column name="options" type="text" />
<column name="is_active" type="char" size="1" default="Y" />
<column name="description" type="text" />
<column name="list_order" type="number" size="11" notnull="notnull" default="1" index="idx_list_order" />

View file

@ -26,11 +26,17 @@
</select>
</div>
</div>
<div class="x_control-group multiExample">
<label for="multiSelect" class="x_control-label"><em style="color:red">*</em> {$lang->options}</label>
<div class="x_control-group">
<label for="default_value" class="x_control-label"> {$lang->default_value}</label>
<div class="x_controls">
<textarea rows="4" cols="42" id="multiSelect" name="default_value" style="vertical-align:top"><block cond="$default_value">{implode('|@|', $default_value)}</block></textarea>
<p class="x_help-inline">{$lang->about_multi_type}</p>
<input type="text" id="default_value" name="default_value" value="{$default_value}" />
</div>
</div>
<div class="x_control-group multiExample">
<label for="multiSelect" class="x_control-label"> {$lang->options}</label>
<div class="x_controls">
<textarea rows="4" cols="42" id="multiSelect" name="options" style="vertical-align:top"><block cond="$options">{implode("\n", $options)}</block></textarea>
<p class="x_help-block">{$lang->about_multi_type}</p>
</div>
</div>
<div class="x_control-group">
@ -51,7 +57,6 @@
<span class="x_pull-right"><button class="x_btn x_btn-primary" type="submit" name="mode" <!--@if($formInfo)-->value="update"<!--@else-->value="insert"<!--@end--> >{$lang->cmd_save}</button></span>
</div>
<script>
var $ = jQuery;
var typeSelect = $('.typeSelect');
var multiOption = $('.typeSelect>option[value=checkbox], .typeSelect>option[value=radio], .typeSelect>option[value=select_multiple], .typeSelect>option[value=select]');
var multiExample = $('.multiExample');

View file

@ -2003,7 +2003,7 @@ class MenuAdminController extends Menu
// If the value of node->group_srls exists
if($node->group_srls) {
$group_srls_exported = json_encode(array_values(is_array($node->group_srls) ? $node->group_srls : array_map('intval', explode(',', $node->group_srls))));
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged&&%s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0);
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged&&%s)||(!$is_logged&&%s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0, $node->group_srls == '-4' ? 1 : 0);
}
else
{
@ -2099,7 +2099,7 @@ class MenuAdminController extends Menu
if($node->group_srls)
{
$group_srls_exported = json_encode(array_values(is_array($node->group_srls) ? $node->group_srls : array_map('intval', explode(',', $node->group_srls))));
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged && %s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0);
$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, %s)))||($is_logged && %s)||(!$is_logged && %s))', $group_srls_exported, $node->group_srls == '-1' ? 1 : 0, $node->group_srls == '-4' ? 1 : 0);
}
else
{

View file

@ -216,6 +216,10 @@ class MenuAdminModel extends Menu
{
$menuItem->grant = 'manager';
}
else if($menuItem->group_srls[0] == -4)
{
$menuItem->grant = 'not_member';
}
else
{
$menuItem->grant = 'group';

View file

@ -2361,39 +2361,29 @@ jQuery(function($){
$node.find('._groups').append($groupNode);
}
if(i === 0){
$node.find('._group_signedup').remove();
//$node.find('._group_manager').remove();
}else{
/*
guest : 모든 옵션 사용 가능, 항상 권한 있음.
member : '모든 사용자' 제외하고 사용 가능, 로그인 정보가 있을 경우 true
not_member : 비로그인 사용자, 로그인 정보가 *없을* 경우 true
manager : '관리자만','선택그룹 사용자' 옵션만 사용가능, 관리자일 경우에만 true
root : manager와 동일.
*/
switch(sDefault){
case 'guest':
//
/*
guest : 모든 옵션 사용 가능, 항상 권한 있음.
member : '모든 사용자' 제외하고 사용 가능, 로그인 정보가 있을 경우 true
not_member : 비로그인 사용자, 로그인 정보가 *없을* 경우 true
manager : '관리자만','선택그룹 사용자' 옵션만 사용가능, 관리자일 경우에만 true
root : manager와 동일.
*/
switch(sDefault) {
case 'guest':
break;
case 'member':
$node.find('._group_all').remove();
case 'member':
case 'not_member':
case 'site':
$node.find('._group_loggedin').prop('selected', true);
break;
case 'not_member':
$node.find('._group_all').remove();
break;
case 'site':
$node.find('._group_all').remove();
break;
case 'manager':
case 'root':
default:
$node.find('._group_all').remove();
$node.find('._group_loggedin').remove();
$node.find('._group_signedup').remove();
}
case 'manager':
case 'root':
default:
$node.find('._group_manager').prop('selected', true);
$node.find('._group_all').remove();
$node.find('._group_loggedin').remove();
$node.find('._group_not_loggedin').remove();
}
//console.log(22, $node);
$List.append($node);
$('#auth select').trigger('change');
}

View file

@ -71,9 +71,9 @@ class MessageView extends Message
Context::set('ssl_mode', \RX_SSL);
Context::set('system_message', nl2br($this->getMessage()));
Context::set('system_message_detail', nl2br($detail));
Context::set('system_message_help', self::getErrorHelp(strval($detail)));
Context::set('system_message_location', escape($location));
Context::set('system_message_detail', nl2br($detail ?? ''));
Context::set('system_message_help', self::getErrorHelp(strval($detail ?? '')));
Context::set('system_message_location', escape($location ?? ''));
if ($this->getError())
{

View file

@ -103,7 +103,11 @@ class Permission
// Check if each permission is granted to the current user.
foreach ($this->_spec as $key => $requirement)
{
if ($requirement === 'guest')
if ($key === 'manager' && $this->manager)
{
continue;
}
elseif ($requirement === 'guest')
{
$this->{$key} = true;
}

View file

@ -171,9 +171,18 @@ class ModuleAdminModel extends Module
$grant_list->manager->title = lang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// Get a permission group granted to the current module
$selected_group = array();
$default_grant = array();
foreach ($grant_list as $key => $val)
{
if (!empty($val->default))
{
$default_grant[$key] = $val->default;
}
}
$args = new stdClass();
$args->module_srl = $module_srl;
$output = executeQueryArray('module.getModuleGrants', $args);

View file

@ -37,15 +37,15 @@
</div>
</div>
{@$suggestion_id = 0}
{@ $group = ''; $not_first = false; $suggestion_id = 0; }
<block loop="$widget_info->extra_var => $id, $var">
{@$suggestion_id++}
{@ $suggestion_id++; }
<block cond="!$not_first && !$var->group"><section class="extra_vars section"></block>
<block cond="$group != $var->group">
<block cond="$not_first"></section></block>
<section class="extra_vars section">
<h1>{$var->group}</h1>
{@$group = $var->group}
{@ $group = $var->group; }
</block>
{@$not_first = true}
@ -53,21 +53,21 @@
<label class="x_control-label" for="{$id}"|cond="$var->type != 'radio' && $var->type != 'checkbox'">{$var->name}</label>
<div class="x_controls">
<block cond="$var->type == 'text'">
<input type="text" name="{$id}" />
<input type="text" name="{$id}" value="{$var->default}" />
</block>
<block cond="$var->type == 'color'">
<input type="text" name="{$id}" value="" id="{$id}" class="rx-spectrum" style="width:178px" />
</block>
<block cond="$var->type == 'textarea'">
<textarea cond="$var->type == 'textarea'" name="{$id}" id="{$id}" rows="8" cols="42"></textarea>
<textarea cond="$var->type == 'textarea'" name="{$id}" id="{$id}" rows="8" cols="42">{$var->default}</textarea>
</block>
<block cond="$var->type == 'select'">
<select name="{$id}" id="{$id}">
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option>
<option loop="$var->options => $key, $val" value="{$key}" selected="selected"|cond="$var->default !== '' && $key == $var->default">{$val}</option>
</select>
</block>
<block cond="$var->type == 'select-multi-order'">
<!--@if($var->init_options && is_array($var->init_options))-->
<!--@if(isset($var->init_options) && is_array($var->init_options))-->
{@$inits = array_keys($var->init_options)}
<input type="hidden" name="{$id}" value="{implode(',', $inits)}" />
<!--@else-->
@ -76,7 +76,7 @@
<div style="display:inline-block;padding-top:3px">
<label>{$lang->display_no}</label>
<select class="multiorder_show" size="8" multiple="multiple" style="vertical-align:top;margin-bottom:5px">
<option loop="$var->options => $key, $val" cond="!$var->init_options[$key]" value="{$key}" default="true"|cond="$var->default_options[$key]">{$val}</option>
<option loop="$var->options => $key, $val" cond="empty($var->init_options[$key])" value="{$key}" default="true"|cond="!empty($var->default_options[$key])">{$val}</option>
</select>
<br>
<button type="button" class="x_btn multiorder_add" style="vertical-align:top">{$lang->cmd_insert}</button>
@ -84,7 +84,7 @@
<div style="display:inline-block;padding-top:3px">
<label>{$lang->display_yes}</label>
<select class="multiorder_selected" size="8" multiple="multiple" style="vertical-align:top;margin-bottom:5px">
<option loop="$var->options => $key, $val" cond="$var->init_options[$key]" value="{$key}" default="true"|cond="$var->default_options[$key]">{$val}</option>
<option loop="$var->options => $key, $val" cond="!empty($var->init_options[$key])" value="{$key}" default="true"|cond="!empty($var->default_options[$key])">{$val}</option>
</select>
<br>
<button type="button" class="x_btn multiorder_up" style="margin:0 -5px 0 0;border-radius:2px 0 0 2px">{$lang->cmd_move_up}</button>

View file

@ -21,7 +21,7 @@
</div>
<div id="content" class="x_modal-body">
<p>{$widget_info->description} {$lang->about_widget_code_in_page}</p>
<form cond="$type=='faceoff'" class="x_form-horizontal">
<form cond="isset($type) && $type === 'faceoff'" class="x_form-horizontal">
<input type="hidden" name="module" value="widget" />
<input type="hidden" name="type" value="faceoff" />
<input type="hidden" name="act" value="dispWidgetGenerateCodeInPage" />

View file

@ -28,9 +28,9 @@
</div>
<div class="x_modal-body x_form-horizontal">
<a href="{getUrl('widgetstyle','none')}" class="widgetStyle"><img src="images/widgetstyle_none.gif" title="{$lang->notuse}" /></a>
<a loop="$widgetStyle_list => $key, $widgetStyle" cond="$widgetStyle->preview" href="{getUrl('widgetstyle',$widgetStyle->widgetStyle)}" class="widgetStyle <!--@if($widgetStyle->widgetStyle==$widgetstyle)-->selected<!--@end-->"><img src="{getUrl()}{$widgetStyle->preview}" title="{$widgetStyle->title}" /><span>{$widgetStyle->title}</span></a>
<a loop="$widgetStyle_list => $key, $widgetStyle" cond="$widgetStyle->preview" href="{getUrl('widgetstyle',$widgetStyle->widgetStyle)}" class="widgetStyle <!--@if($widgetStyle->widgetStyle == ($widgetstyle ?? ''))-->selected<!--@end-->"><img src="{getUrl()}{$widgetStyle->preview}" title="{$widgetStyle->title}" /><span>{$widgetStyle->title}</span></a>
<block cond="$widgetstyle_info">
<h2>{$widgetstyle_info->title} ver {$widgetstyle_info->version}</h2>
<div class="x_control-group">
<label class="x_control-label">{$lang->description}</label>
@ -52,45 +52,46 @@
{zdate($widgetstyle_info->date,'Y-m-d')}
</div>
</div>
{@ $group = ''; $not_first = false; $suggestion_id = 0; }
<block loop="$widgetstyle_info->extra_var => $id, $var">
{@$suggestion_id++}
{@ $suggestion_id++; }
<block cond="!$not_first && !$var->group"><section class="section"></block>
<block cond="$group != $var->group">
<block cond="$not_first"></section></block>
<h1>{$var->group}</h1>
<section class="section">
{@$group = $var->group}
{@ $group = $var->group; }
</block>
{@$not_first = true}
{@ $not_first = true; }
<div class="x_control-group">
<label class="x_control-label" for="{$id}"|cond="$var->type!='text'&&$var->type!='textarea'" for="lang_{$id}"|cond="$var->type=='text'||$var->type=='textarea'">{$var->name}</label>
<div class="x_controls extra_vars">
<div cond="$var->type == 'text'">
<input type="text" name="{$id}" value="" class="lang_code" />
<input type="text" name="{$id}" value="{$var->default}" class="lang_code" />
</div>
<input cond="$var->type == 'color'" type="text" name="{$id}" class="rx-spectrum" />
<input cond="$var->type == 'color'" type="text" name="{$id}" value="{$var->default}" class="rx-spectrum" />
<div cond="$var->type == 'textarea'">
<textarea name="{$id}" rows="8" cols="42" class="lang_code"></textarea>
<textarea name="{$id}" rows="8" cols="42" class="lang_code">{$var->default}</textarea>
</div>
<select cond="$var->type == 'select'" name="{$id}">
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option>
<option loop="$var->options ?? [] => $key, $val" value="{$key}" selected="selected"|cond="$var->default !== '' && $key == $var->default">{$val}</option>
</select>
<block cond="$var->type == 'filebox'">
<input type="hidden" name="{$id}" />
<a href="#modalFilebox" class="modalAnchor filebox">{$lang->cmd_select}</a>
{@$use_filebox = TRUE}
</block>
<label loop="$var->options => $key, $val" cond="$var->type == 'radio'">
<label loop="$var->options ?? [] => $key, $val" cond="$var->type == 'radio'">
<input type="radio" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
</label>
<label loop="$var->options => $key, $val" cond="$var->type == 'checkbox'">
<label loop="$var->options ?? [] => $key, $val" cond="$var->type == 'checkbox'">
<input type="checkbox" name="{$id}" id="{$id}_{$key}" value="{$key}" > {$val}
</label>
<span class="x_help-block">{$var->description}</span>

View file

@ -382,7 +382,7 @@ class WidgetController extends Widget
}
$args->widget_sequence = $args->widget_sequence ?? 0;
$args->colorset = $args->colorset ?? null;
$args->colorset = $args->colorset ?? '';
foreach ($lang_list as $lang_type => $val)
{
@ -430,6 +430,14 @@ class WidgetController extends Widget
return;
}
foreach (WidgetModel::getWidgetInfo($widget)->extra_var ?? [] as $key => $val)
{
if (!isset($args->{$key}))
{
$args->{$key} = $val->default !== '' ? $val->default : null;
}
}
$widget_content = $oWidget->proc($args);
return Context::replaceUserLang($widget_content);
}
@ -453,6 +461,14 @@ class WidgetController extends Widget
return;
}
foreach (WidgetModel::getWidgetInfo($widget)->extra_var ?? [] as $key => $val)
{
if (!isset($args->{$key}))
{
$args->{$key} = $val->default !== '' ? $val->default : null;
}
}
$oFrontEndFileHandler = FrontEndFileHandler::getInstance();
$oFrontEndFileHandler->startLog();
@ -498,7 +514,7 @@ class WidgetController extends Widget
// Set default
$args->widget_sequence = $args->widget_sequence ?? 0;
$args->widget_cache = $args->widget_cache ?? 0;
$args->colorset = $args->colorset ?? null;
$args->colorset = $args->colorset ?? '';
/**
* Widgets widgetContent/widgetBox Wanted If you are not content
@ -600,25 +616,30 @@ class WidgetController extends Widget
{
foreach($args as $key => $val)
{
$val = (string)$val;
if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
}
$oWidgetController = getController('widget');
$widget_content_header = sprintf(
'<div class="rhymix_content xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
$widget_content_header = vsprintf(
'<div class="rhymix_content xe_content widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
'<div class="widgetResize"></div>'.
'<div class="widgetResizeLeft"></div>'.
'<div class="widgetBorder">'.
'<div style="%s">',$args->widgetstyle,
'<div style="%s">',
[
$args->widgetstyle ?? '',
$style,
$args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom,
$args->widget_padding_left,
$args->widget_padding_right,
$args->widget_padding_top,
$args->widget_padding_bottom,
$args->document_srl,
implode(' ',$attribute),
$inner_style);
implode(' ', $attribute),
$inner_style,
]);
$widget_content_body = $body;
$widget_content_footer = sprintf('</div>'.
@ -642,11 +663,21 @@ class WidgetController extends Widget
}
}
$widget_content_header = sprintf(
'<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
$widget_content_header = vsprintf(
'<div class="widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
'<div class="widgetBoxResize"></div>'.
'<div class="widgetBoxResizeLeft"></div>'.
'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style);
'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',
[
$args->widgetstyle ?? '',
$style,
$widget_padding_top,
$widget_padding_right,
$widget_padding_bottom,
$widget_padding_left,
implode(' ', $attribute),
$inner_style,
]);
$widget_content_body = $widgetbox_content;
@ -667,12 +698,20 @@ class WidgetController extends Widget
}
}
$widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
$widget_content_header = vsprintf('<div class="widgetOutput ' . ($args->css_class ?? '') . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
'<div class="widgetResize"></div>'.
'<div class="widgetResizeLeft"></div>'.
'<div class="widgetBorder">',$args->widgetstyle,$style,
$widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,
$widget, implode(' ',$attribute));
'<div class="widgetBorder">',
[
$args->widgetstyle ?? '',
$style,
$widget_padding_top,
$widget_padding_right,
$widget_padding_bottom,
$widget_padding_left,
$widget,
implode(' ', $attribute),
]);
$widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content);
@ -831,25 +870,20 @@ class WidgetController extends Widget
$vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom);
$vars->document_srl= trim($request_vars->document_srl);
if(countobj($widget_info->extra_var))
foreach ($widget_info->extra_var ?? [] as $key => $val)
{
foreach($widget_info->extra_var as $key=>$val)
{
$vars->{$key} = trim($request_vars->{$key} ?? '');
}
$vars->{$key} = trim($request_vars->{$key} ?? '');
}
// If the widget style
// Additional configuration for widget styles
if($request_vars->widgetstyle)
{
$widgetStyle_info = WidgetModel::getWidgetStyleInfo($request_vars->widgetstyle);
if(countobj($widgetStyle_info->extra_var))
foreach ($widgetStyle_info->extra_var ?? [] as $key => $val)
{
foreach($widgetStyle_info->extra_var as $key=>$val)
if (in_array($val->type, ['color', 'text', 'select', 'filebox', 'textarea']))
{
if($val->type =='color' || $val->type =='text' || $val->type =='select' || $val->type =='filebox' || $val->type == 'textarea')
{
$vars->{$key} = trim($request_vars->{$key} ?? '');
}
$vars->{$key} = trim($request_vars->{$key} ?? '');
}
}
}

View file

@ -128,12 +128,19 @@ class WidgetModel extends Widget
return;
}
// Check the cache.
// Check the local cache.
$xml_mtime = filemtime($xml_file);
if (isset($GLOBALS['__widget_info__'][$widget][$xml_mtime]))
{
return $GLOBALS['__widget_info__'][$widget][$xml_mtime];
}
// Check the system cache.
$cache_key = sprintf('widget_info:%s:%d', $widget, $xml_mtime);
$widget_info = Rhymix\Framework\Cache::get($cache_key);
if ($widget_info)
{
$GLOBALS['__widget_info__'][$widget][$xml_mtime] = $widget_info;
return $widget_info;
}
@ -145,6 +152,7 @@ class WidgetModel extends Widget
}
Rhymix\Framework\Cache::set($cache_key, $widget_info);
$GLOBALS['__widget_info__'][$widget][$xml_mtime] = $widget_info;
return $widget_info;
}
@ -155,7 +163,7 @@ class WidgetModel extends Widget
public static function getWidgetStyleInfo($widgetStyle)
{
// Check the widget style path.
$widgetStyle = preg_replace('/[^a-zA-Z0-9-_]/', '', $widgetStyle);
$widgetStyle = preg_replace('/[^a-zA-Z0-9-_]/', '', (string)$widgetStyle);
$widgetStyle_path = self::getWidgetStylePath($widgetStyle);
if (!$widgetStyle_path)
{
@ -169,12 +177,19 @@ class WidgetModel extends Widget
return;
}
// Check the cache.
// Check the local cache.
$xml_mtime = filemtime($xml_file);
if (isset($GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime]))
{
return $GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime];
}
// Check the system cache.
$cache_key = sprintf('widgetstyle_info:%s:%d', $widgetStyle, $xml_mtime);
$widgetStyle_info = Rhymix\Framework\Cache::get($cache_key);
if ($widgetStyle_info)
{
$GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime] = $widgetStyle_info;
return $widgetStyle_info;
}
@ -186,6 +201,7 @@ class WidgetModel extends Widget
}
Rhymix\Framework\Cache::set($cache_key, $widgetStyle_info);
$GLOBALS['__widgetstyle_info__'][$widgetStyle][$xml_mtime] = $widgetStyle_info;
return $widgetStyle_info;
}
}