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


PHP Permissions::getInstance方法代码示例

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


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

示例1: display

 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     // 		$this->assignRef('perms', Permissions::getInstance());
     $model = VmModel::getModel();
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $shoppergroup = $model->getShopperGroup();
         $this->SetViewTitle('SHOPPERGROUP', $shoppergroup->shopper_group_name);
         $vendors = ShopFunctions::renderVendorList($shoppergroup->virtuemart_vendor_id);
         $this->assignRef('vendorList', $vendors);
         $this->assignRef('shoppergroup', $shoppergroup);
         $this->addStandardEditViewCommands();
     } else {
         $this->SetViewTitle();
         JToolBarHelper::makeDefault();
         $this->loadHelper('permissions');
         $showVendors = Permissions::getInstance()->check('admin');
         $this->assignRef('showVendors', $showVendors);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $shoppergroups = $model->getShopperGroups(false, true);
         $this->assignRef('shoppergroups', $shoppergroups);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:31,代码来源:view.html.php

示例2: getOrderDetails

 public function getOrderDetails()
 {
     $orderModel = VmModel::getModel('orders');
     $orderDetails = 0;
     // If the user is not logged in, we will check the order number and order pass
     if ($orderPass = JRequest::getString('order_pass', false) and $orderNumber = JRequest::getString('order_number', false)) {
         $orderId = $orderModel->getOrderIdByOrderPass($orderNumber, $orderPass);
         if (empty($orderId)) {
             vmDebug('Invalid order_number/password ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS'));
             return 0;
         }
         $orderDetails = $orderModel->getOrder($orderId);
     }
     if ($orderDetails == 0) {
         $_currentUser = JFactory::getUser();
         $cuid = $_currentUser->get('id');
         // If the user is logged in, we will check if the order belongs to him
         $virtuemart_order_id = JRequest::getInt('virtuemart_order_id', 0);
         if (!$virtuemart_order_id) {
             $virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber(JRequest::getString('order_number'));
         }
         $orderDetails = $orderModel->getOrder($virtuemart_order_id);
         JLoader::register('Permissions', JPATH_VM_ADMINISTRATOR . '/helpers/permissions.php');
         if (!Permissions::getInstance()->check("admin")) {
             if (!empty($orderDetails['details']['BT']->virtuemart_user_id)) {
                 if ($orderDetails['details']['BT']->virtuemart_user_id != $cuid) {
                     echo 'view ' . JText::_('COM_VIRTUEMART_RESTRICTED_ACCESS');
                     return;
                 }
             }
         }
     }
     return $orderDetails;
 }
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:34,代码来源:invoice.php

示例3: can

 function can($task, $view, $created_by = null, $vendorId = null)
 {
     static $user_id = null;
     static $isAdmin = null;
     static $vendor = null;
     if ($vendor === null) {
         JLoader::register('Permissions', JPATH_VM_ADMINISTRATOR . '/helpers/permissions.php');
         $vendor = Permissions::getInstance()->isSuperVendor();
         if ($user_id = JFactory::getUser()->get('id')) {
             $isAdmin = Permissions::getInstance()->check("admin,storeadmin");
             JLoader::register('ShopFunctions', JPATH_VM_ADMINISTRATOR . '/helpers/shopfunctions.php');
         }
     }
     if (!$vendor) {
         return '';
     }
     if ($vendor > 1) {
         if (!ShopFunctions::can($task, $view)) {
             return false;
         }
         // only link to own entries or same vendor id
         if ($vendorId) {
             if ($vendorId != $vendor) {
                 return false;
             }
         } elseif ($created_by != $user_id) {
             return false;
         }
     }
     return true;
 }
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:31,代码来源:vmview.php

