mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Merge branch 'develop' into pr/sms
This commit is contained in:
commit
bbd95865c3
6 changed files with 61 additions and 51 deletions
|
|
@ -700,10 +700,11 @@ class adminAdminController extends admin
|
|||
}
|
||||
|
||||
// Thumbnail settings
|
||||
$args = new stdClass;
|
||||
$args->thumbnail_type = $vars->thumbnail_type === 'ratio' ? 'ratio' : 'crop';
|
||||
$oDocumentModel = getModel('document');
|
||||
$document_config = $oDocumentModel->getDocumentConfig();
|
||||
$document_config->thumbnail_type = $vars->thumbnail_type === 'ratio' ? 'ratio' : 'crop';
|
||||
$oModuleController = getController('module');
|
||||
$oModuleController->insertModuleConfig('document', $args);
|
||||
$oModuleController->insertModuleConfig('document', $document_config);
|
||||
|
||||
// Other settings
|
||||
Rhymix\Framework\Config::set('use_rewrite', $vars->use_rewrite === 'Y');
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ class boardController extends board
|
|||
$comment->status = 7;
|
||||
$output = $oCommentController->updateCommentByDelete($comment, $this->grant->manager);
|
||||
}
|
||||
elseif($this->module_info->comment_delete_message === 'only_commnet' && $instant_delete != 'Y')
|
||||
elseif(starts_with('only_comm', $this->module_info->comment_delete_message) && $instant_delete != 'Y')
|
||||
{
|
||||
$childs = $oCommentModel->getChildComments($comment_srl);
|
||||
if(count($childs) > 0)
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@
|
|||
<select name="comment_delete_message" id="comment_delete_message">
|
||||
<option value="no" selected="selected"|cond="$module_info->comment_delete_message == 'no'">{$lang->cmd_do_not_message}</option>
|
||||
<option value="yes" selected="selected"|cond="$module_info->comment_delete_message == 'yes'">{$lang->cmd_all_comment_message}</option>
|
||||
<option value="only_commnet" selected="selected"|cond="$module_info->comment_delete_message == 'only_commnet'">{$lang->cmd_only_p_comment}</option>
|
||||
<option value="only_comment" selected="selected"|cond="starts_with('only_comm', $module_info->comment_delete_message)">{$lang->cmd_only_p_comment}</option>
|
||||
</select>
|
||||
<p class="x_help-block">{$lang->about_comment_delete_message}</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -79,13 +79,6 @@ class documentAdminController extends document
|
|||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists()) continue;
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
$logged_info = Context::get('logged_info');
|
||||
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
|
||||
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
|
||||
{
|
||||
return new Object();
|
||||
}
|
||||
$source_category_srl = $oDocument->get('category_srl');
|
||||
|
||||
unset($obj);
|
||||
|
|
@ -475,8 +468,10 @@ class documentAdminController extends document
|
|||
function procDocumentAdminInsertConfig()
|
||||
{
|
||||
// Get the basic information
|
||||
$config = new stdClass();
|
||||
$oDocumentModel = getModel('document');
|
||||
$config = $oDocumentModel->getDocumentConfig();
|
||||
$config->view_count_option = Context::get('view_count_option');
|
||||
|
||||
// Insert by creating the module Controller object
|
||||
$oModuleController = getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('document',$config);
|
||||
|
|
|
|||
|
|
@ -1052,63 +1052,78 @@ class documentController extends document
|
|||
return false;
|
||||
}
|
||||
|
||||
// Get the view count option, and use the default if the value is empty or invalid.
|
||||
$valid_options = array(
|
||||
'all' => true,
|
||||
'some' => true,
|
||||
'once' => true,
|
||||
'none' => true,
|
||||
);
|
||||
|
||||
$oDocumentModel = getModel('document');
|
||||
$config = $oDocumentModel->getDocumentConfig();
|
||||
if (!$config->view_count_option || !isset($valid_options[$config->view_count_option]))
|
||||
{
|
||||
$config->view_count_option = 'once';
|
||||
}
|
||||
|
||||
if($config->view_count_option == 'none') return false;
|
||||
|
||||
// If not counting, return now.
|
||||
if ($config->view_count_option == 'none')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get document and user information.
|
||||
$document_srl = $oDocument->document_srl;
|
||||
$member_srl = $oDocument->get('member_srl');
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Option 'once': check member_srl and IP address.
|
||||
if ($config->view_count_option == 'once')
|
||||
{
|
||||
// Pass if the author's IP address is as same as visitor's.
|
||||
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
|
||||
{
|
||||
if (Context::getSessionStatus())
|
||||
{
|
||||
$_SESSION['readed_document'][$document_srl] = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Pass if the author's member_srl is the same as the visitor's.
|
||||
if($member_srl && $logged_info->member_srl && $logged_info->member_srl == $member_srl)
|
||||
{
|
||||
$_SESSION['readed_document'][$document_srl] = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Call a trigger when the read count is updated (before)
|
||||
$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
|
||||
if(!$trigger_output->toBool()) return $trigger_output;
|
||||
|
||||
// Pass if read count is increaded on the session information
|
||||
if($_SESSION['readed_document'][$document_srl] && $config->view_count_option == 'once')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if($config->view_count_option == 'some')
|
||||
{
|
||||
if($_SESSION['readed_document'][$document_srl])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if($config->view_count_option == 'once')
|
||||
{
|
||||
// Pass if the author's IP address is as same as visitor's.
|
||||
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'] && Context::getSessionStatus())
|
||||
{
|
||||
$_SESSION['readed_document'][$document_srl] = true;
|
||||
return false;
|
||||
}
|
||||
// Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
|
||||
if($member_srl && $logged_info->member_srl == $member_srl)
|
||||
{
|
||||
$_SESSION['readed_document'][$document_srl] = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Update read counts
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
// Update read counts
|
||||
$args = new stdClass;
|
||||
$args->document_srl = $document_srl;
|
||||
executeQuery('document.updateReadedCount', $args);
|
||||
|
||||
// Call a trigger when the read count is updated (after)
|
||||
ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
//remove document item from cache
|
||||
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($document_srl) . $document_srl);
|
||||
|
||||
// Register session
|
||||
if(!$_SESSION['banned_document'][$document_srl] && Context::getSessionStatus())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -928,7 +928,6 @@ class documentModel extends document
|
|||
$config = $oModuleModel->getModuleConfig('document');
|
||||
|
||||
if(!$config) $config = new stdClass();
|
||||
if(!$config->view_count_option) $config->view_count_option = 'once';
|
||||
$GLOBALS['__document_config__'] = $config;
|
||||
}
|
||||
return $GLOBALS['__document_config__'];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue