本文整理汇总了PHP中EasyBlogHelper::storeSession方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::storeSession方法的具体用法?PHP EasyBlogHelper::storeSession怎么用?PHP EasyBlogHelper::storeSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::storeSession方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
// @task: Check for acl rules.
$this->checkAccess('user');
$mainframe = JFactory::getApplication();
$db = EasyBlogHelper::db();
$my = JFactory::getUser();
$acl = JFactory::getACL();
$config = EasyBlogHelper::getConfig();
// Create a new JUser object
$user = JFactory::getUser(JRequest::getVar('id', 0, 'post', 'int'));
$original_gid = $user->get('gid');
$post = JRequest::get('post');
$post['username'] = JRequest::getVar('username', '', 'post', 'username');
$post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
$post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW);
if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
$jformPost = JRequest::getVar('jform', array(), 'post', 'array');
$post['params'] = $jformPost['params'];
}
if (!$user->bind($post)) {
EasyBlogHelper::storeSession($post, 'EASYBLOG_REGISTRATION_POST');
$mainframe->enqueueMessage($user->getError(), 'error');
$this->_saveError($user->id);
}
if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
if ($user->get('id') == $my->get('id') && $user->get('block') == 1) {
$mainframe->enqueueMessage(JText::_('You cannot block Yourself!'), 'error');
$this->_saveError($user->id);
} else {
if ($user->authorise('core.admin') && $user->get('block') == 1) {
$mainframe->enqueueMessage(JText::_('You cannot block a Super User'), 'error');
$this->_saveError($user->id);
} else {
if ($user->authorise('core.admin') && !$my->authorise('core.admin')) {
$mainframe->enqueueMessage(JText::_('You cannot edit a Super User account'), 'message');
$this->_saveError($user->id);
}
}
}
//replacing thr group name with group id so it is save correctly into the Joomla group table.
$jformPost = JRequest::getVar('jform', array(), 'post', 'array');
if (!empty($jformPost['groups'])) {
$user->groups = array();
foreach ($jformPost['groups'] as $groupid) {
$user->groups[$groupid] = $groupid;
}
}
} else {
$objectID = $acl->get_object_id('users', $user->get('id'), 'ARO');
$groups = $acl->get_object_groups($objectID, 'ARO');
$this_group = strtolower($acl->get_group_name($groups[0], 'ARO'));
if ($user->get('id') == $my->get('id') && $user->get('block') == 1) {
$mainframe->enqueueMessage(JText::_('You cannot block Yourself!'), 'error');
$this->_saveError($user->id);
} else {
if ($this_group == 'super administrator' && $user->get('block') == 1) {
$mainframe->enqueueMessage(JText::_('You cannot block a Super Administrator'), 'error');
$this->_saveError($user->id);
} else {
if ($this_group == 'administrator' && $my->get('gid') == 24 && $user->get('block') == 1) {
$mainframe->enqueueMessage(JText::_('WARNBLOCK'), 'error');
$this->_saveError($user->id);
} else {
if ($this_group == 'super administrator' && $my->get('gid') != 25) {
$mainframe->enqueueMessage(JText::_('You cannot edit a super administrator account'), 'message');
$this->_saveError($user->id);
}
}
}
}
}
// Are we dealing with a new user which we need to create?
$isNew = $user->get('id') < 1;
if (EasyBlogHelper::getJoomlaVersion() <= '1.5') {
// do this step only for J1.5
if (!$isNew) {
// if group has been changed and where original group was a Super Admin
if ($user->get('gid') != $original_gid && $original_gid == 25) {
// count number of active super admins
$query = 'SELECT COUNT( id )' . ' FROM #__users' . ' WHERE gid = 25' . ' AND block = 0';
$db->setQuery($query);
$count = $db->loadResult();
if ($count <= 1) {
// disallow change if only one Super Admin exists
$this->setRedirect('index.php?option=com_users', JText::_('WARN_ONLY_SUPER'));
return false;
}
}
}
}
if (!$user->save()) {
$mainframe->enqueueMessage($user->getError(), 'error');
return $this->execute('edit');
}
// If updating self, load the new user object into the session
if (EasyBlogHelper::getJoomlaVersion() <= '1.5') {
if ($user->get('id') == $my->get('id')) {
//.........这里部分代码省略.........
示例2: savePublish
function savePublish()
{
// Check for request forgeries
JRequest::checkToken() or jexit('Invalid Token');
// @task: Check for acl rules.
$this->checkAccess('blog');
$mainframe = JFactory::getApplication();
$config = EasyBlogHelper::getConfig();
$message = '';
$type = 'message';
$saveNew = JRequest::getInt('savenew', 0);
$authorId = JRequest::getVar('authorId');
$user = JFactory::getUser($authorId);
$joomlaVersion = EasyBlogHelper::getJoomlaVersion();
if (JRequest::getMethod() == 'GET') {
echo JText::_('COM_EASYBLOG_NOT_ALLOWED');
return;
}
$acl = EasyBlogACLHelper::getRuleSet();
if (empty($acl->rules->add_entry)) {
$message = JText::_('COM_EASYBLOG_BLOGS_BLOG_NO_PERMISSION_TO_CREATE_BLOG');
$mainframe->enqueueMessage($message, 'error');
$this->setRedirect('index.php?option=com_easyblog&view=blogs');
}
// get data from form post.
$post = JRequest::get('post');
// @rule: Check for invalid title
$postTitle = trim($post['title']);
if (empty($postTitle)) {
$post['write_content'] = JRequest::getVar('write_content_hidden', '', 'post', 'string', JREQUEST_ALLOWRAW);
EasyBlogHelper::storeSession($post, 'tmpBlogData');
$mainframe->enqueueMessage(JText::_('COM_EASYBLOG_DASHBOARD_SAVE_EMPTY_TITLE_ERROR'), 'error');
$mainframe->redirect('index.php?option=com_easyblog&view=blog');
$mainframe->close();
}
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$blog = EasyBlogHelper::getTable('blog', 'Table');
$id = JRequest::getInt('blogid');
$blog->load($id);
$isNew = $blog->id == 0 ? true : false;
$draftId = JRequest::getInt('draft_id');
$under_approval = JRequest::getInt('under_approval');
$contributionSource = isset($post['blog_contribute_source']) ? $post['blog_contribute_source'] : '';
// If contribution source is empty, we should assume that it's for EasyBlog but it shouldn't be empty in the first place.
if (!$contributionSource) {
$contributionSource = 'easyblog';
}
//override the isnew variable
if (!$isNew) {
// if this is blog edit, then we should see the column isnew to determine
// whether we should send any notification
$isNew = $blog->isnew;
}
// @task: Get the offset
$txOffset = EasyBlogDateHelper::getOffSet();
// we do not proccess this on draft
if ($post['published'] != POST_ID_DRAFT) {
// we check the publishing date here
// if user set the future date then we will automatically change
// the status to Schedule
$today = EasyBlogHelper::getDate();
if ($post['published'] == POST_ID_PUBLISHED) {
$publishing = EasyBlogHelper::getDate($post['publish_up'], $txOffset);
if ($publishing->toUnix() > $today->toUnix()) {
$post['published'] = POST_ID_SCHEDULED;
}
}
//end if
}
if (empty($post['publish_down'])) {
$post['publish_down'] = '0000-00-00 00:00:00';
}
// set author
$post['created_by'] = $authorId;
// Some other elements might use name="language", so we need to remap this
$language = JRequest::getVar('eb_language');
$post['language'] = $language;
$blog->bind($post, true);
/**
* check here if user do not have the 'Publish Entry' acl, send this post for pending approval.
*/
if (empty($draftId) && empty($acl->rules->publish_entry)) {
$this->_saveDraft();
return;
}
//check if user have permission to enable privacy.
$aclBlogPrivacy = $acl->rules->enable_privacy;
$blog->private = empty($aclBlogPrivacy) ? '0' : $blog->private;
//check if user have permission to contribute the blog post to eblog frontpage
$blog->frontpage = empty($acl->rules->contribute_frontpage) ? '0' : $blog->frontpage;
$blog->isnew = $isNew && $blog->published != 1 ? '1' : '0';
//now we need to check the blog contribution
$blogContribution = array();
$issitewide = '1';
if (isset($post['blog_contribute'])) {
$myContribution = $post['blog_contribute'];
//reset the value
$issitewide = '0';
if ($myContribution == '0') {
//.........这里部分代码省略.........
示例3: statistic
function statistic()
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$acl = EasyBlogACLHelper::getRuleSet();
$sort = JRequest::getCmd('sort', 'latest');
$id = JRequest::getInt('id', 0);
//setting pathway
$pathway = $mainframe->getPathway();
$this->setPathway(JText::_('COM_EASYBLOG_TEAMBLOG'), EasyBlogRouter::_('index.php?option=com_easyblog&view=teamblog'));
$id = JRequest::getInt('id', 0);
if ($id == 0) {
echo JText::_('COM_EASYBLOG_TEAMBLOG_INVALID_ID');
return;
}
// set meta tags for teamblog view
EasyBlogHelper::setMeta($id, META_TYPE_TEAM);
//stats type
$statType = JRequest::getString('stat', '');
$statId = $statType == 'tag' ? JRequest::getString('tagid', '') : JRequest::getString('catid', '');
$statObject = null;
if ($statType == 'category') {
$statObject = EasyBlogHelper::getTable('Category', 'Table');
$statObject->load($statId);
} else {
$statObject = EasyBlogHelper::getTable('Tag', 'Table');
$statObject->load($statId);
}
$team = EasyBlogHelper::getTable('TeamBlog', 'Table');
$team->load($id);
$team->avatar = $team->getAvatar();
$gid = EasyBlogHelper::getUserGids();
$isMember = $team->isMember($my->id, $gid);
//check if the logged in user a teammember when the team set to member only.
if ($team->access == EBLOG_TEAMBLOG_ACCESS_MEMBER) {
$isMember = $team->isMember($my->id, $gid);
}
$team->isMember = $isMember;
// check if team description is emtpy or not. if yes, show default message.
if (empty($team->description)) {
$team->description = JText::_('COM_EASYBLOG_TEAMBLOG_NO_DESCRIPTION');
}
//add the pathway for teamblog
$this->setPathway($team->title, '');
$tbModel = $this->getModel('TeamBlogs');
$model = $this->getModel('Blog');
$blogs = $model->getBlogsBy('teamblog', $team->id);
$blogs = EasyBlogHelper::formatBlog($blogs);
$pagination = $model->getPagination();
//now get the teams info
$members = $tbModel->getTeamMembers($team->id);
$teamMembers = EasyBlogHelper::formatTeamMembers($members);
$isFeatured = EasyBlogHelper::isFeatured('teamblog', $team->id);
$pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
$pageNumber = $pagination->get('pages.current');
$pageText = $pageNumber == 1 ? '' : ' - ' . JText::sprintf('COM_EASYBLOG_PAGE_NUMBER', $pageNumber);
$document->setTitle($team->title . $pageText . $pageTitle);
EasyBlogHelper::storeSession($team->id, 'EASYBLOG_TEAMBLOG_ID');
//var_dump($blogs);exit;
$tpl = new CodeThemes();
$tpl->set('team', $team);
$tpl->set('teamMembers', $teamMembers);
$tpl->set('data', $blogs);
$tpl->set('isFeatured', $isFeatured);
$tpl->set('pagination', $pagination->getPagesLinks());
$tpl->set('siteadmin', EasyBlogHelper::isSiteAdmin());
$tpl->set('config', $config);
$tpl->set('my', $my);
$tpl->set('acl', $acl);
$tpl->set('statType', $statType);
$tpl->set('statObject', $statObject);
echo $tpl->fetch('blog.teamblogs.php');
}
示例4: save
//.........这里部分代码省略.........
$blog->private = empty($acl->rules->enable_privacy) ? 0 : $blog->private;
//check if user have permission to contribute the blog post to eblog frontpage
$blog->frontpage = empty($acl->rules->contribute_frontpage) ? '0' : $blog->frontpage;
$blog->isnew = $isNew && $blog->published != 1 ? '1' : '0';
//now we need to check the blog contribution
$blog->issitewide = isset($post['blog_contribute']) && $post['blog_contribute'] != 0 ? false : true;
$blogContribution = array();
$issitewide = '1';
if (isset($post['blog_contribute']) && $post['blog_contribute'] == '0') {
$blog->issitewide = true;
} else {
$blog->issitewide = false;
$blogContribution[] = $post['blog_contribute'];
}
// @task: When a new post is saved, we need to clear the drafts first.
if (isset($post['draft_id']) && !empty($post['draft_id'])) {
$draft = EasyBlogHelper::getTable('Draft', 'Table');
$draft->load($post['draft_id']);
// @rule: Only delete the draft when the owner really owns the draft.
if ($draft->created_by == $my->id || EasyBlogHelper::isSiteAdmin() || $under_approval) {
if ($under_approval) {
// @task: Cleanup any messages
$postreject = EasyBlogHelper::getTable('PostReject', 'Table');
$postreject->clear($draft->id);
}
$draft->delete();
}
}
if ($under_approval) {
$blog->under_approval = true;
}
if (!$blog->store()) {
$post['write_content'] = JRequest::getVar('write_content_hidden', '', 'post', 'string', JREQUEST_ALLOWRAW);
// Restore the contents
EasyBlogHelper::storeSession($post, 'tmpBlogData');
EasyBlogHelper::setMessageQueue($blog->getError(), 'error');
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=write' . $returnRaw, false));
}
// @task: Update the contribution linkage between the blog post and the respective team
$blog->updateBlogContribution($blogContribution, $contributionSource);
// @task: Notify the world that someone created a blog post.
//if( $blog->published == POST_ID_PUBLISHED && $isNew && !$blog->private )
// Do not send out emails when the post is scheduled to post in future
if ($isNew && !$blog->private && $blog->published != POST_ID_SCHEDULED) {
$blog->notify($under_approval, $blog->published);
}
$message = JText::_('COM_EASYBLOG_DASHBOARD_ENTRIES_SAVED');
JTable::addIncludePath(EBLOG_TABLES);
$author = EasyBlogHelper::getTable('Profile', 'Table');
$author->load($blog->created_by);
if ($blog->published == POST_ID_PUBLISHED && $my->id == $blog->created_by && !$blog->ispending && $contributionSource != 'easyblog') {
// @since 3.5
// Event integrations.
switch ($contributionSource) {
case 'jomsocial.event':
EasyBlogHelper::getHelper('Event')->addStream($blog, $isNew, $blogContribution, $contributionSource);
EasyBlogHelper::getHelper('Event')->sendNotifications($blog, $isNew, $blogContribution, $contributionSource, $author);
break;
default:
EasyBlogHelper::getHelper('Groups')->addStream($blog, $isNew, $blogContribution, $contributionSource);
EasyBlogHelper::getHelper('Groups')->sendNotifications($blog, $isNew, $blogContribution, $contributionSource, $author);
break;
}
}
// @task: Update or initialize meta table.
$blog->createMeta(JRequest::getVar('keywords', ''), JRequest::getVar('description', ''));
// @task: Store trackbacks into the trackback table for tracking purposes.
$trackbacks = JRequest::getVar('trackback', '', 'POST');
// Store trackbacks if necessary
if (!empty($acl->rules->add_trackback) && !empty($trackbacks)) {
$blog->storeTrackbacks($trackbacks);
}
// @task: Save any tags associated with the blog entry.
$tags = JRequest::getVar('tags', '', 'POST');
$date = EasyBlogHelper::getDate();
// @rule: Process the tags after the blog is stored.
$blog->processTags($tags, $isNew);
// @rule: Autoposting to social network sites.
if ($blog->published == POST_ID_PUBLISHED) {
$autopost = JRequest::getVar('socialshare', '');
$centralized = JRequest::getVar('centralized', '');
$blog->autopost($autopost, $centralized);
}
// @rule: Process trackbacks
$blog->processTrackbacks();
$message = JText::_('COM_EASYBLOG_DASHBOARD_SAVE_SUCCESS');
if (!empty($return)) {
$this->setRedirect(JRoute::_($return, false), $message);
return;
}
$isApply = JRequest::getBool('apply');
if ($isApply) {
$message = JText::_('COM_EASYBLOG_DASHBOARD_APPLY_SUCCESS');
EasyBlogHelper::setMessageQueue($message, 'success');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=write&blogid=' . $blog->id, false));
return;
}
EasyBlogHelper::setMessageQueue($message, 'success');
$this->setRedirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard&layout=entries', false));
}