示例4: getCurrenciesList

 /**
  * Retireve a list of currencies from the database.
  * This function is used in the backend for the currency listing, therefore no asking if enabled or not
  * @author Max Milbers
  * @return object List of currency objects
  */
 function getCurrenciesList($search, $vendorId = 1)
 {
     $where = array();
     // 		$this->_query = 'SELECT * FROM `#__virtuemart_currencies` ';
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (!Permissions::getInstance()->check('admin')) {
         $where[] = '(`virtuemart_vendor_id` = "' . (int) $vendorId . '" OR `shared`="1")';
     }
     if (empty($search)) {
         $search = JRequest::getString('search', false);
     }
     /* add filters */
     if ($search) {
         $search = '"%' . $this->_db->getEscaped($search, true) . '%"';
         //$search = $this->_db->Quote($search, false);
         $where[] = '`currency_name` LIKE ' . $search . ' OR `currency_code_2` LIKE ' . $search . ' OR `currency_code_3` LIKE ' . $search;
     }
     // 		if (JRequest::getString('search', false)) $where[] = '`currency_name` LIKE "%'.$this->_db->getEscaped(JRequest::getString('search')).'%"';
     $whereString = '';
     if (count($where) > 0) {
         $whereString = ' WHERE ' . implode(' AND ', $where);
     }
     // 		if (count($where) > 0) $this->_query .= ' WHERE '.implode(' AND ', $where) ;
     // 		$this->_query .= $this->_getOrdering('currency_name');
     // 		$this->_data = $this->_getList($this->_query, $this->getState('limitstart'), $this->getState('limit'));
     // 		$this->_total = $this->_getListCount($this->_query) ;
     // 		$object, $select, $joinedTables, $whereString = '', $groupBy = '', $orderBy = '', $filter_order_Dir = '', $nbrReturnProducts = false
     $this->_data = $this->exeSortSearchListQuery(0, '*', ' FROM `#__virtuemart_currencies`', $whereString, '', $this->_getOrdering());
     return $this->_data;
     // 		return $this->_data;
 }
开发者ID:Gskflute,项目名称:joomla25,代码行数:39,代码来源:currency.php

