本文整理汇总了PHP中DiscussHelper::isMine方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::isMine方法的具体用法?PHP DiscussHelper::isMine怎么用?PHP DiscussHelper::isMine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::isMine方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$permalink = '';
if ($post->itemtype == 'posts') {
$permalink = DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id);
} else {
if ($post->itemtype == 'replies') {
$permalink = DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->parent_id);
$permalink = $permalink . '#' . JText::_('COM_EASYDISCUSS_REPLY_PERMALINK') . '-' . $post->id;
} else {
if ($post->itemtype == 'category') {
$permalink = DiscussRouter::_('index.php?option=com_easydiscuss&view=categories&layout=listings&category_id=' . $post->id);
}
}
}
?>
<li class="<?php
echo DiscussHelper::isMine($post->user->id) ? 'mypost' : '';
?>
">
<div class="discuss-item<?php
echo $post->islock ? ' is-locked' : '';
echo $post->isresolve ? ' is-resolved' : '';
echo $post->isFeatured ? ' is-featured' : '';
?>
">
<div class="row-table">
<div class="col-cell feed-head">
<?php
if ($system->config->get('layout_avatar') && $system->config->get('layout_avatar_in_post')) {
?>
<div class="discuss-avatar">
示例2: edit
public function edit($tpl = null)
{
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$my = JFactory::getUser();
$acl = DiscussHelper::getHelper('ACL');
$config = DiscussHelper::getConfig();
// Load post item
$id = JRequest::getInt('id', 0);
if (empty($id)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_POST_ID'));
return;
}
$post = DiscussHelper::getTable('Post');
$post->load($id);
$post->content_raw = $post->content;
$editing = (bool) $post->id;
if (!$editing) {
// try to get from session if there are any.
$this->getSessionData($post);
}
$categoryId = JRequest::getInt('category', $post->category_id);
// Load category item.
$category = DiscussHelper::getTable('Category');
$category->load($categoryId);
// Check if user is allowed to post a discussion, we also need to check against the category acl
if (empty($my->id) && !$acl->allowed('add_question', 0)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_KINDLY_LOGIN_TO_CREATE_A_POST'));
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false));
$app->close();
return;
}
if ($my->id != 0 && !$acl->allowed('add_question', '0') && !$category->canPost()) {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false), JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'));
$app->close();
return;
}
// Set the breadcrumbs.
$this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_ASK'));
// Set the page title.
$title = JText::_('COM_EASYDISCUSS_TITLE_ASK');
if ($id && $post->id) {
$title = JText::sprintf('COM_EASYDISCUSS_TITLE_EDIT_QUESTION', $post->getTitle());
}
// Set the page title
DiscussHelper::setPageTitle($title);
if ($editing) {
$isModerator = DiscussHelper::getHelper('Moderator')->isModerator($post->category_id);
if (!DiscussHelper::isMine($post->user_id) && !DiscussHelper::isSiteAdmin() && !$acl->allowed('edit_question') && !$isModerator) {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $postid, false), JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'));
$app->close();
}
$tagsModel = DiscussHelper::getModel('PostsTags');
$post->tags = $tagsModel->getPostTags($post->id);
} else {
if ($categoryId) {
// set the default category
$post->category_id = $categoryId;
}
}
$attachments = $post->getAttachments();
if (isset($post->sessiondata)) {
$attachments = '';
}
$model = DiscussHelper::getModel('Posts');
$postCount = count($model->getPostsBy('user', $my->id));
$onlyPublished = empty($post->id) ? true : false;
// @rule: If there is a category id passed through the query, respect it first.
$showPrivateCat = empty($post->id) && $my->id == 0 ? false : true;
// [model:category]
$categoryModel = $this->getModel('Category');
$defaultCategory = $categoryModel->getDefaultCategory();
if ($categoryId == 0 && $defaultCategory !== false) {
$categoryId = $defaultCategory->id;
}
$nestedCategories = '';
$categories = '';
if ($config->get('layout_category_selection') == 'multitier') {
$categoriesModel = $this->getModel('Categories');
$categories = $categoriesModel->getCategories(array('acl_type' => DISCUSS_CATEGORY_ACL_ACTION_SELECT));
} else {
$nestedCategories = DiscussHelper::populateCategories('', '', 'select', 'category_id', $categoryId, true, $onlyPublished, $showPrivateCat, true);
}
if ($config->get('layout_reply_editor') == 'bbcode') {
// Legacy fix when switching from WYSIWYG editor to bbcode.
$post->content = EasyDiscussParser::html2bbcode($post->content);
}
$editor = '';
if ($config->get('layout_editor') != 'bbcode') {
$editor = JFactory::getEditor($config->get('layout_editor'));
}
// Get list of moderators from the site.
$moderatorList = array();
if ($config->get('main_assign_user')) {
$moderatorList = DiscussHelper::getHelper('Moderator')->getSelectOptions($post->category_id);
}
$composer = new DiscussComposer("editing", $post);
// Set the discussion object.
$access = $post->getAccess($category);
$theme = new DiscussThemes();
//.........这里部分代码省略.........
示例3: ajaxReadmoreReplies
function ajaxReadmoreReplies($limitstart = null, $sorting = null, $type = 'questions', $parentId = null, $filter = null, $category = null)
{
$ajax = new Disjax();
$model = $this->getModel('Posts');
$limitstart = (int) $limitstart;
$mainframe = JFactory::getApplication();
$config = DiscussHelper::getConfig();
$posts = $model->getReplies($parentId, $sorting, $limitstart);
$pagination = $model->getPagination($parentId, $sorting);
$my = JFactory::getUser();
$posts = DiscussHelper::formatPost($posts);
$parent = DiscussHelper::getTable('Post');
$parent->load($parentId);
//check all the 'can' or 'canot' here.
$acl = DiscussHelper::getHelper('ACL');
$isMainLocked = $parent->islock ? true : false;
$canDelete = false;
$canTag = false;
$canReply = $acl->allowed('add_reply', '0');
if ($config->get('main_allowdelete', 2) == 2) {
$canDelete = $isSiteAdmin ? true : false;
} else {
if ($config->get('main_allowdelete', 2) == 1) {
$canDelete = $acl->allowed('delete_reply', '0');
}
}
$category = DiscussHelper::getTable('Category');
$category->load($category);
$posts = DiscussHelper::formatReplies($posts, $category);
$template = new DiscussThemes();
$template->set('replies', $posts);
$template->set('config', $config);
$template->set('canReply', $canReply);
$template->set('canDelete', $canDelete);
$template->set('isMainLocked', $isMainLocked);
//$template->set( 'isMine' , false );
//$template->set( 'isAdmin' , false );
$template->set('isMine', DiscussHelper::isMine($parent->user_id));
$template->set('isAdmin', DiscussHelper::isSiteAdmin());
$html = $template->fetch('reply.item.php');
$nextLimit = $limitstart + DiscussHelper::getListLimit();
if ($nextLimit >= $pagination->total) {
$ajax->remove('dc_pagination a');
}
$ajax->value('pagination-start', $nextLimit);
$ajax->script('EasyDiscuss.$("#dc_response").children().children( ":last").addClass( "separator" );');
$ajax->append('dc_response tbody', $html);
$ajax->send();
}
示例4: ajaxNoStatusPost
public function ajaxNoStatusPost($id = null)
{
$ajax = new Disjax();
$config = DiscussHelper::getConfig();
if (!$id) {
$ajax->assign('dc_main_notifications', JText::_('COM_EASYDISCUSS_SYSTEM_INVALID_ID'));
$ajax->script('EasyDiscuss.$( "#dc_main_notifications" ).addClass( "alert alert-error" );');
$ajax->send();
return;
}
$post = DiscussHelper::getTable('Post');
$post->load($id);
$isMine = DiscussHelper::isMine($post->user_id);
$isAdmin = DiscussHelper::isSiteAdmin();
$acl = DiscussHelper::getHelper('ACL');
$isModerator = DiscussHelper::getHelper('Moderator')->isModerator($post->category_id);
if (!$isMine && !$isAdmin && !$acl->allowed('mark_no_status', '0')) {
if (!$isModerator) {
$ajax->assign('dc_main_notifications', JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'));
$ajax->script('EasyDiscuss.$( "#dc_main_notifications" ).addClass( "alert alert-error" );');
$ajax->send();
return;
}
}
// Turn on the on-hold status,
// DISCUSS_POST_STATUS_OFF = 0
$post->post_status = DISCUSS_POST_STATUS_OFF;
if (!$post->store()) {
$ajax->assign('dc_main_notifications', $post->getError());
$ajax->script('EasyDiscuss.$( "#dc_main_notifications" ).addClass( "alert alert-error" );');
$ajax->send();
return;
}
// @rule: Add notifications for the thread starter
$my = JFactory::getUser();
if ($post->get('user_id') != $my->id) {
$notification = DiscussHelper::getTable('Notifications');
$notification->bind(array('title' => JText::sprintf('COM_EASYDISCUSS_NO_STATUS_DISCUSSION_NOTIFICATION_TITLE', $post->title), 'cid' => $post->get('id'), 'type' => 'unhold', 'target' => $post->get('user_id'), 'author' => $my->id, 'permalink' => 'index.php?option=com_easydiscuss&view=post&id=' . $post->get('id')));
$notification->store();
}
// Remove other status
$ajax->script('EasyDiscuss.$( ".discuss-item" ).removeClass( "is-resolved" );');
$ajax->script('EasyDiscuss.$( ".postStatus" ).removeClass( "label-post_status" );');
$ajax->script('EasyDiscuss.$( ".postStatus" ).removeClass( "label-post_status-on-hold" );');
$ajax->script('EasyDiscuss.$( ".postStatus" ).removeClass( "label-post_status-accept" );');
$ajax->script('EasyDiscuss.$( ".postStatus" ).removeClass( "label-post_status-working-on" );');
$ajax->script('EasyDiscuss.$( ".postStatus" ).removeClass( "label-post_status-reject" );');
$ajax->assign('dc_main_notifications', JText::_('COM_EASYDISCUSS_POST_NO_STATUS'));
$ajax->script('EasyDiscuss.$( "#dc_main_notifications" ).addClass( "alert alert-success" );');
$ajax->script('EasyDiscuss.$( ".postStatus" ).html("");');
$ajax->send();
return;
}
示例5: submit
/**
* Handles POST request for new discussions
*
* @since 3.0
* @access public
*/
public function submit()
{
JRequest::checkToken('request') or jexit('Invalid Token');
$config = DiscussHelper::getConfig();
$my = JFactory::getUser();
$app = JFactory::getApplication();
$acl = DiscussHelper::getHelper('ACL');
// If guest posting is disallowed in the settings, they shouldn't be able to create a discussion at all.
if (!$my->id && !$acl->allowed('add_question', '0')) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_POST_PLEASE_LOGIN'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
return $app->close();
}
// If user is disallowed in the acl, they shouldn't be able to create a discussion at all.
if ($my->id && !$acl->allowed('add_question', '0')) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
return $app->close();
}
// Get values from the posted form.
$data = JRequest::get('post');
if (isset($data['mod_post_topic_category_id'])) {
$data['category_id'] = $data['mod_post_topic_category_id'];
unset($data['mod_post_topic_category_id']);
}
// Run validation on the posted data.
if (!$this->_fieldValidate($data)) {
$files = JRequest::getVar('filedata', array(), 'FILES');
$data['attachments'] = $files;
DiscussHelper::storeSession($data, 'NEW_POST_TOKEN');
$app->redirect(DiscussRouter::getAskRoute(null, false));
}
// get id if available
$id = JRequest::getInt('id', 0);
// bind the table
$post = DiscussHelper::getTable('Post');
$post->load($id);
// set is new value
$isNew = !$post->id ? true : false;
// If the post is edited and it doesn't have private the user might be switching from private -> non private
if (!$isNew && !isset($data['private'])) {
$post->private = false;
}
// Perform captcha validation
$state = EDC::validateCaptcha($data);
if (!$state) {
// Store the data into the session
EDC::storeSession($data, 'NEW_POST_TOKEN');
// Set error message
EDC::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_CAPTCHA'), DISCUSS_QUEUE_ERROR);
if ($isNew) {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=ask', false));
} else {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=ask&id=' . $post->id, false));
}
}
$previousTags = array();
if (!$isNew) {
//check if admin or is owner before allowing edit.
$isMine = DiscussHelper::isMine($post->user_id);
$isAdmin = DiscussHelper::isSiteAdmin();
$isEditor = $acl->allowed('edit_question');
if (!$my->id && !$isMine && !$isAdmin && !$isEditor) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NO_PERMISSION_TO_PERFORM_THE_REQUESTED_ACTION'), DISCUSS_QUEUE_ERROR);
$this->setRedirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $id, false));
return;
}
// If this is an edited post, we need to remove existing tags and add them back again.
$postsTagsModel = $this->getModel('PostsTags');
$tmppreviousTags = $postsTagsModel->getPostTags($id);
if (!empty($tmppreviousTags)) {
foreach ($tmppreviousTags as $previoustag) {
$previousTags[] = $previoustag->id;
}
}
if ($acl->allowed('add_tag', '0')) {
$postsTagsModel->deletePostTag($id);
}
}
// Get raw content from request as we may need to respect the html codes.
$content = JRequest::getVar('dc_reply_content', '', 'post', 'none', JREQUEST_ALLOWRAW);
if (empty($content)) {
// if there is no content from component, get from module quick question
$content = JRequest::getVar('quick_question_reply_content', '', 'post', 'none', JREQUEST_ALLOWRAW);
}
// some joomla editor htmlentity the content before it send to server. so we need
// to do the god job to fix the content.
$content = DiscussHelper::getHelper('String ')->unhtmlentities($content);
// Ensure that the posted content is respecting the correct values.
$data['dc_reply_content'] = $content;
// Cleanup alias.
$alias = DiscussHelper::wordFilter($data['title']);
$data['alias'] = DiscussHelper::getAlias($alias, 'post', $post->id);
// Detect the poster type.
//.........这里部分代码省略.........
示例6:
echo $post->id;
?>
', 'reply' , '' );" class="btn btn-mini">
<?php
}
?>
<i class="icon-remove"></i> <?php
echo JText::_('COM_EASYDISCUSS_ENTRY_DELETE');
?>
</a>
<?php
}
?>
<?php
if ($access->canResolve() && $post->isQuestion() && !DiscussHelper::isSiteAdmin($my->id) && !DiscussHelper::isModerator($post->category_id, $my->id) && DiscussHelper::isMine($my->id)) {
?>
<a class="admin-unresolve btn btn-mini" href="javascript:void(0);" onclick="discuss.post.unresolve('<?php
echo $post->id;
?>
');">
<i class="icon-remove-sign"></i> <?php
echo JText::_('COM_EASYDISCUSS_ENTRY_MARK_UNRESOLVED');
?>
</a>
<a class="admin-resolve btn btn-mini" href="javascript:void(0);" onclick="discuss.post.resolve('<?php
echo $post->id;
?>
');">
<i class="icon-ok-sign"></i> <?php
示例7: canUnmarkAnswered
public function canUnmarkAnswered()
{
if (!$this->config->get('main_qna')) {
return false;
}
if (!$this->post->answered) {
return false;
}
if ($this->isSiteAdmin || $this->isModerator) {
return true;
}
if (!is_null($this->parent)) {
//check if the parent post is belong to current user or not.
if (DiscussHelper::isMine($this->parent->user_id)) {
return true;
}
}
if ($this->acl->allowed('mark_answered')) {
return true;
}
return false;
}