本文整理汇总了PHP中DiscussHelper::setMessageQueue方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::setMessageQueue方法的具体用法?PHP DiscussHelper::setMessageQueue怎么用?PHP DiscussHelper::setMessageQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::setMessageQueue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: history
/**
* Displays the user's points achievement history
*
* @since 2.0
* @access public
*/
public function history($tmpl = null)
{
$app = JFactory::getApplication();
$id = JRequest::getInt('id');
if (!$id) {
DiscussHelper::setMessageQueue(JText::_('Unable to locate the id of the user.'), DISCUSS_QUEUE_ERROR);
$app->redirect('index.php?option=com_easydiscuss');
$app->close();
}
$model = DiscussHelper::getModel('Points', true);
$history = $model->getPointsHistory($id);
foreach ($history as $item) {
$date = DiscussDateHelper::dateWithOffSet($item->created);
$item->created = $date->toFormat('%A, %b %e %Y');
$points = DiscussHelper::getHelper('Points')->getPoints($item->command);
if ($points) {
if ($points[0]->rule_limit < 0) {
$item->class = 'badge-important';
$item->points = $points[0]->rule_limit;
} else {
$item->class = 'badge-info';
$item->points = '+' . $points[0]->rule_limit;
}
} else {
$item->class = 'badge-info';
$item->points = '+';
}
}
$theme = new DiscussThemes();
$theme->set('history', $history);
echo $theme->fetch('points.history.php');
}
示例2: save
public function save()
{
JRequest::checkToken('request') or jexit('Invalid Token');
$mainframe = JFactory::getApplication();
$post = JRequest::get('post');
$ids = isset($post['id']) ? $post['id'] : '';
$starts = isset($post['start']) ? $post['start'] : '';
$ends = isset($post['end']) ? $post['end'] : '';
$titles = isset($post['title']) ? $post['title'] : '';
$removal = isset($post['itemRemove']) ? $post['itemRemove'] : '';
$model = DiscussHelper::getModel('Ranks', true);
if (!empty($removal)) {
$rids = explode(',', $removal);
$model->removeRanks($rids);
}
if (!empty($ids)) {
if (count($ids) > 0) {
for ($i = 0; $i < count($ids); $i++) {
$data = array();
$data['id'] = $ids[$i];
$data['start'] = $starts[$i];
$data['end'] = $ends[$i];
$data['title'] = $titles[$i];
$ranks = DiscussHelper::getTable('Ranks');
$ranks->bind($data);
$ranks->store();
}
}
//end if
}
//end if
$message = JText::_('COM_EASYDISCUSS_RANKING_SUCCESSFULLY_UPDATED');
DiscussHelper::setMessageQueue($message, DISCUSS_QUEUE_SUCCESS);
$mainframe->redirect('index.php?option=com_easydiscuss&view=ranks');
}
示例3: remove
function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$mails = JRequest::getVar('cid', '', 'POST');
$message = '';
$type = 'success';
if (empty($mails)) {
$message = JText::_('COM_EASYDISCUSS_NO_MAIL_ID_PROVIDED');
$type = 'error';
} else {
$table = DiscussHelper::getTable('MailQueue');
foreach ($mails as $id) {
$table->load($id);
if (!$table->delete()) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SPOOLS_DELETE_ERROR'), DISCUSS_QUEUE_ERROR);
$this->setRedirect('index.php?option=com_easydiscuss&view=spools');
return;
}
}
$message = JText::_('COM_EASYDISCUSS_SPOOLS_EMAILS_DELETED');
}
DiscussHelper::setMessageQueue($message, $type);
$this->setRedirect('index.php?option=com_easydiscuss&view=spools');
}
示例4: convert
/**
* Converts a comment into a discussion reply
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function convert()
{
JRequest::checkToken('request') or jexit('Invalid Token');
// Get the Joomla app
$app = JFactory::getApplication();
// Get the comment id from the request.
$id = JRequest::getInt('id');
// Load the comment
$comment = DiscussHelper::getTable('Comment');
$comment->load($id);
if (!$id || !$comment->id) {
// Throw error here.
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_COMMENT_ID_PROVIDED'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
$app->close();
}
// Get the post id from the request.
$postId = JRequest::getInt('postId');
$post = DiscussHelper::getTable('Post');
$post->load($postId);
if (!$postId || !$post->id) {
// Throw error here.
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_INVALID_POST_ID_PROVIDED'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
$app->close();
}
if (!$comment->canConvert()) {
// Throw error here.
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_NOT_ALLOWED_TO_CONVERT'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
$app->close();
}
// Create a new reply.
$reply = DiscussHelper::getTable('Post');
$reply->title = $post->title;
$reply->content = $comment->comment;
$reply->published = 1;
$reply->created = $comment->created;
$reply->parent_id = $post->id;
$reply->user_id = $comment->user_id;
$reply->user_type = 'member';
$reply->category_id = $post->category_id;
$state = $reply->store();
if (!$state) {
// Throw error here.
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_ERROR_SAVING_REPLY'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
$app->close();
}
// Once the reply is stored, delete the comment
$comment->delete();
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_COMMENTS_SUCCESS_CONVERTED_COMMENT_TO_REPLY'), DISCUSS_QUEUE_SUCCESS);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false));
$app->close();
}
示例5: markreadall
/**
* Allows user to mark all their notification items as read
**/
public function markreadall()
{
$my = JFactory::getUser();
if (!$my->id) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error');
JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
}
$db = DiscussHelper::getDBO();
$query = 'UPDATE ' . $db->nameQuote('#__discuss_notifications') . ' ' . 'SET ' . $db->nameQuote('state') . '=' . $db->Quote(0) . ' ' . 'WHERE ' . $db->nameQuote('target') . '=' . $db->Quote($my->id);
$db->setQuery($query);
$db->Query();
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_ALL_NOTIFICATIONS_MARKED_AS_READ'));
JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=notifications', false));
}
示例6: display
public function display($tpl = null)
{
$my = JFactory::getUser();
if (!$my->id) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_PLEASE_LOGIN_FIRST'), 'error');
JFactory::getApplication()->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
}
$model = $this->getModel('Notification');
$this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMBS_NOTIFICATIONS'));
// Make this configurable?
$limit = 100;
$notifications = $model->getNotifications($my->id, false, $limit);
DiscussHelper::getHelper('Notifications')->format($notifications, true);
$theme = new DiscussThemes();
$theme->set('notifications', $notifications);
echo $theme->fetch('notifications.php');
}
示例7: removeAccess
function removeAccess()
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$return = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile', false);
if ($user->id == 0) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_USER_NOT_FOUND'), 'error');
$this->setRedirect($return);
}
$twitter = DiscussHelper::getTable('Twitter');
if (!$twitter->load($user->id)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_OAUTH_DOESNT_EXIST'), 'error');
$this->setRedirect($return);
}
$twitter->delete();
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_TWITTER_REQUIRE_AUTHENTICATION'));
$this->setRedirect($return);
}
示例8: clearCache
public function clearCache()
{
$paths = array(DISCUSS_ADMIN_THEMES, DISCUSS_SITE_THEMES, DISCUSS_JOOMLA_MODULES);
$count = 0;
foreach ($paths as $path) {
$cachedFiles = JFolder::files($path, 'style.less.cache', true, true);
foreach ($cachedFiles as $file) {
$count++;
JFile::delete($file);
}
}
// Also purge the /resources and /config files
require_once DISCUSS_CLASSES . '/compiler.php';
$compiler = new DiscussCompiler();
$compiler->purgeResources();
$message = JText::sprintf('COM_EASYDISCUSS_CACHE_DELETED', $count);
DiscussHelper::setMessageQueue($message, DISCUSS_QUEUE_SUCCESS);
$this->setRedirect('index.php?option=com_easydiscuss');
}
示例9: remove
function remove()
{
$subs = JRequest::getVar('cid', '', 'POST');
$message = '';
$type = 'success';
if (count($subs) <= 0) {
$message = JText::_('COM_EASYDISCUSS_INVALID_POST_ID');
$type = 'error';
} else {
$table = JTable::getInstance('Subscribe', 'Discuss');
foreach ($subs as $sub) {
$table->load($sub);
if (!$table->delete()) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REMOVING_SUBSCRIPTION_PLEASE_TRY_AGAIN_LATER'), DISCUSS_QUEUE_ERROR);
$this->setRedirect('index.php?option=com_easydiscuss&view=subscription');
return;
}
}
$message = JText::_('COM_EASYDISCUSS_SUBSCRIPTION_DELETED');
}
DiscussHelper::setMessageQueue($message, $type);
$this->setRedirect('index.php?option=com_easydiscuss&view=subscription');
}
示例10: submit
public function submit()
{
$config = DiscussHelper::getConfig();
$my = JFactory::getUser();
$id = JRequest::getInt('id');
$app = JFactory::getApplication();
$post = DiscussHelper::getTable('Post');
$state = $post->load($id);
$acl = DiscussHelper::getHelper('ACL');
if (!$post->id || !$state) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_POST_ID'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
$app->close();
}
// Get the URL to the discussion.
$url = DiscussRouter::getPostRoute($post->id, false);
if ($post->isReply()) {
$url = DiscussRouter::getPostRoute($post->parent_id, false);
}
if (!$acl->allowed('send_report')) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_YOU_DO_NOT_HAVE_PERMISION_TO_SUBMIT_REPORT'), DISCUSS_QUEUE_ERROR);
$app->redirect($url);
$app->close();
}
if (!$config->get('main_report')) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_HAS_BEEN_DISABLED_BY_ADMINISTRATOR'), DISCUSS_QUEUE_ERROR);
$app->redirect($url);
$app->close();
}
$message = JRequest::getString('reporttext', '');
if (empty($message)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_EMPTY_TEXT'), DISCUSS_QUEUE_ERROR);
$app->redirect($url);
$app->close();
}
$date = DiscussHelper::getDate();
$report = DiscussHelper::getTable('Report');
$report->created_by = $my->id;
$report->post_id = $post->id;
$report->reason = $message;
$report->created = $date->toMySQL();
if (!$report->store()) {
DiscussHelper::setMessageQueue($report->getError(), DISCUSS_QUEUE_ERROR);
$app->redirect($url);
$app->close();
}
// Mark post as reported.
$report->markPostReport();
$threshold = $config->get('main_reportthreshold', 15);
$totalReports = $report->getReportCount();
$redirectMessage = JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED');
// Check if the number of reports for this post exceeded the threshold.
if ($totalReports > $reportThreshold) {
$owner = $post->getOwner();
$date = DiscussHelper::getDate($post->created);
$emailData = array();
$emailData['postContent'] = $post->content;
$emailData['postAuthor'] = $owner->name;
$emailData['postAuthorAvatar'] = $owner->avatar;
$emailData['postDate'] = $date->toFormat();
$emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false, true);
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_REPORT_REQUIRED_YOUR_ATTENTION', JString::substr($postTbl->content, 0, 15)) . '...';
$emailData['emailTemplate'] = 'email.post.attention.php';
if ($post->isReply()) {
$emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->parent_id, false, true);
}
DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array(), $config->get('notify_admin'), $config->get('notify_moderator'));
$redirectMessage = JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED_BUT_POST_MARKED_AS_REPORT');
}
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_REPORT_SUBMITTED'), DISCUSS_QUEUE_SUCCESS);
$app->redirect($url);
}
示例11: unread
/**
* Marks a message as unread
*
* @since 3.0
* @access public
*/
public function unread()
{
JRequest::checkToken('request', 'get') or jexit('Invalid Token');
$id = JRequest::getInt('id');
$app = JFactory::getApplication();
// Test for valid recipients.
if (!$id) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_MESSAGING_INVALID_ID'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation', false));
$app->close();
}
// Only registered users are allowed to use conversation.
$my = JFactory::getUser();
if (!$my->id) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NOT_ALLOWED'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation', false));
$app->close();
}
// Retrieve model.
$model = DiscussHelper::getModel('Conversation');
// Test if user has access
if (!$model->hasAccess($id, $my->id)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NOT_ALLOWED'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation', false));
$app->close();
}
// Mark the conversation as unread.
$model->markAsUnread($id, $my->id);
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CONVERSATION_MARKED_AS_UNREAD'), DISCUSS_QUEUE_SUCCESS);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation', false));
$app->close();
}
示例12: saveOrder
public function saveOrder()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$app = JFactory::getApplication();
$row = DiscussHelper::getTable('Role');
$row->rebuildOrdering();
$message = JText::_('COM_EASYDISCUSS_ROLES_ORDERING_SAVED');
$type = 'message';
DiscussHelper::setMessageQueue($message, $type);
$app->redirect('index.php?option=com_easydiscuss&view=roles');
exit;
}
示例13: compose
/**
* Responsible to display the conversation form.
*
* @since 3.0
* @access public
*/
public function compose()
{
// Get recipient id from request.
$id = JRequest::getInt('id');
$app = JFactory::getApplication();
$my = JFactory::getUser();
// Do not allow non logged in users to view anything in conversation.
if (!$my->id) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NOT_ALLOWED'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false));
$app->close();
}
if (!$id) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CONVERSATION_INVALID'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false));
$app->close();
}
$recipient = DiscussHelper::getTable('Profile');
$recipient->load($id);
// Initialize conversation table.
$conversation = DiscussHelper::getTable('Conversation');
// Check if this conversation already exist in the system.
$state = $conversation->loadByRelation($my->id, $recipient->id);
// If conversation already exists between both parties, just redirect to the reply in an existing conversation.
if ($state) {
$app->redirect(DiscussRouter::getMessageRoute($conversation->id, false) . '#reply');
$app->close();
}
$theme = new DiscussThemes();
$theme->set('recipient', $recipient);
echo $theme->fetch('conversation.compose.php');
}
示例14: unpublish
function unpublish()
{
$tags = JRequest::getVar('cid', array(0), 'POST');
$message = '';
$type = 'success';
if (count($tags) <= 0) {
$message = JText::_('COM_EASYDISCUSS_INVALID_TAG_ID');
$type = 'error';
} else {
$model = $this->getModel('Tags');
if ($model->publish($tags, 0)) {
$message = JText::_('COM_EASYDISCUSS_TAG_UNPUBLISHED');
} else {
$message = JText::_('COM_EASYDISCUSS_TAG_UNPUBLISH_ERROR');
$type = 'error';
}
}
DiscussHelper::setMessageQueue($message, $type);
$this->setRedirect('index.php?option=com_easydiscuss&view=tags');
}
示例15: remove
public function remove()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
$cid = JRequest::getVar('cid', array(), '', 'array');
JArrayHelper::toInteger($cid);
if (count($cid) < 1) {
JError::raiseError(500, JText::_('COM_EASYDISCUSS_SELECT_USER_TO_DELETE', true));
}
$result = null;
foreach ($cid as $id) {
$result = null;
if (DiscussHelper::getJoomlaVersion() >= '1.6') {
$result = $this->_removeUser16($id);
} else {
$result = $this->_removeUser($id);
}
if (!$result['success']) {
DiscussHelper::setMessageQueue($result['msg'], DISCUSS_QUEUE_ERROR);
$this->setRedirect('index.php?option=com_easydiscuss&view=users', $result['msg']);
}
}
DiscussHelper::setMessageQueue($result['msg'], DISCUSS_QUEUE_SUCCESS);
$this->setRedirect('index.php?option=com_easydiscuss&view=users', $result['msg']);
}