本文整理汇总了PHP中EasyBlogHelper::setMessageQueue方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::setMessageQueue方法的具体用法?PHP EasyBlogHelper::setMessageQueue怎么用?PHP EasyBlogHelper::setMessageQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::setMessageQueue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
//.........这里部分代码省略.........
$this->intro = $inputFilter->clean($this->intro);
$this->content = $inputFilter->clean($this->content);
}
// @rule: Process badword filters for content here.
$blockedWord = EasyBlogHelper::getHelper('String')->hasBlockedWords($this->intro . $this->content);
if ($blockedWord !== false) {
$this->setError(JText::sprintf('COM_EASYBLOG_BLOG_POST_CONTAIN_BLOCKED_WORDS', $blockedWord));
return false;
}
// @rule: Test for the empty-ness
if (empty($this->intro) && empty($this->content)) {
$this->setError(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_CONTENT_ERROR'));
}
// alway set this to false no matter what! TODO: remove this column.
$this->ispending = '0';
$state = parent::store();
$source = JRequest::getVar('blog_contribute_source', 'easyblog');
// @trigger: onBeforeSave
$this->triggerAfterSave();
// if this is blog edit, then we should see the column isnew to determine
// whether the post is really new or not.
if (!$isNew) {
$isNew = $this->isnew;
}
// @task: If auto featured is enabled, we need to feature the blog post automatically since the blogger is featured.
if ($config->get('main_autofeatured', 0) && EasyBlogHelper::isFeatured('blogger', $this->created_by) && !EasyBlogHelper::isFeatured('post', $this->id)) {
EasyBlogHelper::makeFeatured('post', $this->id);
}
// @task: This is when the blog is either created or updated.
if ($source == 'easyblog' && $state && $this->published == POST_ID_PUBLISHED && $log) {
// @rule: Add new stream item in jomsocial
EasyBlogHelper::addJomSocialActivityBlog($this, $isNew);
// @rule: Log new stream item into EasyBlog
$activity = new stdClass();
$activity->actor_id = $this->created_by;
$activity->target_id = '0';
$activity->context_type = 'post';
$activity->context_id = $this->id;
$activity->verb = $isNew ? 'add' : 'update';
$activity->uuid = $this->title;
EasyBlogHelper::activityLog($activity);
}
if ($source == 'easyblog' && $state && $this->published == POST_ID_PUBLISHED && $isNew && $log) {
// @rule: Send email notifications out to subscribers.
$author = EasyBlogHelper::getTable('Profile');
$author->load($this->created_by);
// @rule: Ping pingomatic
if ($config->get('main_pingomatic')) {
if (!EasyBlogHelper::getHelper('Pingomatic')->ping($this->title, EasyBlogHelper::getExternalLink('index.php?option=com_easyblog&view=entry&id=' . $this->id, true))) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_PINGOMATIC_ERROR'), 'error');
}
}
// Assign EasySocial points
$easysocial = EasyBlogHelper::getHelper('EasySocial');
$easysocial->assignPoints('blog.create', $this->created_by);
// @rule: Add userpoints for jomsocial
if ($config->get('main_jomsocial_userpoint')) {
$path = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'userpoints.php';
if (JFile::exists($path)) {
require_once $path;
CUserPoints::assignPoint('com_easyblog.blog.add', $this->created_by);
}
}
$link = $this->getExternalBlogLink('index.php?option=com_easyblog&view=entry&id=' . $this->id);
// @rule: Add notifications for jomsocial 2.6
if ($config->get('integrations_jomsocial_notification_blog')) {
// Get list of users who subscribed to this blog.
$target = $this->getRegisteredSubscribers('new', array($this->created_by));
EasyBlogHelper::getHelper('JomSocial')->addNotification(JText::sprintf('COM_EASYBLOG_JOMSOCIAL_NOTIFICATIONS_NEW_BLOG', $author->getName(), $link, $this->title), 'easyblog_new_blog', $target, $this->created_by, $link);
}
// @rule: Mighty Touch karma points
EasyBlogHelper::getHelper('MightyTouch')->setKarma($this->created_by, 'new_blog');
// @rule: Integrations with EasyDiscuss
EasyBlogHelper::getHelper('EasyDiscuss')->log('easyblog.new.blog', $this->created_by, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_HISTORY_NEW_BLOG', $this->title));
EasyBlogHelper::getHelper('EasyDiscuss')->addPoint('easyblog.new.blog', $this->created_by);
EasyBlogHelper::getHelper('EasyDiscuss')->addBadge('easyblog.new.blog', $this->created_by);
// Assign badge for users that report blog post.
// Only give points if the viewer is viewing another person's blog post.
EasyBlogHelper::getHelper('EasySocial')->assignBadge('blog.create', JText::_('COM_EASYBLOG_EASYSOCIAL_BADGE_CREATE_BLOG_POST'));
if ($config->get('integrations_easydiscuss_notification_blog')) {
// Get list of users who subscribed to this blog.
$target = $this->getRegisteredSubscribers('new', array($this->created_by));
EasyBlogHelper::getHelper('EasyDiscuss')->addNotification($this, JText::sprintf('COM_EASYBLOG_EASYDISCUSS_NOTIFICATIONS_NEW_BLOG', $author->getName(), $this->title), EBLOG_NOTIFICATIONS_TYPE_BLOG, $target, $this->created_by, $link);
}
$my = JFactory::getUser();
// @rule: Add points for AlphaUserPoints
if ($my->id == $this->created_by && EasyBlogHelper::isAUPEnabled()) {
// get blog post URL
$url = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $this->id);
$aupid = AlphaUserPointsHelper::getAnyUserReferreID($this->created_by);
AlphaUserPointsHelper::newpoints('plgaup_easyblog_add_blog', $aupid, 'easyblog_add_blog_' . $this->id, JText::sprintf('COM_EASYBLOG_AUP_NEW_BLOG_CREATED', $url, $this->title));
}
// @rule: Process trackbacks
$this->processTrackbacks();
// Update the isnew column so that if user edits this entry again, it doesn't send any notifications the second time.
$this->isnew = 0;
$this->store(false);
}
return $state;
}
示例2: submitReport
/**
* Process report items.
*
* @access public
* @param null
**/
public function submitReport()
{
JRequest::checkToken() or die('Invalid Token');
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
if (!$my->id && !$config->get('main_reporting_guests')) {
echo JText::_('COM_EASYBLOG_CATEGORIES_FOR_REGISTERED_USERS_ONLY');
exit;
}
$objId = JRequest::getInt('obj_id');
$objType = JRequest::getCmd('obj_type');
$reason = JRequest::getString('reason');
// @task: Ensure that the reason is never empty.
if (empty($reason)) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_REPORT_PLEASE_SPECIFY_REASON'), 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false));
return;
}
$report = EasyBlogHelper::getTable('Report');
$report->set('obj_id', $objId);
$report->set('obj_type', $objType);
$report->set('reason', $reason);
$report->set('created', EasyBlogHelper::getDate()->toMySQL());
$report->set('created_by', $my->id);
$report->set('ip', @$_SERVER['REMOTE_ADDR']);
if (!$report->store()) {
$error = $report->getError();
EasyBlogHelper::setMessageQueue($error, 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false));
return;
}
// @TODO: Configurable report links
switch ($objType) {
case EBLOG_REPORTING_POST:
default:
$blog = EasyBlogHelper::getTable('Blog');
$blog->load($objId);
$report->notify($blog);
$message = JText::_('COM_EASYBLOG_THANKS_FOR_REPORTING');
$redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $objId, false);
break;
}
EasyBlogHelper::setMessageQueue($message);
$this->setRedirect($redirect);
}
示例3: display
function display($tmpl = null)
{
$mainframe = JFactory::getApplication();
$my = JFactory::getuser();
if (empty($my->id)) {
$return = JRequest::getVar('return', '');
EasyBlogHelper::showLogin($return);
return;
} else {
$showPermissionMsg = JRequest::getVar('showpermissionmsg', '');
if ($showPermissionMsg) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_YOU_DO_NOT_HAVE_PERMISSION_TO_VIEW'), 'error');
} else {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_YOU_ARE_ALREADY_LOGIN'), 'error');
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest'));
}
}
}
示例4: unsubscribe
function unsubscribe()
{
$my = JFactory::getUser();
$redirectLInk = 'index.php?option=com_easyblog&view=subscription';
if ($my->id == 0) {
$redirectLInk = 'index.php?option=com_easyblog&view=latest';
}
//type=site - subscription type
//sid=1 - subscription id
//uid=42 - user id
//token=0fd690b25dd9e4d2dc47a252d025dff4 - md5 subid.subdate
$data = base64_decode(JRequest::getVar('data', ''));
$param = EasyBlogHelper::getRegistry($data);
$param->type = $param->get('type', '');
$param->sid = $param->get('sid', '');
$param->uid = $param->get('uid', '');
$param->token = $param->get('token', '');
$subtable = EasyBlogHelper::getTable($param->type, 'Table');
$subtable->load($param->sid);
$token = md5($subtable->id . $subtable->created);
$paramToken = md5($param->sid . $subtable->created);
if ($subtable->id != 0) {
if ($token != $paramToken) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_SUBSCRIPTION_UNSUBSCRIBE_FAILED'), 'error');
$this->setRedirect(EasyBlogRouter::_($redirectLInk, false));
return false;
}
if (!$subtable->delete($param->sid)) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_SUBSCRIPTION_UNSUBSCRIBE_FAILED_ERROR_DELETING_RECORDS'), 'error');
$this->setRedirect(EasyBlogRouter::_($redirectLInk, false));
return false;
}
}
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_SUBSCRIPTION_UNSUBSCRIBE_SUCCESS'));
$this->setRedirect(EasyBlogRouter::_($redirectLInk, false));
return true;
}
示例5: uploadMediaAvatar
public static function uploadMediaAvatar($mediaType, $mediaTable, $isFromBackend = false)
{
jimport('joomla.utilities.error');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
$my = JFactory::getUser();
$mainframe = JFactory::getApplication();
$config = EasyBlogHelper::getConfig();
$acl = EasyBlogACLHelper::getRuleSet();
// required params
$layout_type = $mediaType == 'category' ? 'categories' : 'teamblogs';
$view_type = $mediaType == 'category' ? 'categories' : 'teamblogs';
$default_avatar_type = $mediaType == 'category' ? 'default_category.png' : 'default_team.png';
if (!$isFromBackend && $mediaType == 'category') {
if (empty($acl->rules->upload_cavatar)) {
$url = 'index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type;
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_UPLOAD_AVATAR'), 'warning');
$mainframe->redirect(EasyBlogRouter::_($url, false));
}
}
$avatar_config_path = $mediaType == 'category' ? $config->get('main_categoryavatarpath') : $config->get('main_teamavatarpath');
$avatar_config_path = rtrim($avatar_config_path, '/');
$avatar_config_path = str_replace('/', DIRECTORY_SEPARATOR, $avatar_config_path);
$upload_path = JPATH_ROOT . DIRECTORY_SEPARATOR . $avatar_config_path;
$rel_upload_path = $avatar_config_path;
$err = null;
$file = JRequest::getVar('Filedata', '', 'files', 'array');
//check whether the upload folder exist or not. if not create it.
if (!JFolder::exists($upload_path)) {
if (!JFolder::create($upload_path)) {
// Redirect
if (!$isFromBackend) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_IMAGE_UPLOADER_FAILED_TO_CREATE_UPLOAD_FOLDER'), 'error');
self::setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
} else {
//from backend
self::setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $layout_type, false), JText::_('COM_EASYBLOG_IMAGE_UPLOADER_FAILED_TO_CREATE_UPLOAD_FOLDER'), 'error');
}
return;
} else {
// folder created. now copy index.html into this folder.
if (!JFile::exists($upload_path . DIRECTORY_SEPARATOR . 'index.html')) {
$targetFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'index.html';
$destFile = $upload_path . DIRECTORY_SEPARATOR . 'index.html';
if (JFile::exists($targetFile)) {
JFile::copy($targetFile, $destFile);
}
}
}
}
//makesafe on the file
$file['name'] = $mediaTable->id . '_' . JFile::makeSafe($file['name']);
if (isset($file['name'])) {
$target_file_path = $upload_path;
$relative_target_file = $rel_upload_path . DIRECTORY_SEPARATOR . $file['name'];
$target_file = JPath::clean($target_file_path . DIRECTORY_SEPARATOR . JFile::makeSafe($file['name']));
$isNew = false;
//include_once(JPATH_ROOT.DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_easyblog'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'image.php');
require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'image.php';
require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'easysimpleimage.php';
if (!EasyImageHelper::canUpload($file, $err)) {
if (!$isFromBackend) {
EasyBlogHelper::setMessageQueue(JText::_($err), 'error');
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
} else {
//from backend
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $view_type, false), JText::_($err), 'error');
}
return;
}
if (0 != (int) $file['error']) {
if (!$isFromBackend) {
EasyBlogHelper::setMessageQueue($file['error'], 'error');
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
} else {
//from backend
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=' . $view_type, false), $file['error'], 'error');
}
return;
}
//rename the file 1st.
$oldAvatar = empty($mediaTable->avatar) ? $default_avatar_type : $mediaTable->avatar;
$tempAvatar = '';
if ($oldAvatar != $default_avatar_type) {
$session = JFactory::getSession();
$sessionId = $session->getToken();
$fileExt = JFile::getExt(JPath::clean($target_file_path . DIRECTORY_SEPARATOR . $oldAvatar));
$tempAvatar = JPath::clean($target_file_path . DIRECTORY_SEPARATOR . $sessionId . '.' . $fileExt);
JFile::move($target_file_path . DIRECTORY_SEPARATOR . $oldAvatar, $tempAvatar);
} else {
$isNew = true;
}
if (JFile::exists($target_file)) {
if ($oldAvatar != $default_avatar_type) {
//rename back to the previous one.
JFile::move($tempAvatar, $target_file_path . DIRECTORY_SEPARATOR . $oldAvatar);
}
if (!$isFromBackend) {
EasyBlogHelper::setMessageQueue(JText::sprintf('ERROR.FILE_ALREADY_EXISTS', $relative_target_file), 'error');
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=' . $layout_type, false));
//.........这里部分代码省略.........
示例6: microblog
/**
* Micro blogging layout
*
* @since 3.0.7706
* @access public
* @param null
* @return null
*/
public function microblog()
{
$mainframe = JFactory::getApplication();
$config = EasyBlogHelper::getConfig();
$acl = EasyBlogACLHelper::getRuleSet();
if (!EasyBlogHelper::isLoggedIn()) {
EasyBlogHelper::showLogin();
return;
}
$my = JFactory::getuser();
$user = EasyBlogHelper::getTable('Profile', 'Table');
$user->load($my->id);
// @rule: Test if microblogging is allowed
if (!$config->get('main_microblog')) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
JFactory::getApplication()->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard', false));
}
// @rule: Test ACL if add entry is allowed
if (!$acl->rules->add_entry) {
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard', false), JText::_('COM_EASYBLOG_NO_PERMISSION_TO_CREATE_BLOG'));
$mainframe->close();
}
$document = JFactory::getDocument();
$title = EasyBlogHelper::getPageTitle(JText::_('COM_EASYBLOG_DASHBOARD_SHARE_A_STORY_TITLE'));
// @task: Set the page title
parent::setPageTitle($title, false, $config->get('main_pagetitle_autoappend'));
// Add toolbar to the output
echo $this->showToolbar(__FUNCTION__, $user);
// Get active tabs
$activeType = JRequest::getVar('type', 'text');
// Add the breadcrumbs
$breadcrumbs = array(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB_SHARE_STORY') => '');
// @task: Retrieve existing categories
$categoryModel = $this->getModel('Categories');
$categories = EasyBlogHelper::populateCategories('', '', 'select', 'category_id', '', true, true, true);
// @task: Retrieve existing tags
$tagsModel = $this->getModel('Tags');
$tags = $tagsModel->getTags();
$template = new CodeThemes('dashboard');
$template->set('activeType', $activeType);
$template->set('categories', $categories);
$template->set('breadcrumbs', $breadcrumbs);
$template->set('tags', $tags);
echo $template->fetch('dashboard.microblog.php');
}
示例7: removePicture
/**
* Allow current user to remove their own profile picture.
*
*/
public function removePicture()
{
$mainframe = JFactory::getApplication();
$acl = EasyBlogACLHelper::getRuleSet();
$my = JFactory::getUser();
$config = EasyBlogHelper::getConfig();
if (!$config->get('layout_avatar') || !$acl->rules->upload_avatar) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_PROFILE_PICTURE'), 'error');
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
$mainframe->close();
}
JTable::addIncludePath(EBLOG_TABLES);
$profile = EasyBlogHelper::getTable('Profile', 'Table');
$profile->load($my->id);
$avatar_config_path = $config->get('main_avatarpath');
$avatar_config_path = rtrim($avatar_config_path, '/');
$avatar_config_path = str_replace('/', DIRECTORY_SEPARATOR, $avatar_config_path);
$path = JPATH_ROOT . DIRECTORY_SEPARATOR . $avatar_config_path . DIRECTORY_SEPARATOR . $profile->avatar;
if (!JFile::delete($path)) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_PROFILE_PICTURE'), 'error');
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
$mainframe->close();
}
// @rule: Update avatar in database
$profile->avatar = '';
$profile->store();
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_PROFILE_PICTURE_REMOVED'));
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
$mainframe->close();
}
示例8: unsubscribe
/**
* @since 3.0
* Unsubscribe a user with email to a blog post
*
* @param int Subscription ID
* @param int Blog post ID
*
* @return bool True on success
*/
public function unsubscribe()
{
$subscriptionId = JRequest::getInt('subscription_id');
$blogId = JRequest::getInt('blog_id');
$my = JFactory::getUser();
$mainframe = JFactory::getApplication();
$redirect = EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId, false);
// Check variables
if ($my->id == 0 || !$subscriptionId || !$blogId) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
$mainframe->redirect($redirect);
}
// Need to ensure that whatever id passed in is owned by the current browser
$blogModel = EasyblogHelper::getModel('Blog');
$sid = $blogModel->isBlogSubscribedUser($blogId, $my->id, $my->email);
if ($subscriptionId != $sid) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
$mainframe->redirect($redirect);
}
// Proceed to unsubscribe
$table = EasyBlogHelper::getTable('Subscription', 'Table');
$table->load($subscriptionId);
if (!$table->delete()) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_FAILED'), 'error');
$mainframe->redirect($redirect);
}
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_UNSUBSCRIBE_BLOG_SUCCESS'), 'success');
$mainframe->redirect($redirect);
}
示例9: confirmDeleteTag
public function confirmDeleteTag($ids, $url)
{
$my = JFactory::getUser();
$ajax = new Ejax();
$acl = EasyBlogACLHelper::getRuleSet();
$config = EasyBlogHelper::getConfig();
$ids = explode(',', $ids);
if ($my->id == 0 || empty($acl->rules->create_tag)) {
$options = new stdClass();
$options->content = JText::_('COM_EASYBLOG_NOT_ALLOWED');
$ajax->dialog($options);
return $ajax->send();
}
// Need to ensure that whatever id passed in is owned by the current browser
foreach ($ids as $id) {
$tag = EasyBlogHelper::getTable('Tag', 'Table');
$tag->load($id);
if ($tag->created_by != $my->id && !EasyBlogHelper::isSiteAdmin()) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
$mainframe->redirect(EasyBlogRouter::_($url, false));
return;
}
}
$themes = new CodeThemes('dashboard');
$themes->set('id', implode(',', $ids));
$themes->set('redirect', base64_encode($url));
$options = new stdClass();
$options->title = JText::_('COM_EASYBLOG_DASHBOARD_TAGS_DIALOG_CONFIRM_DELETE_TITLE');
$options->content = $themes->fetch('ajax.dialog.tag.delete.php');
$ajax->dialog($options);
return $ajax->send();
}
示例10: revoke
/**
* Responsible to revoke access for the specific oauth client
*
* @param null
* @return null
**/
public function revoke()
{
$mainframe = JFactory::getApplication();
$my = JFactory::getUser();
$url = EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false);
$redirect = JRequest::getVar('redirect', '');
$type = JRequest::getWord('type');
$config = EasyBlogHelper::getConfig();
if (!empty($redirect)) {
$url = base64_decode($redirect);
}
if (!EasyBlogHelper::isLoggedIn()) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_YOU_MUST_LOGIN_FIRST'), 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog', false));
return;
}
$oauth = EasyBlogHelper::getTable('OAuth', 'Table');
$oauth->loadByUser($my->id, $type);
// Revoke the access through the respective client first.
$callback = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&controller=oauth&task=grant&type=' . $type, false, true);
$key = $config->get('integrations_' . $type . '_api_key');
$secret = $config->get('integrations_' . $type . '_secret_key');
$consumer = EasyBlogOauthHelper::getConsumer($type, $key, $secret, $callback);
$consumer->setAccess($oauth->access_token);
// @task: Only show errors when the user is really authenticated with the respective provider.
if (!$consumer->revokeApp() && !empty($oauth->access_token)) {
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_APPLICATION_REVOKED_ERROR'), 'error');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
return;
}
$oauth->delete();
EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_APPLICATION_REVOKED_SUCCESSFULLY'));
$this->setRedirect($url);
}