当前位置: 首页>>代码示例>>PHP>>正文


PHP EB::acl方法代码示例

本文整理汇总了PHP中EB::acl方法的典型用法代码示例。如果您正苦于以下问题:PHP EB::acl方法的具体用法?PHP EB::acl怎么用?PHP EB::acl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EB的用法示例。


在下文中一共展示了EB::acl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLink

 public static function getLink($type, $id)
 {
     if (empty($type) || empty($id)) {
         return false;
     }
     //prevent jtable is not loading incase overwritten by other component.
     JTable::addIncludePath(EBLOG_TABLES);
     $oauth = EB::table('Oauth');
     $oauth->loadByUser($id, $type);
     $param = EB::registry($oauth->params);
     $screenName = $param->get('screen_name', '');
     $acl = EB::acl($id);
     $rule = 'update_' . $type;
     if (!$acl->get($rule)) {
         return false;
     }
     switch ($type) {
         case 'twitter':
             $link = empty($screenName) ? '' : 'http://twitter.com/' . $screenName;
             break;
         case 'facebook':
             $link = '';
             break;
         case 'linkedin':
             $link = '';
             break;
     }
     return $link;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:29,代码来源:socialshare.php

示例2: __construct

 public function __construct()
 {
     $this->my = JFactory::getUser();
     $this->app = JFactory::getApplication();
     $this->input = EB::request();
     $this->acl = EB::acl();
     $this->config = EB::config();
     // Set the user project
     $this->user = EB::user($this->my->id);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:10,代码来源:composer.php

示例3: push

 /**
  * Pushes to the oauth site
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function push(EasyBlogPost &$post)
 {
     // When there is no access token set on this oauth record, we shouldn't do anything
     if (!$this->access_token) {
         $this->setError(JText::sprintf('No access token available for autoposting on %1$s', $this->type));
         return false;
     }
     $config = EB::config();
     // Determines if this user is really allowed to auto post
     $author = $post->getAuthor();
     // Check the author's acl
     $acl = EB::acl($author->id);
     $rule = 'update_' . $this->type;
     if (!$acl->get($rule) && !EB::isSiteAdmin($post->created_by)) {
         $this->setError(JText::sprintf('No access to autopost on %1$s', $this->type));
         return false;
     }
     // we only check if the autopost on blog edit is disabled.
     if (!$config->get('integrations_' . $this->type . '_centralized_send_updates')) {
         // Check if the blog post was shared before.
         if ($this->isShared($post->id)) {
             $this->setError(JText::sprintf('Post %1$s has been shared to %2$s before.', $post->id, $this->type));
             return false;
         }
     }
     // Ensure that the oauth data has been set correctly
     $config = EB::config();
     $key = $config->get('integrations_' . $this->type . '_api_key');
     $secret = $config->get('integrations_' . $this->type . '_secret_key');
     // If either of this is empty, skip this
     if (!$key || !$secret) {
         return false;
     }
     // Set the callback URL
     $callback = JURI::base() . 'index.php?option=com_easyblog&task=oauth.grant&type=' . $this->type;
     // Now we do the real thing. Get the library and push
     $lib = EB::oauth()->getClient($this->type, $key, $secret, $callback);
     $lib->setAccess($this->access_token);
     // Try to share the post now
     $state = $lib->share($post, $this);
     if ($state === true) {
         $history = EB::table('OAuthPost');
         $history->load(array('oauth_id' => $this->id, 'post_id' => $post->id));
         $history->post_id = $post->id;
         $history->oauth_id = $this->id;
         $history->created = EB::date()->toSql();
         $history->modified = EB::date()->toSql();
         $history->sent = EB::date()->toSql();
         $history->store();
         return true;
     }
     return false;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:61,代码来源:oauth.php

示例4: __construct

 public function __construct($config = array())
 {
     $this->doc = JFactory::getDocument();
     $this->app = JFactory::getApplication();
     $this->acl = EB::acl();
     $this->my = JFactory::getUser();
     $this->info = EB::info();
     $this->config = EB::config();
     if ($this->doc->getType() == 'ajax') {
         $this->ajax = EB::ajax();
     }
     parent::__construct($config);
     $this->input = EB::request();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:14,代码来源:controller.php

示例5: __construct

 public function __construct()
 {
     $this->doc = JFactory::getDocument();
     $this->app = JFactory::getApplication();
     $this->my = JFactory::getUser();
     $this->config = EB::config();
     $this->info = EB::info();
     $this->jconfig = EB::jconfig();
     $this->acl = EB::acl();
     // If this is a dashboard theme, we need to let the theme object know
     $options = array('paramsPrefix' => $this->paramsPrefix);
     // If this is an ajax document, we should pass the $ajax library to the client
     if ($this->doc->getType() == 'ajax') {
         //we need to load frontend language from here incase it was called from backend.
         JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
         $this->ajax = EB::ajax();
     }
     // Create an instance of the theme so child can start setting variables to it.
     $this->theme = EB::template(null, $options);
     // Set the input object
     $this->input = EB::request();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:22,代码来源:views.php

示例6: updateComment

 public function updateComment()
 {
     $mainframe = JFactory::getApplication();
     $my = JFactory::getUser();
     $acl = EB::acl();
     $id = JRequest::getInt('commentId');
     $post = JRequest::get('POST');
     //add here so that other component with the same comment.php jtable file will not get reference.
     JTable::addIncludePath(EBLOG_TABLES);
     $comment = EB::table('Comment');
     $comment->load($id);
     $redirect = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $comment->post_id, false);
     if (($my->id != $comment->created_by || !$acl->get('delete_comment')) && !EasyBlogHelper::isSiteAdmin() && !$acl->get('manage_comment') || $my->id == 0) {
         EB::info()->set(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_UPDATE_COMMENT'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     $comment->bindPost($post);
     if (!$comment->validate('title')) {
         EB::info()->set(JText::_('COM_EASYBLOG_COMMENT_TITLE_IS_EMPTY'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     if (!$comment->validate('comment')) {
         EB::info()->set(JText::_('COM_EASYBLOG_COMMENT_IS_EMPTY'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     $comment->modified = EB::date()->toMySQL();
     if (!$comment->store()) {
         EB::info()->set(JText::_('COM_EASYBLOG_COMMENT_FAILED_TO_SAVE'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     EB::info()->set(JText::_('COM_EASYBLOG_COMMENT_UPDATED_SUCCESS'), 'success');
     $mainframe->redirect($redirect);
     $mainframe->close();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:38,代码来源:entry.php

示例7: listings

 /**
  * Displays blog posts created by specific users
  *
  * @since	4.0
  * @access	public
  */
 public function listings()
 {
     // Get sorting options
     $sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
     $id = $this->input->get('id', 0, 'int');
     // Load the author object
     $author = EB::user($id);
     // Disallow all users from being viewed
     if (!$this->config->get('main_nonblogger_profile') && !EB::isBlogger($author->id) || !$author->id) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_INVALID_AUTHOR_ID_PROVIDED'));
     }
     // Get the authors acl
     $acl = EB::acl($author->id);
     // Set meta tags for the author if allowed to
     if ($acl->get('allow_seo')) {
         EB::setMeta($author->id, META_TYPE_BLOGGER, true);
     }
     // Set the breadcrumbs
     if (!EBR::isCurrentActiveMenu('blogger', $author->id) && !EBR::isCurrentActiveMenu('blogger')) {
         $this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EB::_('index.php?option=com_easyblog&view=blogger'));
         $this->setPathway($author->getName());
     }
     // Get the current active menu
     $active = $this->app->getMenu()->getActive();
     // Excluded categories
     $excludeCats = array();
     if (isset($active->params)) {
         $excludeCats = $active->params->get('exclusion');
         // Ensure that this is an array
         if (!is_array($excludeCats) && $excludeCats) {
             $excludeCats = array($excludeCats);
         }
     }
     // Get the blogs model now to retrieve our blog posts
     $model = EB::model('Blog');
     // Get blog posts
     $posts = $model->getBlogsBy('blogger', $author->id, $sort, 0, '', false, false, '', false, false, false, $excludeCats);
     $pagination = $model->getPagination();
     // Format the blogs with our standard formatter
     $posts = EB::formatter('list', $posts);
     // Add canonical urls
     $this->canonical('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id);
     // Add authors rss links on the header
     if ($this->config->get('main_rss')) {
         if ($this->config->get('main_feedburner') && $this->config->get('main_feedburnerblogger')) {
             $this->doc->addHeadLink(EB::string()->escape($author->getRssLink()), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
         } else {
             // Add rss feed link
             $this->doc->addHeadLink($author->getRSS(), 'alternate', 'rel', array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'));
             $this->doc->addHeadLink($author->getAtom(), 'alternate', 'rel', array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'));
         }
     }
     // Set the title of the page
     $title = EB::getPageTitle($author->getName());
     $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
     // Check if subscribed
     $bloggerModel = EB::model('Blogger');
     $isBloggerSubscribed = $bloggerModel->isBloggerSubscribedEmail($author->id, $this->my->email);
     $return = base64_encode($author->getPermalink());
     $this->set('return', $return);
     $this->set('author', $author);
     $this->set('posts', $posts);
     $this->set('sort', $sort);
     $this->set('isBloggerSubscribed', $isBloggerSubscribed);
     parent::display('authors/item');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:72,代码来源:view.html.php

示例8: removeFeaturedx

 /**
  * Remove an item as featured
  *
  * @param	string	$type	The type of this item
  * @param	int		$postId	The unique id of the item
  *
  * @return	string	Json string
  **/
 function removeFeaturedx($type, $postId)
 {
     $ajax = new Ejax();
     $acl = EB::acl();
     EasyBlogHelper::removeFeatured($type, $postId);
     $idName = '';
     $message = '';
     switch ($type) {
         case 'blogger':
             $idName = '#blogger_title_' . $postId;
             $message = JText::_('COM_EASYBLOG_BLOGGER_UNFEATURED');
             break;
         case 'teamblog':
             $idName = '#teamblog_title_' . $postId;
             $message = JText::_('COM_EASYBLOG_TEAMBLOG_UNFEATURED');
             break;
         case 'post':
         default:
             $idName = '#title_' . $postId;
             $message = JText::_('COM_EASYBLOG_BLOG_UNFEATURED');
             break;
     }
     $ajax->script('$("' . $idName . '").removeClass("featured-item");');
     $ajax->alert($message, JText::_('COM_EASYBLOG_INFO'), '450', 'auto');
     $ajax->send();
     return;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:view.ajax.php

示例9:

        echo JText::_('MOD_EASYSOCIAL_MENU_ACTIVITY_LOG');
        ?>
</span>
				</a>
			</li>
			<?php 
    }
    ?>


			<!-- EasyBlog Integrations -->
			<?php 
    if ($params->get('integrate_easyblog', true) && $eblogExists) {
        ?>
				<?php 
        if (EB::acl()->get('add_entry')) {
            ?>
					<li>
						<a href="<?php 
            echo EBR::_('index.php?option=com_easyblog&view=dashboard&layout=write&Itemid=' . EBR::getItemId('dashboard'));
            ?>
">
							<i class="ies-plus-2 ies-small"></i>
							<span><?php 
            echo JText::_('MOD_EASYSOCIAL_MENU_EASYBLOG_WRITE_NEW');
            ?>
</span>
						</a>
					</li>
					<li>
						<a href="<?php 
开发者ID:knigherrant,项目名称:decopatio,代码行数:31,代码来源:default.php

示例10: removePicture

 /**
  * Allow current user to remove their own profile picture.
  *
  */
 public function removePicture()
 {
     $mainframe = JFactory::getApplication();
     $acl = EB::acl();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     if (!$config->get('layout_avatar') || !$acl->get('upload_avatar')) {
         EB::info()->set(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_PROFILE_PICTURE'), 'error');
         $mainframe->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
         $mainframe->close();
     }
     JTable::addIncludePath(EBLOG_TABLES);
     $profile = EB::user($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)) {
         EB::info()->set(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_PROFILE_PICTURE'), 'error');
         $mainframe->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
         $mainframe->close();
     }
     // @rule: Update avatar in database
     $profile->avatar = '';
     $profile->store();
     EB::info()->set(JText::_('COM_EASYBLOG_PROFILE_PICTURE_REMOVED'));
     $mainframe->redirect(EBR::_('index.php?option=com_easyblog&view=dashboard&layout=profile', false));
     $mainframe->close();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:profile.php

示例11: getAcl

 /**
  * Retrieves author's acl
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getAcl()
 {
     $acl = EB::acl($this->id);
     return $acl;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:13,代码来源:profile.php

示例12: upload

 /**
  * Uploads a user avatar
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function upload($fileData, $userId = false)
 {
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     // Check if the user is allowed to upload avatar
     $acl = EB::acl();
     // Ensure that the user really has access to upload avatar
     if (!$acl->get('upload_avatar')) {
         $this->setError('COM_EASYBLOG_NO_PERMISSION_TO_UPLOAD_AVATAR');
         return false;
     }
     // Get the current user
     $user = JFactory::getUser();
     // If there is userId passed, means this is from backend.
     // We cannot get the current logged in user because it will always be the admin.
     if ($userId) {
         $user = JFactory::getUser($userId);
     }
     $app = JFactory::getApplication();
     $config = EB::config();
     $path = $config->get('main_avatarpath');
     $path = rtrim($path, '/');
     $relativePath = $path;
     $absolutePath = JPATH_ROOT . '/' . $path;
     // If the absolute path does not exist, create it first
     if (!JFolder::exists($absolutePath)) {
         JFolder::create($absolutePath);
         // Copy the index.html file over to this new folder
         JFile::copy(JPATH_ROOT . '/components/com_easyblog/index.html', $absolutePath . '/index.html');
     }
     // The file data should have a name
     if (!isset($fileData['name'])) {
         return false;
     }
     // Generate a better name for the file
     $fileData['name'] = $user->id . '_' . JFile::makeSafe($fileData['name']);
     // Get the relative path
     $relativeFile = $relativePath . '/' . $fileData['name'];
     // Get the absolute file path
     $absoluteFile = $absolutePath . '/' . $fileData['name'];
     // Test if the file is upload-able
     $message = '';
     if (!EB::image()->canUpload($fileData, $message)) {
         $this->setError($message);
         return false;
     }
     // Determines if the web server is generating errors
     if ($fileData['error'] != 0) {
         $this->setError($fileData['error']);
         return false;
     }
     // We need to delete the old avatar
     $profile = EB::user($user->id);
     // Get the old avatar
     $oldAvatar = $profile->avatar;
     $isNew = false;
     // Delete the old avatar first
     if ($oldAvatar != 'default.png' && $oldAvatar != 'default_blogger.png') {
         $session = JFactory::getSession();
         $sessionId = $session->getToken();
         $oldAvatarPath = $absolutePath . '/' . $oldAvatar;
         if (JFile::exists($oldAvatarPath)) {
             JFile::delete($oldAvatarPath);
         }
     } else {
         $isNew = true;
     }
     $width = EBLOG_AVATAR_LARGE_WIDTH;
     $height = EBLOG_AVATAR_LARGE_HEIGHT;
     $image = EB::simpleimage();
     $image->load($fileData['tmp_name']);
     $image->resizeToFill($width, $height);
     $image->save($absoluteFile, $image->type);
     if ($isNew && $config->get('main_jomsocial_userpoint')) {
         EB::jomsocial()->assignPoints('com_easyblog.avatar.upload', $user->id);
     }
     return $fileData['name'];
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:86,代码来源:avatar.php

示例13: isBlogger

 public static function isBlogger($userId)
 {
     if (empty($userId)) {
         return false;
     }
     $acl = EB::acl($userId);
     if ($acl->get('add_entry')) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:12,代码来源:easyblog.php

示例14: updateBlogSubscriptionEmail

 public function updateBlogSubscriptionEmail($sid, $userid, $email)
 {
     $config = EasyBlogHelper::getConfig();
     $acl = EB::acl();
     $my = JFactory::getUser();
     if ($acl->get('allow_subscription') || empty($my->id) && $config->get('main_allowguestsubscribe')) {
         $subscriber = EB::table('Subscriptions');
         $subscriber->load($sid);
         $subscriber->user_id = $userid;
         $subscriber->email = $email;
         $subscriber->store();
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:13,代码来源:blog.php

示例15: __construct

 public function __construct($uid = null, $userId = null)
 {
     // Load site's language file
     EB::loadLanguages();
     // This will call EasyBlog class to construct $config, $doc, $app, $input, $my.
     parent::__construct();
     // Globals
     $this->uid = $uid;
     // The author of this item
     $this->user = EB::user($userId);
     // The acl of the author
     $this->acl = EB::acl($this->user->id);
     // If this is a new post, we want to create a new workbench
     if (!$uid) {
         $this->createNewWorkbench();
     } else {
         $this->load($uid);
     }
     // Set the post object to the router so that they can easily retrieve it.
     EBR::setPost($this);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:21,代码来源:post.php


注:本文中的EB::acl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。