本文整理汇总了PHP中EasyBlogHelper::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyBlogHelper::getSession方法的具体用法?PHP EasyBlogHelper::getSession怎么用?PHP EasyBlogHelper::getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyBlogHelper
的用法示例。
在下文中一共展示了EasyBlogHelper::getSession方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
// @rule: Test for user access if on 1.6 and above
if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
if (!JFactory::getUser()->authorise('easyblog.manage.user', 'com_easyblog')) {
JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
JFactory::getApplication()->close();
}
}
//initialise variables
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$config = EasyBlogHelper::getConfig();
$id = JRequest::getInt('id');
$blogger = EasyBlogHelper::getTable('Profile', 'Table');
$blogger->load($id);
$post = EasyBlogHelper::getSession('EASYBLOG_REGISTRATION_POST');
$avatarIntegration = $config->get('layout_avatarIntegration', 'default');
$user = JFactory::getUser($id);
$isNew = $user->id == 0 ? true : false;
if ($isNew && !empty($post)) {
unset($post['id']);
$pwd = $post['password'];
unset($post['password']);
unset($post['password2']);
$user->bind($post);
$post['password'] = $pwd;
$blogger->bind($post);
}
jimport('joomla.html.pane');
$feedburner = EasyBlogHelper::getTable('Feedburner', 'Table');
$feedburner->load($id);
JTable::addIncludePath(EBLOG_TABLES);
//twitter
$twitter = EasyBlogHelper::getTable('Oauth', 'Table');
$twitter->loadByUser($user->id, EBLOG_OAUTH_TWITTER);
//linkedin
$linkedin = EasyBlogHelper::getTable('Oauth', 'Table');
$linkedin->loadByUser($user->id, EBLOG_OAUTH_LINKEDIN);
//facebook
$facebook = EasyBlogHelper::getTable('Oauth', 'Table');
$facebook->loadByUser($user->id, EBLOG_OAUTH_FACEBOOK);
$adsense = EasyBlogHelper::getTable('Adsense', 'Table');
$adsense->load($id);
if ($isNew && !empty($post)) {
$feedburner->url = $post['feedburner_url'];
$twitter->message = $post['integrations_twitter_message'];
$twitter->auto = $post['integrations_twitter_auto'];
$linkedin->auto = $post['integrations_linkedin_auto'];
$linkedin->private = isset($post['integrations_linkedin_private']) ? $post['integrations_linkedin_private'] : false;
$facebook->auto = $post['integrations_facebook_auto'];
$adsense->published = $post['adsense_published'];
$adsense->code = $post['adsense_code'];
$adsense->display = $post['adsense_display'];
}
if (EasyBlogHelper::getJoomlaVersion() >= '1.6') {
require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_users' . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'user.php';
$jUserModel = new UsersModelUser();
$form = $jUserModel->getForm();
$form->setValue('password', null);
$form->setValue('password2', null);
$this->assignRef('form', $form);
}
$joomla_date = EasyBlogHelper::getJoomlaVersion() <= '1.5' ? '%Y-%m-%d %H:%M:%S' : 'Y-m-d H:i:s';
$editor = JFactory::getEditor($config->get('layout_editor', 'tinymce'));
$userParams = $user->getParameters(true);
$bloggerRawParams = $blogger->getParams();
if (is_array($bloggerRawParams)) {
$bloggerRawParams = '';
}
$bloggerParams = EasyBlogHelper::getRegistry($bloggerRawParams);
$this->assignRef('bloggerParams', $bloggerParams);
$this->assignRef('editor', $editor);
$this->assignRef('dateFormat', $joomla_date);
$this->assignRef('config', $config);
$this->assignRef('pane', $pane);
$this->assignRef('feedburner', $feedburner);
$this->assignRef('adsense', $adsense);
$this->assignRef('twitter', $twitter);
$this->assignRef('facebook', $facebook);
$this->assignRef('linkedin', $linkedin);
$this->assignRef('blogger', $blogger);
$this->assignRef('user', $user);
$this->assignRef('isNew', $isNew);
$this->assignRef('params', $userParams);
$this->assignRef('avatarIntegration', $avatarIntegration);
$this->assignRef('post', $post);
parent::display($tpl);
}
示例2: write
function write()
{
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$mainframe = JFactory::getApplication();
$acl = EasyBlogACLHelper::getRuleSet();
$siteAdmin = EasyBlogHelper::isSiteAdmin();
$my = JFactory::getUser();
// set the editor title based on operation
$editorTitle = '';
// just to inform the view that this is edit operation
$showDraftStatus = true;
$isEdit = false;
if (!EasyBlogHelper::isLoggedIn()) {
EasyBlogHelper::showLogin();
return;
}
if (!EasyBlogRouter::isCurrentActiveMenu('dashboard')) {
$this->setPathway(JText::_('COM_EASYBLOG_DASHBOARD_BREADCRUMB'), EasyBlogRouter::_('index.php?option=com_easyblog&view=dashboard'));
}
$this->setPathway(JText::_('COM_EASYBLOG_DASHBOARD_WRITE_BREADCRUMB'));
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();
}
// enable datetime picker
EasyBlogDateHelper::enableDateTimePicker();
// Add the Calendar includes to the document <head> section
JHTML::_('behavior.calendar');
// Add modal behavior
JHTML::_('behavior.modal');
// Load the JEditor object
if ($config->get('layout_editor_author')) {
// Get user's parameters
$userParams = EasyBlogHelper::getRegistry($my->params);
$editorType = $userParams->get('editor', $config->get('layout_editor'));
$editor = JFactory::getEditor($editorType);
} else {
$editor = JFactory::getEditor($config->get('layout_editor'));
}
$user = EasyBlogHelper::getTable('Profile', 'Table');
$user->setUser($my);
$model = $this->getModel('Blog');
$categoriesModel = $this->getModel('Categories');
$publishedOnly = true;
$categoryItems = $categoriesModel->getParentCategories('', 'all', $publishedOnly, true);
$categories = array();
if ($categoryItems) {
foreach ($categoryItems as $categoryItem) {
$category = EasyBlogHelper::getTable('Category');
$category->bind($categoryItem);
$categories[] = $category;
}
}
$trackbacksModel = $this->getModel('TrackbackSent');
$blogContributed = '';
$trackbacks = '';
$external = '';
$extGroupId = '';
// @task: See if there's any uid in the query string.
// @since 3.5
$source = JRequest::getVar('source');
$uid = JRequest::getInt('uid');
// get blogid if exists
$blogId = JRequest::getVar('blogid', '');
// Test if draft id exists
$draftId = JRequest::getVar('draft_id', '');
// test if this is a under approval post or not.
$underApproval = JRequest::getVar('approval', '');
// Load blog table
$blog = EasyBlogHelper::getTable('Blog', 'Table');
$blog->load($blogId);
// Test if this blog belongs to the team and the current browser is the team admin.
$teamblogModel = $this->getModel('TeamBlogs');
$teamContribution = $teamblogModel->getBlogContributed($blog->id);
// Check if the person has access to create a new blog post
if ($blog->id && $blog->created_by != $my->id && !$siteAdmin && empty($acl->rules->moderate_entry) && !$teamContribution) {
$url = 'index.php?option=com_easyblog&view=dashboard';
$mainframe->redirect(EasyBlogRouter::_($url, false), JText::_('COM_EASYBLOG_NO_PERMISSION_TO_CREATE_BLOG'));
}
// This will be the team blog checking
$isCurrentTeamAdmin = false;
if ($teamContribution && !$siteAdmin && empty($acl->rules->moderate_entry)) {
$isCurrentTeamAdmin = $teamblogModel->checkIsTeamAdmin($my->id, $teamContribution->team_id);
// Test if the user has access to this team posting.
if (!$isCurrentTeamAdmin && $blog->created_by != $my->id) {
$url = 'index.php?option=com_easyblog&view=dashboard';
$mainframe->redirect(EasyBlogRouter::_($url, false), JText::_('COM_EASYBLOG_NO_PERMISSION_TO_CREATE_BLOG'));
}
}
$tmpBlogData = EasyBlogHelper::getSession('tmpBlogData');
$loadFromSession = false;
$blogSource = '';
if (isset($tmpBlogData)) {
$loadFromSession = true;
$blog->bind($tmpBlogData);
// reprocess the date offset here.
$tzoffset = EasyBlogDateHelper::getOffSet();
if (!empty($blog->created)) {
$date = EasyBlogHelper::getDate($blog->created, $tzoffset);
//.........这里部分代码省略.........
示例3: display
function display($tmpl = null)
{
JPluginHelper::importPlugin('easyblog');
$dispatcher = JDispatcher::getInstance();
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$config = EasyBlogHelper::getConfig();
$my = JFactory::getUser();
$notice = '';
//for trigger
$params = $mainframe->getParams('com_easyblog');
$limitstart = JRequest::getInt('limitstart', 0, '');
$blogId = JRequest::getVar('id');
if (JRequest::getInt('print') == 1) {
// Add noindex for print view by default.
$document->setMetadata('robots', 'noindex,follow');
}
if (empty($blogId)) {
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false), JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
$mainframe->close();
}
if ($my->id <= 0 && $config->get('main_login_read')) {
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blogId . '&layout=login', false));
$mainframe->close();
}
$team = JRequest::getVar('team', '');
if (empty($team)) {
//try get from session.
$team = EasyBlogHelper::getSession('EASYBLOG_TEAMBLOG_ID');
}
// set meta tags for post
EasyBlogHelper::setMeta($blogId, META_TYPE_POST);
$print = JRequest::getBool('print');
if ($print) {
$document->setMetaData('robots', 'noindex, nofollow');
}
$my = JFactory::getUser();
$blog = EasyBlogHelper::getTable('Blog', 'Table');
if (!$blog->load($blogId)) {
$mainframe->redirect(EasyBlogRouter::_('index.php?option=com_easyblog&view=latest', false), JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
$mainframe->close();
}
if (!empty($blog->robots)) {
$document->setMetaData('robots', $blog->robots);
}
if (!empty($blog->copyrights)) {
$document->setMetaData('rights', $blog->copyrights);
}
//assign the teamid here.
$checkIsPrivate = false;
//check if blog is password protected.
if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
if (!EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
$errmsg = '';
$jSession = JFactory::getSession();
if ($jSession->has('PROTECTEDBLOG_' . $blog->id, 'EASYBLOG')) {
$errmsg = JText::_('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_INVALID_PASSWORD');
}
$theme = new CodeThemes();
$theme->set('id', $blog->id);
$theme->set('return', base64_encode(JURI::getInstance()->toString()));
$theme->set('errmsg', $errmsg);
echo $theme->fetch('blog.protected.php');
return false;
}
}
//if team id provided, then we need to check if the user belong to the team or not.
if ($blog->issitewide) {
$checkIsPrivate = true;
} else {
if (empty($team)) {
// blog post is not sitewide and teamid is empty? this is not so right. need to check this post contributed to which team one more time.
$team = $blog->getTeamContributed();
}
/*
* if teamblog access set to 'member only' | 'registered user', team blog will supersede blog permision
* if teamblog access set to 'everyone' then blog's permission will supersede teamblog access (logged user vs guest)
*/
if (!empty($team)) {
$teamblog = EasyBlogHelper::getTable('TeamBlog', 'Table');
$teamblog->load($team);
if ($teamblog->access == '1') {
if (!EasyBlogHelper::isTeamBlogJoined($my->id, $team)) {
//show error.
EasyBlogHelper::showAccessDenied('teamblog', $teamblog->access);
return;
}
} else {
if ($teamblog->access == '2') {
if (!EasyBlogHelper::isLoggedIn()) {
EasyBlogHelper::showLogin();
return;
}
} else {
// if teamblog the access set to 'everyone' then blog permission will supersede teamblog access
$checkIsPrivate = true;
}
}
} else {
$checkIsPrivate = true;
//.........这里部分代码省略.........