Merge branch 'develop' into pr/1548

This commit is contained in:
Kijin Sung 2021-01-08 14:59:25 +09:00
commit 8bf3fdeaee
29 changed files with 246 additions and 350 deletions

View file

@ -2293,7 +2293,7 @@ class Context
$plugin_name = 'ui';
}
if($loaded_plugins[$plugin_name])
if(isset($loaded_plugins[$plugin_name]))
{
return;
}

View file

@ -235,6 +235,9 @@ class TemplateHandler
// replace value of src in img/input/script tag
$buff = preg_replace_callback('/<(?:img|input|script)(?:[^<>]*?)(?(?=cond=")(?:cond="[^"]+"[^<>]*)+|)[^<>]* src="(?!(?:https?|file):\/\/|[\/\{])([^"]+)"/is', array($this, '_replacePath'), $buff);
// replace value of srcset in img/source/link tag
$buff = preg_replace_callback('/<(?:img|source|link)(?:[^<>]*?)(?(?=cond=")(?:cond="[^"]+"[^<>]*)+|)[^<>]* srcset="([^"]+)"/is', array($this, '_replaceSrcsetPath'), $buff);
// replace loop and cond template syntax
$buff = $this->_parseInline($buff);
@ -381,7 +384,7 @@ class TemplateHandler
}
/**
* preg_replace_callback hanlder
* preg_replace_callback handler
*
* replace image path
* @param array $match
@ -390,7 +393,19 @@ class TemplateHandler
*/
private function _replacePath($match)
{
//return origin conde when src value started '${'.
$src = $this->_replaceRelativePath($match);
return substr($match[0], 0, -strlen($match[1]) - 6) . "src=\"{$src}\"";
}
/**
* replace relative path
* @param array $match
*
* @return string changed result
*/
private function _replaceRelativePath($match)
{
//return origin code when src value started '${'.
if(preg_match('@^\${@', $match[1]))
{
return $match[0];
@ -415,7 +430,33 @@ class TemplateHandler
$src = $tmp;
}
return substr($match[0], 0, -strlen($match[1]) - 6) . "src=\"{$src}\"";
return $src;
}
/**
* preg_replace_callback handler
*
* replace srcset string with multiple paths
* @param array $match
*
* @return string changed result
*/
private function _replaceSrcsetPath($match)
{
// explode urls by comma
$url_list = explode(",", $match[1]);
foreach ($url_list as &$url) {
// replace if url is not starting with the pattern
$url = preg_replace_callback(
'/^(?!(?:https?|file):\/\/|[\/\{])(\S+)/i',
array($this, '_replaceRelativePath'),
trim($url)
);
}
$srcset = implode(", ", $url_list);
return substr($match[0], 0, -strlen($match[1]) - 9) . "srcset=\"{$srcset}\"";
}
/**
@ -536,7 +577,7 @@ class TemplateHandler
}
/**
* preg_replace_callback hanlder
* preg_replace_callback handler
* replace php code.
* @param array $m
* @return string changed result

View file

@ -85,7 +85,6 @@ $GLOBALS['RX_AUTOLOAD_FILE_MAP'] = array_change_key_case(array(
'XmlLangParser' => 'classes/xml/XmlLangParser.class.php',
'XmlParser' => 'classes/xml/XmlParser.class.php',
'XeXmlParser' => 'classes/xml/XmlParser.class.php',
'Bmp' => 'common/libraries/bmp.php',
'Ftp' => 'common/libraries/ftp.php',
'Tar' => 'common/libraries/tar.php',
'CryptoCompat' => 'common/libraries/cryptocompat.php',

View file

@ -1,257 +0,0 @@
<?php
// Read 1,4,8,24,32bit BMP files
// Save 24bit BMP files
// Author: de77
// Licence: MIT
// Webpage: de77.com
// Article about this class: http://de77.com/php/read-and-write-bmp-in-php-imagecreatefrombmp-imagebmp
// First-version: 07.02.2010
// Version: 21.08.2010
// Modified by Kijin Sung, April 6, 2013: Remove die() and global functions
class BMP
{
public static function imagebmp(&$img, $filename = false)
{
$wid = imagesx($img);
$hei = imagesy($img);
$wid_pad = str_pad('', $wid % 4, "\0");
$size = 54 + ($wid + $wid_pad) * $hei * 3; //fixed
//prepare & save header
$header['identifier'] = 'BM';
$header['file_size'] = self::dword($size);
$header['reserved'] = self::dword(0);
$header['bitmap_data'] = self::dword(54);
$header['header_size'] = self::dword(40);
$header['width'] = self::dword($wid);
$header['height'] = self::dword($hei);
$header['planes'] = self::word(1);
$header['bits_per_pixel'] = self::word(24);
$header['compression'] = self::dword(0);
$header['data_size'] = self::dword(0);
$header['h_resolution'] = self::dword(0);
$header['v_resolution'] = self::dword(0);
$header['colors'] = self::dword(0);
$header['important_colors'] = self::dword(0);
if ($filename)
{
$f = fopen($filename, "wb");
foreach ($header AS $h)
{
fwrite($f, $h);
}
//save pixels
for ($y=$hei-1; $y>=0; $y--)
{
for ($x=0; $x<$wid; $x++)
{
$rgb = imagecolorat($img, $x, $y);
fwrite($f, byte3($rgb));
}
fwrite($f, $wid_pad);
}
fclose($f);
}
else
{
foreach ($header AS $h)
{
echo $h;
}
//save pixels
for ($y=$hei-1; $y>=0; $y--)
{
for ($x=0; $x<$wid; $x++)
{
$rgb = imagecolorat($img, $x, $y);
echo self::byte3($rgb);
}
echo $wid_pad;
}
}
}
public static function getimagesize($filename)
{
$f = fopen($filename, "rb");
//read header
$header = fread($f, 54);
$header = unpack( 'c2identifier/Vfile_size/Vreserved/Vbitmap_data/Vheader_size/' .
'Vwidth/Vheight/vplanes/vbits_per_pixel/Vcompression/Vdata_size/'.
'Vh_resolution/Vv_resolution/Vcolors/Vimportant_colors', $header);
if ($header['identifier1'] != 66 or $header['identifier2'] != 77)
{
return false;
}
if (!in_array($header['bits_per_pixel'], array(24, 32, 8, 4, 1)))
{
return false;
}
$bps = $header['bits_per_pixel']; //bits per pixel
$wid2 = ceil(($bps/8 * $header['width']) / 4) * 4;
$colors = pow(2, $bps);
$wid = $header['width'];
$hei = $header['height'];
return array($wid, $hei, 'BMP');
}
public static function imagecreatefrombmp($filename)
{
$f = fopen($filename, "rb");
//read header
$header = fread($f, 54);
$header = unpack( 'c2identifier/Vfile_size/Vreserved/Vbitmap_data/Vheader_size/' .
'Vwidth/Vheight/vplanes/vbits_per_pixel/Vcompression/Vdata_size/'.
'Vh_resolution/Vv_resolution/Vcolors/Vimportant_colors', $header);
if ($header['identifier1'] != 66 or $header['identifier2'] != 77)
{
return false;
}
if (!in_array($header['bits_per_pixel'], array(24, 32, 8, 4, 1)))
{
return false;
}
$bps = $header['bits_per_pixel']; //bits per pixel
$wid2 = ceil(($bps/8 * $header['width']) / 4) * 4;
$colors = pow(2, $bps);
$wid = $header['width'];
$hei = $header['height'];
$img = imagecreatetruecolor($header['width'], $header['height']);
//read palette
if ($bps < 9)
{
for ($i=0; $i<$colors; $i++)
{
$palette[] = self::undword(fread($f, 4));
}
}
else
{
if ($bps == 32)
{
imagealphablending($img, false);
imagesavealpha($img, true);
}
$palette = array();
}
//read pixels
for ($y=$hei-1; $y>=0; $y--)
{
$row = fread($f, $wid2);
$pixels = self::str_split2($row, $bps, $palette);
for ($x=0; $x<$wid; $x++)
{
self::makepixel($img, $x, $y, $pixels[$x], $bps);
}
}
fclose($f);
return $img;
}
private static function str_split2($row, $bps, $palette)
{
switch ($bps)
{
case 32:
case 24: return str_split($row, $bps/8);
case 8: $out = array();
$count = strlen($row);
for ($i=0; $i<$count; $i++)
{
$out[] = $palette[ ord($row[$i]) ];
}
return $out;
case 4: $out = array();
$count = strlen($row);
for ($i=0; $i<$count; $i++)
{
$roww = ord($row[$i]);
$out[] = $palette[ ($roww & 240) >> 4 ];
$out[] = $palette[ ($roww & 15) ];
}
return $out;
case 1: $out = array();
$count = strlen($row);
for ($i=0; $i<$count; $i++)
{
$roww = ord($row[$i]);
$out[] = $palette[ ($roww & 128) >> 7 ];
$out[] = $palette[ ($roww & 64) >> 6 ];
$out[] = $palette[ ($roww & 32) >> 5 ];
$out[] = $palette[ ($roww & 16) >> 4 ];
$out[] = $palette[ ($roww & 8) >> 3 ];
$out[] = $palette[ ($roww & 4) >> 2 ];
$out[] = $palette[ ($roww & 2) >> 1 ];
$out[] = $palette[ ($roww & 1) ];
}
return $out;
}
}
private static function makepixel($img, $x, $y, $str, $bps)
{
switch ($bps)
{
case 32 : $a = ord($str[0]);
$b = ord($str[1]);
$c = ord($str[2]);
$d = 256 - ord($str[3]); //TODO: gives imperfect results
$pixel = $d*256*256*256 + $c*256*256 + $b*256 + $a;
imagesetpixel($img, $x, $y, $pixel);
break;
case 24 : $a = ord($str[0]);
$b = ord($str[1]);
$c = ord($str[2]);
$pixel = $c*256*256 + $b*256 + $a;
imagesetpixel($img, $x, $y, $pixel);
break;
case 8 :
case 4 :
case 1 : imagesetpixel($img, $x, $y, $str);
break;
}
}
private static function byte3($n)
{
return chr($n & 255) . chr(($n >> 8) & 255) . chr(($n >> 16) & 255);
}
private static function undword($n)
{
$r = unpack("V", $n);
return $r[1];
}
private static function dword($n)
{
return pack("V", $n);
}
private static function word($n)
{
return pack("v", $n);
}
}

View file

@ -21,7 +21,7 @@
<action name="procAdminRecompileCacheFile" type="controller" />
<action name="procAdminLogout" type="controller" method="GET|POST" />
<action name="procAdminInsertDefaultDesignInfo" type="controller" />
<action name="procAdminToggleFavorite" type="controller" ruleset="toggleFavorite" />
<action name="procAdminToggleFavorite" type="controller" />
<action name="procAdminEnviromentGatheringAgreement" type="controller" />
<action name="procAdminUpdateConfig" type="controller" />
<action name="procAdminDeleteLogo" type="controller" />

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ruleset version="1.5.0">
<customrules />
<fields>
<field name="site_srl" required="true" rule="number" />
<field name="module_name" required="true" />
</fields>
</ruleset>

View file

@ -68,9 +68,9 @@
<a cond="!$favorite->title">{$lang->msg_not_founded}</a>
<form class="remove" action="./" method="post">
<input type="hidden" name="module" value="admin" />
<input type="hidden" name="act" value="" />
<input type="hidden" name="act" value="procAdminToggleFavorite" />
<input type="hidden" name="module_name" value="{$favorite->module}" />
<input type="hidden" name="success_return_url" value="{getUrl(['module' => 'admin'])}" />
<input type="hidden" name="success_return_url" value="{getCurrentUrl()}" />
<button type="submit" class="x_close" title="{$lang->cmd_delete}">&times;</button>
</form>
</li>

View file

@ -776,7 +776,7 @@ class boardView extends board
foreach($normal_category_list as $category_srl => $category)
{
$is_granted = TRUE;
if($category->group_srls)
if(isset($category->group_srls) && $category->group_srls)
{
$category_group_srls = explode(',',$category->group_srls);
$is_granted = FALSE;
@ -814,12 +814,12 @@ class boardView extends board
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE;
$savedDoc = ($oDocument->get('module_srl') == $oDocument->get('member_srl'));
$oDocument->add('module_srl', $this->module_srl);
if($oDocument->isExists())
{
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
if(($this->module_info->protect_document_regdate ?? 0) > 0 && $this->grant->manager == false)
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
{
@ -828,7 +828,7 @@ class boardView extends board
throw new Rhymix\Framework\Exception($massage);
}
}
if($this->module_info->protect_content == "Y" || $this->module_info->protect_update_content == 'Y')
if(($this->module_info->protect_content ?? 'N') === 'Y' || ($this->module_info->protect_update_content ?? 'N') == 'Y')
{
if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
{

View file

@ -2,7 +2,7 @@
<load target="board.default.js" type="body" />
<load target="../../../../common/xeicon/xeicon.min.css" />
<!--@if($order_type == "desc")-->
<!--@if(isset($order_type) && $order_type == "desc")-->
{@ $order_type = "asc"; }
<!--@else-->
{@ $order_type = "desc"; }

View file

@ -7,9 +7,9 @@
</h1>
<p class="meta">
<span class="author">
<i class="xi-user"></i><a cond="$module_info->display_author!='N' && $oDocument->getMemberSrl() <= 0 && $oDocument->isExistsHomepage()" href="{$oDocument->getHomepageUrl()}" target="_blank" rel="noopener" class="author">{$oDocument->getNickName()}</a>
<block cond="$module_info->display_author!='N' && $oDocument->getMemberSrl() <= 0 && !$oDocument->isExistsHomepage()">{$oDocument->getNickName()}</block>
<a cond="$module_info->display_author!='N' && $oDocument->getMemberSrl() > 0" href="#popup_menu_area" class="member_{$oDocument->get('member_srl')} author" onclick="return false">{$oDocument->getNickName()}</a>
<i class="xi-user"></i><a cond="isset($module_info->display_author) && $module_info->display_author != 'N' && $oDocument->getMemberSrl() <= 0 && $oDocument->isExistsHomepage()" href="{$oDocument->getHomepageUrl()}" target="_blank" rel="noopener" class="author">{$oDocument->getNickName()}</a>
<block cond="isset($module_info->display_author) && $module_info->display_author != 'N' && $oDocument->getMemberSrl() <= 0 && !$oDocument->isExistsHomepage()">{$oDocument->getNickName()}</block>
<a cond="isset($module_info->display_author) && $module_info->display_author != 'N' && $oDocument->getMemberSrl() > 0" href="#popup_menu_area" class="member_{$oDocument->get('member_srl')} author" onclick="return false">{$oDocument->getNickName()}</a>
</span>
<span class="time">
<i class="xi-time"></i> {$oDocument->getRegdate('Y.m.d H:i')}
@ -109,7 +109,7 @@
</span>
<a class="document_{$oDocument->document_srl} action" href="#popup_menu_area" onclick="return false">{$lang->cmd_document_do}</a>
</div>
<div class="sign" cond="$module_info->display_sign!='N'&&($oDocument->getProfileImage()||$oDocument->getSignature())">
<div class="sign" cond="isset($module_info->display_sign) && $module_info->display_sign != 'N' && ($oDocument->getProfileImage() || $oDocument->getSignature())">
<img cond="$oDocument->getProfileImage()" src="{$oDocument->getProfileImage()}" alt="Profile" class="pf" />
<div cond="$oDocument->getSignature()" class="tx">{$oDocument->getSignature()}</div>
</div>

View file

@ -1,10 +1,10 @@
<include target="_header.html" />
<include cond="$oDocument->isExists()" target="_read.html" />
<ul class="cTab" cond="$module_info->use_category=='Y'">
<li class="on"|cond="!$category"><a href="{getUrl('category','','page','')}">{$lang->total}</a></li>
<li loop="$cate_list=>$key,$val" class="on"|cond="$category==$val->category_srl"><a href="{getUrl('category',$val->category_srl,'document_srl','', 'page', '')}">{$val->title}<!--<em cond="$val->document_count">[{$val->document_count}]</em>--></a>
<li class="on"|cond="!isset($category) || !$category"><a href="{getUrl('category','','page','')}">{$lang->total}</a></li>
<li loop="$cate_list=>$key,$val" class="on"|cond="isset($category) && $category == $val->category_srl"><a href="{getUrl('category',$val->category_srl,'document_srl','', 'page', '')}">{$val->title}<!--<em cond="$val->document_count">[{$val->document_count}]</em>--></a>
<ul cond="count($val->children)">
<li loop="$val->children=>$idx,$item" class="on_"|cond="$category==$item->category_srl"><a href="{getUrl('category',$item->category_srl,'document_srl','', 'page', '')}">{$item->title}<!--<em cond="$val->document_count">[{$item->document_count}]</em>--></a></li>
<li loop="$val->children=>$idx,$item" class="on_"|cond="isset($category) && $category == $item->category_srl"><a href="{getUrl('category',$item->category_srl,'document_srl','', 'page', '')}">{$item->title}<!--<em cond="$val->document_count">[{$item->document_count}]</em>--></a></li>
</ul>
</li>
</ul>
@ -44,14 +44,14 @@
<tr class="notice" loop="$notice_list=>$no,$document">
<block loop="$list_config=>$key,$val">
<td class="notice" cond="$val->type=='no' && $val->idx==-1">
<block cond="$document_srl==$document->document_srl">&raquo;</block>
<block cond="$document_srl!=$document->document_srl">{$lang->notice}</block>
<block cond="isset($document_srl) && $document_srl == $document->document_srl">&raquo;</block>
<block cond="!isset($document_srl) || $document_srl != $document->document_srl">{$lang->notice}</block>
</td>
<td class="module_title" cond="$val->type=='module_title' && $val->idx==-1">
<a href="{getUrl('', 'mid', $document->get('mid'))}">{$document->get('module_title')}</a>
</td>
<td class="title" cond="$val->type=='title' && $val->idx==-1">
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle ?? '', 'cpage','')}">
{$document->getTitle()}
</a>
<a cond="$document->getCommentCount()" href="{getUrl('document_srl', $document->document_srl)}#comment" class="replyNum" title="Replies">
@ -90,14 +90,14 @@
<tr loop="$document_list=>$no,$document">
<block loop="$list_config=>$key,$val">
<td class="no" cond="$val->type=='no' && $val->idx==-1">
<block cond="$document_srl==$document->document_srl">&raquo;</block>
<block cond="$document_srl!=$document->document_srl">{$no}</block>
<block cond="isset($document_srl) && $document_srl == $document->document_srl">&raquo;</block>
<block cond="!isset($document_srl) || $document_srl != $document->document_srl">{$no}</block>
</td>
<td class="module_title" cond="$val->type=='module_title' && $val->idx==-1">
<a href="{getUrl('', 'mid', $document->get('mid'))}">{$document->get('module_title')}</a>
</td>
<td class="title" cond="$val->type=='title' && $val->idx==-1">
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">{$document->getTitle()}</a>
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle ?? '', 'cpage','')}">{$document->getTitle()}</a>
<a cond="$document->getCommentCount()" href="{getUrl('document_srl', $document->document_srl)}#comment" class="replyNum" title="Replies">[{$document->getCommentCount()}]</a>
<a cond="$document->getTrackbackCount()" href="{getUrl('document_srl', $document->document_srl)}#trackback" class="trackbackNum" title="Trackbacks">[{$document->getTrackbackCount()}]</a>
{$document->printExtraImages(60*60*$module_info->duration_new)}
@ -140,27 +140,26 @@
</div>
<form cond="$grant->view" action="{getUrl()}" method="get" onsubmit="return procFilter(this, search)" id="board_search" class="board_search" no-error-return-url="true">
<input type="hidden" name="vid" value="{$vid}" />
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="category" value="{$category}" />
<input type="hidden" name="category" value="{$category ?? ''}" />
<select name="search_target">
<option loop="$search_option=>$key,$val" value="{$key}" selected="selected"|cond="$search_target==$key">{$val}</option>
<option loop="$search_option=>$key,$val" value="{$key}" selected="selected"|cond="isset($search_target) && $search_target == $key">{$val}</option>
</select>
<div class="search_input">
<i class="xi-magnifier"></i>
<input type="text" name="search_keyword" value="{escape($search_keyword, false)}" title="{$lang->cmd_search}" class="iText" />
<input type="text" name="search_keyword" value="{escape($search_keyword ?? '', false)}" title="{$lang->cmd_search}" class="iText" />
</div>
<button type="submit" class="btn" onclick="xGetElementById('board_search').submit();return false;">{$lang->cmd_search}</button>
<a cond="$last_division" href="{getUrl('page',1,'document_srl','','division',$last_division,'last_division','')}" class="btn">{$lang->cmd_search_next}</a>
<a cond="isset($last_division) && $last_division" href="{getUrl('page',1,'document_srl','','division',$last_division,'last_division','')}" class="btn">{$lang->cmd_search_next}</a>
</form>
<div class="pagination" cond="$document_list || $notice_list">
<a href="{getUrl('page','','document_srl','','division',$division,'last_division',$last_division)}" class="direction prev"><i class="xi-angle-left"></i>&nbsp;{$lang->first_page}</a>
<a href="{getUrl('page','','document_srl','','division',$division ?? '','last_division',$last_division ?? '')}" class="direction prev"><i class="xi-angle-left"></i>&nbsp;{$lang->first_page}</a>
<block loop="$page_no=$page_navigation->getNextPage()">
<strong cond="$page==$page_no">{$page_no}</strong>
<a cond="$page!=$page_no" href="{getUrl('page',$page_no,'document_srl','','division',$division,'last_division',$last_division)}">{$page_no}</a>
<a cond="$page!=$page_no" href="{getUrl('page',$page_no,'document_srl','','division',$division ?? '','last_division',$last_division ?? '')}">{$page_no}</a>
</block>
<a href="{getUrl('page',$page_navigation->last_page,'document_srl','','division',$division,'last_division',$last_division)}" class="direction next">{$lang->last_page}&nbsp;<i class="xi-angle-right"></i></a>
<a href="{getUrl('page',$page_navigation->last_page,'document_srl','','division',$division ?? '','last_division',$last_division ?? '')}" class="direction next">{$lang->last_page}&nbsp;<i class="xi-angle-right"></i></a>
</div>
</div>

View file

@ -71,12 +71,12 @@
<label for="tags" class="iLabel">{$lang->tag}: {$lang->about_tag}</label>
<input type="text" name="tags" id="tags" value="{htmlspecialchars($oDocument->get('tags'))}" class="iText" style="width:300px" title="Tag" />
</span>
<span class="item" cond="$oDocument->get('document_srl') && $module_info->update_log == 'Y'">
<span class="item" cond="$oDocument->get('document_srl') && isset($module_info->update_log) && $module_info->update_log == 'Y'">
<label for="reason_update" class="iLabel">{$lang->reason_update}</label>
<input type="text" name="reason_update" id="reason_update" value="" class="iText" style="width:300px" title="reason update" />
</span>
</div>
<div class="write_captcha" cond="$captcha">
<div class="write_captcha" cond="isset($captcha) && $captcha">
{$captcha}
</div>
<div style="float:right">

View file

@ -1355,7 +1355,7 @@ class documentController extends document
$oDB->commit();
// Register session
if(!$_SESSION['banned_document'][$document_srl] && Context::getSessionStatus())
if(!isset($_SESSION['readed_document'][$document_srl]) && Context::getSessionStatus())
{
$_SESSION['readed_document'][$document_srl] = true;
}

View file

@ -30,6 +30,11 @@ class documentItem extends BaseObject
* @var bool
*/
var $allow_trackback_status = null;
/**
* Comment page navigation
* @var object
*/
var $comment_page_navigation = null;
/**
* column list
* @var array
@ -1459,7 +1464,7 @@ class documentItem extends BaseObject
if(!isset($GLOBALS['__member_signature_max_height']))
{
$member_config = ModuleModel::getModuleConfig('member');
$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height ?? 100;
}
if($signature)
{

View file

@ -1307,7 +1307,7 @@ class documentModel extends document
$args->page_count = $searchOpt->page_count ?? 10;
$args->start_date = $searchOpt->start_date ?? null;
$args->end_date = $searchOpt->end_date ?? null;
$args->s_is_notice = $searchOpt->except_notice ? 'N' : null;
$args->s_is_notice = ($searchOpt->except_notice ?? false) ? 'N' : null;
$args->statusList = $searchOpt->statusList ?? array(self::getConfigStatus('public'), self::getConfigStatus('secret'));
$args->columnList = $searchOpt->columnList ?? array();

View file

@ -231,6 +231,7 @@ class editorAdminController extends editor
$config->content_word_break = $configVars->content_word_break;
$config->content_word_break = in_array($config->content_word_break, array('normal', 'keep-all', 'break-all', 'none')) ? $config->content_word_break : 'normal';
$config->enable_autosave = $configVars->enable_autosave ?: 'Y';
$config->auto_dark_mode = $configVars->auto_dark_mode ?: 'Y';
$config->allow_html = $configVars->allow_html ?: 'Y';
$config->autoinsert_types = array();
foreach ($configVars->autoinsert_types as $type)

View file

@ -48,6 +48,7 @@ class editor extends ModuleObject
'content_paragraph_spacing' => '0px',
'content_word_break' => 'normal',
'enable_autosave' => 'Y',
'auto_dark_mode' => 'Y',
'allow_html' => 'Y',
'editor_focus' => 'N',
'autoinsert_types' => array('image' => true, 'audio' => true, 'video' => true),

View file

@ -155,6 +155,7 @@ class editorController extends editor
$config->content_font_size = trim($vars->content_font_size);
$config->enable_autosave = $vars->enable_autosave ?: 'Y';
$config->auto_dark_mode = $vars->auto_dark_mode ?: 'Y';
$config->allow_html = $vars->allow_html ?: 'Y';
// Apply module-specific permissions.

View file

@ -203,6 +203,7 @@ class editorModel extends editor
// Set allow html and focus
Context::set('allow_html', ($option->allow_html === false || $option->allow_html === 'N') ? false : true);
Context::set('editor_focus', toBool($option->editor_focus));
Context::set('editor_auto_dark_mode', $option->auto_dark_mode !== 'N');
// Load editor components.
if($option->enable_component)
@ -262,7 +263,7 @@ class editorModel extends editor
Context::set('files_count', (int)$files_count);
// Check an option whether to start the editor manually.
Context::set('editor_manual_start', $option->manual_start);
Context::set('editor_manual_start', $option->manual_start ?? null);
// Compile and return the editor skin template.
$tpl_path = Context::get('editor_path');

View file

@ -76,6 +76,7 @@ $lang->enable_default_component_grant = 'Permission to use default components';
$lang->enable_extra_component_grant = 'Permission to use extra components';
$lang->enable_html_grant = 'Permission to edit HTML';
$lang->enable_autosave = 'Enable Auto-Save';
$lang->editor_auto_dark_mode = 'Automatic dark mode';
$lang->allow_html = 'allow HTML';
$lang->height_resizable = 'Height Resizable';
$lang->editor_height = 'Height of Editor';
@ -83,6 +84,7 @@ $lang->about_default_editor_settings = 'Follow the default settings from the Edi
$lang->about_content_font = 'Please use comma for multiple input.';
$lang->about_content_font_size = 'Please input units such as px or em.';
$lang->about_enable_autosave = 'You may decide whether the auto-save function will be used.';
$lang->about_editor_auto_dark_mode = 'Automatically switch to a dark skin if dark mode is used.';
$lang->edit['fontname'] = 'Font';
$lang->edit['fontsize'] = 'Size';
$lang->edit['use_paragraph'] = 'Paragraph Function';

View file

@ -74,6 +74,7 @@ $lang->enable_default_component_grant = '기본 컴포넌트 사용 권한';
$lang->enable_extra_component_grant = '확장 컴포넌트 사용 권한';
$lang->enable_html_grant = 'HTML 편집 권한';
$lang->enable_autosave = '자동저장 사용';
$lang->editor_auto_dark_mode = '다크모드 자동 감지';
$lang->allow_html = 'HTML 허용';
$lang->height_resizable = '높이 조절 가능';
$lang->editor_height = '에디터 높이';
@ -81,6 +82,7 @@ $lang->about_default_editor_settings = '에디터 모듈의 기본 설정을 따
$lang->about_content_font = '콤마(,)로 여러 폰트를 지정할 수 있습니다.';
$lang->about_content_font_size = '12px, 1em등 단위까지 포함해서 입력해주세요.';
$lang->about_enable_autosave = '글 작성 시 자동 저장 기능을 활성화 시킬 수 있습니다.';
$lang->about_editor_auto_dark_mode = '다크모드 사용시 자동으로 어두운 스킨을 사용합니다.';
$lang->edit['fontname'] = '글꼴';
$lang->edit['fontsize'] = '크기';
$lang->edit['use_paragraph'] = '문단기능';

View file

@ -33,18 +33,81 @@
}
.light_dark(@cs) when (@cs = moono-dark) {
background-color: #494949;
background-color: #333;
color: #fff;
}
.light_dark(@cs) when not (@cs = moono-dark) {
background-color: #fff;
color: #000;
&.color_scheme_dark {
background-color: #333;
color: #fff;
}
}
.light_dark_top(@cs) when (@cs = moono-dark) {
border-bottom-color: #1b1b1b;
body & {
border-color: #555;
&.cke_bottom {
background: #333;
.cke_button_icon, .cke_combo_button, .cke_button_arrow, .cke_button_label {
filter: invert(1);
}
}
}
}
.light_dark_top(@cs) when not (@cs = moono-dark) {
.color_scheme_dark & {
background: #333;
border-color: #555;
.cke_button_on {
background: #000;
border-color: #555;
}
.cke_button_icon, .cke_combo_button, .cke_button_arrow, .cke_button_label {
filter: invert(1);
}
&.cke_dialog_body {
background: #555;
}
.cke_dialog_title {
background: #333;
color: #fff;
border-bottom-color: #555;
.cke_dialog_close_button {
color: #fff;
}
}
.cke_dialog_tabs {
background: #555;
.cke_dialog_tab {
background: #555;
color: #999;
border-color: #777;
}
.cke_dialog_tab_selected {
background: #777;
color: #fff;
border-color: #777;
}
}
.cke_dialog_contents {
background: #555;
border-top-color: #777;
label {
color: #fff;
}
select, input, .ImagePreviewBox td {
background: #333;
color: #fff;
border-color: #777;
}
}
.cke_dialog_footer {
background: #333;
border-top-color: #555;
}
}
}
html {
@ -66,31 +129,36 @@ html {
p.editor_autosaved_message.autosave_message {
display:none;
background: #e0e0e0;
color: #000;
padding: 10px;
margin:0;
line-height:1.2;
.color_scheme_dark & {
background: #222;
color: #fff;
}
}
.cke_reset {
span {
&.cke_top {
.light_dark_top(@colorset);
a {
&:hover, &:focus {
transition: none;
}
}
}
&.cke_combo__fontsize {
.cke_combo_button {
width: 64px;
}
.cke_combo_text {
width: 30px;
.cke_top, .cke_bottom {
.light_dark_top(@colorset);
a {
&:hover, &:focus {
transition: none;
}
}
}
.cke_combo__fontsize {
.cke_combo_button {
width: 64px;
}
.cke_combo_text {
width: 30px;
}
}
}
.cke_dialog_body {
.light_dark_top(@colorset);
}
.xe_content.editable, .rhymix_content.editable, .cke_wysiwyg_div {
.cont_font(@content_font);
@ -125,4 +193,4 @@ p.editor_autosaved_message.autosave_message {
}
}
}
}

View file

@ -92,11 +92,22 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
return val + "/" + val + "px";
}).join(";");
// Apply auto dark mode.
var editor_skin = '{$colorset}';
var editor_color = null;
<!--@if($editor_auto_dark_mode)-->
if (getColorScheme() === 'dark') {
if (editor_skin !== 'moono-lisa' ) {
editor_skin = 'moono-dark';
}
}
<!--@endif-->
// Initialize CKEditor settings.
var settings = {
ckeconfig: {
height: '{$editor_height}',
skin: '{$colorset}',
skin: editor_skin,
contentsCss: {json_encode($css_file_list)},
xe_editor_sequence: {$editor_sequence},
font_defaultLabel: default_font_name,
@ -106,7 +117,7 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
toolbarCanCollapse: true,
allowedContent: true,
startupFocus: {json_encode($editor_focus)},
language: "{str_replace('jp','ja',$lang_type)}"
language: "{str_replace('jp','ja',$lang_type)}",
},
loadXeComponent: true,
enableToolbar: true,

View file

@ -10,7 +10,7 @@
background: #fff;
padding: 10px;
}
&.dark {
&.dark, .color_scheme_dark & {
border-color: #111;
background: #333;
color: #fff;

View file

@ -256,6 +256,14 @@
<p class="x_help-block">{$lang->about_enable_autosave}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->editor_auto_dark_mode}</label>
<div class="x_controls">
<label class="x_inline"><input type="radio" name="auto_dark_mode" value="Y" checked="checked"|cond="$editor_config->auto_dark_mode != 'N'" /> {$lang->cmd_yes}</label>
<label class="x_inline"><input type="radio" name="auto_dark_mode" value="N" checked="checked"|cond="$editor_config->auto_dark_mode == 'N'" /> {$lang->cmd_no}</label>
<p class="x_help-block">{$lang->about_editor_auto_dark_mode}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->allow_html}</label>
<div class="x_controls">

View file

@ -167,6 +167,14 @@
<p class="x_help-inline">{$lang->about_enable_autosave}</p>
</td>
</tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->editor_auto_dark_mode}</th>
<td colspan="2">
<label class="x_inline"><input type="radio" name="auto_dark_mode" value="Y" checked="checked"|cond="$editor_config->auto_dark_mode != 'N'" /> {$lang->cmd_yes}</label>
<label class="x_inline"><input type="radio" name="auto_dark_mode" value="N" checked="checked"|cond="$editor_config->auto_dark_mode == 'N'" /> {$lang->cmd_no}</label>
<p class="x_help-inline">{$lang->about_editor_auto_dark_mode}</p>
</td>
</tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->allow_html}</th>
<td colspan="2">

View file

@ -84,6 +84,7 @@ function getAutoSavedSrl(ret_obj, response_tags, c) {
var fo_obj = getCkFormInstance(editor_sequence);
this.ckeconfig = $.extend({}, default_ckeconfig, opts.ckeconfig || {});
this.ckeconfig.bodyClass = this.ckeconfig.bodyClass + ' color_scheme_' + getColorScheme();
this.editor_sequence = data.editorSequence;
$form.attr('editor_sequence', data.editorSequence);

View file

@ -261,9 +261,9 @@ class widgetController extends widget
// Check whether to include information about editing
$this->javascript_mode = $javascript_mode;
// 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
$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content);
$content = preg_replace_callback('!<img([^>]*)widget=([^>]*?)>!is', array($this, 'transWidget'), $content);
return $content;
}
@ -273,16 +273,18 @@ class widgetController extends widget
*/
function transWidget($matches)
{
$buff = trim($matches[0]);
$oXmlParser = new XeXmlParser();
$xml_doc = $oXmlParser->parse(trim($buff));
if($xml_doc->img) $vars = $xml_doc->img->attrs;
else $vars = $xml_doc->attrs;
$vars = new stdClass;
$xml = simplexml_load_string(trim($matches[0]));
foreach ($xml->img ? $xml->img->attributes() : $xml->attributes() as $key => $val)
{
$vars->{$key} = strval($val);
}
$widget = $vars->widget;
if(!$widget) return $matches[0];
if (!$widget)
{
return $matches[0];
}
unset($vars->widget);
return $this->execute($widget, $vars, $this->javascript_mode);
@ -361,7 +363,7 @@ class widgetController extends widget
}
// Fix the widget sequence if it is missing
$widget_sequence = $override_sequence ?: $args->widget_sequence;
$widget_sequence = $override_sequence ?: ($args->widget_sequence ?? 0);
if (!$widget_sequence)
{
$widget_sequence = sha1(json_encode($args));
@ -480,12 +482,12 @@ class widgetController extends widget
* Wanted specified by the administrator of the widget style
*/
// Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed
$style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style);
$style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style ?? '');
// Find a style statement that based on the internal margin dropping pre-change
$widget_padding_left = $args->widget_padding_left;
$widget_padding_right = $args->widget_padding_right;
$widget_padding_top = $args->widget_padding_top;
$widget_padding_bottom = $args->widget_padding_bottom;
$widget_padding_left = $args->widget_padding_left ?? 0;
$widget_padding_right = $args->widget_padding_right ?? 0;
$widget_padding_top = $args->widget_padding_top ?? 0;
$widget_padding_bottom = $args->widget_padding_bottom ?? 0;
$inner_style = sprintf("padding:%dpx %dpx %dpx %dpx !important;", $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left);
/**
@ -498,7 +500,10 @@ class widgetController extends widget
// If general call is given on page styles should return immediately dreamin '
if(!$javascript_mode)
{
if($args->id) $args->id = ' id="'.$args->id.'" ';
if(isset($args->id) && $args->id)
{
$args->id = ' id="'.$args->id.'" ';
}
switch($widget)
{
// If a direct orthogonal addition information
@ -517,20 +522,20 @@ class widgetController extends widget
$oEditorController = getController('editor');
$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);
$widget_content_body = $body;
$widget_content_footer = '</div></div>';
break;
// If the widget box; it could
case 'widgetBox' :
$widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style);
$widget_content_header = sprintf('<div class="xe-widget-wrapper ' . ($args->css_class ?? '') . '" %sstyle="%s;"><div style="%s"><div>', $args->id ?? '', $style, $inner_style);
$widget_content_body = $widgetbox_content;
break;
// If the General wijetil
default :
$widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s">',$args->id,$style);
$widget_content_header = sprintf('<div class="xe-widget-wrapper ' . ($args->css_class ?? '') . '" %sstyle="%s">', $args->id ?? '', $style);
$widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style,$widget_content);
$widget_content_footer = '</div>';
break;
@ -641,7 +646,10 @@ class widgetController extends widget
}
}
// Compile the widget style.
if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode);
if(isset($args->widgetstyle) && $args->widgetstyle)
{
$widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode);
}
$output = $widget_content_header . $widget_content_body . $widget_content_footer;

View file

@ -275,6 +275,11 @@ class TemplateHandlerTest extends \Codeception\TestCase\Test
array(
'<input>asdf src="../img/img.gif" asdf</input>',
'?><input>asdf src="../img/img.gif" asdf</input>'
),
// srcset (PR #1544)
array(
'<img src="./img/sticker_banner_960w.png" alt="this is a test image." srcset="https://abc.com/static/img/test@2x.png 2x, http://abc.com/static/test@2.5x.png 2.5x,../img/test@3x.png 3x, ../img/test_960w.png 960w, {$mid}/image.png 480w">',
'?><img src="/rhymix/tests/unit/classes/template/img/sticker_banner_960w.png" alt="this is a test image." srcset="https://abc.com/static/img/test@2x.png 2x, http://abc.com/static/test@2.5x.png 2.5x, /rhymix/tests/unit/classes/img/test@3x.png 3x, /rhymix/tests/unit/classes/img/test_960w.png 960w, <?php echo $__Context->mid ?>/image.png 480w">'
),
// Rhymix improvements (PR #604)
array(