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

This commit is contained in:
Kijin Sung 2018-07-06 09:15:52 +09:00
commit 625c3b741f
435 changed files with 22374 additions and 21994 deletions

View file

@ -58,8 +58,25 @@ class adminAdminController extends admin
function procAdminRecompileCacheFile()
{
// rename cache dir
Rhymix\Framework\Storage::move(\RX_BASEDIR . 'files/cache', \RX_BASEDIR . 'files/cache_' . time());
Rhymix\Framework\Storage::createDirectory(\RX_BASEDIR . 'files/cache');
$truncate_method = Rhymix\Framework\Config::get('cache.truncate_method');
if ($truncate_method === 'empty')
{
$tmp_basedir = \RX_BASEDIR . 'files/cache/truncate_' . time();
Rhymix\Framework\Storage::createDirectory($tmp_basedir);
$dirs = Rhymix\Framework\Storage::readDirectory(\RX_BASEDIR . 'files/cache', true, false, false);
if ($dirs)
{
foreach ($dirs as $dir)
{
Rhymix\Framework\Storage::moveDirectory($dir, $tmp_basedir . '/' . basename($dir));
}
}
}
else
{
Rhymix\Framework\Storage::move(\RX_BASEDIR . 'files/cache', \RX_BASEDIR . 'files/cache_' . time());
Rhymix\Framework\Storage::createDirectory(\RX_BASEDIR . 'files/cache');
}
// remove module extend cache
Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/config/module_extend.php');
@ -90,14 +107,24 @@ class adminAdminController extends admin
}
// remove old cache dir
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
if ($truncate_method === 'empty')
{
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files/cache', '/^(truncate_[0-9]+)/');
$tmp_cache_prefix = \RX_BASEDIR . 'files/cache/';
}
else
{
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
$tmp_cache_prefix = \RX_BASEDIR . 'files/';
}
if($tmp_cache_list)
{
foreach($tmp_cache_list as $tmp_dir)
{
if(strval($tmp_dir) !== '')
{
$tmp_dir = \RX_BASEDIR . 'files/' . strval($tmp_dir);
$tmp_dir = $tmp_cache_prefix . $tmp_dir;
if (!Rhymix\Framework\Storage::isDirectory($tmp_dir))
{
continue;
@ -722,7 +749,11 @@ class adminAdminController extends admin
{
if ($vars->object_cache_type === 'memcached' || $vars->object_cache_type === 'redis')
{
if (starts_with('/', $vars->object_cache_host))
if (starts_with('unix:/', $vars->object_cache_host))
{
$cache_servers = array(substr($vars->object_cache_host, 5));
}
elseif (starts_with('/', $vars->object_cache_host))
{
$cache_servers = array($vars->object_cache_host);
}
@ -755,6 +786,12 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('cache', array());
}
// Cache truncate method
if (in_array($vars->cache_truncate_method, array('delete', 'empty')))
{
Rhymix\Framework\Config::set('cache.truncate_method', $vars->cache_truncate_method);
}
// Thumbnail settings
$oDocumentModel = getModel('document');
$document_config = $oDocumentModel->getDocumentConfig();
@ -887,6 +924,7 @@ class adminAdminController extends admin
Rhymix\Framework\Config::set('seo.og_enabled', $vars->og_enabled === 'Y');
Rhymix\Framework\Config::set('seo.og_extract_description', $vars->og_extract_description === 'Y');
Rhymix\Framework\Config::set('seo.og_extract_images', $vars->og_extract_images === 'Y');
Rhymix\Framework\Config::set('seo.og_extract_hashtags', $vars->og_extract_hashtags === 'Y');
Rhymix\Framework\Config::set('seo.og_use_timestamps', $vars->og_use_timestamps === 'Y');
// Save

View file

@ -332,37 +332,6 @@ class adminAdminView extends admin
// Get need update from easy install
$oAutoinstallAdminModel = getAdminModel('autoinstall');
$needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList();
if(is_array($needUpdateList))
{
foreach($needUpdateList AS $key => $value)
{
$helpUrl = './common/manual/admin/index.html#';
switch($value->type)
{
case 'addon':
$helpUrl .= 'UMAN_terminology_addon';
break;
case 'layout':
case 'm.layout':
$helpUrl .= 'UMAN_terminology_layout';
break;
case 'module':
$helpUrl .= 'UMAN_terminology_module';
break;
case 'widget':
$helpUrl .= 'UMAN_terminology_widget';
break;
case 'widgetstyle':
$helpUrl .= 'UMAN_terminology_widgetstyle';
break;
default:
$helpUrl = '';
}
$needUpdateList[$key]->helpUrl = $helpUrl;
}
}
$site_module_info = Context::get('site_module_info');
$oAddonAdminModel = getAdminModel('addon');
$counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl );
@ -539,6 +508,7 @@ class adminAdminView extends admin
Context::set('object_cache_port', null);
Context::set('object_cache_dbnum', 1);
}
Context::set('cache_truncate_method', Rhymix\Framework\Config::get('cache.truncate_method'));
// Thumbnail settings
$oDocumentModel = getModel('document');
@ -626,6 +596,7 @@ class adminAdminView extends admin
Context::set('og_enabled', Rhymix\Framework\Config::get('seo.og_enabled'));
Context::set('og_extract_description', Rhymix\Framework\Config::get('seo.og_extract_description'));
Context::set('og_extract_images', Rhymix\Framework\Config::get('seo.og_extract_images'));
Context::set('og_extract_hashtags', Rhymix\Framework\Config::get('seo.og_extract_hashtags'));
Context::set('og_use_timestamps', Rhymix\Framework\Config::get('seo.og_use_timestamps'));
$this->setTemplateFile('config_seo');
@ -769,6 +740,7 @@ class adminAdminView extends admin
$info['php'] = sprintf('%s (%d-bit)', phpversion(), PHP_INT_SIZE * 8);
$info['server'] = $_SERVER['SERVER_SOFTWARE'];
$info['os'] = sprintf('%s %s', php_uname('s'), php_uname('r'));
$info['sapi'] = php_sapi_name();
$info['baseurl'] = Context::getRequestUri();
$info['basedir'] = RX_BASEDIR;
$info['owner'] = sprintf('%s (%d:%d)', get_current_user(), getmyuid(), getmygid());

View file

@ -168,6 +168,10 @@ $lang->cache_default_ttl = 'Cache default TTL';
$lang->cache_host = 'Host';
$lang->cache_port = 'Port';
$lang->cache_dbnum = 'DB Number';
$lang->cache_truncate_method = 'Cache Truncate Method';
$lang->cache_truncate_method_delete = 'Delete cache folder itself';
$lang->cache_truncate_method_empty = 'Delete content of cache folder';
$lang->about_cache_truncate_method = 'It is faster and more reliable to delete the cache folder itself.<br />Choose the option to delete content only if the cache folder cannot be deleted, e.g. it is a mountpoint.';
$lang->msg_cache_handler_not_supported = 'Your server does not support the selected cache method, or Rhymix is unable to use the cache with the given settings.';
$lang->msg_invalid_default_url = 'The default URL is invalid.';
$lang->msg_default_url_ssl_inconsistent = 'In order to use SSL always, the default URL must also begin with https://';
@ -235,6 +239,7 @@ $lang->og_extract_description = 'Extract Description from Document';
$lang->og_extract_description_fallback = 'Use general description only';
$lang->og_extract_images = 'Extract Images from Document';
$lang->og_extract_images_fallback = 'Use site default image only';
$lang->og_extract_hashtags = 'Extract Hashtags from Document';
$lang->og_use_timestamps = 'Include Timestamps';
$lang->autoinstall = 'EasyInstall';
$lang->last_week = 'Last Week';
@ -301,9 +306,11 @@ $lang->user_theme = 'User Theme';
$lang->user_define = 'User Defined';
$lang->by_you = 'User setting';
$lang->update_available = 'Update Available';
$lang->need_complete_configuration = 'Please complete configuration of recently updated modules.';
$lang->need_complete_configuration_details = 'New features may not function properly until their configuration has been completed.';
$lang->need_update_and_table = 'Need to Create DB Table and Update Module';
$lang->need_update = 'Need to Update Module';
$lang->need_table = 'Need to Create DB Table';
$lang->need_update = 'Complete configuration';
$lang->need_table = 'Create DB table';
$lang->admin_menu_setup = 'Admin Menu Setup';
$lang->no_data = 'There is no data submitted.';
$lang->cmd_admin_menu_reset = 'Initialize admin menu';
@ -335,7 +342,8 @@ $lang->close_all = 'Collapse All';
$lang->desktop_settings = 'PC Settings';
$lang->mobile_settings = 'Mobile Settings';
$lang->details = 'Details';
$lang->available_new_version = 'Available new versions';
$lang->available_new_version = 'New versions are available.';
$lang->available_new_version_details = 'New versions of the following items have been released.';
$lang->uv = 'Unique Visitors';
$lang->pv = 'Page Views';
$lang->next_week = 'Next Week';

View file

@ -169,6 +169,10 @@ $lang->cache_default_ttl = '캐시 기본 TTL';
$lang->cache_host = '호스트';
$lang->cache_port = '포트';
$lang->cache_dbnum = 'DB번호';
$lang->cache_truncate_method = '캐시 비우기 방법';
$lang->cache_truncate_method_delete = '캐시 폴더를 삭제';
$lang->cache_truncate_method_empty = '캐시 내용만 삭제';
$lang->about_cache_truncate_method = '캐시 폴더를 삭제하는 방법이 더 빠르고 안정적입니다.<br />내용만 삭제하는 방법은 램디스크를 캐시 폴더로 사용하는 등 폴더 자체를 삭제해서는 안 되는 경우에만 선택하십시오.';
$lang->msg_cache_handler_not_supported = '선택하신 캐시 방식을 서버에서 지원하지 않거나, 주어진 정보로 캐시에 접속할 수 없습니다.';
$lang->msg_invalid_default_url = '기본 URL이 올바르지 않습니다.';
$lang->msg_default_url_ssl_inconsistent = 'SSL을 항상 사용하실 경우 기본 URL도 https://로 시작해야 합니다.';
@ -231,6 +235,7 @@ $lang->og_extract_description = '본문에서 설명 추출';
$lang->og_extract_description_fallback = '모듈 또는 사이트 전체 설명만 사용';
$lang->og_extract_images = '본문에서 이미지 추출';
$lang->og_extract_images_fallback = '사이트 대표 이미지 사용';
$lang->og_extract_hashtags = '본문에서 해시태그 추출';
$lang->og_use_timestamps = '글 작성/수정 시각 표시';
$lang->autoinstall = '쉬운 설치';
$lang->last_week = '지난주';
@ -297,9 +302,11 @@ $lang->user_theme = '사용자 테마';
$lang->user_define = '사용자 정의 테마';
$lang->by_you = '사용자 설정';
$lang->update_available = '업데이트 가능';
$lang->need_complete_configuration = '업데이트된 모듈의 설정을 완료해야 합니다.';
$lang->need_complete_configuration_details = '설정을 완료하지 않으면 새 기능이 정상적으로 작동하지 않을 수 있습니다.';
$lang->need_update_and_table = 'DB Table 생성과 모듈 업데이트 필요';
$lang->need_update = '모듈 업데이트 필요';
$lang->need_table = 'DB Table 생성 필요';
$lang->need_update = '설정 완료하기';
$lang->need_table = 'DB 테이블 생성';
$lang->admin_menu_setup = '관리자 메뉴 설정';
$lang->no_data = '등록된 데이터가 없습니다.';
$lang->cmd_admin_menu_reset = '관리자 메뉴 초기화';
@ -331,7 +338,8 @@ $lang->close_all = '모두 접기';
$lang->desktop_settings = 'PC 설정';
$lang->mobile_settings = '모바일 설정';
$lang->details = '자세히';
$lang->available_new_version = '새 버전을 사용할 수 있습니다';
$lang->available_new_version = '새 버전을 사용할 수 있습니다.';
$lang->available_new_version_details = '자료실에 새 버전이 등록되었습니다.';
$lang->uv = '순 방문자';
$lang->pv = '페이지 뷰';
$lang->next_week = '다음주';

View file

@ -172,6 +172,15 @@
<input type="text" name="cache_default_ttl" id="cache_default_ttl" value="{$cache_default_ttl}" /> {$lang->unit_sec}
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cache_truncate_method}</label>
<div class="x_controls">
<label for="cache_truncate_method_delete" class="x_inline"><input type="radio" name="cache_truncate_method" id="cache_truncate_method_delete" value="delete" checked="checked"|cond="$cache_truncate_method !== 'empty'" /> {$lang->cache_truncate_method_delete}</label>
<label for="cache_truncate_method_empty" class="x_inline"><input type="radio" name="cache_truncate_method" id="cache_truncate_method_empty" value="empty" checked="checked"|cond="$cache_truncate_method === 'empty'" /> {$lang->cache_truncate_method_empty}</label>
<br />
<p class="x_help-block">{$lang->about_cache_truncate_method}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->minify_scripts}</label>
<div class="x_controls">

View file

@ -63,6 +63,13 @@
<label for="og_extract_images_n" class="x_inline"><input type="radio" name="og_extract_images" id="og_extract_images_n" value="N" checked="checked"|cond="!$og_extract_images" /> {$lang->cmd_no} ({$lang->og_extract_images_fallback})</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->og_extract_hashtags}</label>
<div class="x_controls">
<label for="og_extract_hashtags_y" class="x_inline"><input type="radio" name="og_extract_hashtags" id="og_extract_hashtags_y" value="Y" checked="checked"|cond="$og_extract_hashtags" /> {$lang->cmd_yes}</label>
<label for="og_extract_hashtags_n" class="x_inline"><input type="radio" name="og_extract_hashtags" id="og_extract_hashtags_n" value="N" checked="checked"|cond="!$og_extract_hashtags" /> {$lang->cmd_no}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->og_use_timestamps}</label>
<div class="x_controls">

View file

@ -25,22 +25,29 @@
</div>
<div class="message update" cond="$addTables || $needUpdate">
<h2 cond="$needUpdate && $addTables">{$lang->need_update_and_table}</h2>
<h2 cond="$needUpdate && !$addTables">{$lang->need_update}</h2>
<h2 cond="!$needUpdate && $addTables">{$lang->need_table}</h2>
<h2>{$lang->need_complete_configuration}</h2>
<p>{$lang->need_complete_configuration_details}</p>
<ul>
<block loop="$module_list => $key,$value">
<li style="margin:0 0 4px 0" cond="$value->need_install">{$value->module} - <button type="button" onclick="doInstallModule('{$value->module}')" class="x_btn x_btn-small">{$lang->cmd_create_db_table}</button></li>
<li style="margin:0 0 4px 0" cond="$value->need_update">{$value->module} - <button type="button" onclick="doUpdateModule('{$value->module}')" class="x_btn x_btn-small">{$lang->cmd_module_update}</button></li>
<li style="margin:0 0 4px 0" cond="$value->need_install">
{$value->title} ({$value->module})
&nbsp; <button type="button" onclick="doInstallModule('{$value->module}')" class="x_btn x_btn-small">{$lang->need_table}</button>
</li>
<li style="margin:0 0 4px 0" cond="$value->need_update">
{$value->title} ({$value->module})
&nbsp; <button type="button" onclick="doUpdateModule('{$value->module}')" class="x_btn x_btn-small">{$lang->need_update}</button>
</li>
</block>
</ul>
</div>
<div class="message update" cond="count($newVersionList)">
<h2>{$lang->available_new_version}</h2>
<p>{$lang->available_new_version_details}</p>
<ul>
<li loop="$newVersionList => $key, $package" style="margin:0 0 4px 0">
[{$lang->typename[$package->type]} <a class="x_icon-question-sign" href="{$package->helpUrl}" target="_blank" cond="$package->helpUrl">{$lang->help}</a>] {$package->title} ver. {$package->version} - <a href="{$package->url}&amp;return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->update}</a>
[{$lang->typename[$package->type]}] {$package->title} ver. {$package->currentVersion} → {$package->version}
&nbsp; <a href="{$package->url}&amp;return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->update}</a>
</li>
</ul>
</div>

View file

@ -1827,7 +1827,7 @@ jQuery(function($){
$.fn.xeLoadMultilingualWindowHtml = function(){
function on_complete(data){
// append html
var $content = $('#content');
var $content = ($('#content').length > 0) ? $('#content') : $('body');
$(data.html).appendTo($content).xeMultilingualWindow();
$('.lang_code').trigger('loaded-multilingualWindow');
}

View file

@ -456,6 +456,7 @@ class SFTPModuleInstaller extends ModuleInstaller
return $output;
}
$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
$copied = array();
if(is_array($file_list))
{
@ -475,8 +476,13 @@ class SFTPModuleInstaller extends ModuleInstaller
}
ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
$copied[] = $path;
}
}
FileHandler::clearStatCache($copied, true);
FileHandler::invalidateOpcache($copied);
return new BaseObject();
}
@ -630,6 +636,7 @@ class PHPFTPModuleInstaller extends ModuleInstaller
$this->download_path = substr($this->download_path, 0, -1);
}
$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
$copied = array();
if(is_array($file_list))
{
@ -688,8 +695,13 @@ class PHPFTPModuleInstaller extends ModuleInstaller
{
return new BaseObject(-1, "msg_ftp_upload_failed");
}
$copied[] = $path;
}
}
FileHandler::clearStatCache($copied, true);
FileHandler::invalidateOpcache($copied);
$this->_close();
return new BaseObject();
}
@ -829,6 +841,8 @@ class FTPModuleInstaller extends ModuleInstaller
$oFtp = &$this->oFtp;
$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
$copied = array();
if(is_array($file_list))
{
foreach($file_list as $k => $file)
@ -859,9 +873,13 @@ class FTPModuleInstaller extends ModuleInstaller
}
}
$oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file));
$copied[] = $path;
}
}
FileHandler::clearStatCache($copied, true);
FileHandler::invalidateOpcache($copied);
$this->_close();
return new BaseObject();
@ -957,6 +975,7 @@ class DirectModuleInstaller extends ModuleInstaller
return $output;
}
$target_dir = $this->target_path;
$copied = array();
if(is_array($file_list))
{
@ -984,6 +1003,7 @@ class DirectModuleInstaller extends ModuleInstaller
}
}
FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
$copied[] = $path;
}
}

View file

