本文整理汇总了PHP中DiscussHelper::isModerateThreshold方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::isModerateThreshold方法的具体用法?PHP DiscussHelper::isModerateThreshold怎么用?PHP DiscussHelper::isModerateThreshold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::isModerateThreshold方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxSubmitReply
//.........这里部分代码省略.........
echo $this->_outputJson($output);
return false;
}
if (empty($post['poster_name']) || empty($post['poster_email'])) {
$output = array();
$output['message'] = JText::sprintf('COM_EASYDISCUSS_GUEST_SIGN_IN_DESC');
$output['type'] = 'error';
echo $this->_outputJson($output);
return false;
}
} else {
$post['user_type'] = 'member';
$post['poster_name'] = '';
$post['poster_email'] = '';
}
// get id if available
$id = 0;
// set alias
$post['alias'] = DiscussHelper::getAlias($post['title'], 'post');
// set post owner
$post['user_id'] = $my->id;
$content = JRequest::getVar('dc_reply_content', '', 'post', 'none', JREQUEST_ALLOWRAW);
$content = DiscussHelper::getHelper('String ')->unhtmlentities($content);
// Rebind the post data
$post['dc_reply_content'] = $content;
$post['content_type'] = DiscussHelper::getEditorType('reply');
// Set the ip address
$post['ip'] = JRequest::getVar('REMOTE_ADDR', '', 'SERVER');
// bind the table
$table = DiscussHelper::getTable('Post');
$table->bind($post, true);
// Set the category id for the reply since we might need to use this for acl checks.
$table->category_id = $question->category_id;
if ($config->get('main_moderatepost', 0) && !DiscussHelper::isModerateThreshold($my->id) && !DiscussHelper::isSiteAdmin($post->user_id)) {
$table->published = DISCUSS_ID_PENDING;
} else {
$table->published = DISCUSS_ID_PUBLISHED;
}
require_once DISCUSS_CLASSES . '/recaptcha.php';
if (DiscussRecaptcha::isRequired()) {
$obj = DiscussRecaptcha::recaptcha_check_answer($config->get('antispam_recaptcha_private'), $_SERVER['REMOTE_ADDR'], $post['recaptcha_challenge_field'], $post['recaptcha_response_field']);
if (!$obj->is_valid) {
$output = array();
$output['message'] = JText::_('COM_EASYDISCUSS_POST_INVALID_RECAPTCHA_RESPONSE');
$output['type'] = 'error.captcha';
echo $this->_outputJson($output);
return false;
}
} else {
if ($config->get('antispam_easydiscuss_captcha')) {
$runCaptcha = DiscussHelper::getHelper('Captcha')->showCaptcha();
if ($runCaptcha) {
$response = JRequest::getVar('captcha-response');
$captchaId = JRequest::getInt('captcha-id');
$discussCaptcha = new stdClass();
$discussCaptcha->captchaResponse = $response;
$discussCaptcha->captchaId = $captchaId;
$state = DiscussHelper::getHelper('Captcha')->verify($discussCaptcha);
if (!$state) {
$output = array();
$output['message'] = JText::sprintf('COM_EASYDISCUSS_INVALID_CAPTCHA');
$output['type'] = 'error';
echo $this->_outputJson($output);
return false;
}
}
示例2: submit
//.........这里部分代码省略.........
}
}
}
// Get previous status before binding.
$prevPostStatus = $post->published;
// If post is being edited, do not change the owner of the item.
if (!$post->id) {
$data['user_id'] = !$post->user_id ? $my->id : $post->user_id;
}
// Check permission to modify assignee
$category = DiscussHelper::getTable('Category');
$access = $post->getAccess($category);
if ($access->canAssign()) {
$assignment = DiscussHelper::getTable('PostAssignment');
$assignment->load($post->id);
// Add new record if assignee was changed
if (array_key_exists('assignee_id', $data) && $assignment->assignee_id != $data['assignee_id']) {
$newAssignment = DiscussHelper::getTable('PostAssignment');
$newAssignment->post_id = $post->id;
$newAssignment->assignee_id = (int) $data['assignee_id'];
$newAssignment->assigner_id = (int) JFactory::getUser()->id;
if (!$newAssignment->store()) {
$ajax->fail('Storing failed');
return $ajax->send();
}
}
}
$data['content_type'] = DiscussHelper::getEditorType('question');
// Bind posted data against the table.
$post->bind($data, true);
// Set all post to be published by default.
$post->published = DISCUSS_ID_PUBLISHED;
// Detect if post should be moderated.
if ($config->get('main_moderatepost') && !DiscussHelper::isSiteAdmin($post->user_id) && !DiscussHelper::isModerateThreshold($post->user_id)) {
$post->published = DISCUSS_ID_PENDING;
}
// Bind posted parameters such as custom tab contents.
$post->bindParams($data);
// Check for maximum length of content if category has specific settings.
$category = DiscussHelper::getTable('Category');
$category->load($post->category_id);
// If there's a maximum content length specified per category base, then we need to check against the content.
if ($category->getParam('maxlength')) {
$length = JString::strlen($post->content);
if ($length > $category->getParam('maxlength_size', 1000)) {
DiscussHelper::storeSession($data, 'NEW_POST_TOKEN');
DiscussHelper::setMessageQueue(JText::sprintf('COM_EASYDISCUSS_MAXIMUM_LENGTH_EXCEEDED', $category->getParam('maxlength_size', 1000)), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=ask', false));
return $app->close();
}
}
// If user tries to submit in a container, throw an error.
if ($category->container) {
DiscussHelper::storeSession($data, 'NEW_POST_TOKEN');
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NOT_ALLOWED_TO_POST_INTO_CONTAINER'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=ask', false));
return $app->close();
}
// @trigger: onBeforeSave
DiscussEventsHelper::importPlugin('content');
DiscussEventsHelper::onContentBeforeSave('post', $post, $isNew);
// If password is disabled, do not allow users to set password.
if (!$config->get('main_password_protection')) {
$post->password = '';
}
// Detect user's ip address.