本文整理汇总了PHP中CKunenaTools::editTimeCheck方法的典型用法代码示例。如果您正苦于以下问题:PHP CKunenaTools::editTimeCheck方法的具体用法?PHP CKunenaTools::editTimeCheck怎么用?PHP CKunenaTools::editTimeCheck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKunenaTools
的用法示例。
在下文中一共展示了CKunenaTools::editTimeCheck方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
protected function edit()
{
if (!$this->load()) {
return false;
}
if ($this->lockProtection()) {
return false;
}
if ($this->isUserBanned()) {
return false;
}
if ($this->isIPBanned()) {
return false;
}
$saved = $this->_app->getUserState('com_kunena.postfields');
$this->_app->setUserState('com_kunena.postfields', null);
$message = $this->msg_cat;
if ($message->parent == 0) {
$this->allow_topic_icons = 1;
}
$allowEdit = 0;
if (CKunenaTools::isModerator($this->my->id, $this->catid)) {
// Moderator can edit any message
$allowEdit = 1;
} else {
if ($this->my->id && $this->my->id == $message->userid) {
$allowEdit = CKunenaTools::editTimeCheck($message->modified_time, $message->time);
}
}
if ($allowEdit == 1) {
// Load attachments
require_once KUNENA_PATH_LIB . '/kunena.attachments.class.php';
$attachments = CKunenaAttachments::getInstance();
$this->attachments = array_pop($attachments->get($message->id));
$this->kunena_editmode = 1;
$this->message_text = $message->message;
$this->resubject = $message->subject;
$this->authorName = $message->name;
$this->email = $message->email;
$this->id = $message->id;
$this->catid = $message->catid;
$this->parent = $message->parent;
$this->emoid = $message->topic_emoticon;
$this->action = 'edit';
//save the options for query after and load the text options, the number options is for create the fields in the form after
if ($message->poll_id) {
$this->polldatasedit = $this->poll->get_poll_data($this->id);
if ($this->kunena_editmode) {
$this->polloptionstotal = count($this->polldatasedit);
}
}
$this->allow_anonymous = !empty($this->msg_cat->allow_anonymous) && $message->userid;
$this->anonymous = 0;
$this->allow_name_change = 0;
if (!$this->my->id || $this->config->changename || !empty($this->msg_cat->allow_anonymous) || CKunenaTools::isModerator($this->my->id, $this->catid)) {
$this->allow_name_change = 1;
}
if (!$this->allow_name_change && $message->userid == $this->my->id) {
$this->authorName = $this->getAuthorName();
}
$this->title = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->resubject;
if ($saved) {
$this->authorName = $saved['fields']['name'];
$this->email = $saved['fields']['email'];
$this->resubject = $saved['fields']['subject'];
$this->message_text = $saved['fields']['message'];
$this->emoid = $saved['fields']['topic_emoticon'];
if (isset($saved['options']['anonymous'])) {
$this->anonymous = $saved['options']['anonymous'];
}
}
$this->modified_reason = isset($saved['fields']['modified_reason']) ? $saved['fields']['modified_reason'] : '';
CKunenaTools::loadTemplate('/editor/form.php');
} else {
while (@ob_end_clean()) {
}
$this->_app->redirect(CKunenaLink::GetKunenaURL(false), JText::_('COM_KUNENA_POST_NOT_MODERATOR'));
}
}
示例2: canDelete
function canDelete($action = '-delete-')
{
// Visitors cannot delete posts
if (!$this->_my->id) {
return $this->setError($action, JText::_('COM_KUNENA_POST_ERROR_ANONYMOUS_FORBITTEN'));
}
// User must see topic in order to delete messages in it
if (!$this->canRead($action)) {
return false;
}
// Categories cannot be deleted - verify that post exists
if (!$this->parent->id) {
return $this->setError($action, JText::_('COM_KUNENA_POST_INVALID'));
}
// Do not perform rest of the checks to moderators and admins
if (CKunenaTools::isModerator($this->_my, $this->parent->catid)) {
return true;
// ACCEPT!
}
// User must be author of the message
if ($this->parent->userid != $this->_my->id) {
return $this->setError($action, JText::_('COM_KUNENA_POST_DELETE_NOT_ALLOWED'));
}
// User is only allowed to delete post within time specified in the configuration
if (!CKunenaTools::editTimeCheck($this->parent->modified_time, $this->parent->time)) {
return $this->setError($action, JText::_('COM_KUNENA_POST_DELETE_NOT_ALLOWED'));
}
// Posts cannot be deleted in locked topics
if ($this->parent->topiclocked) {
return $this->setError($action, JText::_('COM_KUNENA_POST_ERROR_TOPIC_LOCKED'));
}
// Posts cannot be deleted in locked categories
if ($this->parent->catlocked) {
return $this->setError($action, JText::_('COM_KUNENA_POST_ERROR_CATEGORY_LOCKED'));
}
// Post cannot be marked as deleted
if ($this->parent->hold >= 1) {
return $this->setError($action, JText::_('COM_KUNENA_POST_ALREADY_DELETED'));
}
return true;
}
示例3: display
//.........这里部分代码省略.........
}
if ($this->params->get('avatarPosition') == 'left' || $this->params->get('avatarPosition') == 'right') {
$avatar = $this->profile->getAvatarLink('kavatar', 'post');
} else {
$avatar = $this->profile->getAvatarLink('kavatar', 'welcome');
}
if ($avatar) {
$this->avatar = '<span class="kavatar">' . $avatar . '</span>';
}
if ($this->config->showuserstats) {
$activityIntegration = KunenaFactory::getActivityIntegration();
if ($this->config->userlist_usertype) {
$this->usertype = $this->profile->getType($this->catid);
}
$this->userrankimage = $this->profile->getRank($this->catid, 'image');
$this->userranktitle = $this->profile->getRank($this->catid, 'title');
$this->userposts = $this->profile->posts;
$this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
$this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
}
//karma points and buttons
$this->userkarma_minus = $this->userkarma_plus = '';
if ($this->config->showkarma && $this->profile->userid) {
$this->userkarma = JText::_('COM_KUNENA_KARMA') . ": " . $this->profile->karma;
if ($this->my->id && $this->my->id != $this->profile->userid) {
$this->userkarma_minus = CKunenaLink::GetKarmaLink('decrease', $this->catid, $this->id, $this->userid, '<span class="kkarma-minus" alt="Karma-" border="0" title="' . JText::_('COM_KUNENA_KARMA_SMITE') . '"> </span>');
$this->userkarma_plus = CKunenaLink::GetKarmaLink('increase', $this->catid, $this->id, $this->userid, '<span class="kkarma-plus" alt="Karma+" border="0" title="' . JText::_('COM_KUNENA_KARMA_APPLAUD') . '"> </span>');
}
}
$this->profilelink = $this->profile->profileIcon('profile');
$this->personaltext = $this->profile->personalText;
$this->signatureHtml = KunenaParser::parseBBCode($this->profile->signature);
//Thankyou info and buttons
if ($this->config->showthankyou && $this->profile->userid && $mode != 'threaded') {
require_once KPATH_SITE . '/lib/kunena.thankyou.php';
$thankyou = new CKunenaThankyou();
$this->total_thankyou = $thankyou->getThankYouUser($this->id);
$this->thankyou = array_slice($this->total_thankyou, 0, $this->config->thankyou_max);
if ($this->my->id && $this->my->id != $this->profile->userid) {
$this->message_thankyou = CKunenaLink::GetThankYouLink($this->catid, $this->id, $this->userid, CKunenaTools::showButton('thankyou', JText::_('COM_KUNENA_BUTTON_THANKYOU')), JText::_('COM_KUNENA_BUTTON_THANKYOU_LONG'), 'kicon-button kbuttonuser btn-left');
}
}
if (!$message->hold && (CKunenaTools::isModerator($this->my->id, $this->catid) || !$this->topicLocked)) {
//user is allowed to reply/quote
$this->captcha = KunenaSpamRecaptcha::getInstance();
if ($this->my->id && (CKunenaTools::isModerator($this->my->id, $this->catid) || $this->me->posts >= $this->config->captcha_post_limit)) {
$this->message_quickreply = CKunenaLink::GetTopicPostReplyLink('reply', $this->catid, $this->id, CKunenaTools::showButton('reply', JText::_('COM_KUNENA_BUTTON_QUICKREPLY')), 'nofollow', 'kicon-button kbuttoncomm btn-left kqreply', JText::_('COM_KUNENA_BUTTON_QUICKREPLY_LONG'), ' id="kreply' . $this->id . '"');
}
$this->message_reply = CKunenaLink::GetTopicPostReplyLink('reply', $this->catid, $this->id, CKunenaTools::showButton('reply', JText::_('COM_KUNENA_BUTTON_REPLY')), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_REPLY_LONG'));
$this->message_quote = CKunenaLink::GetTopicPostReplyLink('quote', $this->catid, $this->id, CKunenaTools::showButton('quote', JText::_('COM_KUNENA_BUTTON_QUOTE')), 'nofollow', 'kicon-button kbuttoncomm btn-left', JText::_('COM_KUNENA_BUTTON_QUOTE_LONG'));
} else {
//user is not allowed to write a post
if ($this->topicLocked) {
$this->message_closed = JText::_('COM_KUNENA_POST_LOCK_SET');
} else {
$this->message_closed = JText::_('COM_KUNENA_VIEW_DISABLED');
}
}
$this->msgclass = 'kmsg';
//Offer an moderator a few tools
if (CKunenaTools::isModerator($this->my->id, $this->catid)) {
unset($this->message_closed);
$this->message_edit = CKunenaLink::GetTopicPostReplyLink('edit', $this->catid, $this->id, CKunenaTools::showButton('edit', JText::_('COM_KUNENA_BUTTON_EDIT')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_EDIT_LONG'));
$this->message_moderate = CKunenaLink::GetTopicPostReplyLink('moderate', $this->catid, $this->id, CKunenaTools::showButton('moderate', JText::_('COM_KUNENA_BUTTON_MODERATE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_MODERATE_LONG'));
if ($message->hold == 1) {
$this->message_publish = CKunenaLink::GetTopicPostLink('approve', $this->catid, $this->id, CKunenaTools::showButton('approve', JText::_('COM_KUNENA_BUTTON_APPROVE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_APPROVE_LONG'));
$this->msgclass .= ' kunapproved';
}
if ($message->hold == 2 || $message->hold == 3) {
$this->msgclass .= ' kunapproved kdeleted';
$this->message_undelete = CKunenaLink::GetTopicPostLink('undelete', $this->catid, $this->id, CKunenaTools::showButton('undelete', JText::_('COM_KUNENA_BUTTON_UNDELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_UNDELETE_LONG'));
$this->message_permdelete = CKunenaLink::GetTopicPostLink('permdelete', $this->catid, $this->id, CKunenaTools::showButton('permdelete', JText::_('COM_KUNENA_BUTTON_PERMDELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_PERMDELETE_LONG'));
} else {
$this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG'));
}
} else {
if ($this->config->useredit && $this->my->id && $this->my->id == $this->profile->userid) {
//Now, if the viewer==author and the viewer is allowed to edit his/her own post then offer an 'edit' link
if ($message->hold != 2 && CKunenaTools::editTimeCheck($message->modified_time, $message->time)) {
$this->message_edit = CKunenaLink::GetTopicPostReplyLink('edit', $this->catid, $this->id, CKunenaTools::showButton('edit', JText::_('COM_KUNENA_BUTTON_EDIT')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_EDIT_LONG'));
if ($this->config->userdeletetmessage == '1') {
if ($this->replynum == $this->replycnt) {
$this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG'));
}
} else {
if ($this->config->userdeletetmessage == '2') {
$this->message_delete = CKunenaLink::GetTopicPostLink('delete', $this->catid, $this->id, CKunenaTools::showButton('delete', JText::_('COM_KUNENA_BUTTON_DELETE')), 'nofollow', 'kicon-button kbuttonmod btn-left', JText::_('COM_KUNENA_BUTTON_DELETE_LONG'));
}
}
}
}
}
$this->class = 'class="' . $this->msgclass . '"';
if (!$mode) {
$templatefile = '/view/message.php';
} else {
$templatefile = "/view/message.{$mode}.php";
}
CKunenaTools::loadTemplate($templatefile, false, $this->templatepath);
}