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


PHP cmsFramework::getUser方法代码示例

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


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

示例1: addFavorite

 function addFavorite($results)
 {
     $listing_ids = array_keys($results);
     if (!isset($this->Config)) {
         App::import('Component', 'config', 'jreviews');
         $this->Config = ClassRegistry::getClass('ConfigComponent');
     }
     if ($this->Config->favorites_enable) {
         # Get favoured count
         $query = "\n                SELECT \n                    content_id AS listing_id, count(*) AS favored FROM #__jreviews_favorites AS Favorite\n\t\t\t    WHERE \n                    Favorite.content_id IN (" . implode(',', $listing_ids) . ")\n\t\t\t    GROUP BY \n                    listing_id\n            ";
         $this->_db->setQuery($query);
         $favored = $this->_db->loadAssocList('listing_id');
         # Check if in user's favorites list
         $User =& cmsFramework::getUser();
         if ($User->id) {
             $query = "\n                    SELECT \n                        Favorite.user_id, Favorite.content_id AS listing_id\n\t\t\t\t    FROM \n                        #__jreviews_favorites AS Favorite\n\t\t\t\t    WHERE \n                        Favorite.content_id IN (" . implode(',', $listing_ids) . ")\n\t\t\t\t        AND Favorite.user_id = " . $User->id;
             $this->_db->setQuery($query);
             $my_favorite = $this->_db->loadAssocList('listing_id');
         }
         foreach ($results as $key => $result) {
             if (isset($favored[$result['Listing']['listing_id']]['favored'])) {
                 $results[$key]['Favorite']['favored'] = $favored[$result['Listing']['listing_id']]['favored'];
             } else {
                 $results[$key]['Favorite']['favored'] = 0;
             }
             if (isset($my_favorite[$result['Listing']['listing_id']]['user_id'])) {
                 $results[$key]['Favorite']['my_favorite'] = 1;
             } else {
                 $results[$key]['Favorite']['my_favorite'] = 0;
             }
         }
     }
     return $results;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:34,代码来源:favorite.php

示例2: reviewVoting

 function reviewVoting($review)
 {
     $review_id = $review['Review']['review_id'];
     $User = cmsFramework::getUser();
     $output = '<div class="reviewHelpful">';
     $output .= '<div class="jrHelpfulTitle">' . __t("Was this review helpful to you?", true) . '&nbsp;</div>';
     $output .= '<div id="jr_reviewVote' . $review_id . '" style="float:left;">';
     if ($this->Access->canVoteHelpful($review['User']['user_id'])) {
         $output .= '<span class="jrVote jrButton" onclick="jreviews.review.voteYes(this,{review_id:' . $review_id . '})">';
     } elseif ($User->id > 0) {
         $output .= '<span class="jrVote jrButton" onclick="s2Alert(\'' . __t("You are not allowed to vote", true, true) . '\');">';
     } else {
         $output .= '<span class="jrVote jrButton" onclick="s2Alert(\'' . __t("Login or register to vote", true, true) . '\');">';
     }
     $output .= '<span class="jrButtonText" style="color: green;">' . $review['Vote']['yes'] . '</span><span class="jrIcon jrIconThumbUp"></span>';
     $output .= '</span>';
     if ($this->Access->canVoteHelpful($review['User']['user_id'])) {
         $output .= '<span class="jrVote jrButton" onclick="jreviews.review.voteNo(this,{review_id:' . $review_id . '})">';
     } elseif ($User->id > 0) {
         $output .= '<span class="jrVote jrButton" onclick="s2Alert(\'' . __t("You are not allowed to vote", true, true) . '\');">';
     } else {
         $output .= '<span class="jrVote jrButton" onclick="s2Alert(\'' . __t("Login or register to vote", true, true) . '\');">';
     }
     $output .= '<span class="jrButtonText" style="color: red;">' . $review['Vote']['no'] . '</span><span class="jrIcon jrIconThumbDown"></span>';
     $output .= '</span>';
     $output .= '<span class="jr_loadingSmall jr_hidden"></span>';
     $output .= '</div>';
     $output .= '</div>';
     return $output;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:30,代码来源:widgets.php

示例3: init

 function init(&$Config)
 {
     if (!isset($this->_user)) {
         $this->_user =& cmsFramework::getUser();
     }
     $this->Config =& $Config;
     $this->gid = $this->getGroupId($this->_user->id);
     Configure::write('JreviewsSystem.Access', $this);
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:9,代码来源:access.php

示例4: __construct

 function __construct()
 {
     parent::__construct();
     $User =& cmsFramework::getUser();
     // Used in MyReviews page to differentiate from other component reviews
     $this->tag = __t("MYBLOG_TAG", true);
     // Uncomment line below to show tag in My Reviews page
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
     // Set default WHERE statement
     $this->conditions = array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )', '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )', 'Listing.catid > 0');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:11,代码来源:everywhere_com_myblog.php

示例5: __construct

 function __construct()
 {
     parent::__construct();
     $User =& cmsFramework::getUser();
     // Used in MyReviews page to differentiate from other component reviews
     $this->tag = __t("MYBLOG_TAG", true);
     // Uncomment line below to show tag in My Reviews page
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
     // Set default WHERE statement
     $this->conditions = array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )', '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )', 'Listing.catid > 0');
     if (!defined('MVC_FRAMEWORK_ADMIN')) {
         # Shows only links users can access
         $Access = Configure::read('JreviewsSystem.Access');
         if ($this->cmsVersion == CMS_JOOMLA15) {
             $this->conditions[] = 'Listing.access <= ' . $User->gid;
         } else {
             $this->conditions[] = 'Listing.access IN ( ' . $Access->getAccessLevels() . ')';
         }
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:20,代码来源:everywhere_com_myblog.php

示例6: favorite

 function favorite($listing)
 {
     $output = '';
     $listing_id = $listing['Listing']['listing_id'];
     $User = cmsFramework::getUser();
     $output .= '<span class="jrFavoriteWidget" title="' . __t("Favorites", true) . '">';
     $output .= '<span class="jrIcon jrIconFavorites"></span>';
     $output .= '<span id="jr_favoriteCount' . $listing_id . '">' . $listing['Favorite']['favored'] . '</span>';
     $output .= '</span>';
     if ($listing['Favorite']['my_favorite']) {
         // Already in user's favorites
         $output .= '<span id="jr_favoriteImg' . $listing_id . '" class="jrFavoriteButton jrButton" title="' . __t("Remove from favorites", true) . '" onclick="jreviews.favorite.remove(this,{listing_id:' . $listing_id . '})">' . __t("Remove", true) . '</span>';
     } elseif ($User->id) {
         // Not in user's favorites
         $output .= '<span id="jr_favoriteImg' . $listing_id . '" class="jrFavoriteButton jrButton" title="' . __t("Add to favorites", true) . '" onclick="jreviews.favorite.add(this,{listing_id:' . $listing_id . '})">' . __t("Add", true) . '</span>';
     } else {
         // This is a guest user, needs to register to use the favorites widget
         $output .= '<span id="jr_favoriteImg' . $listing_id . '" class="jrFavoriteButton jrButton" title="' . __t("Add to favorites", true) . '" onclick="s2Alert(\'' . __t("Register to add this entry to your favorites", true) . '\');">' . __t("Add", true) . '</span>';
     }
     return $output;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:21,代码来源:widgets.php

示例7: beforeFilter

 function beforeFilter()
 {
     # These should be called in each controller where they are required instead of globally
     $this->_db = cmsFramework::getDB();
     $this->_user = cmsFramework::getUser();
     # Overcome host restrictions
     $query = "SET SQL_BIG_SELECTS=1";
     $this->_db->setQuery($query);
     $this->_db->query();
     # Fix Joomla bug when language filter is active with default language code hidden in url
     if (isset($this->params['lang'])) {
         $this->params['lang'] = cmsFramework::getUrlLanguageCode();
     }
     # Init Access
     if (isset($this->Access)) {
         $this->Access->init($this->Config);
     }
     App::import('Component', 'theming', 'jreviews');
     $this->Theming = ClassRegistry::getClass('ThemingComponent');
     $this->Theming->startup($this);
     # Set pagination vars
     // First check url, then menu parameter. Otherwise the limit list in pagination doesn't respond b/c menu params always wins
     $this->limit = Sanitize::getInt($this->params, 'limit', Sanitize::getInt($this->data, 'limit_special', Sanitize::getInt($this->data, 'limit')));
     //		$this->passedArgs['limit'] = $this->limit;
     $this->page = Sanitize::getInt($this->data, 'page', Sanitize::getInt($this->params, 'page', 1));
     if (!$this->limit) {
         if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->user_limit);
             $this->params['default_limit'] = $this->Config->user_limit;
         } else {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->list_limit);
             $this->params['default_limit'] = $this->Config->list_limit;
         }
     }
     if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
         $this->params['default_limit'] = $this->Config->user_limit;
     } else {
         $this->params['default_limit'] = $this->Config->list_limit;
     }
     // Set a hard code limit to prevent abuse
     $this->limit = max(min($this->limit, 50), 1);
     // Need to normalize the limit var for modules
     if (isset($this->params['module'])) {
         $module_limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Required further below for Community Model init
     if (!isset($this->Menu)) {
         App::import('Model', 'menu', 'jreviews');
         $this->Menu = ClassRegistry::getClass('MenuModel');
     }
     if (!$this->ajaxRequest) {
         if (!($menu_id = Configure::read('_public_menu_id'))) {
             # Find and set one public Itemid to use for Ajax requests
             $menu_id = '';
             $menu_id = $this->Menu->get('jreviews_public');
             $menu_id = $menu_id != '' ? $menu_id : 99999;
             Configure::write('_public_menu_id', $menu_id);
         }
         if (!($search_itemid = Configure::read('_search_itemid'))) {
             // Set search menu Itemid used in several of the controllers
             $option = Sanitize::getString($this->params, 'option');
             $auto_itemid = Sanitize::getBool($this->Config, 'search_itemid', false);
             $hc_itemid = Sanitize::getInt($this->Config, 'search_itemid_hc', '');
             $search_menuid = $this->Menu->get('jr_advsearch');
             $search_itemid = '';
             switch ($option) {
                 case 'com_jreviews':
                     // page Itemid is enabled
                     if (!$auto_itemid && $hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } elseif (!$auto_itemid & $search_menuid > 0) {
                         $search_itemid = $search_menuid;
                     }
                     break;
                 default:
                     // Non-JReviews pages - can't use current page Itemid
                     if ($hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } else {
                         $search_itemid = $search_menuid;
                     }
                     break;
             }
             $search_itemid == '' and $option == 'com_jreviews' and $search_itemid = Sanitize::getString($this->params, 'Itemid');
             Configure::write('_search_itemid', $search_itemid);
         }
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:my_controller.php

示例8: array

global $Itemid;
$url = Sanitize::getString($_REQUEST, 'url');
$menu_id = Sanitize::getInt($_REQUEST, 'Itemid', $Itemid);
$menu_id = $menu_id == 99999999 ? null : $menu_id;
$menu_params = array();
# Check if this is a custom route
$route['url']['url'] = $url;
$route = S2Router::parse($route, false, 'jreviews');
/*******************************************************************
 *                         ADMIN ROUTING
 ******************************************************************/
if (defined('MVC_FRAMEWORK_ADMIN')) {
    // Ensure user has access to this function
    switch (getCmsVersion()) {
        case 'CMS_JOOMLA15':
            $User =& cmsFramework::getUser();
            $Acl =& cmsFramework::getACL();
            if ($Acl->acl_check('administration', 'manage', 'users', $User->usertype, 'components', S2Paths::get('jreviews', 'S2_CMSCOMP'))) {
                cmsFramework::redirect('index.php', JText::_('ALERTNOTAUTH'));
            }
            break;
        case 'CMS_JOOMLA16':
            if (!JFactory::getUser()->authorise('core.manage', S2Paths::get('jreviews', 'S2_CMSCOMP'))) {
                return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
            }
            break;
        default:
            die('Not authorized');
            break;
    }
    // Controller routing
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:index.php

示例9: Categories

    function Categories()
    {
        $assets = array('js' => array('jreviews', 'jquery', 'jreviews.compare', 'jq.ui.core', 'jq.json', 'jq.jsoncookie', 'jq.scrollable', 'jq.tooltip'), 'css' => array('theme', 'theme.list', 'paginator', 'jq.ui.core'));
        $User = cmsFramework::getUser();
        $User->id > 0 and array_push($assets['js'], 'jq.jreviews.plugins');
        ?>

        <script type="text/javascript">     
        /* <![CDATA[ */
        jQuery(document).ready(function() {                                                 
            jreviewsCompare.set({
                'numberOfListingsPerPage':<?php 
        echo Sanitize::getInt($this->Config, 'list_compare_columns', 3);
        ?>
,
				'maxNumberOfListings' : 15,
                'compareURL':'<?php 
        echo cmsFramework::route('index.php?option=com_jreviews&url=categories/compare/type:type_id/');
        ?>
'
            });
            <?php 
        if ($this->action == 'compare') {
            ?>
jreviewsCompare.initComparePage();<?php 
        }
        ?>
    
            jreviewsCompare.initCompareDashboard();
            <?php 
        if ($this->action != 'compare') {
            ?>
jreviewsCompare.initListingsSelection();<?php 
        }
        ?>
        });
        /* ]]> */
        </script>   
       
		<?php 
        $this->send($assets);
    }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:42,代码来源:assets.php

示例10: save

 function save(&$data, $Access, $validFields = array())
 {
     $Config = Configure::read('JreviewsSystem.Config');
     $User =& cmsFramework::getUser();
     $userid = $User->id;
     $this->valid_fields = $validFields;
     # Check if this is a new review or an updated review
     $isNew = (int) $data['Review']['id'] > 0 ? false : true;
     $review_id = (int) $data['Review']['id'];
     $output = array("err" => '', "reviewid" => '', "author" => 0);
     # If new then assign the logged in user info. Zero if it's a guest
     if ($isNew) {
         # Validation passed, so proceed with saving review to DB
         $data['Review']['ipaddress'] = s2GetIpAddress();
         $data['Review']['userid'] = $userid;
         $data['Review']['created'] = gmdate('Y-m-d H:i:s');
     }
     # Edited review
     if (!$isNew) {
         appLogMessage('*********Load current info because we are editing the review', 'database');
         // Load the review info
         $row = $this->findRow(array('fields' => array('Rating.rating_id AS `Rating.rating_id`'), 'conditions' => array('Review.id = ' . $review_id)), array());
         $data['ratings_col_empty'] = !Sanitize::getInt($row['Rating'], 'rating_id') && Sanitize::getString($row['Rating'], 'ratings', '') == '';
         // Used in afterFind
         // Capture ip address of reviewer
         if ($userid == $row['User']['user_id']) {
             $data['Review']['ipaddress'] = s2GetIpAddress();
         }
         $data['Review']['modified'] = gmdate('Y-m-d H:i:s');
         // Capture last modified date
         $data['Review']['author'] = $row['Review']['editor'];
     }
     # Complete user info for new reviews
     if ($isNew && $userid > 0) {
         $data['Review']['name'] = $User->name;
         $data['Review']['username'] = $User->username;
         $data['Review']['email'] = $User->email;
     } elseif (!$isNew && !$Access->isManager()) {
         unset($data['Review']['name']);
         unset($data['Review']['username']);
         unset($data['Review']['email']);
     }
     if (!defined('MVC_FRAMEWORK_ADMIN')) {
         $data['Review']['published'] = (int) (!($Access->moderateReview() && $isNew && !$data['Review']['author'] || $Config->moderation_editor_reviews && $isNew && $data['Review']['author'] || $Access->moderateReview() && $Config->moderation_review_edit && !$isNew && !$data['Review']['author'] || $Access->moderateReview() && $Config->moderation_editor_review_edit && !$isNew && $data['Review']['author']));
     }
     # Get criteria info    to process ratings
     appLogMessage('*******Get criteria info to process ratings', 'database');
     $CriteriaModel = ClassRegistry::getClass('CriteriaModel');
     $criteria = $CriteriaModel->findRow(array('conditions' => array('Criteria.id = ' . $data['Criteria']['id'])));
     // Complete review info with $criteria info
     $data = array_insert($data, $criteria);
     $data['new'] = $isNew ? 1 : 0;
     # Save standard review fields
     appLogMessage('*******Save standard review fields', 'database');
     $save = $this->store($data);
     if (!$save) {
         appLogMessage('*******There was a problem saving the review fields', 'database');
         $output['err'] = "There was a problem saving the review fields";
     }
     return $output;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:61,代码来源:review.php

示例11: afterFilter

 function afterFilter()
 {
     if (!class_exists('AssetsHelper')) {
         App::import('Helper', 'assets', 'jreviews');
     }
     $Assets = ClassRegistry::getClass('AssetsHelper');
     // Need to override name and action because using $this->requestAction in theme files replaces the original values (i.e. related listings prevents detail page js/css from loading)
     $Assets->name = $this->name;
     $Assets->action = $this->action;
     $Assets->params = $this->params;
     $Assets->viewVars =& $this->viewVars;
     if (!isset($Assets->Access)) {
         if (!isset($this->Access)) {
             App::import('Component', 'access', 'jreviews');
             $Access = new AccessComponent();
             if (!is_object($this->_user)) {
                 $User =& cmsFramework::getUser();
             } else {
                 $User = $this->_user;
             }
             $Access->gid = $Access->getGroupId($User->id);
             $Assets->Access =& $Access;
         } else {
             $Assets->Access =& $this->Access;
         }
     }
     if (!isset($Assets->Config)) {
         if (!isset($this->Config)) {
             $Assets->Config = Configure::write('JreviewsSystem.Config');
         } else {
             $Assets->Config =& $this->Config;
         }
     }
     // Can't use this in ajax requests because it's output outside the json response and breaks it
     if (!$this->ajaxRequest) {
         if (!empty($this->assets)) {
             $Assets->assets = $this->assets;
         }
         $Assets->load();
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:41,代码来源:my_controller.php

示例12: cached

 /**
  * Outputs cached dispatch view cache
  *
  * @param string $url Requested URL
  * @access public
  */
 function cached($url)
 {
     App::import('Component', 'config', $this->app);
     $controller = new stdClass();
     if (class_exists('ConfigComponent')) {
         $Config = new ConfigComponent();
         $Config->startup($controller);
     }
     $User = cmsFramework::getUser();
     if ($User->id === 0 && !Configure::read('Cache.disable') && Configure::read('Cache.view') && !defined('MVC_FRAMEWORK_ADMIN')) {
         $path = $this->here;
         if ($this->here == '/') {
             $path = 'home';
         }
         $path = Inflector::slug($path);
         $filename = CACHE . 'views' . DS . $path . '.php';
         if (!file_exists($filename)) {
             $filename = CACHE . 'views' . DS . $path . '_index.php';
         }
         if (file_exists($filename)) {
             if (!class_exists('MyView')) {
                 App::import('Core', 'View', $this->app);
             }
             $controller = null;
             $view = new MyView($controller, false);
             // Pass the configuration object to the view and set the theme variable for helpers
             $view->name = $this->controller;
             $view->action = $this->action;
             $view->page = Sanitize::getInt($this->params, 'page');
             $view->limit = Sanitize::getInt($this->params, 'limit');
             $view->Config = $Config;
             $view->viewTheme = $Config->template;
             $view->xajaxRequest = false;
             $view->ajaxRequest = $this->isAjax();
             $out = $view->renderCache($filename, S2getMicrotime());
             return $out;
         }
     }
     return false;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:46,代码来源:dispatcher.php


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