示例5: display

 function display($tpl = null)
 {
     // Load the helper(s)
     $this->addHelperPath(JPATH_VM_ADMINISTRATOR . DS . 'helpers');
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (!class_exists('VmHTML')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('vmPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmplugin.php';
     }
     $this->assignRef('perms', Permissions::getInstance());
     $model = VmModel::getModel('paymentmethod');
     //@todo should be depended by loggedVendor
     //		$vendorId=1;
     //		$this->assignRef('vendorId', $vendorId);
     // TODO logo
     $this->SetViewTitle();
     $layoutName = JRequest::getWord('layout', 'default');
     $vendorModel = VmModel::getModel('vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $currencyModel = VmModel::getModel('currency');
     $currencyModel = $currencyModel->getCurrency($vendor->vendor_currency);
     $this->assignRef('vendor_currency', $currencyModel->currency_symbol);
     if ($layoutName == 'edit') {
         // Load the helper(s)
         if (!class_exists('VmImage')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'image.php';
         }
         if (!class_exists('vmParameters')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'parameterparser.php';
         }
         $payment = $model->getPayment();
         $this->assignRef('payment', $payment);
         $this->assignRef('vmPPaymentList', self::renderInstalledPaymentPlugins($payment->payment_jplugin_id));
         //			$this->assignRef('PaymentTypeList',self::renderPaymentRadioList($paym->payment_type));
         //			$this->assignRef('creditCardList',self::renderCreditCardRadioList($paym->payment_creditcards));
         //			echo 'humpf <pre>'.print_r($paym).'</pre>' ;
         //$this->assignRef('creditCardList',ShopFunctions::renderCreditCardList($paym->payment_creditcards,true));
         $this->assignRef('shopperGroupList', ShopFunctions::renderShopperGroupList($payment->virtuemart_shoppergroup_ids, true));
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $vendorList = ShopFunctions::renderVendorList($payment->virtuemart_vendor_id);
             $this->assignRef('vendorList', $vendorList);
         }
         $this->addStandardEditViewCommands($payment->virtuemart_paymentmethod_id);
     } else {
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model);
         $payments = $model->getPayments();
         $this->assignRef('payments', $payments);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
开发者ID:Arturogcalleja,项目名称:herbolario,代码行数:58,代码来源:view.html.php

示例6: display

 public function display($tpl = null)
 {
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $session = JFactory::getSession();
     $cmp = $session->get('compare', '');
     $listpid = explode(",", $cmp);
     if (empty($cmp)) {
         $valid = 0;
         $this->assignRef('valid', $valid);
         //$app =& JFactory::getApplication();
         //$app->enqueueMessage('Your Wishlist is Empty Please Add any product to Wishlist', 'error');
         //$app->redirect('index.php');
         //exit;
     } else {
         $valid = 1;
         $this->assignRef('valid', $valid);
         $this->assignRef('wids', $wids);
         $productModel = VmModel::getModel('product');
         $products = $productModel->getProducts($listpid);
         //echo "<pre>";
         //print_r($wishlist);
         //exit;
         $productModel->addImages($products, 1);
         $this->assignRef('products', $products);
         foreach ($products as $product) {
             $product->stock = $productModel->getStockIndicator($product);
         }
         $show_prices = VmConfig::get('show_prices', 1);
         if ($show_prices == '1') {
             if (!class_exists('calculationHelper')) {
                 require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
             }
         }
         $this->assignRef('show_prices', $show_prices);
         if (!class_exists('Permissions')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
         }
         $showBasePrice = Permissions::getInstance()->check('admin');
         //todo add config settings
         $this->assignRef('showBasePrice', $showBasePrice);
         $currency = CurrencyDisplay::getInstance();
         $this->assignRef('currency', $currency);
         $pagination = $productModel->getPagination(3);
         $this->assignRef('vmPagination', $pagination);
         /*** rating ***/
         $ratingModel = VmModel::getModel('ratings');
         $showRating = $ratingModel->showRating($product->virtuemart_product_id);
         $this->assignRef('showRating', $showRating);
         if ($showRating) {
             $vote = $ratingModel->getVoteByProduct($product->virtuemart_product_id);
             $this->assignRef('vote', $vote);
             $rating = $ratingModel->getRatingByProduct($product->virtuemart_product_id);
             $this->assignRef('rating', $rating);
         }
     }
     parent::display($tpl);
 }
开发者ID:sergy444,项目名称:joomla,代码行数:58,代码来源:view.html.php

示例7: display

 function display($tpl = null)
 {
     // Load the helper(s)
     $this->loadHelper('permissions');
     $this->loadHelper('html');
     if (!class_exists('vmPlugin')) {
         require JPATH_VM_PLUGINS . DS . 'vmplugin.php';
     }
     $this->perms = Permissions::getInstance();
     $model = VmModel::getModel('paymentmethod');
     //@todo should be depended by loggedVendor
     //		$vendorId=1;
     //		$this->assignRef('vendorId', $vendorId);
     $vendorModel = VmModel::getModel('vendor');
     $vendorModel->setId(1);
     $vendor = $vendorModel->getVendor();
     $currencyModel = VmModel::getModel('currency');
     $currencyModel->setId($vendor->vendor_currency);
     $currency = $currencyModel->getData();
     $this->vendor_currency = $currency->currency_symbol;
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         // Load the helper(s)
         $this->loadHelper('image');
         // jimport('joomla.html.pane');
         $this->payment = $model->getPayment();
         // $this->vmPPaymentList = self::InstalledPaymentPlgSelectList($payment->payment_jplugin_id);
         //			$this->assignRef('PaymentTypeList',self::renderPaymentRadioList($paym->payment_type));
         //			$this->assignRef('creditCardList',self::renderCreditCardRadioList($paym->payment_creditcards));
         //			echo 'humpf <pre>'.print_r($paym).'</pre>' ;
         //$this->assignRef('creditCardList',ShopFunctions::renderCreditCardList($paym->payment_creditcards,true));
         $this->shopperGroupList = ShopFunctions::renderShopperGroupList($this->payment->virtuemart_shoppergroup_ids, true);
         if (Vmconfig::get('multix', 'none') !== 'none') {
             $this->vendorList = ShopFunctions::renderVendorList($this->payment->virtuemart_vendor_id);
         }
         // TODO logo
         $this->SetViewTitle('', $this->payment->payment_name);
         $this->addStandardEditViewCommands($this->payment->virtuemart_paymentmethod_id);
     } else {
         if (JRequest::getWord('format', '') === 'raw') {
             $tpl = 'results';
         } else {
             $this->SetViewTitle();
             $this->addStandardDefaultViewCommands();
             // know payment list
             $this->installedPayments = $this->PaymentPlgList();
         }
         $this->addStandardDefaultViewLists($model);
         $this->payments = $model->getPayments();
         $this->pagination = $model->getPagination();
     }
     parent::display($tpl);
     if ($tpl === 'results') {
         echo $this->AjaxScripts();
     }
 }
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:56,代码来源:view.html.php

示例8: checkPermissionForTools

	/**
	 * Call at begin of every task to check if the permission is high enough.
	 * Atm the standard is at least vm admin
	 * @author Max Milbers
	 */
	private function checkPermissionForTools(){
		//Hardcore Block, we may do that better later
		if(!class_exists('Permissions'))
		require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php');
		if(!Permissions::getInstance()->check('admin')){
			$msg = 'Forget IT';
			$this->setRedirect('index.php?option=com_virtuemart', $msg);
		}

		return true;
	}
开发者ID:rubengarcia0510,项目名称:tienda,代码行数:16,代码来源:updatesmigration.php

示例9: save

 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 function save($data = 0)
 {
     $data = JRequest::get('post');
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (Permissions::getInstance()->check('admin')) {
         $data['product_desc'] = JRequest::getVar('product_desc', '', 'post', 'STRING', 2);
         $data['product_s_desc'] = JRequest::getVar('product_s_desc', '', 'post', 'STRING', 2);
     }
     parent::save($data);
 }
开发者ID:rubengarcia0510,项目名称:tienda,代码行数:17,代码来源:product.php

示例10: synchronizeMedia

 function synchronizeMedia()
 {
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (!Permissions::getInstance()->check('admin')) {
         $msg = 'Forget IT';
         $this->setRedirect('index.php?option=com_virtuemart', $msg);
     }
     if (!class_exists('Migrator')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'migrator.php';
     }
     $migrator = new Migrator();
     $result = $migrator->portMedia();
     $this->setRedirect($this->redirectPath, $result);
 }
开发者ID:Gskflute,项目名称:joomla25,代码行数:16,代码来源:media.php

示例11: smarty_block_userHasPermission

/**
 * Smarty {userHasPermission} block plugin
 *
 * Type:     block<br>
 * Name:     userHasPermission<br>
 * Purpose: Outputs $content if user has permission
 * Useage:  {userHasPermission controller='foo' action='bar'}you have permission{/userHasPermission}
 * @author Nathan Gardner <nathan@factory8.com>
 */
function smarty_block_userHasPermission(&$params, $content, &$smarty, &$repeat)
{
    if (!empty($params['controller']) && !empty($params['action'])) {
        $objPermissions = Permissions::getInstance();
        $objAuth = Authentication::getInstance();
        $user_id = $objAuth->user_id;
        $isAllowed = $objPermissions->actionAllowed($params['controller'], $params['action'], $user_id);
        if ($isAllowed) {
            return $content;
        } else {
            return false;
        }
    } else {
        echo 'Must pass controller and action to do permission check.';
    }
}
开发者ID:ngardner,项目名称:BentoCMS,代码行数:25,代码来源:block.userHasPermission.php

示例12: display

 function display($tpl = null)
 {
     $this->loadHelper('html');
     $this->loadHelper('permissions');
     //@todo should be depended by loggedVendor
     $vendorId = 1;
     $this->assignRef('vendorId', $vendorId);
     // TODO add icon for media view
     $this->SetViewTitle();
     $model = VmModel::getModel();
     $perms = Permissions::getInstance();
     $this->assignRef('perms', $perms);
     $layoutName = JRequest::getWord('layout', 'default');
     if ($layoutName == 'edit') {
         $media = $model->getFile();
         $this->assignRef('media', $media);
         $isNew = $media->virtuemart_media_id < 1;
         /*			if ($isNew) {
         				if(!Permissions::getInstance()->check('admin')) {
         					$usermodel = VmModel::getModel('user');
         // 					$usermodel->setCurrent();
         					$userDetails = $usermodel->getUser();
         					if(empty($userDetails->virtuemart_vendor_id)){
         						JError::raiseError(403,'Forbidden for non vendors');
         					}
         				} else $media->virtuemart_vendor_id = 1;
         				if(empty($media->virtuemart_vendor_id))$media->virtuemart_vendor_id = $userDetails->virtuemart_vendor_id;
         			}
         */
         $this->addStandardEditViewCommands();
     } else {
         $virtuemart_product_id = JRequest::getInt('virtuemart_product_id', 0);
         $cat_id = JRequest::getInt('virtuemart_category_id', 0);
         JToolBarHelper::customX('synchronizeMedia', 'new', 'new', JText::_('COM_VIRTUEMART_TOOLS_SYNC_MEDIA_FILES'), false);
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, null, null, 'searchMedia');
         $options = array('' => JText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'product' => JText::_('COM_VIRTUEMART_PRODUCT'), 'category' => JText::_('COM_VIRTUEMART_CATEGORY'), 'manufacturer' => JText::_('COM_VIRTUEMART_MANUFACTURER'), 'vendor' => JText::_('COM_VIRTUEMART_VENDOR'));
         $this->lists['search_type'] = VmHTML::selectList('search_type', JRequest::getVar('search_type'), $options, 1, '', 'onchange="this.form.submit();"');
         $files = $model->getFiles(false, false, $virtuemart_product_id, $cat_id);
         $this->assignRef('files', $files);
         $pagination = $model->getPagination();
         $this->assignRef('pagination', $pagination);
     }
     parent::display($tpl);
 }