@ -63,10 +63,12 @@ class boardAdminController extends board {
// insert/update the board module based on module_srl
if(!$args->module_srl) {
$args->hide_category = 'N';
$args->allow_no_category = 'N';
$output = $oModuleController->insertModule($args);
$msg_code = 'success_registed';
} else {
$args->hide_category = $module_info->hide_category;
$args->allow_no_category = $module_info->allow_no_category;
$output = $oModuleController->updateModule($args);
$msg_code = 'success_updated';
}
@ -170,6 +172,7 @@ class boardAdminController extends board {
}
$module_info->hide_category = Context::get('hide_category') == 'Y' ? 'Y' : 'N';
$module_info->allow_no_category = Context::get('allow_no_category') == 'Y' ? 'Y' : 'N';
$oModuleController = getController('module'); /* @var $oModuleController moduleController */
$output = $oModuleController->updateModule($module_info);
if(!$output->toBool())

View file

@ -38,6 +38,13 @@ class boardController extends board
return $this->setError('msg_empty_content');
}
// Return error if content is too large.
$document_length_limit = ($this->module_info->document_length_limit ?: 1024) * 1024;
if (strlen($obj->content) > $document_length_limit && !$this->grant->manager)
{
return $this->setError('msg_content_too_long');
}
// unset document style if not manager
if(!$this->grant->manager)
{
@ -356,7 +363,20 @@ class boardController extends board
// get the relevant data for inserting comment
$obj = Context::getRequestVars();
$obj->module_srl = $this->module_srl;
// Return error if content is empty.
if (is_empty_html_content($obj->content))
{
return $this->setError('msg_empty_content');
}
// Return error if content is too large.
$comment_length_limit = ($this->module_info->comment_length_limit ?: 128) * 1024;
if (strlen($obj->content) > $comment_length_limit && !$this->grant->manager)
{
return $this->setError('msg_content_too_long');
}
if(!$this->module_info->use_status) $this->module_info->use_status = 'PUBLIC';
if(!is_array($this->module_info->use_status))
{
@ -676,44 +696,20 @@ class boardController extends board
**/
function triggerMemberMenu(&$obj)
{
$member_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
if(!$member_srl || !$mid)
if(!$mid = Context::get('cur_mid'))
{
return;
}
$logged_info = Context::get('logged_info');
// get the module information
$oModuleModel = getModel('module');
$columnList = array('module');
$cur_module_info = $oModuleModel->getModuleInfoByMid($mid, 0, $columnList);
if($cur_module_info->module != 'board')
$module_info = getModel('module')->getModuleInfoByMid($mid);
if(empty($module_info->module) || $module_info->module !== 'board' || $module_info->use_anonymous === 'Y')
{
return;
}
// get the member information
if($member_srl == $logged_info->member_srl)
{
$member_info = $logged_info;
} else {
$oMemberModel = getModel('member');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
}
if(!$member_info->user_id)
{
return;
}
//search
$url = getUrl('','mid',$mid,'search_target','nick_name','search_keyword',$member_info->nick_name);
$oMemberController = getController('member');
$oMemberController->addMemberPopupMenu($url, 'cmd_view_own_document', '');
$url = getUrl('', 'mid', $mid, 'member_srl', $obj->member_srl);
getController('member')->addMemberPopupMenu($url, 'cmd_view_own_document', '');
}
/**

View file

@ -175,7 +175,9 @@ class boardView extends board
if(in_array($signupFormElement->title, $search_option))
{
if($signupFormElement->isPublic == 'N')
{
unset($search_option[$signupFormElement->name]);
}
}
}
Context::set('search_option', $search_option);
@ -270,7 +272,7 @@ class boardView extends board
if($this->consultation && !$oDocument->isNotice())
{
$logged_info = Context::get('logged_info');
if($oDocument->get('member_srl')!=$logged_info->member_srl)
if(abs($oDocument->get('member_srl')) != $logged_info->member_srl)
{
$oDocument = $oDocumentModel->getDocument(0);
}
@ -328,13 +330,12 @@ class boardView extends board
));
// update the document view count (if the document is not secret)
if(!$oDocument->isSecret() || $oDocument->isGranted())
if($oDocument->isAccessible())
{
$oDocument->updateReadedCount();
}
// disappear the document if it is secret
if($oDocument->isSecret() && !$oDocument->isGranted())
else
{
$oDocument->add('content',lang('thisissecret'));
}
@ -492,17 +493,22 @@ class boardView extends board
// get the search target and keyword
$args->search_target = Context::get('search_target');
$args->search_keyword = Context::get('search_keyword');
$search_option = Context::get('search_option');
if($search_option==FALSE)
if(!$search_option = Context::get('search_option'))
{
$search_option = $this->search_option;
}
if(isset($search_option[$args->search_target])==FALSE)
if(!isset($search_option[$args->search_target]))
{
$args->search_target = '';
}
// set member_srl for view particular member's document
if($this->module_info->use_anonymous !== 'Y')
{
$args->member_srl = abs(Context::get('member_srl'));
}
// if the category is enabled, then get the category
if($this->module_info->use_category=='Y')
{
@ -544,11 +550,20 @@ class boardView extends board
if($this->consultation)
{
$logged_info = Context::get('logged_info');
$args->member_srl = $logged_info->member_srl;
if($this->module_info->use_anonymous === 'Y')
{
$args->member_srl = array($logged_info->member_srl, $logged_info->member_srl * -1);
}
else
{
$args->member_srl = $logged_info->member_srl;
}
}
// setup the list config variable on context
Context::set('list_config', $this->listConfig);
// setup document list variables on context
$output = $oDocumentModel->getDocumentList($args, $this->except_notice, TRUE, $this->columnList);
Context::set('document_list', $output->data);
@ -783,7 +798,7 @@ class boardView extends board
// if the document is not granted, then back to the password input form
$oModuleModel = getModel('module');
if($oDocument->isExists()&&!$oDocument->isGranted())
if($oDocument->isExists() && !$oDocument->isGranted())
{
return $this->setTemplateFile('input_password_form');
}
@ -825,8 +840,14 @@ class boardView extends board
/**
* add JS filters
**/
if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml');
else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml');
if(Context::get('logged_info')->is_admin == 'Y' || $this->module_info->allow_no_category == 'Y')
{
Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml');
}
else
{
Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml');
}
$oSecurity = new Security();
$oSecurity->encodeHTML('category_list.text', 'category_list.title');

View file

@ -45,9 +45,15 @@ $lang->comment_status = 'Comments';
$lang->category_settings = 'Category settings';
$lang->hide_category = 'Hide categories';
$lang->about_hide_category = 'You can disable a category feature.';
$lang->allow_no_category = 'Do not require category';
$lang->about_allow_no_category = 'Allow users to write documents without selecting a category.';
$lang->protect_content = 'Protect Content';
$lang->protect_comment = 'Protect Comment';
$lang->protect_regdate = 'Update/Delete Time Limit';
$lang->document_length_limit = 'Limit Document Size';
$lang->comment_length_limit = 'Limit Comment Size';
$lang->about_document_length_limit = 'Restrict documents that are too large. This limit may be triggered by copying and pasting a web page that contains a lot of unnecessary tags.';
$lang->about_comment_length_limit = 'Restrict comments that are too large.';
$lang->update_order_on_comment = 'Update Document on New Comment';
$lang->about_update_order_on_comment = 'When a new comment is posted, update the update timestamp of the parent document. This is needed for forums.';
$lang->non_login_vote = 'Allow guest votes';
@ -65,6 +71,7 @@ $lang->msg_board_update_protect_comment = 'You cannot update a comment when ther
$lang->msg_protect_regdate_document = 'You cannot update or delete a document after %d days.';
$lang->msg_protect_regdate_comment = 'You cannot update or delete a comment after %d days.';
$lang->msg_dont_have_update_log = 'This document has no update log.';
$lang->msg_content_too_long = 'The content is too long.';
$lang->original_letter = 'Original';
$lang->msg_warning_update_log = '<span class="x_label x_label-important">Warning!</span> This can massively increase the size of your database.';
$lang->comment_delete_message = 'Leave Placeholder for Deleted Comment';

View file

@ -46,9 +46,15 @@ $lang->comment_status = '댓글';
$lang->category_settings = '분류 설정';
$lang->hide_category = '분류 숨기기';
$lang->about_hide_category = '임시로 분류를 사용하지 않으려면 체크하세요.';
$lang->allow_no_category = '미분류 허용';
$lang->about_allow_no_category = '분류를 선택하지 않은 글도 허용하려면 체크하세요.';
$lang->protect_content = '글 보호 기능';
$lang->protect_comment = '댓글 보호 기능';
$lang->protect_regdate = '기간 제한 기능';
$lang->document_length_limit = '문서 길이 제한';
$lang->comment_length_limit = '댓글 길이 제한';
$lang->about_document_length_limit = '지나치게 용량이 큰 글을 작성하지 못하도록 합니다. 지저분한 태그가 많이 붙은 글을 붙여넣기하면 제한을 초과할 수도 있습니다.';
$lang->about_comment_length_limit = '지나치게 용량이 큰 댓글을 작성하지 못하도록 합니다.';
$lang->update_order_on_comment = '댓글 작성시 글 수정 시각 갱신';
$lang->about_update_order_on_comment = '댓글이 작성되면 해당 글의 수정 시각을 갱신합니다. 포럼형 게시판, 최근 댓글 표시 기능 등에 필요합니다.';
$lang->non_login_vote = '비회원 추천 허용';
@ -64,6 +70,7 @@ $lang->msg_board_update_protect_comment = '대댓글이 달린 댓글은 수정
$lang->msg_protect_regdate_document = '%d일 이상 지난 글은 수정 또는 삭제할 수 없습니다.';
$lang->msg_protect_regdate_comment = '%d일 이상 지난 댓글은 수정 또는 삭제할 수 없습니다.';
$lang->msg_dont_have_update_log = '업데이트 로그가 기록되어 있지 않은 게시글입니다.';
$lang->msg_content_too_long = '내용이 너무 깁니다.';
$lang->original_letter = '원본글';
$lang->msg_warning_update_log = '<span class="x_label x_label-important">주의!</span> 사용시 디비가 많이 늘어날 수 있습니다.';
$lang->reason_update = '수정한 이유';

View file

@ -8,7 +8,7 @@
<a href="{getUrl('act','dispBoardWrite','document_srl','')}" class="write">{$lang->cmd_write}</a>
</div>
<div class="co">
<!--@if($oDocument->isSecret() && !$oDocument->isGranted())-->
<!--@if(!$oDocument->isAccessible())-->
<form action="./" method="get" class="ff" onsubmit="return procFilter(this, input_password)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="page" value="{$page}" />

View file

@ -9,7 +9,7 @@
<span>{$oDocument->getRegdate()}</span>
</div>
<div class="co">
<!--@if($oDocument->isSecret() && !$oDocument->isGranted())-->
<!--@if(!$oDocument->isAccessible())-->
<div class="secretContent">
<form action="./" method="get" onsubmit="return procFilter(this, input_password)">
<input type="hidden" name="mid" value="{$mid}" />

View file

@ -20,7 +20,7 @@
</div>
<!-- /READ HEADER -->
<!-- Extra Output -->
<div class="exOut" cond="$oDocument->isExtraVarsExists() && (!$oDocument->isSecret() || $oDocument->isGranted())">
<div class="exOut" cond="$oDocument->isExtraVarsExists() && $oDocument->isAccessible()">
<table border="1" cellspacing="0" summary="Extra Form Output">
<tr loop="$oDocument->getExtraVars() => $key,$val">
<th scope="row">{$val->name}</th>
@ -31,7 +31,7 @@
<!-- /Extra Output -->
<!-- READ BODY -->
<div class="read_body">
<!--@if($oDocument->isSecret() && !$oDocument->isGranted())-->
<!--@if(!$oDocument->isAccessible())-->
<form action="./" method="get" onsubmit="return procFilter(this, input_password)">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="page" value="{$page}" />

View file

@ -24,7 +24,7 @@
</div>
<!-- /READ HEADER -->
<!-- Extra Output -->
<div class="exOut" cond="$oDocument->isExtraVarsExists() && (!$oDocument->isSecret() || $oDocument->isGranted())">
<div class="exOut" cond="$oDocument->isExtraVarsExists() && $oDocument->isAccessible()">
<table border="1" cellspacing="0" summary="Extra Form Output">
<tr loop="$oDocument->getExtraVars() => $key,$val">
<th scope="row">{$val->name}</th>
@ -35,7 +35,7 @@
<!-- /Extra Output -->
<!-- READ BODY -->
<div class="read_body">
<!--@if($oDocument->isSecret() && !$oDocument->isGranted())-->
<!--@if(!$oDocument->isAccessible())-->
<form action="./" method="get" onsubmit="return procFilter(this, input_password)" class="secretForm">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="page" value="{$page}" />

View file

@ -225,6 +225,20 @@
<p class="x_help-block">{$lang->about_anonymous_name}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->document_length_limit}</label>
<div class="x_controls">
<input type="number" name="document_length_limit" id="document_length_limit" value="{$module_info->document_length_limit ?: 1024}" /> KB
<p class="x_help-block">{$lang->about_document_length_limit}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->comment_length_limit}</label>
<div class="x_controls">
<input type="number" name="comment_length_limit" id="comment_length_limit" value="{$module_info->comment_length_limit ?: 128}" /> KB
<p class="x_help-block">{$lang->about_comment_length_limit}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->consultation}</label>
<div class="x_controls">

View file

@ -19,6 +19,12 @@
<label class="x_inline" for="hide_category"><input type="checkbox" name="hide_category" id="hide_category" value="Y" checked="checked"|cond="$module_info->hide_category == 'Y'" /> {$lang->about_hide_category}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->allow_no_category}</label>
<div class="x_controls">
<label class="x_inline" for="allow_no_category"><input type="checkbox" name="allow_no_category" id="allow_no_category" value="Y" checked="checked"|cond="$module_info->allow_no_category == 'Y'" /> {$lang->about_allow_no_category}</label>
</div>
</div>
</section>
<div class="x_clearfix btnArea">
<div class="x_pull-right">

View file

@ -84,7 +84,7 @@
</div>
<form action="" class="search x_input-append center" no-error-return-url="true">
<input type="hidden" name="module" value="{$module}" />
<select cond="count($module_category)" name="module_category_srl" title="{$lang->module_category}" style="margin-right:4px">
<select cond="countobj($module_category)" name="module_category_srl" title="{$lang->module_category}" style="margin-right:4px">
<option value="" selected="selected"|cond="!$module_category_srl">{$lang->all}</option>
<option value="0" selected="selected"|cond="$module_category_srl==='0'">{$lang->not_exists}</option>
<option value="{$key}" loop="$module_category => $key,$val" selected="selected"|cond="$module_category_srl==$key">{$val->title}</option>

View file

@ -135,25 +135,76 @@ class commentAdminView extends comment
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of comment postings to appear on a single page
$args->page_count = 10; // /< the number of pages to appear on the page navigation
$args->sort_index = 'comment_declared.declared_count'; // /< sorting values
$args->order_type = 'desc'; // /< sorted value
// get a list
$declared_output = executeQuery('comment.getDeclaredList', $args);
$oCommentModel = getModel('comment');
if($declared_output->data && count($declared_output->data))
// select sort method
$sort_index = Context::get('sort_index');
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
{
$comment_list = array();
foreach($declared_output->data as $key => $comment)
$sort_index = 'declared_latest';
}
Context::set('sort_index', $sort_index);
// get latest declared list
if ($sort_index === 'declared_latest')
{
$declared_output = executeQueryArray('comment.getDeclaredLatest', $args);
if ($declared_output->data && count($declared_output->data))
{
$comment_list[$key] = new commentItem();
$comment_list[$key]->setAttribute($comment);
$args->comment_srls = array_map(function($item) { return $item->comment_srl; }, $declared_output->data);
$comments = executeQueryArray('comment.getComments', $args);
$comment_list = array();
foreach ($declared_output->data as $key => $declared_info)
{
foreach ($comments->data as $comment)
{
if ($comment->comment_srl == $declared_info->comment_srl)
{
$comment->declared_count = $declared_info->declared_count;
$comment->latest_declared = $declared_info->latest_declared;
$comment_list[$key] = new commentItem();
$comment_list[$key]->setAttribute($comment);
break;
}
}
}
$declared_output->data = $comment_list;
}
}
else
{
if ($sort_index === 'declared_count')
{
$args->sort_index = 'comment_declared.declared_count';
}
else
{
$args->sort_index = 'comments.regdate';
}
$declared_output = executeQueryArray('comment.getDeclaredList', $args);
if ($declared_output->data && count($declared_output->data))
{
$args->comment_srls = array_map(function($item) { return $item->comment_srl; }, $declared_output->data);
$declared_latest = executeQueryArray('comment.getDeclaredLatest', $args);
$comment_list = array();
foreach ($declared_output->data as $key => $comment)
{
foreach ($declared_latest->data as $key => $declared_info)
{
if ($comment->comment_srl == $declared_info->comment_srl)
{
$comment->declared_count = $declared_info->declared_count;
$comment->latest_declared = $declared_info->latest_declared;
$comment_list[$key] = new commentItem();
$comment_list[$key]->setAttribute($comment);
}
}
}
$declared_output->data = $comment_list;
}
$declared_output->data = $comment_list;
}
$oCommentModel = getModel('comment');
$secretNameList = $oCommentModel->getSecretNameList();
// set values in the return object of comment_model:: getCommentList() in order to use a template.

View file

@ -108,6 +108,21 @@ class comment extends ModuleObject
return true;
}
// 2017.12.21 Add an index for nick_name
if(!$oDB->isIndexExists('comments', 'idx_nick_name'))
{
return true;
}
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after'))
{
return true;
}
if(!$oModuleModel->getTrigger('document.copyDocumentModule', 'comment', 'controller', 'triggerAddCopyDocument', 'add'))
{
return true;
}
return FALSE;
}
@ -192,6 +207,21 @@ class comment extends ModuleObject
{
$oDB->addIndex('comments', 'idx_parent_srl', array('parent_srl'));
}
// 2017.12.21 Add an index for nick_name
if(!$oDB->isIndexExists('comments', 'idx_nick_name'))
{
$oDB->addIndex('comments', 'idx_nick_name', array('nick_name'));
}
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after'))
{
$oModuleController->insertTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after');
}
if(!$oModuleModel->getTrigger('document.copyDocumentModule', 'comment', 'controller', 'triggerAddCopyDocument', 'add'))
{
$oModuleController->insertTrigger('document.copyDocumentModule', 'comment', 'controller', 'triggerAddCopyDocument', 'add');
}
}
/**

View file

@ -439,7 +439,7 @@ class commentController extends comment
}
// if use editor of nohtml, Remove HTML tags from the contents.
if(!$manual_inserted)
if(!$manual_inserted || isset($obj->allow_html) || isset($obj->use_html))
{
$obj->content = getModel('editor')->converter($obj, 'comment');
}
@ -512,6 +512,7 @@ class commentController extends comment
{
// get the top listed comment among those in lower depth and same head with parent's.
$p_args = new stdClass();
$p_args->document_srl = $document_srl;
$p_args->head = $parent->head;
$p_args->arrange = $parent->arrange;
$p_args->depth = $parent->depth;
@ -786,13 +787,13 @@ class commentController extends comment
// remove Rhymix's wn tags from contents
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
// Return error if content is empty.
if (!$manual_inserted && is_empty_html_content($obj->content))
if (!$manual_updated && is_empty_html_content($obj->content))
{
return new BaseObject(-1, 'msg_empty_content');
}
// if use editor of nohtml, Remove HTML tags from the contents.
if(!$manual_updated)
if(!$manual_updated || isset($obj->allow_html) || isset($obj->use_html))
{
$obj->content = getModel('editor')->converter($obj, 'comment');
}
@ -1257,7 +1258,7 @@ class commentController extends comment
$oDocument = $oDocumentModel->getDocument($document_srl);
}
if(!$oDocument->isExists() || !$oDocument->isGranted())
if(!$oDocument->isGranted())
{
return new BaseObject(-1, 'msg_not_permitted');
}
@ -1565,6 +1566,38 @@ class commentController extends comment
$this->add('declared_count', $declared_count + 1);
// Send message to admin
$message_targets = array();
$module_srl = $oComment->get('module_srl');
$oModuleModel = getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('comment', $module_srl);
if ($comment_config->declared_message && in_array('admin', $comment_config->declared_message))
{
$output = executeQueryArray('member.getAdmins', new stdClass);
foreach ($output->data as $admin)
{
$message_targets[$admin->member_srl] = true;
}
}
if ($comment_config->declared_message && in_array('manager', $comment_config->declared_message))
{
$output = executeQueryArray('module.getModuleAdmin', (object)['module_srl' => $module_srl]);
foreach ($output->data as $manager)
{
$message_targets[$manager->member_srl] = true;
}
}
if ($message_targets)
{
$oCommunicationController = getController('communication');
$message_title = lang('document.declared_message_title');
$message_content = sprintf('<p><a href="%s">%s</a></p><p>%s</p>', $oComment->getPermanentUrl(), $oComment->getContentText(50), $declare_message);
foreach ($message_targets as $target_member_srl => $val)
{
$oCommunicationController->sendMessage($this->user->member_srl, $target_member_srl, $message_title, $message_content, false);
}
}
// Call a trigger (after)
$trigger_obj->declared_count = $declared_count + 1;
ModuleHandler::triggerCall('comment.declaredComment', 'after', $trigger_obj);
@ -1653,6 +1686,10 @@ class commentController extends comment
$comment_config->use_vote_down = 'Y';
}
$comment_config->declared_message = Context::get('declared_message');
if(!is_array($comment_config->declared_message)) $comment_config->declared_message = array();
$comment_config->declared_message = array_values($comment_config->declared_message);
$comment_config->use_comment_validation = Context::get('use_comment_validation');
if(!$comment_config->use_comment_validation)
{
@ -1726,7 +1763,45 @@ class commentController extends comment
$this->add('comment_list', $commentList);
}
function triggerMoveDocument($obj)
{
executeQuery('comment.updateCommentModule', $obj);
executeQuery('comment.updateCommentListModule', $obj);
}
function triggerAddCopyDocument(&$obj)
{
$args = new stdClass;
$args->document_srls = $obj->source->document_srl;
$comment_list = executeQueryArray('comment.getCommentsByDocumentSrls', $args)->data;
$copied_comments = array();
foreach($comment_list as $comment)
{
$copy = clone $comment;
$copy->comment_srl = getNextSequence();
$copy->module_srl = $obj->copied->module_srl;
$copy->document_srl = $obj->copied->document_srl;
$copy->parent_srl = $comment->parent_srl ? $copied_comments[$comment->parent_srl] : 0;
// call a trigger (add)
$args = new stdClass;
$args->source = $comment;
$args->copied = $copy;
ModuleHandler::triggerCall('comment.copyCommentByDocument', 'add', $args);
// insert a copied comment
$this->insertComment($copy, true);
$copied_comments[$comment->comment_srl] = $copy->comment_srl;
}
// update
$obj->copied->last_updater = $copy->nick_name;
$obj->copied->comment_count = count($copied_comments);
}
function triggerCopyModule(&$obj)
{
$oModuleModel = getModel('module');
@ -1741,7 +1816,6 @@ class commentController extends comment
}
}
}
}
/* End of file comment.controller.php */
/* Location: ./modules/comment/comment.controller.php */

View file

@ -17,7 +17,11 @@ class commentItem extends BaseObject
* @var int
*/
var $comment_srl = 0;
/**
* grant
* @var bool
*/
var $grant_cache = null;
/**
* Get the column list int the table
* @var array
@ -88,52 +92,95 @@ class commentItem extends BaseObject
function isExists()
{
return $this->comment_srl ? TRUE : FALSE;
return (bool) ($this->comment_srl);
}
function isGranted()
{
if($_SESSION['granted_comment'][$this->comment_srl])
if(!$this->isExists())
{
return TRUE;
return false;
}
if(!Context::get('is_logged'))
if (isset($_SESSION['granted_comment'][$this->comment_srl]))
{
return FALSE;
return true;
}
if ($this->grant_cache !== null)
{
return $this->grant_cache;
}
$logged_info = Context::get('logged_info');
if($logged_info->is_admin == 'Y')
if (!$logged_info->member_srl)
{
return TRUE;
return $this->grant_cache = false;
}
$grant = Context::get('grant');
if($grant->manager)
if ($logged_info->is_admin == 'Y')
{
return TRUE;
return $this->grant_cache = true;
}
if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
if ($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl)
{
return TRUE;
return $this->grant_cache = true;
}
return FALSE;
$oModuleModel = getModel('module');
$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
if ($grant->manager)
{
return $this->grant_cache = true;
}
return $this->grant_cache = false;
}
function setGrant()
{
$this->is_granted = TRUE;
$this->grant_cache = true;
}
function setGrantForSession()
{
$_SESSION['granted_comment'][$this->comment_srl] = true;
$this->setGrant();
}
function isAccessible()
{
if(!$this->isExists())
{
return false;
}
if (isset($_SESSION['accessible'][$this->comment_srl]) && $_SESSION['accessible'][$this->comment_srl] === $this->get('last_update'))
{
return true;
}
if ($this->get('status') == RX_STATUS_PUBLIC && $this->get('is_secret') !== 'Y')
{
$this->setAccessible();
return true;
}
if ($this->isGranted())
{
$this->setAccessible();
return true;
}
$oDocument = getModel('document')->getDocument($this->get('document_srl'));
if ($oDocument->isGranted())
{
$this->setAccessible();
return true;
}
return false;
}
function setAccessible()
{
if(Context::getSessionStatus())
@ -141,58 +188,30 @@ class commentItem extends BaseObject
$_SESSION['accessible'][$this->comment_srl] = $this->get('last_update');
}
}
function isEditable()
{
if($this->isGranted() || !$this->get('member_srl'))
{
return TRUE;
}
return FALSE;
return !$this->get('member_srl') || $this->isGranted();
}
function isSecret()
{
return $this->get('is_secret') == 'Y' ? TRUE : FALSE;
return $this->get('is_secret') == 'Y';
}
function isDeleted()
{
return $this->get('status') == RX_STATUS_DELETED || $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
}
function isDeletedByAdmin()
{
return $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
}
function isAccessible()
{
if (isset($_SESSION['accessible'][$this->comment_srl]) && $_SESSION['accessible'][$this->comment_srl] === $this->get('last_update'))
{
return TRUE;
}
if (!$this->isSecret() || $this->isGranted())
{
$this->setAccessible();
return TRUE;
}
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
if ($oDocument->isExists() && $oDocument->isGranted())
{
$this->setAccessible();
return TRUE;
}
return FALSE;
}
function useNotify()
{
return $this->get('notify_message') == 'Y' ? TRUE : FALSE;
return $this->get('notify_message') == 'Y';
}
/**
@ -506,25 +525,26 @@ class commentItem extends BaseObject
function hasUploadedFiles()
{
if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
if(!$this->isAccessible())
{
return FALSE;
return false;
}
return $this->get('uploaded_count') ? TRUE : FALSE;
}
function getUploadedFiles()
{
if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
if(!$this->isAccessible())
{
return;
}
if(!$this->get('uploaded_count'))
{
return;
}
$oFileModel = getModel('file');
$file_list = $oFileModel->getFiles($this->comment_srl, array(), 'file_srl', TRUE);
return $file_list;
@ -637,11 +657,11 @@ class commentItem extends BaseObject
$thumbnail_type = $config->thumbnail_type ?: 'crop';
}
if($this->isSecret() && !$this->isGranted())
if(!$this->isAccessible())
{
return;
}
// If signiture height setting is omitted, create a square
if(!$height)
{

View file

@ -297,7 +297,7 @@ class commentModel extends comment
* @param bool $published
* @return int
*/
function getCommentAllCount($module_srl, $published = null)
function getCommentAllCount($module_srl, $published = false)
{
$args = new stdClass();
$args->module_srl = $module_srl;
@ -700,6 +700,7 @@ class commentModel extends comment
$args->page_count = $obj->page_count ? $obj->page_count : 10;
$args->s_module_srl = $obj->module_srl;
$args->exclude_module_srl = $obj->exclude_module_srl;
$args->statusList = $obj->statusList;
if ($obj->is_secret)
{
$args->s_is_secret = $obj->is_secret;
@ -732,7 +733,7 @@ class commentModel extends comment
case 'user_id' :
if($search_keyword)
{
$search_keyword = str_replace(' ', '%', $search_keyword);
$search_keyword = trim($search_keyword);
}
$args->s_user_id = $search_keyword;
@ -743,7 +744,7 @@ class commentModel extends comment
case 'user_name' :
if($search_keyword)
{
$search_keyword = str_replace(' ', '%', $search_keyword);
$search_keyword = trim($search_keyword);
}
$args->s_user_name = $search_keyword;
@ -752,7 +753,7 @@ class commentModel extends comment
case 'nick_name' :
if($search_keyword)
{
$search_keyword = str_replace(' ', '%', $search_keyword);
$search_keyword = trim($search_keyword);
}
$args->s_nick_name = $search_keyword;
@ -869,7 +870,7 @@ class commentModel extends comment
case 'user_id' :
if($search_keyword)
{
$search_keyword = str_replace(' ', '%', $search_keyword);
$search_keyword = trim($search_keyword);
}
$args->s_user_id = $search_keyword;
@ -879,7 +880,7 @@ class commentModel extends comment
case 'user_name' :
if($search_keyword)
{
$search_keyword = str_replace(' ', '%', $search_keyword);
$search_keyword = trim($search_keyword);
}
$args->s_user_name = $search_keyword;
@ -888,7 +889,7 @@ class commentModel extends comment
case 'nick_name' :
if($search_keyword)
{
$search_keyword = str_replace(' ', '%', $search_keyword);
$search_keyword = trim($search_keyword);
}
$args->s_nick_name = $search_keyword;

View file

@ -3,11 +3,12 @@
<table name="comments_list" />
</tables>
<columns>
<column name="min(comments_list.arrange)" alias="arrange" />
<column name="min(arrange)" alias="arrange" />
</columns>
<conditions>
<condition operation="equal" column="comments_list.head" var="head" filter="number" notnull="notnull" />
<condition operation="excess" column="comments_list.arrange" var="arrange" filter="number" notnull="notnull" pipe="and" />
<condition operation="less" column="comments_list.depth" var="depth" filter="number" notnull="notnull" pipe="and" />
<condition operation="equal" column="document_srl" var="document_srl" filter="number" />
<condition operation="equal" column="head" var="head" filter="number" notnull="notnull" pipe="and" />
<condition operation="excess" column="arrange" var="arrange" filter="number" notnull="notnull" pipe="and" />
<condition operation="less" column="depth" var="depth" filter="number" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -0,0 +1,14 @@
<query id="getCommentsByDocumentSrls" action="select">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" filter="number" notnull="notnull" />
</conditions>
<navigation>
<index var="sort_index" default="comment_srl" order="asc" />
</navigation>
</query>

View file

@ -0,0 +1,27 @@
<query id="getDeclaredLatest" action="select">
<tables>
<table name="comments" />
<table name="comment_declared" />
<table name="comment_declared_log" />
</tables>
<columns>
<column name="comment_declared_log.comment_srl" />
<column name="count(*)" alias="declared_count" />
<column name="max(comment_declared_log.regdate)" alias="latest_declared" />
</columns>
<conditions>
<condition operation="equal" column="comments.comment_srl" default="comment_declared_log.comment_srl" />
<condition operation="equal" column="comment_declared.comment_srl" default="comment_declared_log.comment_srl" pipe="and" />
<condition operation="more" column="comment_declared.declared_count" default="1" pipe="and" />
<condition operation="in" column="comment_declared_log.comment_srl" var="comment_srls" pipe="and" />
</conditions>
<groups>
<group column="comment_declared_log.comment_srl" />
</groups>
<navigation>
<index var="sort_index" default="latest_declared" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -7,7 +7,8 @@
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="comments.comment_srl" default="comment_declared.comment_srl" />
<condition operation="equal" column="comments.comment_srl" default="comment_declared.comment_srl" />
<condition operation="more" column="comment_declared.declared_count" default="1" pipe="and" />
</conditions>
<navigation>
<index var="sort_index" default="comment_declared.declared_count" order="order_type" />

View file

@ -12,8 +12,8 @@
<condition operation="equal" column="is_secret" var="s_is_secret" pipe="and" />
<group pipe="and">
<condition operation="like" column="content" var="s_content" pipe="or" />
<condition operation="like" column="user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="homepage" var="s_homepage" pipe="or" />
<condition operation="equal" column="member_srl" var="s_member_srl" pipe="or" />

View file

@ -8,13 +8,13 @@
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="like" column="member.user_id" var="s_user_id" notnull="notnull" />
<condition operation="equal" column="member.user_id" var="s_user_id" notnull="notnull" />
<condition operation="equal" column="member.member_srl" var="comments.member_srl" notnull="notnull" pipe="and" />
<condition operation="equal" column="comments.is_secret" var="s_is_secret" pipe="and" />
<group pipe="and">
<condition operation="like" column="comments.content" var="s_content" />
<condition operation="like" column="comments.user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="comments.nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="comments.user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="comments.nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="comments.email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="comments.homepage" var="s_homepage" pipe="or" />
<condition operation="like_prefix" column="comments.regdate" var="s_regdate" pipe="or" />

View file

@ -10,10 +10,11 @@
<condition operation="notin" column="module_srl" var="exclude_module_srl" pipe="and" />
<condition operation="equal" column="is_secret" var="s_is_secret" pipe="and" />
<condition operation="equal" column="status" var="s_is_published" pipe="and" />
<condition operation="in" column="status" var="statusList" pipe="and" />
<group pipe="and">
<condition operation="like" column="content" var="s_content" pipe="or" />
<condition operation="like" column="user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="homepage" var="s_homepage" pipe="or" />
<condition operation="equal" column="member_srl" var="s_member_srl" pipe="or" />

View file

@ -7,13 +7,15 @@
<column name="comments.*" />
</columns>
<conditions>
<condition operation="like" column="member.user_id" var="s_user_id" notnull="notnull" />
<condition operation="equal" column="member.user_id" var="s_user_id" notnull="notnull" />
<condition operation="equal" column="member.member_srl" var="comments.member_srl" notnull="notnull" pipe="and" />
<condition operation="equal" column="comments.is_secret" var="s_is_secret" pipe="and" />
<condition operation="equal" column="comments.status" var="s_is_published" pipe="and" />
<condition operation="in" column="comments.status" var="statusList" pipe="and" />
<group pipe="and">
<condition operation="like" column="comments.content" var="s_content" />
<condition operation="like" column="comments.user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="comments.nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="comments.user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="comments.nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="comments.email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="comments.homepage" var="s_homepage" pipe="or" />
<condition operation="like_prefix" column="comments.regdate" var="s_regdate" pipe="or" />

View file

@ -11,7 +11,7 @@
<column name="password" type="varchar" size="60" />
<column name="user_id" type="varchar" size="80" />
<column name="user_name" type="varchar" size="80" notnull="notnull" />
<column name="nick_name" type="varchar" size="80" notnull="notnull" />
<column name="nick_name" type="varchar" size="80" notnull="notnull" index="idx_nick_name" />
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="email_address" type="varchar" size="250" notnull="notnull" />
<column name="homepage" type="varchar" size="250" notnull="notnull" />

View file

@ -42,6 +42,13 @@
<p class="x_help-inline">{$lang->about_comment_validation}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{lang('document.cmd_declared_message')}</label>
<div class="x_controls">
<label class="x_inline" for="declared_message_admin"><input type="checkbox" name="declared_message[]" id="declared_message_admin" value="admin" checked="checked"|cond="in_array('admin', $comment_config->declared_message)" /> {$lang->cmd_declared_message_admin}</label>
<label class="x_inline" for="declared_message_manager"><input type="checkbox" name="declared_message[]" id="declared_message_manager" value="manager" checked="checked"|cond="in_array('manager', $comment_config->declared_message)" /> {$lang->cmd_declared_message_manager}</label>
</div>
</div>
<div class="x_clearfix btnArea">
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
</div>

View file

@ -33,10 +33,11 @@
<thead>
<tr>
<th scope="col">{$lang->comment}</th>
<th scope="col">{$lang->user_name}</th>
<th scope="col">{$lang->date}</th>
<th scope="col">{$lang->cmd_declare}</th>
<th scope="col">{$lang->writer}</th>
<th scope="col">{$lang->ipaddress}</th>
<th scope="col"><a href="{getUrl('sort_index', 'declared_count')}">{lang('document.declared_count')} <block cond="$sort_index == 'declared_count'"></block></a></th></th>
<th scope="col"><a href="{getUrl('sort_index', 'regdate')}">{$lang->original_date} <block cond="$sort_index == 'regdate'"></block></a></th>
<th scope="col"><a href="{getUrl('sort_index', 'declared_latest')}">{$lang->latest_declared_date} <block cond="$sort_index == 'declared_latest'"></block></a></th>
<th scope="col" style="width:15px"><input type="checkbox" /></th>
</tr>
</thead>
@ -44,9 +45,10 @@
<tr loop="$comment_list => $no, $oComment">
<td><a href="{getUrl('','document_srl',$oComment->get('document_srl'))}#comment_{$oComment->get('comment_srl')}" target="_blank">{$oComment->getSummary(100)}</a></td>
<td><span class="member_{$oComment->getMemberSrl()}">{$oComment->getNickName()}</span></td>
<td>{$oComment->getRegdate("Y-m-d")}</td>
<td><strong>{$oComment->get('declared_count')} (<a href="{getUrl('', 'act', 'dispCommentAdminDeclaredLogByCommentSrl', 'target_srl',$oComment->get('comment_srl'))}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_comment_declare_reason}</a>)</strong></td>
<td>{$oComment->get('ipaddress')}</td>
<td>{$oComment->get('declared_count')} (<a href="{getUrl('', 'act', 'dispCommentAdminDeclaredLogByCommentSrl', 'target_srl',$oComment->get('comment_srl'))}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_comment_declare_reason}</a>)</td>
<td>{$oComment->getRegdate('Y-m-d H:i')}</td>
<td>{zdate($oComment->get('latest_declared'), 'Y-m-d H:i')}</td>
<td><input type="checkbox" name="cart[]" value="{$oComment->get('comment_srl')}" /></td>
</tr>
<tr cond="!$comment_list">

View file

@ -393,7 +393,7 @@ class communicationController extends communication
}
$message_type = Context::get('message_type');
if(!$message_type || !in_array($message_type, array('R', 'S', 'T')))
if(!$message_type || !in_array($message_type, array('R', 'S', 'T', 'N')))
{
return $this->setError('msg_invalid_request');
}
@ -418,8 +418,16 @@ class communicationController extends communication
// Delete
$args = new stdClass();
$args->message_srls = implode(',', $target);
$args->message_type = $message_type;
if ($message_type === 'N')
{
$args->message_type = 'R';
}
else
{
$args->message_type = $message_type;
}
if($message_type == 'S')
{
$args->sender_srl = $member_srl;
@ -825,6 +833,12 @@ class communicationController extends communication
{
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
}
else
{
$allow_message_type = lang('communication.allow_message_type');
unset($allow_message_type['F']);
$GLOBALS['lang']->set('communication.allow_message_type', $allow_message_type);
}
}
function triggerMemberMenu()

View file

@ -13,21 +13,36 @@ class communicationMobile extends communicationView
{
$oCommunicationModel = getModel('communication');
$this->communication_config = $oCommunicationModel->getConfig();
$skin = $this->communication_config->mskin;
$this->config = $oCommunicationModel->getConfig();
Context::set('communication_config', $this->config);
Context::set('communication_config', $this->communication_config);
$tpl_path = sprintf('%sm.skins/%s', $this->module_path, $skin);
$this->setTemplatePath($tpl_path);
$mskin = $this->config->mskin;
if(!$mskin)
{
$template_path = sprintf('%sm.skins/%s/', $this->module_path, 'default');
}
elseif($mskin === '/USE_RESPONSIVE/')
{
$template_path = sprintf("%sskins/%s/", $this->module_path, $this->config->skin);
if(!is_dir($template_path) || !$this->config->skin)
{
$template_path = sprintf("%sskins/%s/", $this->module_path, 'default');
}
}
else
{
$template_path = sprintf('%sm.skins/%s', $this->module_path, $mskin);
}
$oLayoutModel = getModel('layout');
$layout_info = $oLayoutModel->getLayout($this->communication_config->mlayout_srl);
$layout_info = $oLayoutModel->getLayout($this->config->mlayout_srl);
if($layout_info)
{
$this->module_info->mlayout_srl = $this->communication_config->mlayout_srl;
$this->module_info->mlayout_srl = $this->config->mlayout_srl;
$this->setLayoutPath($layout_info->path);
}
$this->setTemplatePath($template_path);
}
/**

View file

@ -116,7 +116,7 @@ class communicationView extends communication
{
stripEmbedTagForAdmin($message->content, $message->sender_srl);
Context::set('message', $message);
if(Context::get('m'))
if(Mobile::isFromMobilePhone())
{
$template_filename = 'read_message';
}

View file

@ -1,6 +1,6 @@
<load target="css/mcommunication.css" />
<div class="hx h2">
<h2>{$lang->message_box[$message_type]}<a href="{getUrl('page','','act','dispCommunicationMessageBoxList','')}" class="ca">{$lang->cmd_message_box}</a></h2>
<h2>{$lang->message_box[$message_type]}<a href="{getUrl('page','','act','dispCommunicationMessageBoxList','message_srl','')}" class="ca">{$lang->cmd_message_box}</a></h2>
</div>
<ul class="lt">
<li loop="$message_list => $no,$val" class="read"|cond="$val->readed == 'Y'" class="unread"|cond="$val->readed != 'Y'">

View file

@ -15,3 +15,4 @@
var confirm_delete_msg = "{$lang->confirm_delete}";
</script>
<include target="messages.html" />

View file

@ -17,7 +17,7 @@
</form>
<div style="clear:both"></div>
</div>
<table class="table table-striped table-hover" cond="$message">
<table class="table table-striped table-hover" style="table-layout: fixed" cond="$message">
<tr>
<th>{$message->title}</th>
</tr>
@ -55,7 +55,7 @@
<!--@end-->
</th>
<th scope="col">{$lang->regdate}</th>
<th scope="col">{$lang->readed_date}</th>
<th scope="col" cond="$message_type !== 'N'">{$lang->readed_date}</th>
<th scope="col"><input name="check_all" type="checkbox" onclick="XE.checkboxToggleAll('message_srl_list[]', {wrap:'fo_message_list'})"/></th>
</tr>
</thead>
@ -71,7 +71,7 @@
<td>
{zdate($val->regdate,"Y-m-d")}
</td>
<td><block cond="$val->readed=='Y'">{zdate($val->readed_date,"Y-m-d H:i")}</block>&nbsp;</td>
<td cond="$message_type !== 'N'"><block cond="$val->readed=='Y'">{zdate($val->readed_date,"Y-m-d H:i")}</block>&nbsp;</td>
<td><input name="message_srl_list[]" type="checkbox" value="{$val->message_srl}" /></td>
</tr>
</tbody>

View file

@ -2,7 +2,7 @@
<load target="js/communication.js" />
<div class="xc" cond="$message">
<h1>{$lang->message_received}</h1>
<table class="table table-striped table-hover">
<table class="table table-striped table-hover" style="table-layout: fixed">
<!--@if($message->member_srl != $logged_info->member_srl)-->
<tr>
<th scope="row">{$lang->sender}</th>

View file

@ -43,424 +43,7 @@ class documentAdminController extends document
$this->setMessage(sprintf(lang('msg_checked_document_is_deleted'), $document_count) );
}
/**
* Change the module to move a specific article
* @param array $document_srl_list
* @param int $module_srl
* @param int $category_srl
* @return Object
*/
function moveDocumentModule($document_srl_list, $module_srl, $category_srl)
{
if(!count($document_srl_list)) return;
$oDocumentModel = getModel('document');
$oDocumentController = getController('document');
$oDB = &DB::getInstance();
$oDB->begin();
$triggerObj = new stdClass();
$triggerObj->document_srls = implode(',',$document_srl_list);
$triggerObj->module_srl = $module_srl;
$triggerObj->category_srl = $category_srl;
// Call a trigger (before)
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
for($i=count($document_srl_list)-1;$i>=0;$i--)
{
$document_srl = $document_srl_list[$i];
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists()) continue;
$source_category_srl = $oDocument->get('category_srl');
unset($obj);
$obj = $oDocument->getObjectVars();
// ISSUE https://github.com/xpressengine/xe-core/issues/32
$args_doc_origin = new stdClass();
$args_doc_origin->document_srl = $document_srl;
$output_ori = executeQuery('document.getDocument', $args_doc_origin, array('content'));
$obj->content = $output_ori->data->content;
// Move the attached file if the target module is different
if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles())
{
$oFileController = getController('file');
$files = $oDocument->getUploadedFiles();
$delete_file_srls = array();
if(is_array($files))
{
foreach($files as $val)
{
$file_info = array();
$file_info['tmp_name'] = $val->uploaded_filename;
$file_info['name'] = $val->source_filename;
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true);
if($inserted_file && $inserted_file->toBool())
{
// for image/video files
if($val->direct_download == 'Y')
{
$source_filename = substr($val->uploaded_filename,2);
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
$obj->content = str_replace($source_filename, $target_filename, $obj->content);
// For binary files
}
else
{
$obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content);
$obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content);
}
}
$delete_file_srls[] = $val->file_srl;
}
// Delete an existing file
$oFileController->deleteFile($delete_file_srls);
}
// Set the all files to be valid
$oFileController->setFilesValid($obj->document_srl);
}
if($module_srl != $obj->module_srl)
{
$oDocumentController->deleteDocumentAliasByDocument($obj->document_srl);
}
// Move a module of the article
$obj->module_srl = $module_srl;
$obj->category_srl = $category_srl;
$output = executeQuery('document.updateDocumentModule', $obj);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
else
{
$update_output = $oDocumentController->insertDocumentUpdateLog($obj);
if(!$update_output->toBool())
{
$oDB->rollback();
return $update_output;
}
}
//Move a module of the extra vars
$output = executeQuery('document.moveDocumentExtraVars', $obj);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// Set 0 if a new category doesn't exist after catergory change
if($source_category_srl != $category_srl)
{
if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
}
}
$args = new stdClass();
$args->document_srls = implode(',',$document_srl_list);
$args->module_srl = $module_srl;
// move the comment
$output = executeQuery('comment.updateCommentModule', $args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
$output = executeQuery('comment.updateCommentListModule', $args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// move the trackback
if(getClass('trackback'))
{
$output = executeQuery('trackback.updateTrackbackModule', $args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
}
// Tags
$output = executeQuery('tag.updateTagModule', $args);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// Call a trigger (after)
ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj);
$oDB->commit();
//remove from cache
foreach ($document_srl_list as $document_srl)
{
Rhymix\Framework\Cache::delete('document_item:'. getNumberingPath($document_srl) . $document_srl);
}
return new BaseObject();
}
/**
* Copy the post
* @param array $document_srl_list
* @param int $module_srl
* @param int $category_srl
* @return object
*/
function copyDocumentModule($document_srl_list, $module_srl, $category_srl)
{
if(count($document_srl_list) < 1) return;
$oDocumentModel = getModel('document');
$oDocumentController = getController('document');
$oFileModel = getModel('file');
$oDB = &DB::getInstance();
$oDB->begin();
$triggerObj = new stdClass();
$triggerObj->document_srls = implode(',',$document_srl_list);
$triggerObj->module_srl = $module_srl;
$triggerObj->category_srl = $category_srl;
// Call a trigger (before)
$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $triggerObj);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
$extraVarsList = $oDocumentModel->getDocumentExtraVarsFromDB($document_srl_list);
$extraVarsListByDocumentSrl = array();
if(is_array($extraVarsList->data))
{
foreach($extraVarsList->data as $value)
{
if(!isset($extraVarsListByDocumentSrl[$value->document_srl]))
{
$extraVarsListByDocumentSrl[$value->document_srl] = array();
}
$extraVarsListByDocumentSrl[$value->document_srl][] = $value;
}
}
for($i=count($document_srl_list)-1;$i>=0;$i--)
{
$document_srl = $document_srl_list[$i];
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists()) continue;
$obj = $oDocument->getObjectVars();
$extraVars = $extraVarsListByDocumentSrl[$document_srl];
if($module_srl == $obj->module_srl)
{
if(is_array($extraVars))
{
foreach($extraVars as $extraItem)
{
if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value;
}
}
}
$obj->module_srl = $module_srl;
$obj->document_srl = getNextSequence();
$obj->category_srl = $category_srl;
$obj->password_is_hashed = true;
$obj->comment_count = 0;
$obj->trackback_count = 0;
// Pre-register the attachment
if($oDocument->hasUploadedFiles())
{
$files = $oDocument->getUploadedFiles();
foreach($files as $val)
{
$file_info = array();
$file_info['tmp_name'] = $val->uploaded_filename;
$file_info['name'] = $val->source_filename;
$oFileController = getController('file');
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true);
// if image/video files
if($val->direct_download == 'Y')
{
$source_filename = substr($val->uploaded_filename,2);
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
$obj->content = str_replace($source_filename, $target_filename, $obj->content);
// If binary file
}
else
{
$obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content);
$obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content);
}
}
}
// Write a post
$output = $oDocumentController->insertDocument($obj, true, true);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// copy multi language contents
if(is_array($extraVars))
{
foreach($extraVars as $value)
{
if($value->idx >= 0 && $value->lang_code == Context::getLangType())
{
continue;
}
if( $value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0) )
{
$oDocumentController->insertDocumentExtraVar($value->module_srl, $obj->document_srl, $value->var_idx, $value->value, $value->eid, $value->lang_code);
}
}
}
// Move the comments
if($oDocument->getCommentCount())
{
$oCommentModel = getModel('comment');
$comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999);
$comments = $comment_output->data;
if(count($comments) > 0)
{
$oCommentController = getController('comment');
$success_count = 0;
$p_comment_srl = array();
foreach($comments as $comment_obj)
{
$comment_srl = getNextSequence();
$p_comment_srl[$comment_obj->comment_srl] = $comment_srl;
// Pre-register the attachment
if($comment_obj->uploaded_count)
{
$files = $oFileModel->getFiles($comment_obj->comment_srl, true);
foreach($files as $val)
{
$file_info = array();
$file_info['tmp_name'] = $val->uploaded_filename;
$file_info['name'] = $val->source_filename;
$oFileController = getController('file');
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $comment_srl, 0, true);
// if image/video files
if($val->direct_download == 'Y')
{
$source_filename = substr($val->uploaded_filename,2);
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
$comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content);
// If binary file
}
else
{
$comment_obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $comment_obj->content);
$comment_obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $comment_obj->content);
}
}
}
$comment_obj->module_srl = $obj->module_srl;
$comment_obj->document_srl = $obj->document_srl;
$comment_obj->comment_srl = $comment_srl;
if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl];
$output = $oCommentController->insertComment($comment_obj, true);
if($output->toBool()) $success_count ++;
}
$oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true);
}
}
// Move the trackbacks
$oTrackbackModel = getModel('trackback');
if($oTrackbackModel && $oDocument->getTrackbackCount())
{
$trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl);
if(count($trackbacks))
{
$success_count = 0;
foreach($trackbacks as $trackback_obj)
{
$trackback_obj->trackback_srl = getNextSequence();
$trackback_obj->module_srl = $obj->module_srl;
$trackback_obj->document_srl = $obj->document_srl;
$output = executeQuery('trackback.insertTrackback', $trackback_obj);
if($output->toBool()) $success_count++;
}
// Update the number of trackbacks
$oDocumentController->updateTrackbackCount($obj->document_srl, $success_count);
}
}
$copied_srls[$document_srl] = $obj->document_srl;
}
// Call a trigger (before)
$triggerObj->copied_srls = $copied_srls;
ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $triggerObj);
$oDB->commit();
$output = new BaseObject();
$output->add('copied_srls', $copied_srls);
return $output;
}
/**
* Delete all documents of the module
* @param int $module_srl
* @return object
*/
function deleteModuleDocument($module_srl)
{
$args = new stdClass();
$args->module_srl = $module_srl;
$oDocumentModel = getModel('document');
$args->module_srl = $module_srl;
$document_list = $oDocumentModel->getDocumentList($args);
$documents = $document_list->data;
$output = executeQuery('document.deleteModuleDocument', $args);
if(is_array($documents))
{
foreach ($documents as $oDocument)
{
$document_srl_list[] = $oDocument->document_srl;
}
}
//remove from cache
foreach ($document_srl_list as $document_srl)
{
Rhymix\Framework\Cache::delete('document_item:'. getNumberingPath($document_srl) . $document_srl);
}
return $output;
}
/**
* Save the default settings of the document module
* @return object
@ -810,60 +393,222 @@ class documentAdminController extends document
$trash_srl = Context::get('trash_srl');
$this->restoreTrash($trash_srl);
}
/*function restoreTrash($trash_srl){
$oDB = &DB::getInstance();
$oDocumentModel = getModel('document');
$trash_args->trash_srl = $trash_srl;
$output = executeQuery('document.getTrash', $trash_args);
if (!$output->toBool()) {
return $output;
}
$document_args->document_srl = $output->data->document_srl;
$document_args->module_srl = $output->data->module_srl;
$document_args->member_srl = $output->data->member_srl;
$document_args->ipaddress = $output->data->ipaddress;
$document_args->update_order = $output->data->update_order;
$oDocument = $oDocumentModel->getDocument($document_args->document_srl);
// begin transaction
$oDB->begin();
$output = executeQuery('document.updateDocument', $document_args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
/**
* Move module of the documents
* @param array $document_srl_list
* @param int $target_module_srl
* @param int $target_category_srl
* @return Object
*/
function moveDocumentModule($document_srl_list, $target_module_srl, $target_category_srl)
{
if(empty($document_srl_list))
{
return;
}
$obj = new stdClass;
$obj->document_srls = implode(',', $document_srl_list);
$obj->list_count = count($document_srl_list);
$obj->document_list = executeQueryArray('document.getDocuments', $obj)->data;
$obj->module_srl = $target_module_srl;
$obj->category_srl = $target_category_srl;
$oDB = DB::getInstance();
$oDB->begin();
// call a trigger (before)
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $obj);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
$origin_category = array();
$oDocumentController = getController('document');
foreach($obj->document_list as $document)
{
// if the target module is different
if($document->module_srl != $obj->module_srl)
{
$oDocumentController->deleteDocumentAliasByDocument($document->document_srl);
}
// if the target category is different
if($document->category_srl != $obj->category_srl && $document->category_srl)
{
$origin_category[$document->category_srl] = $document->module_srl;
}
$oDocumentController->insertDocumentUpdateLog($document);
}
// update documents
$output = executeQuery('document.updateDocumentsModule', $obj);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// update extra vars
$output = executeQuery('document.updateDocumentExtraVarsModule', $obj);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// call a trigger (after)
ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $obj);
// update category count
foreach($origin_category as $category_srl => $module_srl)
{
$oDocumentController->updateCategoryCount($module_srl, $category_srl);
}
if($obj->category_srl)
{
$oDocumentController->updateCategoryCount($obj->module_srl, $obj->category_srl);
}
$oDB->commit();
// remove from cache
foreach ($document_srl_list as $document_srl)
{
Rhymix\Framework\Cache::delete('document_item:'. getNumberingPath($document_srl) . $document_srl);
}
return new BaseObject();
}
$output = executeQuery('document.deleteTrash', $trash_args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
/**
* Copy the documents
* @param array $document_srl_list
* @param int $target_module_srl
* @param int $target_category_srl
* @return object
*/
function copyDocumentModule($document_srl_list, $target_module_srl, $target_category_srl)
{
if(empty($document_srl_list))
{
return;
}
$obj = new stdClass;
$obj->document_srls = implode(',', $document_srl_list);
$obj->list_count = count($document_srl_list);
$obj->document_list = executeQueryArray('document.getDocuments', $obj)->data;
$obj->module_srl = $target_module_srl;
$obj->category_srl = $target_category_srl;
$oDB = DB::getInstance();
$oDB->begin();
// call a trigger (before)
$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $obj);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
$oDocumentController = getController('document');
$extra_vars_list = getModel('document')->getDocumentExtraVarsFromDB($document_srl_list)->data;
$extra_vars = array();
foreach($extra_vars_list as $extra)
{
if(!isset($extra_vars[$extra->document_srl]))
{
$extra_vars[$extra->document_srl] = array();
}
$extra_vars[$extra->document_srl][] = $extra;
}
$copied_srls = array();
foreach($obj->document_list as $document)
{
$copy = clone $document;
$copy->document_srl = getNextSequence();
$copy->module_srl = $obj->module_srl;
$copy->category_srl = $obj->category_srl;
$copy->comment_count = 0;
$copy->trackback_count = 0;
$copy->password_is_hashed = true;
// call a trigger (add)
$args = new stdClass;
$args->source = $document;
$args->copied = $copy;
ModuleHandler::triggerCall('document.copyDocumentModule', 'add', $args);
// insert a copied document
$output = $oDocumentController->insertDocument($copy, true, true);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
// insert copied extra vars of the document
if(isset($extra_vars[$document->document_srl]))
{
foreach($extra_vars[$document->document_srl] as $extra)
{
$oDocumentController->insertDocumentExtraVar($copy->module_srl, $copy->document_srl, $extra->var_idx, $extra->value, $extra->eid, $extra->lang_code);
}
}
$copied_srls[$document->document_srl] = $copy->document_srl;
}
// call a trigger (after)
$obj->copied_srls = $copied_srls;
ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $obj);
$oDB->commit();
// return copied document_srls
$output = new BaseObject();
$output->add('copied_srls', $copied_srls);
return $output;
}
// If the post was not temorarily saved, set the attachment's status to be valid
if($oDocument->hasUploadedFiles() && $document_args->member_srl != $document_args->module_srl) {
$args->upload_target_srl = $oDocument->document_srl;
$args->isvalid = 'Y';
executeQuery('file.updateFileValid', $args);
/**
* Delete all documents of the module
* @param int $module_srl
* @return object
*/
function deleteModuleDocument($module_srl)
{
$args = new stdClass;
$args->page = 0;
$args->module_srl = $module_srl;
$document_list = executeQueryArray('document.getDocumentList', $args, array('document_srl'))->data;
// delete documents
$output = executeQuery('document.deleteModuleDocument', $args);
if(!$output->toBool())
{
return $output;
}
// remove from cache
foreach ($document_list as $document)
{
Rhymix\Framework\Cache::delete('document_item:'. getNumberingPath($document->document_srl) . $document->document_srl);
}
return new BaseObject();
}
// call a trigger (after)
if($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $document_args);
if(!$trigger_output->toBool()) {
$oDB->rollback();
return $trigger_output;
}
}
// commit
$oDB->commit();
return $output;
}*/
/**
* Restore document from trash module, called by trash module
* This method is passived

View file

@ -54,12 +54,12 @@ class documentAdminView extends document
}
$args->sort_index = 'list_order'; // /< sorting value
$args->module_srl = Context::get('module_srl');
$args->statusList = array($this->getConfigStatus('public'), $this->getConfigStatus('secret'), $this->getConfigStatus('temp'));
// get a list
$oDocumentModel = getModel('document');
$columnList = array('document_srl', 'module_srl', 'title', 'member_srl', 'nick_name', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status', 'category_srl');
$columnList = array('document_srl', 'module_srl', 'category_srl', 'member_srl', 'title', 'nick_name', 'comment_count', 'trackback_count', 'readed_count', 'voted_count', 'blamed_count', 'regdate', 'ipaddress', 'status');
$output = $oDocumentModel->getDocumentList($args, false, true, $columnList);
// get Status name list
@ -177,8 +177,16 @@ class documentAdminView extends document
$args->page_count = 10; // /< the number of pages that appear in the page navigation
$args->order_type = strtolower(Context::get('order_type')) === 'asc' ? 'asc' : 'desc';
// select sort method
$sort_index = Context::get('sort_index');
if (!in_array($sort_index, array('declared_latest', 'declared_count', 'regdate')))
{
$sort_index = 'declared_latest';
}
Context::set('sort_index', $sort_index);
// get latest declared list
if (Context::get('sort_index') === 'declared_latest')
if ($sort_index === 'declared_latest')
{
$declared_output = executeQueryArray('document.getDeclaredLatest', $args);
if ($declared_output->data && count($declared_output->data))
@ -205,6 +213,14 @@ class documentAdminView extends document
}
else
{
if ($sort_index === 'declared_count')
{
$args->sort_index = 'document_declared.declared_count';
}
else
{
$args->sort_index = 'documents.regdate';
}
$declared_output = executeQueryArray('document.getDeclaredList', $args);
if ($declared_output->data && count($declared_output->data))
{

View file

@ -37,6 +37,7 @@ class document extends ModuleObject
$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
$oDB->addIndex("documents","idx_module_regdate", array("module_srl","regdate"));
$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
@ -65,6 +66,7 @@ class document extends ModuleObject
if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true;
if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true;
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
if(!$oDB->isIndexExists("documents","idx_module_regdate")) return true;
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
// 2007. 10. 25 add parent_srl, expand to the document category
@ -126,7 +128,12 @@ class document extends ModuleObject
// 2016. 3. 14 Add a column(document_upate_log) for admin
if(!$oDB->isColumnExists('document_update_log', 'is_admin')) return true;
// 2017.12.21 Add an index for nick_name
if(!$oDB->isIndexExists('documents', 'idx_nick_name')) return true;
if(!$oModuleModel->getTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after')) return true;
return false;
}
@ -166,6 +173,12 @@ class document extends ModuleObject
{
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
}
if(!$oDB->isIndexExists("documents","idx_module_regdate"))
{
$oDB->addIndex("documents","idx_module_regdate", array("module_srl","regdate"));
}
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
@ -339,6 +352,17 @@ class document extends ModuleObject
$oDB->addColumn('document_update_log', 'is_admin', 'varchar', 1);
$oDB->addIndex('document_update_log', 'idx_is_admin', array('is_admin'));
}
// 2017.12.21 Add an index for nick_name
if(!$oDB->isIndexExists('documents', 'idx_nick_name'))
{
$oDB->addIndex('documents', 'idx_nick_name', array('nick_name'));
}
if(!$oModuleModel->getTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after'))
{
$oModuleController->insertTrigger('file.deleteFile', 'document', 'controller', 'triggerAfterDeleteFile', 'after');
}
}
/**
@ -373,8 +397,7 @@ class document extends ModuleObject
*/
function getConfigStatus($key)
{
if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
else $this->getDefaultStatus();
return $this->statusList[$key];
}
}
/* End of file document.class.php */