开发者ID:rubengarcia0510,项目名称:tienda,代码行数:45,代码来源:view.html.php

示例13: isSuperVendor

 public static function isSuperVendor()
 {
     if (JVM_VERSION <= 2) {
         if (!class_exists('Permissions')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
         }
         if (Permissions::getInstance()->check("admin,storeadmin")) {
             return true;
         }
     } else {
         $text = '';
         $user = JFactory::getUser();
         if ($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart') or VmConfig::isSuperVendor()) {
             return true;
         }
     }
     return false;
 }
开发者ID:aldegtyarev,项目名称:stelsvelo,代码行数:18,代码来源:mini.php

示例14: getProductListing

 /**
  * Method to get a list of products.
  * Overriddes the the function defined in the com_virtuemart/models/product.php.
  *
  * @author	Sakis Terz
  * @return	mixed	An array of data items on success, false on failure.
  * @since	1.0
  */
 public function getProductListing($group = false, $nbrReturnProducts = false, $withCalc = true, $onlyPublished = true, $single = false)
 {
     $front = true;
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (!Permissions::getInstance()->check('admin', 'storeadmin')) {
         $onlyPublished = true;
         if ($show_prices = VmConfig::get('show_prices', 1) == '0') {
             $withCalc = false;
         }
     }
     //get the published custom filters
     $this->published_cf = $this->getPublishedCustomfilters();
     $ids = $this->sortSearchListQuery($onlyPublished, $vmcat = false, $group, $nbrReturnProducts);
     $products = $this->getProducts($ids, $front, $withCalc, $onlyPublished, $single);
     return $products;
 }
开发者ID:alesconti,项目名称:FF_2015,代码行数:26,代码来源:products.php

示例15: save

 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 function save($data = 0)
 {
     if ($data === 0) {
         $data = JRequest::get('post');
     }
     $data['product_desc'] = $this->filterText('product_desc');
     $data['product_s_desc'] = $this->filterText('product_s_desc');
     if (!class_exists('Permissions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'permissions.php';
     }
     if (Permissions::getInstance()->isSuperVendor() != 1) {
         $multix = Vmconfig::get('multix', 'none');
         if ($multix != 'none') {
             unset($data['childs']);
         }
     }
     return parent::save($data);
 }
开发者ID:denis1001,项目名称:Virtuemart-2-Joomla-3-Bootstrap,代码行数:23,代码来源:product.php


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