View file

@ -479,7 +479,7 @@ class documentController extends document
}
// if use editor of nohtml, Remove HTML tags from the contents.
if(!$manual_inserted)
if(!$manual_inserted || isset($obj->allow_html) || isset($obj->use_html))
{
$obj->content = getModel('editor')->converter($obj, 'document');
}
@ -632,10 +632,10 @@ class documentController extends document
$args->document_srl = $obj->document_srl;
$args->module_srl = $obj->module_srl;
if($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
$args->nick_name = $source_obj->get('nick_name');
$args->member_srl = $source_obj->get('member_srl');
$args->nick_name = $logged_info->nick_name;
$args->member_srl = $logged_info->member_srl;
$args->regdate = $source_obj->get('last_update');
$args->ipaddress = $source_obj->get('ipaddress');
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
$output = executeQuery("document.insertHistory", $args);
}
else
@ -737,7 +737,7 @@ class documentController extends document
}
// if use editor of nohtml, Remove HTML tags from the contents.
if(!$manual_updated)
if(!$manual_updated || isset($obj->allow_html) || isset($obj->use_html))
{
$obj->content = getModel('editor')->converter($obj, 'document');
}
@ -1049,7 +1049,10 @@ class documentController extends document
$trash_args->module_srl = $oDocument->get('module_srl');
$obj->module_srl = $oDocument->get('module_srl');
// Cannot throw data from the trash to the trash
if($trash_args->module_srl == 0) return false;
if($trash_args->module_srl == 0)
{
return new BaseObject(-1, 'Cannot throw data from the trash to the trash');
}
// Data setting
$trash_args->document_srl = $obj->document_srl;
$trash_args->description = $obj->description;
@ -1176,10 +1179,6 @@ class documentController extends document
// Option 'some': only count once per session.
if ($config->view_count_option != 'all' && $_SESSION['readed_document'][$document_srl])
{
if (Context::getSessionStatus())
{
$_SESSION['readed_document'][$document_srl] = true;
}
return false;
}
@ -1609,6 +1608,38 @@ class documentController extends document
}
$this->add('declared_count', $declared_count + 1);
// Send message to admin
$message_targets = array();
$module_srl = $oDocument->get('module_srl');
$oModuleModel = getModel('module');
$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
if ($document_config->declared_message && in_array('admin', $document_config->declared_message))
{
$output = executeQueryArray('member.getAdmins', new stdClass);
foreach ($output->data as $admin)
{
$message_targets[$admin->member_srl] = true;
}
}
if ($document_config->declared_message && in_array('manager', $document_config->declared_message))
{
$output = executeQueryArray('module.getModuleAdmin', (object)['module_srl' => $module_srl]);
foreach ($output->data as $manager)
{
$message_targets[$manager->member_srl] = true;
}
}
if ($message_targets)
{
$oCommunicationController = getController('communication');
$message_title = lang('document.declared_message_title');
$message_content = sprintf('<p><a href="%s">%s</a></p><p>%s</p>', $oDocument->getPermanentUrl(), $oDocument->getTitleText(), $declare_message);
foreach ($message_targets as $target_member_srl => $val)
{
$oCommunicationController->sendMessage($this->user->member_srl, $target_member_srl, $message_title, $message_content, false);
}
}
// Call a trigger (after)
$trigger_obj->declared_count = $declared_count + 1;
@ -2278,13 +2309,13 @@ class documentController extends document
// Get data of the child nodes
if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
// List variables
$expand = $node->expand;
$group_srls = $node->group_srls;
$mid = $node->mid;
$module_srl = $node->module_srl;
$parent_srl = $node->parent_srl;
$color = $node->color;
$description = $node->description;
$expand = ($node->expand) ? $node->expand : 'N';
$group_srls = ($node->group_srls) ? $node->group_srls : '';
$mid = ($node->mid) ? $node->mid : '';
$module_srl = ($node->module_srl) ? $node->parent_srl : '';
$parent_srl = ($node->parent_srl) ? $node->parent_srl : '';
$color = ($node->color) ? $node->color : '';
$description = ($node->description) ? $node->description : '';
// If node->group_srls value exists
if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
else $group_check_code = "true";
@ -2538,158 +2569,181 @@ class documentController extends document
function procDocumentManageCheckedDocument()
{
@set_time_limit(0);
if(!Context::get('is_logged')) return $this->setError('msg_not_permitted');
$logged_info = Context::get('logged_info');
// Get request parameters.
$cart = Context::get('cart');
if(!is_array($cart)) $cart = explode('|@|', $cart);
$cart = array_unique(array_map('intval', $cart));
$type = Context::get('type');
$target_module_srl = intval(Context::get('module_srl') ?: Context::get('target_module'));
$target_category_srl = Context::get('target_category');
// send default message - misol 2015-07-23
$send_default_message = Context::get('send_default_message');
if($send_default_message === 'Y')
{
$message_content = '';
$default_message_verbs = lang('default_message_verbs');
if(isset($default_message_verbs[$type]) && is_string($default_message_verbs[$type]))
{
$message_content = sprintf(lang('default_message_format'), $logged_info->nick_name, $default_message_verbs[$type]);
}
}
else
{
$message_content = Context::get('message_content');
if($message_content) $message_content = nl2br($message_content);
}
// Check permissions on all documents.
$document_items = array();
$document_srl_list = array();
$module_srl_list = array();
$oDocumentModel = getModel('document');
foreach ($cart as $document_srl)
{
$oDocument = $oDocumentModel->getDocument($document_srl);
$document_items[] = $oDocument;
$document_srl_list[] = $document_srl;
$module_srl_list[] = $oDocument->get('module_srl');
if (!$oDocument->isGranted())
{
return $this->stop('msg_not_permitted');
}
}
$obj = new stdClass;
$obj->type = Context::get('type');
$obj->document_list = array();
$obj->document_srl_list = array();
$obj->target_module_srl = intval(Context::get('module_srl') ?: Context::get('target_module'));
$obj->target_category_srl = Context::get('target_category');
$obj->manager_message = Context::get('message_content') ? nl2br(escape(strip_tags(Context::get('message_content')))) : '';
$obj->send_message = $obj->manager_message || Context::get('send_default_message') == 'Y';
$obj->return_message = '';
// Check permissions on all modules.
$oModuleModel = getModel('module');
if ($target_module_srl && !in_array($target_module_srl, $module_srl_list))
// Check permission of target module
if($obj->target_module_srl)
{
$module_srl_list[] = $target_module_srl;
}
foreach ($module_srl_list as $module_srl)
{
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
$module_info = getModel('module')->getModuleInfoByModuleSrl($obj->target_module_srl);
if (!$module_info->module_srl)
{
return $this->setError('msg_invalid_request');
}
$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
$module_grant = getModel('module')->getGrant($module_info, $logged_info);
if (!$module_grant->manager)
{
return $this->setError('msg_not_permitted');
}
}
// Set a spam-filer not to be filtered to spams
$oSpamController = getController('spamfilter');
$oSpamController->setAvoidLog();
if($type == 'move')
// Set Cart
$cart = Context::get('cart');
if(!is_array($cart))
{
if(!$target_module_srl) return $this->setError('fail_to_move');
$oDocumentAdminController = getAdminController('document');
$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $target_module_srl, $target_category_srl);
if(!$output->toBool()) return $this->setError('fail_to_move');
$msg_code = 'success_moved';
$cart = explode('|@|', $cart);
}
else if($type == 'copy')
$obj->document_srl_list = array_unique(array_map('intval', $cart));
// Set document list
$obj->document_list = getModel('document')->getDocuments($obj->document_srl_list, false, false);
if(empty($obj->document_list))
{
if(!$target_module_srl) return $this->setError('fail_to_move');
$oDocumentAdminController = getAdminController('document');
$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $target_module_srl, $target_category_srl);
if(!$output->toBool()) return $this->setError('fail_to_move');
$msg_code = 'success_copied';
return $this->setError('msg_invalid_request');
}
else if($type =='delete')
// Call a trigger (before)
$output = ModuleHandler::triggerCall('document.manage', 'before', $obj);
if(!$output->toBool())
{
$oDB = &DB::getInstance();
$oDB->begin();
foreach ($document_srl_list as $document_srl)
return $output;
}
$oController = getAdminController('document');
if($obj->type == 'move')
{
if(!$obj->target_module_srl)
{
return $this->setError('fail_to_move');
}
$output = $oController->moveDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
if(!$output->toBool())
{
return $output;
}
$obj->return_message = 'success_moved';
}
else if($obj->type == 'copy')
{
if(!$obj->target_module_srl)
{
return $this->setError('fail_to_move');
}
$output = $oController->copyDocumentModule($obj->document_srl_list, $obj->target_module_srl, $obj->target_category_srl);
if(!$output->toBool())
{
return $output;
}
$obj->return_message = 'success_copied';
}
else if($obj->type == 'delete')
{
foreach ($obj->document_list as $document_srl => $oDocument)
{
$output = $this->deleteDocument($document_srl, true);
if(!$output->toBool()) return $this->setError('fail_to_delete');
if(!$output->toBool())
{
unset($obj->document_list[$document_srl]);
$obj->return_message = $output->getMessage();
}
}
$oDB->commit();
$msg_code = 'success_deleted';
$obj->return_message = $obj->return_message ?: 'success_deleted';
}
else if($type == 'trash')
else if($obj->type == 'trash')
{
$args = new stdClass();
$args->description = $message_content;
$oDB = &DB::getInstance();
$oDB->begin();
foreach ($document_srl_list as $document_srl)
$args = new stdClass;
$args->description = $obj->manager_message;
foreach ($obj->document_list as $document_srl => $oDocument)
{
$args->document_srl = $document_srl;
$output = $this->moveDocumentToTrash($args);
if(!$output || !$output->toBool()) return $this->setError('fail_to_trash');
if(!$output->toBool())
{
unset($obj->document_list[$document_srl]);
$obj->return_message = $output->getMessage();
}
}
$oDB->commit();
$msg_code = 'success_trashed';
$obj->return_message = $obj->return_message ?: 'success_trashed';
}
else if($type == 'cancelDeclare')
else if($obj->type == 'cancelDeclare')
{
$args = new stdClass();
$args->document_srl = $document_srl_list;
$args = new stdClass;
$args->document_srl = $obj->document_srl_list;
$output = executeQuery('document.deleteDeclaredDocuments', $args);
$msg_code = 'success_declare_canceled';
}
// Send a message
if($message_content)
{
$oCommunicationController = getController('communication');
$title = cut_str($message_content,10,'...');
$sender_member_srl = $logged_info->member_srl;
foreach($document_items as $oDocument)
if(!$output->toBool())
{
if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue;
if($type=='move') $purl = sprintf("<a href=\"%s\" target=\"_blank\" style=\"padding:10px 0;\">%s</a><hr />", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
else $purl = "";
$content = sprintf("<div style=\"padding:10px 0;\"><p>%s</p></div><hr />%s<div style=\"padding:10px 0;font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
$oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false);
return $output;
}
$obj->return_message = 'success_declare_canceled';
}
else
{
return $this->setError('msg_invalid_request');
}
// Call a trigger (after)
ModuleHandler::triggerCall('document.manage', 'after', $obj);
// Send a message
$actions = lang('default_message_verbs');
if(isset($actions[$obj->type]) && $obj->send_message)
{
// Set message
$title = sprintf(lang('default_message_format'), $actions[$obj->type]);
$content = <<< Content
<div style="padding:10px 0;"><strong>{$title}</strong></div>
<p>{$obj->manager_message}</p>
<hr>
<ul>%1\$s</ul>
Content;
$document_item = '<li><a href="%1$s">%2$s</a></li>';
// Set recipient
$recipients = array();
foreach ($obj->document_list as $document_srl => $oDocument)
{
if(!($member_srl = abs($oDocument->get('member_srl'))) || $logged_info->member_srl == $member_srl)
{
continue;
}
if(!isset($recipients[$member_srl]))
{
$recipients[$member_srl] = array();
}
$recipients[$member_srl][] = sprintf($document_item, $oDocument->getPermanentUrl(), $oDocument->getTitleText());
}
// Send
$oCommunicationController = getController('communication');
foreach ($recipients as $member_srl => $items)
{
$oCommunicationController->sendMessage($member_srl, $member_srl, $title, sprintf($content, implode('', $items)), false);
}
}
$_SESSION['document_management'] = array();
$this->setMessage($msg_code);
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList');
$this->setRedirectUrl($returnUrl);
$this->setMessage($obj->return_message);
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList'));
}
/**
@ -2732,7 +2786,9 @@ class documentController extends document
$document_config->use_vote_down = Context::get('use_vote_down');
if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
$document_config->use_status = Context::get('use_status');
$document_config->declared_message = Context::get('declared_message');
if(!is_array($document_config->declared_message)) $document_config->declared_message = array();
$document_config->declared_message = array_values($document_config->declared_message);
$oModuleController = getController('module');
foreach ($module_srl as $srl)
@ -2869,26 +2925,47 @@ class documentController extends document
}
}
}
public function updateUploaedCount($documentSrlList)
public function updateUploaedCount($document_srl_list)
{
$oDocumentModel = getModel('document');
$oFileModel = getModel('file');
if(is_array($documentSrlList))
if(!is_array($document_srl_list))
{
$documentSrlList = array_unique($documentSrlList);
foreach($documentSrlList AS $key => $documentSrl)
$document_srl_list = array($document_srl_list);
}
if(empty($document_srl_list))
{
return;
}
$oFileModel = getModel('file');
$document_srl_list = array_unique($document_srl_list);
foreach($document_srl_list as $document_srl)
{
if(!$document_srl = (int) $document_srl)
{
$fileCount = $oFileModel->getFilesCount($documentSrl);
$args = new stdClass();
$args->document_srl = $documentSrl;
$args->uploaded_count = $fileCount;
executeQuery('document.updateUploadedCount', $args);
continue;
}
$args = new stdClass;
$args->document_srl = $document_srl;
$args->uploaded_count = $oFileModel->getFilesCount($document_srl);
executeQuery('document.updateUploadedCount', $args);
}
}
function triggerAfterDeleteFile($file)
{
$oDocument = getModel('document')->getDocument($file->upload_target_srl, false, false);
if(!$oDocument->isExists())
{
return;
}
$this->updateUploaedCount($file->upload_target_srl);
}
/**
* Copy extra keys when module copied
* @param object $obj

View file

@ -50,6 +50,11 @@ class documentItem extends BaseObject
* @var array
*/
var $uploadedFiles = array();
/**
* extra eids
* @var array
*/
protected $extra_eids = array();
/**
* Constructor
@ -62,7 +67,6 @@ class documentItem extends BaseObject
{
$this->document_srl = $document_srl;
$this->columnList = $columnList;
$this->_loadFromDB($load_extra_vars);
}
@ -79,10 +83,12 @@ class documentItem extends BaseObject
*/
function _loadFromDB($load_extra_vars = true)
{
if(!$this->document_srl) return;
if(!$this->document_srl)
{
return;
}
$document_item = false;
$cache_put = false;
$columnList = array();
$reload_counts = true;
@ -127,44 +133,59 @@ class documentItem extends BaseObject
$this->setAttribute($document_item, $load_extra_vars);
}
function setAttribute($attribute, $load_extra_vars=true)
function setAttribute($attribute, $load_extra_vars = true)
{
if(!$attribute->document_srl)
{
$this->document_srl = null;
return;
}
$this->document_srl = $attribute->document_srl;
$this->lang_code = $attribute->lang_code;
$this->adds($attribute);
// Tags
// set XE_DOCUMENT_LIST
$GLOBALS['XE_DOCUMENT_LIST'][$this->document_srl] = $this;
// set tags
if($this->get('tags'))
{
$tag_list = explode(',', $this->get('tags'));
$tag_list = array_map('utf8_trim', $tag_list);
$this->add('tag_list', $tag_list);
$this->add('tag_list', $this->getTags());
}
$oDocumentModel = getModel('document');
// set extra vars
if($load_extra_vars)
{
$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
$oDocumentModel->setToAllDocumentExtraVars();
getModel('document')->setToAllDocumentExtraVars();
}
// set content in user language
if(isset($GLOBALS['RX_DOCUMENT_LANG'][$this->document_srl]['title']))
{
$this->add('title', $GLOBALS['RX_DOCUMENT_LANG'][$this->document_srl]['title']);
}
if(isset($GLOBALS['RX_DOCUMENT_LANG'][$this->document_srl]['content']))
{
$this->add('content', $GLOBALS['RX_DOCUMENT_LANG'][$this->document_srl]['content']);
}
$GLOBALS['XE_DOCUMENT_LIST'][$this->document_srl] = $this;
}
function isExists()
{
return $this->document_srl ? true : false;
return (bool) ($this->document_srl);
}
function isGranted()
{
if ($_SESSION['granted_document'][$this->document_srl])
if(!$this->isExists())
{
return $this->grant_cache = true;
return false;
}
if (isset($_SESSION['granted_document'][$this->document_srl]))
{
return true;
}
if ($this->grant_cache !== null)
@ -185,17 +206,17 @@ class documentItem extends BaseObject
{
return $this->grant_cache = true;
}
$oModuleModel = getModel('module');
$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
if ($grant->manager)
{
return $this->grant_cache = true;
}
return $this->grant_cache = false;
}
function setGrant()
{
$this->grant_cache = true;
@ -206,52 +227,35 @@ class documentItem extends BaseObject
$_SESSION['granted_document'][$this->document_srl] = true;
$this->setGrant();
}
function isAccessible()
{
if(!$this->isExists())
{
return false;
}
if (isset($_SESSION['accessible'][$this->document_srl]) && $_SESSION['accessible'][$this->document_srl] === $this->get('last_update'))
{
return true;
}
if ($this->grant_cache === true)
$status_list = getModel('document')->getStatusList();
if ($this->get('status') === $status_list['public'])
{
$this->setAccessible();
return true;
}
$logged_info = Context::get('logged_info');
if ($logged_info->is_admin == 'Y')
if ($this->isGranted())
{
$this->setAccessible();
return true;
}
$status = $this->get('status');
if (empty($status))
{
return false;
}
$configStatusList = getModel('document')->getStatusList();
if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
{
$this->setAccessible();
return true;
}
elseif ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
{
if ($this->get('member_srl') == $logged_info->member_srl)
{
$this->setAccessible();
return true;
}
}
return false;
}
function setAccessible()
{
if(Context::getSessionStatus())
@ -259,13 +263,16 @@ class documentItem extends BaseObject
$_SESSION['accessible'][$this->document_srl] = $this->get('last_update');
}
}
function allowComment()
{
// init write, document is not exists. so allow comment status is true
if(!$this->isExists()) return true;
return $this->get('comment_status') == 'ALLOW' ? true : false;
if(!$this->isExists())
{
return true;
}
return (bool) ($this->get('comment_status') == 'ALLOW');
}
function allowTrackback()
@ -307,38 +314,42 @@ class documentItem extends BaseObject
function isLocked()
{
if(!$this->isExists()) return false;
return $this->get('comment_status') == 'ALLOW' ? false : true;
if(!$this->isExists())
{
return false;
}
return (bool) ($this->get('comment_status') != 'ALLOW');
}
function isEditable()
{
if($this->isGranted() || !$this->get('member_srl')) return true;
return false;
return (bool) (!$this->get('member_srl') || $this->isGranted());
}
function isSecret()
{
$oDocumentModel = getModel('document');
return $this->get('status') == $oDocumentModel->getConfigStatus('secret') ? true : false;
return (bool) ($this->get('status') == getModel('document')->getConfigStatus('secret'));
}
function isNotice()
{
return $this->get('is_notice') == 'Y' ? true : false;
return (bool) ($this->get('is_notice') == 'Y');
}
function useNotify()
{
return $this->get('notify_message')=='Y' ? true : false;
return (bool) ($this->get('notify_message') == 'Y');
}
function doCart()
{
if(!$this->document_srl) return false;
if($this->isCarted()) $this->removeCart();
else $this->addCart();
if(!$this->isExists())
{
return false;
}
$this->isCarted() ? $this->removeCart() : $this->addCart();
}
function addCart()
@ -353,7 +364,7 @@ class documentItem extends BaseObject
function isCarted()
{
return $_SESSION['document_management'][$this->document_srl];
return isset($_SESSION['document_management'][$this->document_srl]);
}
/**
@ -364,23 +375,35 @@ class documentItem extends BaseObject
*/
function notify($type, $content)
{
if(!$this->document_srl) return;
if(!$this->isExists())
{
return;
}
// return if it is not useNotify
if(!$this->useNotify()) return;
if(!$this->useNotify())
{
return;
}
// Pass if an author is not a logged-in user
if(!$this->get('member_srl')) return;
if(!$this->get('member_srl'))
{
return;
}
// Return if the currently logged-in user is an author
$logged_info = Context::get('logged_info');
if($logged_info->member_srl == $this->get('member_srl')) return;
if($logged_info->member_srl == $this->get('member_srl'))
{
return;
}
// List variables
if($type) $title = "[".$type."] ";
$title .= cut_str(strip_tags($content), 10, '...');
$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
$receiver_srl = $this->get('member_srl');
$sender_member_srl = $logged_info->member_srl;
$title = ($type ? sprintf('[%s] ', $type) : '') . cut_str(strip_tags($content), 10, '...');
$content = sprintf('%s<br><br>from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
// Send a message
$oCommunicationController = getController('communication');
$oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false);
$sender_member_srl = $logged_info->member_srl ?: $this->get('member_srl');
getController('communication')->sendMessage($sender_member_srl, $this->get('member_srl'), $title, $content, false);
}
function getLangCode()
@ -394,23 +417,27 @@ class documentItem extends BaseObject
{
return $this->get('ipaddress');
}
return '*' . strstr($this->get('ipaddress'), '.');
}
function isExistsHomepage()
{
if(trim($this->get('homepage'))) return true;
return false;
return (bool) trim($this->get('homepage'));
}
function getHomepageUrl()
{
$url = trim($this->get('homepage'));
if(!$url) return;
if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) $url = 'http://' . $url;
if(!$url = trim($this->get('homepage')))
{
return;
}
if(!preg_match('@^[a-z]+://@i', $url))
{
$url = 'http://' . $url;
}
return $url;
}
@ -421,120 +448,135 @@ class documentItem extends BaseObject
function getUserID()
{
return htmlspecialchars($this->get('user_id'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
return escape($this->get('user_id'), false);
}
function getUserName()
{
return htmlspecialchars($this->get('user_name'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
return escape($this->get('user_name'), false);
}
function getNickName()
{
return htmlspecialchars($this->get('nick_name'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
return escape($this->get('nick_name'), false);
}
function getLastUpdater()
{
return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
return escape($this->get('last_updater'), false);
}
function getTitleText($cut_size = 0, $tail='...')
function getTitleText($cut_size = 0, $tail = '...')
{
if(!$this->document_srl) return;
if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
else $title = $this->get('title');
return $title;
if(!$this->isExists())
{
return;
}
return $cut_size ? cut_str($this->get('title'), $cut_size, $tail) : $this->get('title');
}
function getVoted()
{
if(!$this->document_srl) return false;
if(!$this->isExists())
{
return false;
}
$logged_info = Context::get('logged_info');
if(!$logged_info->member_srl)
{
return false;
}
if(isset($_SESSION['voted_document'][$this->document_srl]))
{
return $_SESSION['voted_document'][$this->document_srl];
}
$logged_info = Context::get('logged_info');
if(!$logged_info->member_srl) return false;
$args = new stdClass();
$args = new stdClass;
$args->member_srl = $logged_info->member_srl;
$args->document_srl = $this->document_srl;
$output = executeQuery('document.getDocumentVotedLog', $args);
if($output->data->point)
{
return $_SESSION['voted_document'][$this->document_srl] = $output->data->point;
}
return $_SESSION['voted_document'][$this->document_srl] = false;
}
function getTitle($cut_size = 0, $tail='...')
function getTitle($cut_size = 0, $tail = '...')
{
if(!$this->document_srl) return;
$title = $this->getTitleText($cut_size, $tail);
$attrs = array();
if(!$this->isExists())
{
return false;
}
$title = escape($this->getTitleText($cut_size, $tail), false);
$this->add('title_color', trim($this->get('title_color')));
if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
$attrs = array();
if($this->get('title_bold') == 'Y')
{
$attrs[] = 'font-weight:bold';
}
if($this->get('title_color') && $this->get('title_color') != 'N')
{
$attrs[] = 'color:#' . ltrim($this->get('title_color'), '#');
}
if(count($attrs))
{
return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), escape($title, false));
}
else
{
return escape($title, false);
return sprintf('<span style="%s">%s</span>', implode(';', $attrs), $title);
}
return $title;
}
function getContentPlainText($strlen = 0)
{
if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return lang('msg_is_secret');
$result = $this->_checkAccessibleFromStatus();
if($result && Context::getSessionStatus())
if(!$this->isExists())
{
$this->setAccessible();
return;
}
if(!$this->isAccessible())
{
return lang('msg_is_secret');
}
$content = $this->get('content');
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
if($strlen)
{
$content = cut_str($content, $strlen, '...');
}
return escape($content);
}
function getContentText($strlen = 0)
{
if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return lang('msg_is_secret');
$result = $this->_checkAccessibleFromStatus();
if($result && Context::getSessionStatus())
if(!$this->isExists())
{
$this->setAccessible();
return;
}
if(!$this->isAccessible())
{
return lang('msg_is_secret');
}
$content = $this->get('content');
$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
if($strlen)
{
$content = trim(utf8_normalize_spaces(html_entity_decode(strip_tags($content))));
$content = cut_str($content, $strlen, '...');
}
return escape($content);
}
@ -583,21 +625,24 @@ class documentItem extends BaseObject
function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
{
if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return lang('msg_is_secret');
$result = $this->_checkAccessibleFromStatus();
if($result)
if(!$this->isExists())
{
$this->setAccessible();
return;
}
if(!$this->isAccessible())
{
return lang('msg_is_secret');
}
$content = $this->get('content');
if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
if(!$stripEmbedTagException)
{
stripEmbedTagForAdmin($content, $this->get('member_srl'));
}
// Define a link if using a rewrite module
$oContext = &Context::getInstance();
$oContext = Context::getInstance();
if($oContext->allow_rewrite)
{
$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
@ -627,18 +672,18 @@ class documentItem extends BaseObject
$this->document_srl, $memberSrl,
$this->document_srl, $memberSrl
);
// Add xe_content class although accessing content is not required
}
else
// Add xe_content class although accessing content is not required
elseif($add_xe_content_class)
{
if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
$content = sprintf('<div class="xe_content">%s</div>', $content);
}
// Change the image path to a valid absolute path if resource_realpath is true
if($resource_realpath)
{
$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
}
return $content;
}
@ -652,11 +697,14 @@ class documentItem extends BaseObject
*/
function getTransContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true)
{
$oEditorController = getController('editor');
if(!$this->isExists())
{
return;
}
$content = $this->getContent($add_popup_menu, $add_content_info, $resource_realpath, $add_xe_content_class);
$content = $oEditorController->transComponent($content);
$content = getController('editor')->transComponent($content);
return $content;
}
@ -724,13 +772,32 @@ class documentItem extends BaseObject
function getTrackbackUrl()
{
if(!$this->document_srl) return;
if(!$this->isExists())
{
return;
}
// Generate a key to prevent spams
$oTrackbackModel = getModel('trackback');
if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
if($oTrackbackModel = getModel('trackback'))
{
return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
}
}
public function getTags()
{
$tag_list = array_map(function($str) { return escape(utf8_trim($str), false); }, explode(',', $this->get('tags')));
$tag_list = array_filter($tag_list, function($str) { return $str !== ''; });
return array_unique($tag_list);
}
public function getHashtags()
{
preg_match_all('/(?<!&)#([\pL\pN_]+)/u', strip_tags($this->get('content')), $hashtags);
$hashtags[1] = array_map(function($str) { return escape($str, false); }, $hashtags[1]);
return array_unique($hashtags[1]);
}
/**
* Update readed count
* @return void
@ -760,80 +827,51 @@ class documentItem extends BaseObject
$oDocumentModel = getModel('document');
return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
}
function getExtraEids()
{
if($this->extra_eids)
{
return $this->extra_eids;
}
$extra_vars = $this->getExtraVars();
foreach($extra_vars as $idx => $key)
{
$this->extra_eids[$key->eid] = $key;
}
return $this->extra_eids;
}
function getExtraValue($idx)
{
$extra_vars = $this->getExtraVars();
if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
{
return $extra_vars[$idx]->getValue();
}
else
{
return '';
}
return isset($extra_vars[$idx]) ? $extra_vars[$idx]->getValue() : '';
}
function getExtraValueHTML($idx)
{
$extra_vars = $this->getExtraVars();
if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
{
return $extra_vars[$idx]->getValueHTML();
}
else
{
return '';
}
return isset($extra_vars[$idx]) ? $extra_vars[$idx]->getValueHTML() : '';
}
function getExtraEidValue($eid)
{
$extra_vars = $this->getExtraVars();
if($extra_vars)
{
// Handle extra variable(eid)
foreach($extra_vars as $idx => $key)
{
$extra_eid[$key->eid] = $key;
}
}
if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
{
return $extra_eid[$eid]->getValue();
}
else
{
return '';
}
$extra_eids = $this->getExtraEids();
return isset($extra_eids[$eid]) ? $extra_eids[$eid]->getValue() : '';
}
function getExtraEidValueHTML($eid)
{
$extra_vars = $this->getExtraVars();
// Handle extra variable(eid)
foreach($extra_vars as $idx => $key)
{
$extra_eid[$key->eid] = $key;
}
if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
{
return $extra_eid[$eid]->getValueHTML();
}
else
{
return '';
}
$extra_eids = $this->getExtraEids();
return isset($extra_eids[$eid]) ? $extra_eids[$eid]->getValueHTML() : '';
}
function getExtraVarsValue($key)
{
$extra_vals = unserialize($this->get('extra_vars'));
$val = $extra_vals->$key;
return $val;
return $extra_vals->$key;
}
function getCommentCount()
@ -843,12 +881,19 @@ class documentItem extends BaseObject
function getComments()
{
if(!$this->getCommentCount()) return;
if(!$this->isGranted() && $this->isSecret()) return;
if(!$this->getCommentCount())
{
return;
}
if(!$this->isAccessible())
{
return;
}
// cpage is a number of comment pages
$cpageStr = sprintf('%d_cpage', $this->document_srl);
$cpage = Context::get($cpageStr);
if(!$cpage)
{
$cpage = Context::get('cpage');
@ -966,11 +1011,11 @@ class documentItem extends BaseObject
$thumbnail_type = $config->thumbnail_type ?: 'crop';
}
if($this->isSecret() && !$this->isGranted())
if(!$this->isAccessible())
{
return;
}
// If not specify its height, create a square
if(!$height) $height = $width;
if($this->get('content'))
@ -1223,25 +1268,42 @@ class documentItem extends BaseObject
function hasUploadedFiles()
{
if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted()) return false;
if(!$this->document_srl)
{
return false;
}
if(!$this->isAccessible())
{
return false;
}
return $this->get('uploaded_count')? true : false;
}
function getUploadedFiles($sortIndex = 'file_srl')
{
if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted()) return;
if(!$this->get('uploaded_count')) return;
if(!$this->document_srl)
{
return;
}
if(!$this->isAccessible())
{
return;
}
if(!$this->get('uploaded_count'))
{
return;
}
if(!$this->uploadedFiles[$sortIndex])
{
$oFileModel = getModel('file');
$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
}
return $this->uploadedFiles[$sortIndex];
}
@ -1266,9 +1328,16 @@ class documentItem extends BaseObject
function isEnableComment()
{
// Return false if not authorized, if a secret document, if the document is set not to allow any comment
if (!$this->allowComment()) return false;
if(!$this->isGranted() && $this->isSecret()) return false;
if (!$this->allowComment())
{
return false;
}
if(!$this->isAccessible())
{
return false;
}
return true;
}
@ -1336,9 +1405,8 @@ class documentItem extends BaseObject
}
/**
* Check accessible by document status
* @param array $matches
* @return mixed
* Compatible function
* For only XE third party
*/
function _checkAccessibleFromStatus()
{

View file

@ -29,100 +29,121 @@ class documentModel extends document
{
return $_SESSION['granted_document'][$document_srl];
}
/**
* Return document extra information from database
* @param array $documentSrls
* @param array $document_srls
* @return object
*/
function getDocumentExtraVarsFromDB($documentSrls)
function getDocumentExtraVarsFromDB($document_srls)
{
if(!is_array($documentSrls) || count($documentSrls) == 0)
{
return $this->setError('msg_invalid_request');
}
$args = new stdClass();
$args->document_srl = $documentSrls;
$output = executeQueryArray('document.getDocumentExtraVars', $args);
return $output;
$args = new stdClass;
$args->document_srl = $document_srls;
return executeQueryArray('document.getDocumentExtraVars', $args);
}
/**
* Extra variables for each article will not be processed bulk select and apply the macro city
* @return void
*/
function setToAllDocumentExtraVars()
{
static $checked_documents = array();
// get document list
$_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
if(count($_document_list) <= 0) return;
// Find all called the document object variable has been set extension
if(empty($_document_list))
{
return;
}
static $checked = array();
static $module_extra_keys = array();
// check documents
$document_srls = array();
foreach($_document_list as $key => $val)
foreach($_document_list as $document_srl => $oDocument)
{
if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
$checked_documents[$val->document_srl] = true;
$document_srls[] = $val->document_srl;
}
// If the document number, return detected
if(!count($document_srls)) return;
// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
//$obj->document_srl = implode(',',$document_srls);
$output = $this->getDocumentExtraVarsFromDB($document_srls);
if($output->toBool() && $output->data)
{
foreach($output->data as $key => $val)
if(isset($checked[$document_srl]) || !($oDocument instanceof documentItem) || !$oDocument->isExists())
{
if(!isset($val->value)) continue;
if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
$extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
continue;
}
$checked[$document_srl] = true;
$document_srls[] = $document_srl;
}
$user_lang_code = Context::getLangType();
for($i=0,$c=count($document_srls);$i<$c;$i++)
if(!$document_srls)
{
$document_srl = $document_srls[$i];
unset($vars);
if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
$module_srl = $_document_list[$document_srl]->get('module_srl');
$extra_keys = $this->getExtraKeys($module_srl);
$vars = $extra_vars[$document_srl];
$document_lang_code = $_document_list[$document_srl]->get('lang_code');
// Expand the variable processing
if(count($extra_keys))
return;
}
// get extra values of documents
$extra_values = array();
$output = $this->getDocumentExtraVarsFromDB($document_srls);
foreach($output->data as $key => $val)
{
if(!$val->value)
{
foreach($extra_keys as $idx => $key)
continue;
}
$extra_values[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
}
// set extra variables and document language
$user_lang_code = Context::getLangType();
foreach($document_srls as $document_srl)
{
$oDocument = $_document_list[$document_srl];
$module_srl = $oDocument->get('module_srl');
$document_lang_code = $oDocument->get('lang_code');
$document_extra_values = $extra_values[$document_srl];
// set XE_EXTRA_VARS
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
{
// get extra keys of the module
if(!isset($module_extra_keys[$module_srl]))
{
$extra_keys[$idx] = clone($key);
$val = $vars[$idx];
if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
else if(isset($val[0])) $v = $val[0];
else $v = null;
$extra_keys[$idx]->value = $v;
$module_extra_keys[$module_srl] = $this->getExtraKeys($module_srl);
}
// set extra variables of the document
if($module_extra_keys[$module_srl])
{
$document_extra_vars = array();
foreach($module_extra_keys[$module_srl] as $idx => $key)
{
$document_extra_vars[$idx] = clone($key);
// set variable value in user language
if(isset($document_extra_values[$idx][$user_lang_code]))
{
$document_extra_vars[$idx]->setValue($document_extra_values[$idx][$user_lang_code]);
}
elseif(isset($document_extra_values[$idx][$document_lang_code]))
{
$document_extra_vars[$idx]->setValue($document_extra_values[$idx][$document_lang_code]);
}
}
$GLOBALS['XE_EXTRA_VARS'][$document_srl] = $document_extra_vars;
}
}
unset($evars);
$evars = new ExtraVar($module_srl);
$evars->setExtraVarKeys($extra_keys);
// Title Processing
if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
// Information processing
if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
// set RX_DOCUMENT_LANG
if(!isset($GLOBALS['RX_DOCUMENT_LANG'][$document_srl]) && $document_lang_code !== $user_lang_code)
{
unset($checked_documents[$document_srl]);
if(isset($document_extra_values[-1][$user_lang_code]))
{
$oDocument->add('title', $document_extra_values[-1][$user_lang_code]);
$GLOBALS['RX_DOCUMENT_LANG'][$document_srl]['title'] = $document_extra_values[-1][$user_lang_code];
}
if(isset($document_extra_values[-2][$user_lang_code]))
{
$oDocument->add('content', $document_extra_values[-2][$user_lang_code]);
$GLOBALS['RX_DOCUMENT_LANG'][$document_srl]['content'] = $document_extra_values[-2][$user_lang_code];
}
}
$GLOBALS['XE_EXTRA_VARS'][$document_srl] = $evars->getExtraVars();
}
}
@ -134,18 +155,25 @@ class documentModel extends document
* @param array $columnList
* @return documentItem
*/
function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array())
{
if(!$document_srl) return new documentItem();
if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
if(!$document_srl)
{
return new documentItem();
}
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$document_srl]))
{
$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
if($load_extra_vars) $this->setToAllDocumentExtraVars();
if(!$oDocument->isExists())
{
return $oDocument;
}
}
if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
if($is_admin)
{
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
}
return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
}
@ -157,57 +185,36 @@ class documentModel extends document
* @param array $columnList
* @return array value type is documentItem
*/
function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())
function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array())
{
if(is_array($document_srls))
{
$list_count = count($document_srls);
$document_srls = implode(',',$document_srls);
}
else
{
$list_count = 1;
}
$args = new stdClass();
$args->document_srls = $document_srls;
$args->list_count = $list_count;
$args->list_count = is_array($document_srls) ? count($document_srls) : 1;
$args->order_type = 'asc';
$output = executeQuery('document.getDocuments', $args, $columnList);
$document_list = $output->data;
if(!$document_list) return;
if(!is_array($document_list)) $document_list = array($document_list);
$document_count = count($document_list);
foreach($document_list as $key => $attribute)
$output = executeQueryArray('document.getDocuments', $args, $columnList);
$documents = array();
foreach($output->data as $attribute)
{
$document_srl = $attribute->document_srl;
if(!$document_srl) continue;
if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl]))
{
$oDocument = null;
$oDocument = new documentItem();
$oDocument->setAttribute($attribute, false);
if($is_admin) $oDocument->setGrant();
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
}
$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
}
if($load_extra_vars) $this->setToAllDocumentExtraVars();
$output = null;
if(count($result))
{
foreach($result as $document_srl => $val)
if($is_admin)
{
$output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl]->setGrant();
}
$documents[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
}
return $output;
if($load_extra_vars)
{
$this->setToAllDocumentExtraVars();
}
return $documents;
}
/**
@ -218,128 +225,62 @@ class documentModel extends document
* @param array $columnList
* @return Object
*/
function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array())
function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array())
{
$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
$obj->sort_index = $sort_check->sort_index;
$obj->isExtraVars = $sort_check->isExtraVars;
unset($obj->use_alternate_output);
$obj->except_notice = $except_notice;
$obj->columnList = $columnList;
// Call trigger (before)
// This trigger can be used to set an alternative output using a different search method
unset($obj->use_alternate_output);
$output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj);
if($output instanceof BaseObject && !$output->toBool())
{
return $output;
}
// If an alternate output is set, use it instead of running the default queries
$use_alternate_output = (isset($obj->use_alternate_output) && $obj->use_alternate_output instanceof BaseObject);
if (!$use_alternate_output)
{
$this->_setSearchOption($obj, $args, $query_id, $use_division);
}
if ($use_alternate_output)
if (isset($obj->use_alternate_output) && $obj->use_alternate_output instanceof BaseObject)
{
$output = $obj->use_alternate_output;
unset($obj->use_alternate_output);
}
elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
{
$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
$args->sort_index = str_replace('documents.','',$args->sort_index);
$output = executeQueryArray($query_id, $args);
}
elseif ($sort_check->isExtraVars)
{
$output = executeQueryArray($query_id, $args);
}
// execute query
else
{
// document.getDocumentList query execution
// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
$groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1);
if(isset($groupByQuery[$query_id]))
{
$group_args = clone($args);
$group_args->sort_index = 'documents.'.$args->sort_index;
$output = executeQueryArray($query_id, $group_args);
if(!$output->toBool()||!count($output->data)) return $output;
foreach($output->data as $key => $val)
{
if($val->document_srl) $target_srls[] = $val->document_srl;
}
$page_navigation = $output->page_navigation;
$keys = array_keys($output->data);
$virtual_number = $keys[0];
$target_args = new stdClass();
$target_args->document_srls = implode(',',$target_srls);
$target_args->list_order = $args->sort_index;
$target_args->order_type = $args->order_type;
$target_args->list_count = $args->list_count;
$target_args->page = 1;
$output = executeQueryArray('document.getDocuments', $target_args);
$output->page_navigation = $page_navigation;
$output->total_count = $page_navigation->total_count;
$output->total_page = $page_navigation->total_page;
$output->page = $page_navigation->cur_page;
}
else
{
$output = executeQueryArray($query_id, $args, $columnList);
}
$this->_setSearchOption($obj, $args, $query_id, $use_division);
$output = executeQueryArray($query_id, $args, $args->columnList);
}
// Return if no result or an error occurs
if(!$output->toBool()||!count($output->data)) return $output;
$idx = 0;
$data = $output->data;
unset($output->data);
if(!isset($virtual_number))
if(!$output->toBool() || !$result = $output->data)
{
$keys = array_keys($data);
$virtual_number = $keys[0];
return $output;
}
if($except_notice)
$output->data = array();
foreach($result as $key => $attribute)
{
foreach($data as $key => $attribute)
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl]))
{
if($attribute->is_notice == 'Y') $virtual_number --;
}
}
foreach($data as $key => $attribute)
{
if($except_notice && $attribute->is_notice == 'Y') continue;
$document_srl = $attribute->document_srl;
if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
{
$oDocument = null;
$oDocument = new documentItem();
$oDocument->setAttribute($attribute, false);
if($is_admin) $oDocument->setGrant();
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
}
$output->data[$virtual_number] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
$virtual_number--;
}
if($load_extra_vars) $this->setToAllDocumentExtraVars();
if(count($output->data))
{
foreach($output->data as $number => $document)
if($is_admin)
{
$output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl];
$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl]->setGrant();
}
$output->data[$key] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
}
if($load_extra_vars)
{
$this->setToAllDocumentExtraVars();
}
// Call trigger (after)
// This trigger can be used to modify search results
ModuleHandler::triggerCall('document.getDocumentList', 'after', $output);
@ -356,32 +297,27 @@ class documentModel extends document
{
$args = new stdClass();
$args->module_srl = $obj->module_srl;
$args->category_srl= $obj->category_srl;
$args->category_srl = $obj->category_srl;
$output = executeQueryArray('document.getNoticeList', $args, $columnList);
if(!$output->toBool()||!$output->data) return;
foreach($output->data as $key => $val)
if(!$output->toBool() || !$result = $output->data)
{
$document_srl = $val->document_srl;
if(!$document_srl) continue;
if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
return;
}
$output->data = array();
foreach($result as $attribute)
{
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl]))
{
$oDocument = null;
$oDocument = new documentItem();
$oDocument->setAttribute($val, false);
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
$oDocument->setAttribute($attribute, false);
}
$result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
$output->data[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl];
}
$this->setToAllDocumentExtraVars();
foreach($result->data as $document_srl => $val)
{
$result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
}
return $result;
return $output;
}
/**
@ -473,12 +409,16 @@ class documentModel extends document
{
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
{
// Extended to extract the values of variables set
$oDocument = $this->getDocument($document_srl, false);
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
$this->getDocument($document_srl);
$this->setToAllDocumentExtraVars();
}
if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
if(empty($GLOBALS['XE_EXTRA_VARS'][$document_srl]) || !is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
{
return array();
}
ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
}
@ -629,7 +569,7 @@ class documentModel extends document
*/
function getDocumentPage($oDocument, $opt)
{
$sort_check = $this->_setSortIndex($opt, TRUE);
$sort_check = $this->_setSortIndex($opt);
$opt->sort_index = $sort_check->sort_index;
$opt->isExtraVars = $sort_check->isExtraVars;
@ -756,7 +696,7 @@ class documentModel extends document
*/
function _arrangeCategory(&$document_category, $list, $depth)
{
if(!count($list)) return;
if(!countobj($list)) return;
$idx = 0;
$list_order = array();
foreach($list as $key => $val)
@ -1258,41 +1198,41 @@ class documentModel extends document
* @param bool $load_extra_vars
* @return object
*/
function _setSortIndex($obj, $load_extra_vars)
function _setSortIndex($obj, $load_extra_vars = true)
{
$sortIndex = $obj->sort_index;
$isExtraVars = false;
if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl')))
$args = new stdClass;
$args->sort_index = $obj->sort_index;
$args->isExtraVars = false;
// check it's default sort
$default_sort = array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl');
if(in_array($args->sort_index, $default_sort))
{
// get module_srl extra_vars list
if ($load_extra_vars)
{
$extra_args = new stdClass();
$extra_args->module_srl = $obj->module_srl;
$extra_output = executeQueryArray('document.getGroupsExtraVars', $extra_args);
if (!$extra_output->data || !$extra_output->toBool())
{
$sortIndex = 'list_order';
}
else
{
$check_array = array();
foreach($extra_output->data as $val)
{
$check_array[] = $val->eid;
}
if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
else $isExtraVars = true;
}
}
else
$sortIndex = 'list_order';
return $args;
}
$returnObj = new stdClass();
$returnObj->sort_index = $sortIndex;
$returnObj->isExtraVars = $isExtraVars;
return $returnObj;
// check it can use extra variable
if(!$load_extra_vars || !$extra_keys = $this->getExtraKeys($obj->module_srl))
{
$args->sort_index = 'list_order';
return $args;
}
$eids = array();
foreach($extra_keys as $idx => $key)
{
$eids[] = $key->eid;
}
// check it exists in extra keys of the module
if(!in_array($args->sort_index, $eids))
{
$args->sort_index = 'list_order';
return $args;
}
$args->isExtraVars = true;
return $args;
}
/**
@ -1307,107 +1247,85 @@ class documentModel extends document
*/
function _setSearchOption($searchOpt, &$args, &$query_id, &$use_division)
{
// Variable check
$args = new stdClass();
$args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null;
$args->order_type = $searchOpt->order_type;
$args->page = $searchOpt->page?$searchOpt->page:1;
$args->list_count = $searchOpt->list_count?$searchOpt->list_count:20;
$args->page_count = $searchOpt->page_count?$searchOpt->page_count:10;
$args->start_date = $searchOpt->start_date?$searchOpt->start_date:null;
$args->end_date = $searchOpt->end_date?$searchOpt->end_date:null;
$args->member_srl = $searchOpt->member_srl;
$logged_info = Context::get('logged_info');
$args = new stdClass;
$args->module_srl = $searchOpt->module_srl;
$args->exclude_module_srl = $searchOpt->exclude_module_srl;
$args->category_srl = $searchOpt->category_srl ?: null;
$args->member_srl = $searchOpt->member_srl ?: ($searchOpt->member_srls ?: null);
$args->order_type = $searchOpt->order_type === 'desc' ? 'desc' : 'asc';
$args->sort_index = $searchOpt->sort_index;
$args->page = $searchOpt->page ?: 1;
$args->list_count = $searchOpt->list_count ?: 20;
$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->statusList = $searchOpt->statusList ?: array($this->getConfigStatus('public'), $this->getConfigStatus('secret'));
$args->columnList = $searchOpt->columnList ?: array();
// Check the target and sequence alignment
$orderType = array('desc' => 1, 'asc' => 1);
if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
// If that came across mid module_srl instead of a direct module_srl guhaejum
// get directly module_srl by mid
if($searchOpt->mid)
{
$oModuleModel = getModel('module');
$args->module_srl = $oModuleModel->getModuleSrlByMid($searchOpt->mid);
unset($searchOpt->mid);
$args->module_srl = getModel('module')->getModuleSrlByMid($searchOpt->mid);
}
// Module_srl passed the array may be a check whether the array
if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
else $args->module_srl = $searchOpt->module_srl;
// Except for the test module_srl
if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
// only admin document list, temp document showing
if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
else
{
if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
else
$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
}
// Category is selected, further sub-categories until all conditions
// add subcategories
if($args->category_srl)
{
$category_list = $this->getCategoryList($args->module_srl);
$category_info = $category_list[$args->category_srl];
$category_info->childs[] = $args->category_srl;
$args->category_srl = implode(',',$category_info->childs);
if(isset($category_list[$args->category_srl]))
{
$categories = $category_list[$args->category_srl]->childs;
$categories[] = $args->category_srl;
$args->category_srl = $categories;
}
}
// Used to specify the default query id (based on several search options to query id modified)
$query_id = 'document.getDocumentList';
// If the search by specifying the document division naeyonggeomsaekil processed for
// default
$query_id = null;
$use_division = false;
// Search options
$search_target = $searchOpt->search_target;
$search_keyword = $searchOpt->search_keyword;
$search_keyword = trim($searchOpt->search_keyword);
// search
if($search_target && $search_keyword)
{
switch($search_target)
{
case 'title' :
case 'content' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->{"s_".$search_target} = $search_keyword;
$use_division = true;
break;
case 'comment' :
case 'tag' :
case 'title_content' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_title = $search_keyword;
$args->s_content = $search_keyword;
$use_division = true;
$search_keyword = str_replace(' ', '%', $search_keyword);
if($search_target == 'title_content')
{
$args->s_title = $search_keyword;
$args->s_content = $search_keyword;
}
else
{
if($search_target == 'comment')
{
$query_id = 'document.getDocumentListWithinComment';
}
elseif($search_target == 'tag')
{
$query_id = 'document.getDocumentListWithinTag';
}
$args->{'s_' . $search_target} = $search_keyword;
}
break;
case 'user_id' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->s_user_id = $search_keyword;
$args->sort_index = 'documents.'.$args->sort_index;
break;
case 'user_name' :
case 'nick_name' :
case 'email_address' :
case 'homepage' :
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
$args->{"s_".$search_target} = $search_keyword;
break;
case 'is_notice' :
if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
else $args->{"s_".$search_target} = '';
break;
case 'is_secret' :
if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
case 'regdate' :
case 'last_update' :
case 'ipaddress' :
$args->{'s_' . $search_target} = str_replace(' ', '%', $search_keyword);
break;
case 'member_srl' :
case 'readed_count' :
@ -1415,131 +1333,118 @@ class documentModel extends document
case 'comment_count' :
case 'trackback_count' :
case 'uploaded_count' :
$args->{"s_".$search_target} = (int)$search_keyword;
$args->{'s_' . $search_target} = (int)$search_keyword;
break;
case 'blamed_count' :
$args->{"s_".$search_target} = (int)$search_keyword * -1;
$args->{'s_' . $search_target} = (int)$search_keyword * -1;
break;
case 'regdate' :
case 'last_update' :
case 'ipaddress' :
$args->{"s_".$search_target} = $search_keyword;
case 'is_notice' :
$args->{'s_' . $search_target} = $search_keyword == 'Y' ? 'Y' : 'N';
break;
case 'comment' :
$args->s_comment = $search_keyword;
$query_id = 'document.getDocumentListWithinComment';
$use_division = true;
break;
case 'tag' :
$args->s_tags = str_replace(' ','%',$search_keyword);
$query_id = 'document.getDocumentListWithinTag';
break;
case 'extra_vars':
$args->var_value = str_replace(' ', '%', $search_keyword);
$query_id = 'document.getDocumentListWithinExtraVars';
case 'is_secret' :
if($search_keyword == 'N')
{
$args->statusList = array($this->getConfigStatus('public'));
}
elseif($search_keyword == 'Y')
{
$args->statusList = array($this->getConfigStatus('secret'));
}
elseif($search_keyword == 'temp')
{
$args->statusList = array($this->getConfigStatus('temp'));
}
break;
default :
if(strpos($search_target,'extra_vars')!==false) {
$args->var_idx = substr($search_target, strlen('extra_vars'));
$args->var_value = str_replace(' ','%',$search_keyword);
$args->sort_index = 'documents.'.$args->sort_index;
$query_id = 'document.getDocumentListWithExtraVars';
// search extra variable
if(preg_match('/^extra_vars([0-9]+)?$/', $search_target, $matches))
{
$args->var_idx = !empty($matches[1]) ? $matches[1] : null;
$args->var_value = str_replace(' ', '%', $search_keyword);
}
break;
}
}
if ($searchOpt->isExtraVars)
{
$query_id = 'document.getDocumentListExtraSort';
}
else
{
/**
* list_order asc sort of division that can be used only when
*/
if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
/**
* If it is true, use_division changed to use the document division
*/
if($use_division)
// exclude secret documents in searching if current user does not have privilege
if(!$args->member_srl || !Context::get('is_logged') || $args->member_srl !== Context::get('logged_info')->member_srl)
{
// Division begins
$division = (int)Context::get('division');
// order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan
if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
$module_info = getModel('module')->getModuleInfoByModuleSrl($args->module_srl);
if(!getModel('module')->getGrant($module_info, Context::get('logged_info'))->manager)
{
$listSqlID = 'document.getDocumentListUseIndex';
$divisionSqlID = 'document.getDocumentDivisionUseIndex';
$args->comment_is_secret = 'N';
$args->statusList = array($this->getConfigStatus('public'));
}
else
{
$listSqlID = 'document.getDocumentList';
$divisionSqlID = 'document.getDocumentDivision';
}
// If you do not value the best division top
if(!$division)
{
$division_args = new stdClass();
$division_args->module_srl = $args->module_srl;
$division_args->exclude_module_srl = $args->exclude_module_srl;
$division_args->list_count = 1;
$division_args->sort_index = $args->sort_index;
$division_args->order_type = $args->order_type;
$division_args->statusList = $args->statusList;
$output = executeQuery($divisionSqlID, $division_args, array('list_order'));
if($output->data)
{
$item = array_pop($output->data);
$division = $item->list_order;
}
$division_args = null;
}
// The last division
$last_division = (int)Context::get('last_division');
// Division after division from the 5000 value of the specified Wanted
if(!$last_division)
{
$last_division_args = new stdClass();
$last_division_args->module_srl = $args->module_srl;
$last_division_args->exclude_module_srl = $args->exclude_module_srl;
$last_division_args->list_count = 1;
$last_division_args->sort_index = $args->sort_index;
$last_division_args->order_type = $args->order_type;
$last_division_args->list_order = $division;
$last_division_args->page = 5001;
$output = executeQuery($divisionSqlID, $last_division_args, array('list_order'));
if($output->data)
{
$item = array_pop($output->data);
$last_division = $item->list_order;
}
}
// Make sure that after last_division article
if($last_division)
{
$last_division_args = new stdClass();
$last_division_args->module_srl = $args->module_srl;
$last_division_args->exclude_module_srl = $args->exclude_module_srl;
$last_division_args->list_order = $last_division;
$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
if($output->data->count<1) $last_division = null;
}
$args->division = $division;
$args->last_division = $last_division;
Context::set('division', $division);
Context::set('last_division', $last_division);
}
}
// set query
if(!$query_id)
{
// by extra variable
if($searchOpt->isExtraVars || !empty($args->var_value))
{
if($searchOpt->isExtraVars)
{
$args->sort_eid = $args->sort_index;
$args->sort_lang = Context::getLangType();
$args->sort_index = 'extra_sort.value';
}
$query_id = 'document.getDocumentListWithExtraVars';
}
else
{
$query_id = 'document.getDocumentList';
}
}
// other queries not support to sort extra variable
elseif($searchOpt->isExtraVars)
{
$args->sort_index = 'list_order';
}
// division search by 5,000
if($use_division)
{
$args->order_type = 'asc';
$args->sort_index = 'list_order';
$args->division = (int)Context::get('division');
$args->last_division = (int)Context::get('last_division');
$division_args = new stdClass;
$division_args->module_srl = $args->module_srl;
$division_args->exclude_module_srl = $args->exclude_module_srl;
// get start point of first division
if(Context::get('division') === null)
{
$args->division = (int)executeQuery('document.getDocumentDivision', $division_args)->data->list_order;
}
// get end point of the division
if(Context::get('last_division') === null && $args->division)
{
$division_args->offset = 5000;
$division_args->list_order = $args->division;
$args->last_division = (int)executeQuery('document.getDocumentDivision', $division_args)->data->list_order;
}
Context::set('division', $args->division);
Context::set('last_division', $args->last_division);
}
// add default prefix
if($args->sort_index && strpos($args->sort_index, '.') === false)
{
$args->sort_index = 'documents.' . $args->sort_index;
}
foreach($args->columnList as $key => $column)
{
if(strpos($column, '.') !== false)
{
continue;
}
$args->columnList[$key] = 'documents.' . $column;
}
}
/**

View file

@ -52,6 +52,9 @@ $lang->alias = 'Alias';
$lang->history = 'History';
$lang->about_use_history = 'You can set whether to use History which allows you to restore an updated article to the previous version.';
$lang->trace_only = 'Trace only';
$lang->cmd_declared_message = 'Report notification';
$lang->cmd_declared_message_admin = 'To administrator';
$lang->cmd_declared_message_manager = 'To module moderators';
$lang->cmd_trash = 'Recycle Bin';
$lang->cmd_restore = 'Restore';
$lang->cmd_restore_all = 'Restore All';
@ -85,15 +88,16 @@ $lang->select_category = 'Select a category.';
$lang->category_description = 'Category Description';
$lang->no_title_document = 'No title in this document.';
$lang->send_default_message = 'Send the default message';
$lang->default_message_format = '%1$s %2$s the document below.';
$lang->default_message_verbs['move'] = 'moves';
$lang->default_message_verbs['copy'] = 'copies';
$lang->default_message_verbs['delete'] = 'deletes';
$lang->default_message_verbs['trash'] = 'deletes';
$lang->default_message_format = '%1$s the document by manager.';
$lang->default_message_verbs['move'] = 'moved';
$lang->default_message_verbs['copy'] = 'copied';
$lang->default_message_verbs['delete'] = 'deleted';
$lang->default_message_verbs['trash'] = 'deleted';
$lang->improper_document_declare = 'Report an improper document';
$lang->original_date = 'Original date';
$lang->declared_count = 'Report count';
$lang->latest_declared_date = 'Last reported date';
$lang->declared_message_title = 'A post has been reported.';
$lang->declaring_user = 'Reporter';
$lang->improper_document_declare_reason = 'Reason';
$lang->improper_document_reasons['advertisement'] = 'Advertisements that do not fit the topics or themes.';

View file

@ -81,9 +81,3 @@ $lang->select_module_id = 'モジュールIDを選択してください。';
$lang->select_category = 'カテゴリを選択してください。';
$lang->category_description = 'カテゴリー説明';
$lang->no_title_document = 'タイトルがないドキュメントです。';
$lang->send_default_message = 'Send the default message';
$lang->default_message_format = '%1$s %2$s the document below.';
$lang->default_message_verbs['move'] = 'moves';
$lang->default_message_verbs['copy'] = 'copies';
$lang->default_message_verbs['delete'] = 'deletes';
$lang->default_message_verbs['trash'] = 'deletes';

View file

@ -61,6 +61,9 @@ $lang->alias = '별칭(Alias)';
$lang->history = '히스토리';
$lang->about_use_history = '히스토리 기능의 사용여부를 지정합니다. 히스토리 기능을 사용할 경우, 문서 수정 후 이전 수정판으로 복원할 수 있습니다.';
$lang->trace_only = '흔적만 남김';
$lang->cmd_declared_message = '신고 알림 쪽지';
$lang->cmd_declared_message_admin = '최고관리자';
$lang->cmd_declared_message_manager = '게시판 관리자';
$lang->cmd_trash = '휴지통';
$lang->cmd_restore = '복원';
$lang->cmd_restore_all = '모두 복원';
@ -84,16 +87,17 @@ $lang->select_category = '분류를 선택하세요.';
$lang->category_description = '카테고리 설명';
$lang->no_title_document = '제목이 없는 문서입니다.';
$lang->msg_admin_document_no_move_to_trash = '최고관리자의 게시물을 휴지통으로 이동시킬 권한이 없습니다.';
$lang->send_default_message = '기본 쪽지 내용으로 보내기';
$lang->default_message_format = '%1$s님께서 다음 게시물을 %2$s 합니다.';
$lang->default_message_verbs['move'] = '이동';
$lang->default_message_verbs['copy'] = '복사';
$lang->send_default_message = '기본 내용으로만 쪽지 보내기';
$lang->default_message_format = '관리자에 의해 게시물이 %1$s되었습니다.';
$lang->default_message_verbs['move'] = '다른 게시판으로 이동';
$lang->default_message_verbs['copy'] = '다른 게시판에 복사';
$lang->default_message_verbs['delete'] = '삭제';
$lang->default_message_verbs['trash'] = '삭제';
$lang->improper_document_declare = '불량 게시글 신고';
$lang->original_date = '작성 날짜';
$lang->declared_count = '신고 수';
$lang->latest_declared_date = '최근 신고 날짜';
$lang->declared_message_title = '신고가 접수되었습니다.';
$lang->declaring_user = '신고자';
$lang->improper_document_declare_reason = '신고 이유';
$lang->improper_document_reasons['advertisement'] = '주제나 흐름에 맞지 않는 광고 글입니다.';

View file

@ -59,9 +59,3 @@ $lang->search_target_trash_list['trash_member_srl'] = 'Номер удалите
$lang->search_target_trash_list['trash_user_name'] = 'Имя удалителя';
$lang->search_target_trash_list['trash_date'] = 'Дата удаления';
$lang->search_target_trash_list['trash_ipaddress'] = 'IP адрес удалителя';
$lang->send_default_message = 'Send the default message';
$lang->default_message_format = '%1$s %2$s the document below.';
$lang->default_message_verbs['move'] = 'moves';
$lang->default_message_verbs['copy'] = 'copies';
$lang->default_message_verbs['delete'] = 'deletes';
$lang->default_message_verbs['trash'] = 'deletes';

View file

@ -66,9 +66,3 @@ $lang->search_target_trash_list['trash_date'] = 'Silinme Tarihi';
$lang->search_target_trash_list['trash_ipaddress'] = 'Silici IP adresi';
$lang->success_trashed = 'Başarıyla silindi';
$lang->msg_not_selected_document = 'Hiçbir makale seçilmedi.';
$lang->send_default_message = 'Send the default message';
$lang->default_message_format = '%1$s %2$s the document below.';
$lang->default_message_verbs['move'] = 'moves';
$lang->default_message_verbs['copy'] = 'copies';
$lang->default_message_verbs['delete'] = 'deletes';
$lang->default_message_verbs['trash'] = 'deletes';

View file

@ -63,9 +63,3 @@ $lang->search_target_trash_list['trash_user_name'] = 'Tên người xóa';
$lang->search_target_trash_list['trash_date'] = 'Ngày xóa';
$lang->search_target_trash_list['trash_ipaddress'] = 'IP Người xóa';
$lang->success_trashed = 'Đã chuyển tới thùng rác thành công.';
$lang->send_default_message = 'Send the default message';
$lang->default_message_format = '%1$s %2$s the document below.';
$lang->default_message_verbs['move'] = 'moves';
$lang->default_message_verbs['copy'] = 'copies';
$lang->default_message_verbs['delete'] = 'deletes';
$lang->default_message_verbs['trash'] = 'deletes';

View file

@ -65,9 +65,3 @@ $lang->search_target_trash_list['trash_user_name'] = '操作人用户名';
$lang->search_target_trash_list['trash_date'] = '删除日期';
$lang->search_target_trash_list['trash_ipaddress'] = '操作人IP地址';
$lang->success_trashed = '已成功移除到回收箱。';
$lang->send_default_message = 'Send the default message';
$lang->default_message_format = '%1$s %2$s the document below.';
$lang->default_message_verbs['move'] = 'moves';
$lang->default_message_verbs['copy'] = 'copies';
$lang->default_message_verbs['delete'] = 'deletes';
$lang->default_message_verbs['trash'] = 'deletes';

View file

@ -80,9 +80,3 @@ $lang->select_module_id = '選擇模組 ID.';
$lang->select_category = '選擇分類';
$lang->category_description = '分類說明';
$lang->no_title_document = '此文章無標題。';
$lang->send_default_message = 'Send the default message';
$lang->default_message_format = '%1$s %2$s the document below.';
$lang->default_message_verbs['move'] = 'moves';
$lang->default_message_verbs['copy'] = 'copies';
$lang->default_message_verbs['delete'] = 'deletes';
$lang->default_message_verbs['trash'] = 'deletes';

View file

@ -15,9 +15,9 @@
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="and" />
<condition operation="like" column="user_name" var="s_user_name" pipe="and" />
<condition operation="like" column="user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="user_name" var="s_user_name" pipe="and" />
<condition operation="equal" column="user_id" var="s_user_id" pipe="or" />
<condition operation="equal" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="tags" var="s_tags" pipe="or" />

View file

@ -16,9 +16,9 @@
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="and" />
<condition operation="like" column="user_name" var="s_user_name" pipe="and" />
<condition operation="like" column="user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="user_name" var="s_user_name" pipe="and" />
<condition operation="equal" column="user_id" var="s_user_id" pipe="or" />
<condition operation="equal" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="tags" var="s_tags" pipe="or" />

View file

@ -1,19 +1,18 @@
<query id="getDocumentDivision" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="module_srl" var="module_srl" filter="number" />
<condition operation="notin" column="module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="more" column="list_order" var="list_order" filter="number" pipe="and" />
</conditions>
<navigation>
<index var="sort_index" default="list_order" order="order_type" />
<list_count var="list_count" default="1" />
<page_count var="page_count" default="1" />
<page var="page" default="1" />
</navigation>
<tables>
<table name="documents" />
</tables>
<columns>
<column name="list_order" />
</columns>
<conditions>
<condition operation="in" column="module_srl" var="module_srl" filter="number" />
<condition operation="notin" column="module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="more" column="list_order" var="list_order" filter="number" pipe="and" />
</conditions>
<navigation>
<index var="sort_index" default="list_order" order="asc" />
<list_count var="list_count" default="1" />
<offset var="offset" default="0" />
</navigation>
</query>

View file

@ -1,13 +1,13 @@
<query id="getDocumentDivisionCount" action="select">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="in" column="module_srl" var="module_srl" filter="number" />
<condition operation="notin" column="module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="excess" column="list_order" var="list_order" filter="number" pipe="and" />
</conditions>
<tables>
<table name="documents" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="in" column="module_srl" var="module_srl" filter="number" />
<condition operation="notin" column="module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="excess" column="list_order" var="list_order" filter="number" pipe="and" />
</conditions>
</query>

View file

@ -19,9 +19,9 @@
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="or" />
<condition operation="like" column="user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="user_id" var="s_user_id" pipe="or" />
<condition operation="equal" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="tags" var="s_tags" pipe="or" />

View file

@ -14,7 +14,7 @@
<condition operation="notin" column="d.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="in" column="d.category_srl" var="category_srl" pipe="and" />
<condition operation="equal" column="d.is_notice" var="s_is_notice" pipe="and" />
<condition operation="equal" column="d.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="d.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="d.status" var="statusList" pipe="and" />
<group pipe="and">
<condition operation="more" column="d.list_order" var="division" pipe="and" />
@ -23,9 +23,9 @@
<group pipe="and">
<condition operation="like" column="d.title" var="s_title" />
<condition operation="like" column="d.content" var="s_content" pipe="or" />
<condition operation="like" column="d.user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="d.user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="d.nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="d.user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="d.user_id" var="s_user_id" pipe="or" />
<condition operation="equal" column="d.nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="d.email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="d.homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="d.tags" var="s_tags" pipe="or" />

View file

@ -10,7 +10,7 @@
<condition operation="notin" column="module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="in" column="category_srl" var="category_srl" pipe="and" />
<condition operation="equal" column="is_notice" var="s_is_notice" pipe="and" />
<condition operation="equal" column="member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="status" var="statusList" pipe="and" />
<group pipe="and">
<condition operation="more" column="list_order" var="division" pipe="and" />
@ -19,9 +19,9 @@
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="or" />
<condition operation="like" column="user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="user_id" var="s_user_id" pipe="or" />
<condition operation="equal" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="email_address" var="s_email_addres" pipe="or" />
<condition operation="like" column="homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="tags" var="s_tags" pipe="or" />

View file

@ -13,7 +13,7 @@
<condition operation="notin" column="module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="in" column="category_srl" var="category_srl" pipe="and" />
<condition operation="equal" column="is_notice" var="s_is_notice" pipe="and" />
<condition operation="equal" column="member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="status" var="statusList" pipe="and" />
<group pipe="and">
<condition operation="more" column="list_order" var="division" pipe="and" />
@ -22,9 +22,9 @@
<group pipe="and">
<condition operation="like" column="title" var="s_title" />
<condition operation="like" column="content" var="s_content" pipe="or" />
<condition operation="like" column="user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="user_id" var="s_user_id" pipe="or" />
<condition operation="equal" column="nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="tags" var="s_tags" pipe="or" />

View file

@ -1,28 +1,57 @@
<query id="getDocumentListWithExtraVars" action="select">
<tables>
<table name="documents" />
<table name="document_extra_vars" alias="extra_vars" />
</tables>
<columns>
<column name="documents.*" />
</columns>
<conditions>
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="extra_vars.module_srl" default="documents.module_srl" pipe="and" />
<condition operation="equal" column="extra_vars.document_srl" default="documents.document_srl" pipe="and" />
<condition operation="equal" column="extra_vars.var_idx" var="var_idx" notnull="notnull" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<condition operation="like" column="extra_vars.value" var="var_value" notnull="notnull" pipe="and" />
</conditions>
<tables>
<table name="documents" />
<table name="document_extra_vars" alias="extra_vars" />
<table name="document_extra_vars" alias="extra_sort" />
</tables>
<columns>
<column name="documents.*" />
</columns>
<conditions>
<condition operation="like" column="extra_vars.value" var="var_value" />
<condition operation="equal" column="extra_vars.var_idx" var="var_idx" pipe="and" />
<condition operation="equal" column="documents.document_srl" default="extra_vars.document_srl" pipe="and" />
<condition operation="equal" column="extra_sort.eid" var="sort_eid" pipe="and" />
<condition operation="equal" column="extra_sort.lang_code" var="sort_lang" pipe="and" />
<condition operation="equal" column="documents.document_srl" default="extra_sort.document_srl" pipe="and" />
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" pipe="and" />
<condition operation="notin" column="documents.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.is_notice" var="s_is_notice" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<condition operation="more" column="documents.list_order" var="division" pipe="and" />
<condition operation="below" column="documents.list_order" var="last_division" pipe="and" />
<condition operation="more" column="documents.last_update" var="start_date" pipe="and" />
<condition operation="less" column="documents.last_update" var="end_date" pipe="and" />
<group pipe="and">
<condition operation="like" column="documents.title" var="s_title" />
<condition operation="like" column="documents.content" var="s_content" pipe="or" />
<condition operation="equal" column="documents.user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="documents.user_id" var="s_user_id" pipe="or" />
<condition operation="equal" column="documents.nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="documents.email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="documents.tags" var="s_tags" pipe="or" />
<condition operation="equal" column="documents.member_srl" var="s_member_srl" pipe="or" />
<condition operation="more" column="documents.readed_count" var="s_readed_count" pipe="or" />
<condition operation="more" column="documents.voted_count" var="s_voted_count" pipe="or" />
<condition operation="less" column="documents.blamed_count" var="s_blamed_count" pipe="or" />
<condition operation="more" column="documents.comment_count" var="s_comment_count" pipe="or" />
<condition operation="more" column="documents.trackback_count" var="s_trackback_count" pipe="or" />
<condition operation="more" column="documents.uploaded_count" var="s_uploaded_count" pipe="or" />
<condition operation="like_prefix" column="documents.regdate" var="s_regdate" pipe="or" />
<condition operation="like_prefix" column="documents.last_update" var="s_last_update" pipe="or" />
<condition operation="like_prefix" column="documents.ipaddress" var="s_ipaddress" pipe="or" />
</group>
</conditions>
<groups>
<group column="extra_vars.document_srl" />
<group column="documents.document_srl" />
</groups>
<navigation>
<index var="sort_index" default="documents.list_order" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
<navigation>
<index var="sort_index" default="documents.list_order" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -9,10 +9,11 @@
<conditions>
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="extra_vars.module_srl" default="documents.module_srl" pipe="and" />
<condition operation="equal" column="extra_vars.document_srl" default="documents.document_srl" pipe="and" />
<condition operation="equal" column="extra_vars.var_idx" var="var_idx" notnull="notnull" pipe="and" />
<condition operation="equal" column="documents.is_notice" var="s_is_notice" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<condition operation="like" column="extra_vars.value" var="var_value" notnull="notnull" pipe="and" />
<group pipe="and">

View file

@ -1,32 +1,33 @@
<query id="getDocumentListWithinComment" action="select">
<tables>
<table name="documents" alias="documents" />
<table name="comments" alias="comments" />
</tables>
<columns>
<column name="documents.document_srl" />
<column name="documents.list_order" />
</columns>
<conditions>
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" />
<condition operation="notin" column="documents.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.category_srl" var="category_srl" pipe="and" />
<condition operation="equal" column="documents.document_srl" default="comments.document_srl" notnull="notnull" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<group pipe="and">
<condition operation="more" column="documents.list_order" var="division" pipe="and" />
<condition operation="below" column="documents.list_order" var="last_division" pipe="and" />
</group>
<condition operation="like" column="comments.content" var="s_comment" notnull="notnull" pipe="and" />
</conditions>
<navigation>
<index var="sort_index" default="comments.list_order" order="asc" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
<groups>
<group column="documents.document_srl" />
</groups>
<tables>
<table name="documents" />
<table name="comments" />
</tables>
<columns>
<column name="documents.*" />
</columns>
<conditions>
<condition operation="like" column="comments.content" var="s_comment" notnull="notnull" />
<condition operation="equal" column="comments.is_secret" var="comment_is_secret" pipe="and" />
<condition operation="equal" column="documents.document_srl" default="comments.document_srl" pipe="and" />
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" pipe="and" />
<condition operation="notin" column="documents.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.is_notice" var="s_is_notice" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<condition operation="more" column="documents.list_order" var="division" pipe="and" />
<condition operation="below" column="documents.list_order" var="last_division" pipe="and" />
<condition operation="more" column="documents.last_update" var="start_date" pipe="and" />
<condition operation="less" column="documents.last_update" var="end_date" pipe="and" />
</conditions>
<groups>
<group column="documents.document_srl" />
</groups>
<navigation>
<index var="sort_index" default="documents.list_order" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -11,13 +11,15 @@
<condition operation="notin" column="documents.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.category_srl" var="category_srl" pipe="and" />
<condition operation="equal" column="documents.document_srl" default="comments.document_srl" notnull="notnull" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.is_notice" var="s_is_notice" pipe="and" />
<condition operation="in" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<group pipe="and">
<condition operation="more" column="documents.list_order" var="division" pipe="and" />
<condition operation="below" column="documents.list_order" var="last_division" pipe="and" />
</group>
<condition operation="like" column="comments.content" var="s_comment" notnull="notnull" pipe="and" />
<condition operation="equal" column="comments.is_secret" var="comment_is_secret" pipe="and" />
<group pipe="and">
<condition operation="less" column="documents.list_order" var="list_order" filter="number" pipe="and" />
<condition operation="more" column="documents.list_order" var="rev_list_order" filter="number" pipe="and" />

View file

@ -1,27 +1,28 @@
<query id="getDocumentListWithinExtraVars" action="select">
<tables>
<table name="documents" />
<table name="document_extra_vars" alias="extra_vars" />
</tables>
<columns>
<column name="documents.*" />
</columns>
<conditions>
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="extra_vars.module_srl" default="documents.module_srl" pipe="and" />
<condition operation="equal" column="extra_vars.document_srl" default="documents.document_srl" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<condition operation="like" column="extra_vars.value" var="var_value" notnull="notnull" pipe="and" />
</conditions>
<groups>
<group column="extra_vars.document_srl" />
</groups>
<navigation>
<index var="sort_index" default="documents.list_order" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
<tables>
<table name="documents" />
<table name="document_extra_vars" alias="extra_vars" />
</tables>
<columns>
<column name="documents.*" />
</columns>
<conditions>
<condition operation="equal" column="extra_vars.document_srl" default="documents.document_srl" pipe="and" />
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" pipe="and" />
<condition operation="notin" column="documents.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.is_notice" var="s_is_notice" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<condition operation="like" column="extra_vars.value" var="var_value" notnull="notnull" pipe="and" />
</conditions>
<groups>
<group column="extra_vars.document_srl" />
</groups>
<navigation>
<index var="sort_index" default="documents.list_order" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -15,7 +15,7 @@
<condition operation="notin" column="d.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="in" column="d.category_srl" var="category_srl" pipe="and" />
<condition operation="equal" column="d.is_notice" var="s_is_notice" pipe="and" />
<condition operation="equal" column="d.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="d.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="in" column="d.status" var="statusList" pipe="and" />
<group pipe="and">
<condition operation="more" column="d.list_order" var="division" pipe="and" />
@ -24,9 +24,9 @@
<group pipe="and">
<condition operation="like" column="d.title" var="s_title" />
<condition operation="like" column="d.content" var="s_content" pipe="or" />
<condition operation="like" column="d.user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="d.user_id" var="s_user_id" pipe="or" />
<condition operation="like" column="d.nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="d.user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="d.user_id" var="s_user_id" pipe="or" />
<condition operation="equal" column="d.nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="d.email_address" var="s_email_addres" pipe="or" />
<condition operation="like" column="d.homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="d.tags" var="s_tags" pipe="or" />

View file

@ -5,7 +5,7 @@
</tables>
<columns />
<conditions>
<condition operation="like" column="member.user_id" var="s_user_id" notnull="notnull" pipe="and" />
<condition operation="equal" column="member.user_id" var="s_user_id" notnull="notnull" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member.member_srl" notnull="notnull" pipe="and" />
<condition operation="equal" column="documents.module_srl" var="module_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.category_srl" var="category_srl" pipe="and" />
@ -13,8 +13,8 @@
<group pipe="and">
<condition operation="like" column="documents.title" var="s_title" />
<condition operation="like" column="documents.content" var="s_content" pipe="or" />
<condition operation="like" column="documents.user_name" var="s_user_name" pipe="or" />
<condition operation="like" column="documents.nick_name" var="s_nick_name" pipe="or" />
<condition operation="equal" column="documents.user_name" var="s_user_name" pipe="or" />
<condition operation="equal" column="documents.nick_name" var="s_nick_name" pipe="or" />
<condition operation="like" column="documents.email_address" var="s_email_address" pipe="or" />
<condition operation="like" column="documents.homepage" var="s_homepage" pipe="or" />
<condition operation="like" column="documents.tags" var="s_tags" pipe="or" />

View file

@ -1,28 +1,32 @@
<query id="getDocumentListWithinTag" action="select">
<tables>
<table name="documents" alias="documents" />
<table name="tags" alias="tags" />
</tables>
<columns>
<column name="documents.document_srl" />
<column name="documents.list_order" />
</columns>
<conditions>
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" />
<condition operation="notin" column="documents.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.document_srl" default="tags.document_srl" notnull="notnull" pipe="and" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="like" column="tags.tag" var="s_tags" notnull="notnull" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
</conditions>
<navigation>
<index var="sort_index" default="documents.list_order" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
<groups>
<group column="documents.document_srl" />
</groups>
<tables>
<table name="documents" />
<table name="tags" />
</tables>
<columns>
<column name="documents.*" />
</columns>
<conditions>
<condition operation="like" column="tags.tag" var="s_tag" notnull="notnull" />
<condition operation="equal" column="documents.document_srl" default="tags.document_srl" pipe="and" />
<condition operation="in" column="documents.module_srl" var="module_srl" filter="number" pipe="and" />
<condition operation="notin" column="documents.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="in" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.is_notice" var="s_is_notice" pipe="and" />
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
<condition operation="more" column="documents.list_order" var="division" pipe="and" />
<condition operation="below" column="documents.list_order" var="last_division" pipe="and" />
<condition operation="more" column="documents.last_update" var="start_date" pipe="and" />
<condition operation="less" column="documents.last_update" var="end_date" pipe="and" />
</conditions>
<groups>
<group column="documents.document_srl" />
</groups>
<navigation>
<index var="sort_index" default="documents.list_order" order="order_type" />
<list_count var="list_count" default="20" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -11,7 +11,8 @@
<condition operation="notin" column="documents.module_srl" var="exclude_module_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.document_srl" default="tags.document_srl" notnull="notnull" pipe="and" />
<condition operation="in" column="documents.category_srl" var="category_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="equal" column="documents.is_notice" var="s_is_notice" pipe="and" />
<condition operation="in" column="documents.member_srl" var="member_srl" filter="number" pipe="and" />
<condition operation="like" column="tags.tag" var="s_tags" notnull="notnull" pipe="and" />
<group pipe="and">
<condition operation="less" column="documents.list_order" var="list_order" filter="number" pipe="and" />

View file

@ -0,0 +1,11 @@
<query id="updateDocumentExtraVarsModule" action="update">
<tables>
<table name="document_extra_vars" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,12 @@
<query id="updateDocumentsModule" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
<column name="category_srl" var="category_srl" filter="number" default="0" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
</query>

View file

@ -17,7 +17,7 @@
<column name="password" type="varchar" size="60" />
<column name="user_id" type="varchar" size="80" />
<column name="user_name" type="varchar" size="80" notnull="notnull" />
<column name="nick_name" type="varchar" size="80" notnull="notnull" />
<column name="nick_name" type="varchar" size="80" notnull="notnull" index="idx_nick_name" />
<column name="member_srl" type="number" size="11" notnull="notnull" index="idx_member_srl" />
<column name="email_address" type="varchar" size="250" notnull="notnull" />
<column name="homepage" type="varchar" size="250" notnull="notnull" />

View file

@ -35,10 +35,10 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<tr>
<th scope="col" class="title">{$lang->title}</th>
<th scope="col" class="nowr">{$lang->writer}</th>
<th scope="col" class="nowr"><a href="{getUrl('sort_index', 'declared_count')}">{$lang->declared_count} <block cond="$sort_index != 'declared_latest'"></block></a></th>
<th scope="col" class="nowr">{$lang->readed_count}</th>
<th scope="col" class="nowr">{$lang->cmd_vote}(+/-)</th>
<th scope="col" class="nowr">{$lang->original_date}</th>
<th scope="col" class="nowr"><a href="{getUrl('sort_index', 'declared_count')}">{$lang->declared_count} <block cond="$sort_index == 'declared_count'"></block></a></th>
<th scope="col" class="nowr"><a href="{getUrl('sort_index', 'regdate')}">{$lang->original_date} <block cond="$sort_index == 'regdate'"></block></a></th>
<th scope="col" class="nowr"><a href="{getUrl('sort_index', 'declared_latest')}">{$lang->latest_declared_date} <block cond="$sort_index == 'declared_latest'"></block></a></th>
<th scope="col"><input type="checkbox" name="cart" title="Check All" /></th>
</tr>
@ -47,9 +47,9 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<tr loop="$document_list => $no,$oDocument">
<td class="title"><a href="{getUrl('','document_srl',$oDocument->document_srl)}" target="_blank">{$oDocument->getTitle()}</a></td>
<td class="nowr"><a href="#popup_menu_area" class="member_{$oDocument->get('member_srl')}">{$oDocument->getNickName()}</a></td>
<td class="nowr">{$oDocument->get('declared_count')} (<a href="{getUrl('', 'act', 'dispDocumentAdminDeclaredLogByDocumentSrl', 'target_srl',$oDocument->document_srl)}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_document_declare_reason}</a>)</td>
<td class="nowr">{$oDocument->get('readed_count')}</td>
<td class="nowr">{$oDocument->get('voted_count')}/{$oDocument->get('blamed_count')}</td>
<td class="nowr">{$oDocument->get('voted_count')} / {$oDocument->get('blamed_count')}</td>
<td class="nowr">{$oDocument->get('declared_count')} (<a href="{getUrl('', 'act', 'dispDocumentAdminDeclaredLogByDocumentSrl', 'target_srl',$oDocument->document_srl)}" onclick="popopen(this.href, 'admin_popup');return false">{$lang->improper_document_declare_reason}</a>)</td>
<td class="nowr">{$oDocument->getRegdate("Y-m-d H:i")}</td>
<td class="nowr">{zdate($oDocument->get('latest_declared'), 'Y-m-d H:i')}</td>
<td><input type="checkbox" name="cart" value="{$oDocument->document_srl}" /></td>

View file

@ -37,6 +37,13 @@
</select>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->cmd_declared_message}</label>
<div class="x_controls">
<label class="x_inline" for="declared_message_admin"><input type="checkbox" name="declared_message[]" id="declared_message_admin" value="admin" checked="checked"|cond="in_array('admin', $document_config->declared_message)" /> {$lang->cmd_declared_message_admin}</label>
<label class="x_inline" for="declared_message_manager"><input type="checkbox" name="declared_message[]" id="declared_message_manager" value="manager" checked="checked"|cond="in_array('manager', $document_config->declared_message)" /> {$lang->cmd_declared_message_manager}</label>
</div>
</div>
<div class="btnArea">
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
</div>

View file

@ -2,14 +2,12 @@
<h1 class="h1">{$oDocument->getTitleText()}</h1>
<a href="#popup_menu_area" class="member_{$oDocument->get('member_srl')}">{$oDocument->get('nick_name')}</a>
{$oDocument->getRegdate()}
<!--@if($oDocument->isExtraVarsExists() && (!$oDocument->isSecret() || $oDocument->isGranted()) )-->
<!--@if($oDocument->isExtraVarsExists() && $oDocument->isAccessible())-->
<!--@foreach($oDocument->getExtraVars() as $key => $val)-->
{$val->name}: {$val->getValueHtml()}
<!--@end-->
<!--@end-->
{$oDocument->getContent(false, false)}
<script>
//<![CDATA[
jQuery(window).load(function() { window.print(); } );
//]]>
jQuery(window).load(function() { window.print(); } );
</script>

View file

@ -3,6 +3,7 @@
<grants />
<actions>
<action name="dispEditorComponentInfo" type="view" />
<action name="dispEditorFrame" type="view" />
<action name="dispEditorPopup" type="view" />
<action name="dispEditorPreview" type="view" />
<action name="dispEditorSkinColorset" type="view" permission="all-managers" />

View file

@ -161,6 +161,7 @@ class editorAdminController extends editor
$config->mobile_comment_editor_toolbar = $configVars->mobile_comment_editor_toolbar;
$config->mobile_comment_editor_toolbar_hide = $configVars->mobile_comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->content_style = $configVars->content_style;
$config->comment_content_style = $configVars->comment_content_style;
$config->sel_editor_colorset = $configVars->sel_editor_colorset;
$config->sel_comment_editor_colorset = $configVars->sel_comment_editor_colorset;

View file

@ -97,6 +97,10 @@ class editor extends ModuleObject
if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true;
// XEVE-17-030
if(!$oDB->isColumnExists('editor_autosave', 'certify_key')) return true;
if(!$oDB->isIndexExists('editor_autosave', 'idx_certify_key')) return true;
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
@ -120,15 +124,28 @@ class editor extends ModuleObject
{
$oModuleModel = getModel('module');
$oModuleController = getController('module');
$oDB = &DB::getInstance();
// Save module_srl when auto-saving 15/06/2009
if(!$oDB->isColumnExists("editor_autosave","module_srl"))
$oDB->addColumn("editor_autosave","module_srl","number",11);
// create an index on module_srl
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl");
if(!$oDB->isColumnExists('editor_autosave', 'module_srl'))
{
$oDB->addColumn('editor_autosave', 'module_srl', 'number');
}
if(!$oDB->isIndexExists('editor_autosave', 'idx_module_srl'))
{
$oDB->addIndex('editor_autosave', 'idx_module_srl', 'module_srl');
}
// XEVE-17-030
if(!$oDB->isColumnExists('editor_autosave', 'certify_key'))
{
$oDB->addColumn('editor_autosave', 'certify_key', 'varchar', 32);
}
if(!$oDB->isIndexExists('editor_autosave', 'idx_certify_key'))
{
$oDB->addIndex('editor_autosave', 'idx_certify_key', 'certify_key');
}
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');

View file

@ -89,19 +89,19 @@ class editorController extends editor
foreach ($target_module_srl as $srl)
{
if (!$srl) continue;
$module_info = $oModuleModel->getModuleInfoByModuleSrl($srl);
if (!$module_info->module_srl)
{
return $this->setError('msg_invalid_request');
}
$module_grant = $oModuleModel->getGrant($module_info, $logged_info);
if (!$module_grant->manager)
{
return $this->setError('msg_not_permitted');
}
$module_srl[] = $srl;
}
@ -147,21 +147,21 @@ class editorController extends editor
$editor_config->{$key} = explode('|@|', $grant);
}
}
$editor_config->editor_height = (int)Context::get('editor_height');
$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
$editor_config->enable_autosave = Context::get('enable_autosave') ?: 'Y';
$editor_config->allow_html = Context::get('allow_html') ?: 'Y';
$oModuleController = getController('module');
foreach ($module_srl as $srl)
{
$oModuleController->insertModulePartConfig('editor', $srl, $editor_config);
}
$this->setError(-1);
$this->setMessage('success_updated', 'info');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
$this->setRedirectUrl($returnUrl);
}
@ -183,33 +183,9 @@ class editorController extends editor
{
$editor_config = getModel('module')->getModuleConfig('editor');
}
if ($editor_config)
{
$content_style = $editor_config->content_style;
if($content_style)
{
$path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/';
if(is_dir($path) && file_exists($path . 'style.ini'))
{
$ini = file($path.'style.ini');
for($i = 0, $c = count($ini); $i < $c; $i++)
{
$file = trim($ini[$i]);
if(!$file) continue;
if(substr_compare($file, '.css', -4) === 0)
{
Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
}
elseif(substr_compare($file, '.js', -3) === 0)
{
Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
}
}
}
}
$default_font_config = $this->default_font_config;
if ($editor_config->content_font) $default_font_config['default_font_family'] = $editor_config->content_font;
if ($editor_config->content_font_size) $default_font_config['default_font_size'] = $editor_config->content_font_size;
@ -217,7 +193,25 @@ class editorController extends editor
if ($editor_config->content_paragraph_spacing) $default_font_config['default_paragraph_spacing'] = $editor_config->content_paragraph_spacing;
if ($editor_config->content_word_break) $default_font_config['default_word_break'] = $editor_config->content_word_break;
Context::set('default_font_config', $default_font_config);
$content_style = $editor_config->content_style;
if($content_style)
{
$path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/';
if(is_dir($path) && file_exists($path . 'style.ini'))
{
$ini = file($path.'style.ini');
foreach($ini as $file)
{
$file = trim($file);
if(!$file) continue;
$args = array('./modules/editor/styles/'.$content_style.'/'.$file);
Context::loadFile($args);
}
}
}
/*
$buff = array();
$buff[] = '<style> .xe_content {';
@ -298,6 +292,15 @@ class editorController extends editor
function doSaveDoc($args)
{
if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
// Get the current module if module_srl doesn't exist
if(!$args->module_srl) $args->module_srl = Context::get('module_srl');
if(!$args->module_srl)
{
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
@ -305,20 +308,11 @@ class editorController extends editor
}
else
{
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
$args->ipaddress = RX_CLIENT_IP;
$args->certify_key = Rhymix\Framework\Security::getRandom(32);
setcookie('autosave_certify_key_' . $args->module_srl, $args->certify_key, time() + 86400, null, null, RX_SSL, true);
}
// Get the current module if module_srl doesn't exist
if(!$args->module_srl)
{
$args->module_srl = Context::get('module_srl');
}
if(!$args->module_srl)
{
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
// Save
return executeQuery('editor.insertSavedDoc', $args);
}
@ -358,26 +352,36 @@ class editorController extends editor
function deleteSavedDoc($mode = false)
{
$args = new stdClass();
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
$args->member_srl = $logged_info->member_srl;
}
else
{
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->module_srl = Context::get('module_srl');
// Get the current module if module_srl doesn't exist
if(!$args->module_srl)
{
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
$args->member_srl = $logged_info->member_srl;
}
elseif($_COOKIE['autosave_certify_key_' . $args->module_srl])
{
$args->certify_key = $_COOKIE['autosave_certify_key_' . $args->module_srl];
}
else
{
$args->ipaddress = RX_CLIENT_IP;
}
// Check if the auto-saved document already exists
$output = executeQuery('editor.getSavedDocument', $args);
$saved_doc = $output->data;
if(!$saved_doc) return;
if($saved_doc->certify_key && !isset($args->certify_key))
{
return;
}
$oDocumentModel = getModel('document');
$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
@ -385,12 +389,14 @@ class editorController extends editor
{
if($mode)
{
setcookie('autosave_certify_key_' . $args->module_srl, 'deleted', time() - 86400);
$output = executeQuery('editor.getSavedDocument', $args);
$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
}
}
// Delete the saved document
return executeQuery('editor.deleteSavedDoc', $args);
$output = executeQuery('editor.deleteSavedDoc', $args);
return $output;
}
/**
@ -422,8 +428,11 @@ class editorController extends editor
else $output = executeQuery('editor.getComponentList', $args);
$db_list = $output->data;
// Get a list of files
$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
// Get a list of editor component folders
$downloaded_list = FileHandler::readDir(RX_BASEDIR . 'modules/editor/components');
$downloaded_list = array_filter($downloaded_list, function($component_name) {
return is_dir(RX_BASEDIR . 'modules/editor/components/' . $component_name);
});
// Get information about log-in status and its group
$is_logged = Context::get('is_logged');
@ -499,8 +508,8 @@ class editorController extends editor
$component_list->{$component_name} = $xml_info;
// Get buttons, icons, images
$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
$icon_file = RX_BASEDIR . 'modules/editor/components/'.$component_name.'/icon.gif';
$component_icon_file = RX_BASEDIR . 'modules/editor/components/'.$component_name.'/component_icon.gif';
if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
}

View file

@ -409,32 +409,48 @@ class editorModel extends editor
function getSavedDoc($upload_target_srl)
{
$auto_save_args = new stdClass();
// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
$auto_save_args->member_srl = $logged_info->member_srl;
}
else
{
$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$auto_save_args->module_srl = Context::get('module_srl');
// Get the current module if module_srl doesn't exist
if(!$auto_save_args->module_srl)
{
$current_module_info = Context::get('current_module_info');
$auto_save_args->module_srl = $current_module_info->module_srl;
}
// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
$auto_save_args->member_srl = $logged_info->member_srl;
}
elseif($_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl])
{
$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl];
}
else
{
$auto_save_args->ipaddress = RX_CLIENT_IP;
}
// Extract auto-saved data from the DB
$output = executeQuery('editor.getSavedDocument', $auto_save_args);
$saved_doc = $output->data;
// Return null if no result is auto-saved
if(!$saved_doc) return;
// Return null if certify key does not match
if($saved_doc->certify_key && !isset($auto_save_args->certify_key))
{
return;
}
// Check if the auto-saved document already exists
$oDocumentModel = getModel('document');
$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
if($oSaved->isExists()) return;
// Move all the files if the auto-saved data contains document_srl and file
// Then set document_srl to editor_sequence
if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
@ -443,8 +459,18 @@ class editorModel extends editor
$oFileController = getController('file');
$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
}
else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
elseif($upload_target_srl)
{
$saved_doc->document_srl = $upload_target_srl;
}
// Change auto-saved data
$saved_doc->certify_key = $auto_save_args->certify_key;
if(!$saved_doc->certify_key)
{
$saved_doc->certify_key = Rhymix\Framework\Security::getRandom(32);
setcookie('autosave_certify_key_' . $saved_doc->module_srl, $saved_doc->certify_key, time() + 86400, null, null, RX_SSL, true);
}
$oEditorController = getController('editor');
$oEditorController->deleteSavedDoc(false);
$oEditorController->doSaveDoc($saved_doc);

View file

@ -15,6 +15,40 @@ class editorView extends editor
{
}
/**
* @brief Display editor in an iframe
*/
function dispEditorFrame()
{
// Check parent input ID
$parent_input_id = Context::get('parent_input_id');
Context::set('parent_input_id', preg_replace('/[^a-z0-9_]/i', '', $parent_input_id));
Context::addBodyClass('disable_debug_panel');
// Load editor
$oEditorModel = getModel('editor');
$option = $oEditorModel->getEditorConfig();
$option->editor_skin = 'ckeditor';
$option->content_style = 'ckeditor_light';
$option->sel_editor_colorset = 'moono-lisa';
$option->primary_key_name = 'primary_key';
$option->content_key_name = 'content';
$option->allow_fileupload = FALSE;
$option->enable_autosave = FALSE;
$option->enable_default_component = TRUE;
$option->enable_component = FALSE;
$option->height = 300;
$option->editor_focus = 'Y';
$editor = $oEditorModel->getEditor(0, $option);
Context::set('editor', $editor);
// Set template
$this->setLayoutPath('./common/tpl/');
$this->setLayoutFile("default_layout");
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile('editor_frame');
}
/**
* @brief Action to get a request to display compoenet pop-up
*/

View file

@ -1,8 +1,8 @@
<?php
$lang->editor_component = 'Editor Component';
$lang->main_editor = 'Main editor';
$lang->comment_editor = 'Comment editor';
$lang->editor_option = 'Editor Options';
$lang->main_editor = 'Main Editor';
$lang->comment_editor = 'Comment Editor';
$lang->editor_common_settings = 'Common Settings';
$lang->guide_choose_main_editor = 'Main editor';
$lang->guide_set_height_main_editor = 'Main editor height';
$lang->guide_set_main_editor_toolbar = 'Main editor toolbar';
@ -15,6 +15,7 @@ $lang->guide_additional_mobile_css = 'Additional CSS Files for Mobile';
$lang->guide_additional_plugins = 'Load additional plugins';
$lang->guide_remove_plugins = 'Remove plugins';
$lang->guide_choose_text_formatting = 'Text formatting style';
$lang->guide_choose_comment_text_formatting = 'Text formatting style';
$lang->guide_choose_font_preview = 'Preview';
$lang->guide_choose_font_body = 'Default font';
$lang->guide_choose_font_size_body = 'Default font size';

View file

@ -3,7 +3,6 @@ $lang->editor_now = '현재 설정 상태';
$lang->editor_component = '에디터 컴포넌트';
$lang->main_editor = '본문 에디터';
$lang->comment_editor = '댓글 에디터';
$lang->editor_option = '에디터 옵션';
$lang->guide_choose_main_editor = '본문 에디터';
$lang->guide_set_height_main_editor = '본문 에디터 높이';
$lang->guide_set_main_editor_toolbar = '본문 에디터 도구상자';
@ -13,12 +12,14 @@ $lang->guide_set_comment_editor_toolbar = '댓글 에디터 도구상자';
$lang->editor_toolbar_default = '기본';
$lang->editor_toolbar_simple = '간단';
$lang->editor_toolbar_hide = '숨김';
$lang->editor_common_settings = '공통 설정';
$lang->guide_additional_css = 'CSS 파일 추가';
$lang->about_additional_css = '웹폰트 등의 CSS를 에디터 내부에서 추가로 로딩하려면 한 줄에 하나씩 URL을 입력해 주십시오.';
$lang->guide_additional_mobile_css = '모바일 CSS 파일 추가';
$lang->guide_additional_plugins = '추가 플러그인 로드';
$lang->guide_remove_plugins = '플러그인 제거';
$lang->guide_choose_text_formatting = '본문 서식';
$lang->guide_choose_comment_text_formatting = '댓글 서식';
$lang->guide_choose_font_preview = '미리보기';
$lang->guide_choose_font_body = '본문 글꼴';
$lang->guide_choose_font_size_body = '글꼴 크기';

View file

@ -7,5 +7,6 @@
<condition operation="equal" column="module_srl" var="module_srl" />
<condition operation="equal" column="member_srl" var="member_srl" pipe="and" />
<condition operation="equal" column="ipaddress" var="ipaddress" pipe="and" />
<condition operation="equal" column="certify_key" var="certify_key" pipe="and" />
</conditions>
</query>

View file

@ -7,5 +7,6 @@
<condition operation="equal" column="module_srl" var="module_srl" />
<condition operation="equal" column="member_srl" var="member_srl" pipe="and" />
<condition operation="equal" column="ipaddress" var="ipaddress" pipe="and" />
<condition operation="equal" column="certify_key" var="certify_key" pipe="and" />
</conditions>
</query>

View file

@ -5,10 +5,11 @@
<columns>
<column name="module_srl" var="module_srl" />
<column name="member_srl" var="member_srl" />
<column name="ipaddress" var="ipaddress" />
<column name="ipaddress" var="ipaddress" />
<column name="document_srl" var="document_srl" default="0" />
<column name="title" var="title" />
<column name="content" var="content" />
<column name="certify_key" var="certify_key" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>

View file

@ -5,5 +5,6 @@
<column name="document_srl" type="number" size="11" default="0" notnull="notnull" />
<column name="title" type="varchar" size="250" />
<column name="content" type="bigtext" notnull="notnull" />
<column name="certify_key" type="varchar" size="32" index="idx_certify_key" />
<column name="regdate" type="date" index="idx_regdate" />
</table>

View file

@ -112,12 +112,6 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
content_field: jQuery('[name={$editor_content_key_name}]')
};
// Temporary workaround for line break bug in recent versions of iOS.
if (navigator.userAgent.match(/i(OS|Phone|Pad)/)) {
settings.ckeconfig.enterMode = CKEDITOR.ENTER_BR;
settings.ckeconfig.shiftEnterMode = CKEDITOR.ENTER_P;
}
// Prevent removal of icon fonts and Google code.
CKEDITOR.dtd.$removeEmpty.i = 0;
CKEDITOR.dtd.$removeEmpty.ins = 0;
@ -150,6 +144,14 @@ var auto_saved_msg = "{$lang->msg_auto_saved}";
<!--@if($editor_remove_plugins)-->
settings.ckeconfig.removePlugins = {json_encode(implode(',', $editor_remove_plugins))};
<!--@endif-->
// https://github.com/rhymix/rhymix/issues/932
if (CKEDITOR.env.iOS) {
settings.ckeconfig.extraPlugins = (settings.ckeconfig.extraPlugins ? (settings.ckeconfig.extraPlugins + ',') : '') + 'divarea,ios_enterkey';
settings.loadXeComponent = false;
var additional_styles = '.cke_wysiwyg_div { padding: 8px !important; }';
$('head').append('<st' + 'yle>' + additional_styles + css_content.replace(/\.xe_content\.editable/g, '.cke_wysiwyg_div') + '</st' + 'yle>');
}
<!--@if($editor_toolbar === 'simple')-->
settings.ckeconfig.toolbar = [

View file

@ -4,6 +4,7 @@ function editorTextarea(editor_sequence) {
var primary_key = textarea.data("editor-primary-key-name");
var insert_form = textarea.closest("form");
var content_input = insert_form.find("input[name='" + content_key + "']");
var content = "";
// Set editor keys
editorRelKeys[editor_sequence] = {};
@ -16,7 +17,7 @@ function editorTextarea(editor_sequence) {
// Load existing content
if (content_input.size()) {
var content = String(content_input.val()).stripTags();
content = String(content_input.val()).stripTags();
content_input.val(content);
textarea.val(content.unescape());
}
@ -25,4 +26,19 @@ function editorTextarea(editor_sequence) {
textarea.on("change", function() {
content_input.val(String(jQuery(this).val()).escape());
});
// Copy content to another input and resize iframe if configured
if (window.editor_resize_iframe && window.editor_copy_input)
{
content = String(editor_copy_input.val()).stripTags();
editor_copy_input.val(content);
textarea.val(content.unescape());
textarea.on("resize", function(e){
editor_resize_iframe.height(textarea.height());
});
textarea.on("change", function() {
editor_copy_input.val(String(textarea.val()).escape());
});
editor_resize_iframe.height(textarea.height());
}
}

View file

@ -27,12 +27,13 @@
<!-- Editor Option -->
<section class="section">
<h1>{$lang->editor_option}</h1>
<form action="./" method="post" ruleset="generalConfig" class="x_form-horizontal">
<input type="hidden" name="module" value="editor" />
<input type="hidden" name="act" value="procEditorAdminGeneralConfig" />
<input type="hidden" name="xe_validator_id" value="modules/editor/tpl/admin_index/1" />
<h1>{$lang->main_editor}</h1>
<div class="x_control-group">
<label for="change_lang_type" class="x_control-label">{$lang->guide_choose_main_editor}</label>
<div class="x_controls">
@ -71,6 +72,19 @@
</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->guide_choose_text_formatting}</label>
<div class="x_controls">
<!--@foreach($content_style_list as $key => $val)-->
<label class="x_inline">
<input type="radio" name="content_style" value="{$key}" id="content_style_{$key}" checked="checked"|cond="$key==$editor_config->content_style||!$editor_config->content_style && $key=='ckeditor_light'"> {$val->title}
</label>
<!--@end-->
</div>
</div>
<h1>{$lang->comment_editor}</h1>
<div class="x_control-group">
<label for="sel_comment_editor_colorset" class="x_control-label">{$lang->guide_choose_comment_editor}</label>
<div class="x_controls">
@ -111,15 +125,18 @@
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->guide_choose_text_formatting}</label>
<label class="x_control-label">{$lang->guide_choose_comment_text_formatting}</label>
<div class="x_controls">
<!--@foreach($content_style_list as $key => $val)-->
<label class="x_inline">
<input type="radio" name="content_style" value="{$key}" id="style_{$key}" checked="checked"|cond="$key==$editor_config->content_style||!$editor_config->content_style && $key=='ckeditor_light'"> {$val->title}
<input type="radio" name="comment_content_style" value="{$key}" id="comment_content_style_{$key}" checked="checked"|cond="$key==$editor_config->comment_content_style||!$editor_config->comment_content_style && $key=='ckeditor_light'"> {$val->title}
</label>
<!--@end-->
</div>
</div>
<h1>{$lang->editor_common_settings}</h1>
<div class="x_control-group">
<label class="x_control-label">{$lang->guide_choose_font_body}</label>
<div class="x_controls">

View file

@ -0,0 +1,18 @@
<script>
$(function() {
var parent = window.opener ? window.opener : window.parent;
window.editor_copy_input = $("#{$parent_input_id}", parent.document);
window.editor_resize_iframe = window.editor_copy_input.siblings("iframe.editor_iframe");
});
</script>
<style>
body { margin: 0; }
.wfsr { display: none; }
</style>
<form>
<input type="hidden" name="primary_key" id="primary_key" value="" />
<input type="hidden" name="content" id="content" value="" />
{$editor}
</form>

View file

@ -145,6 +145,19 @@ function getAutoSavedSrl(ret_obj, response_tags, c) {
instance.on('instanceReady', function(e) {
$containerEl.css("min-height", 0);
if(window.editor_resize_iframe && window.editor_copy_input)
{
e.editor.setData(editor_copy_input.val());
e.editor.on("resize", function(e){
var height = e.data.outerHeight;
editor_resize_iframe.height(height);
});
e.editor.on("change", function() {
var content = e.editor.getData();
editor_copy_input.val(content);
});
editor_resize_iframe.height($(".cke_chrome").parent().height());
}
});
instance.on('paste', function(e) {

View file

@ -15,42 +15,12 @@ class fileAdminController extends file
}
/**
* Delete the attachment of a particular module
*
* @param int $module_srl Sequence of module to delete files
* @deprecated move to fileController
* @return Object
*/
function deleteModuleFiles($module_srl)
{
// Get a full list of attachments
$args = new stdClass();
$args->module_srl = $module_srl;
$columnList = array('file_srl', 'uploaded_filename');
$output = executeQueryArray('file.getModuleFiles',$args, $columnList);
if(!$output) return $output;
$files = $output->data;
// Remove from the DB
$args->module_srl = $module_srl;
$output = executeQuery('file.deleteModuleFiles', $args);
if(!$output->toBool()) return $output;
// Remove the file
FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
// Remove the file list obtained from the DB
$path = array();
$cnt = count($files);
for($i=0;$i<$cnt;$i++)
{
$uploaded_filename = $files[$i]->uploaded_filename;
FileHandler::removeFile($uploaded_filename);
$path_info = pathinfo($uploaded_filename);
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
}
// Remove a file directory of the document
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
return $output;
return getController('file')->deleteModuleFiles($module_srl);
}
/**
@ -99,6 +69,7 @@ class fileAdminController extends file
$config->allow_outlink = Context::get('allow_outlink');
$config->allow_outlink_format = Context::get('allow_outlink_format');
$config->allow_outlink_site = Context::get('allow_outlink_site');
$config->inline_download_format = array_map('utf8_trim', Context::get('inline_download_format'));
// Check maximum file size
if (PHP_INT_SIZE < 8)

View file

@ -77,7 +77,20 @@ class file extends ModuleObject
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true;
if(!$oDB->isColumnExists('files', 'cover_image')) return true;
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after'))
{
return true;
}
if(!$oModuleModel->getTrigger('document.copyDocumentModule', 'file', 'controller', 'triggerAddCopyDocument', 'add'))
{
return true;
}
if(!$oModuleModel->getTrigger('comment.copyCommentByDocument', 'file', 'controller', 'triggerAddCopyCommentByDocument', 'add'))
{
return true;
}
return false;
}
@ -140,6 +153,19 @@ class file extends ModuleObject
}
if(!$oDB->isColumnExists('files', 'cover_image')) $oDB->addColumn('files', 'cover_image', 'char', '1', 'N');
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after'))
{
$oModuleController->insertTrigger('document.moveDocumentModule', 'file', 'controller', 'triggerMoveDocument', 'after');
}
if(!$oModuleModel->getTrigger('document.copyDocumentModule', 'file', 'controller', 'triggerAddCopyDocument', 'add'))
{
$oModuleController->insertTrigger('document.copyDocumentModule', 'file', 'controller', 'triggerAddCopyDocument', 'add');
}
if(!$oModuleModel->getTrigger('comment.copyCommentByDocument', 'file', 'controller', 'triggerAddCopyCommentByDocument', 'add'))
{
$oModuleController->insertTrigger('comment.copyCommentByDocument', 'file', 'controller', 'triggerAddCopyCommentByDocument', 'add');
}
}
/**

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