本文整理汇总了PHP中CBLib\Application\Application::MyUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::MyUser方法的具体用法?PHP Application::MyUser怎么用?PHP Application::MyUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBLib\Application\Application
的用法示例。
在下文中一共展示了Application::MyUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadEnabledAccounts
/**
* Loads all (published) plans from database in a way which is ordered as a tree
*
* @param int $owner reflecting the user needing to see plan (NULL: means all plans)
* @param boolean $enabled TRUE if to load only published plans
* @param array $currency Currency of payment that must be accepted
* @return cbpaidGatewayAccount[]
*/
public function loadEnabledAccounts($owner = 0, $enabled = true, $currency = null)
{
static $_objects = array();
if (!isset($_objects[$enabled][$owner])) {
$sql = "SELECT a.* FROM `" . $this->_tbl . "` AS a";
$where = array();
if ($enabled) {
$where[] = "a.enabled > 0";
}
if ($owner !== null) {
$where[] = "a.owner = " . (int) $owner;
}
$where[] = "a.viewaccesslevel IN " . $this->_db->safeArrayOfIntegers(Application::MyUser()->getAuthorisedViewLevels());
if (count($where) > 0) {
$sql .= "\n WHERE " . implode(" AND ", $where);
}
$sql .= "\n ORDER BY a.`ordering` ASC";
$this->_db->setQuery($sql);
$_objects[$enabled][$owner] = $this->_loadTrueObjects($this->_tbl_key);
}
if ($currency) {
// A currency has been specified: we need to filter available gateways by their list of accepted currencies:
$acts = array();
foreach ($_objects[$enabled][$owner] as $k => $v) {
/** @noinspection PhpUndefinedMethodInspection */
if ($_objects[$enabled][$owner][$k]->acceptsCurrency($currency)) {
$acts[] = $_objects[$enabled][$owner][$k];
}
}
return $acts;
} else {
return $_objects[$enabled][$owner];
}
}
示例2: canAjax
private function canAjax( &$field, &$user, $output, $reason, $ignoreEmpty = false )
{
global $_CB_framework, $ueConfig;
if ( ( $_CB_framework->getUi() == 1 ) && ( $output == 'html' ) && ( $reason == 'profile' ) && ( $field instanceof FieldTable ) && ( $user instanceof UserTable ) ) {
if ( ! ( $field->params instanceof ParamsInterface ) ) {
$params = new Registry( $field->params );
} else {
$params = $field->params;
}
$value = $user->get( $field->get( 'name' ) );
$notEmpty = ( ( ! ( ( $value === null ) || ( $value === '' ) ) ) || $ueConfig['showEmptyFields'] || cbReplaceVars( CBTxt::T( $field->params->get( 'ajax_placeholder' ) ), $user ) );
$readOnly = $field->get( 'readonly' );
if ( $field->get( 'name' ) == 'username' ) {
if ( ! $ueConfig['usernameedit'] ) {
$readOnly = true;
}
}
if ( ( ! $field->get( '_noAjax', false ) ) && ( ! $readOnly ) && ( $notEmpty || $ignoreEmpty )
&& $params->get( 'ajax_profile', 0 ) && Application::MyUser()->canViewAccessLevel( (int) $params->get( 'ajax_profile_access', 2 ) )
&& ( ! cbCheckIfUserCanPerformUserTask( $user->get( 'id' ), 'allowModeratorsUserEdit' ) )
) {
return true;
}
}
return false;
}
示例3: getCBpluginComponent
/**
* @param null $tab
* @param UserTable $user
* @param int $ui
* @param array $postdata
*/
public function getCBpluginComponent($tab, $user, $ui, $postdata)
{
global $_CB_framework, $_PLUGINS, $_CB_PMS;
cbSpoofCheck('plugin');
$id = $this->input('id', null, GetterInterface::INT);
$user = CBuser::getMyUserDataInstance();
if (!$id) {
cbRedirect($_CB_framework->userProfileUrl($user->get('id'), false, 'getmypmsproTab'), CBTxt::T('SEND_PMS_MISSING_TO_USER', 'Private message failed to send! Error: Missing to user'), 'error');
}
$profileUrl = $_CB_framework->userProfileUrl($id, false, 'getmypmsproTab');
if (!$user->get('id')) {
cbRedirect($profileUrl, CBTxt::T('Not authorized.'), 'error');
}
if ($id == $user->get('id')) {
cbRedirect($profileUrl, CBTxt::T('SEND_PMS_ERROR_SELF', 'Private message failed to send! Error: You can not send a private message to your self'), 'error');
}
$tab = new TabTable();
$tab->load(array('pluginclass' => 'getmypmsproTab'));
if (!($tab->enabled && Application::MyUser()->canViewAccessLevel($tab->viewaccesslevel))) {
cbRedirect($profileUrl, CBTxt::T('Not authorized.'), 'error');
}
$subject = $this->input('subject', null, GetterInterface::STRING);
$message = $this->input('message', null, GetterInterface::STRING);
$send = $_CB_PMS->sendPMSMSG($id, $user->get('id'), $subject, $message, false);
if (is_array($send) && count($send) > 0) {
$result = $send[0];
} else {
$result = false;
}
if ($result) {
cbRedirect($profileUrl, CBTxt::T('SEND_PMS_SUCCESS', 'Private message sent successfully!'));
} else {
cbRedirect($profileUrl, $_PLUGINS->getErrorMSG(), 'error');
}
}
示例4: store
/**
* If table key (id) is NULL : inserts a new row
* otherwise updates existing row in the database table
*
* Can be overridden or overloaded by the child class
*
* @param boolean $updateNulls TRUE: null object variables are also updated, FALSE: not.
* @return boolean TRUE if successful otherwise FALSE
*/
public function store($updateNulls = false)
{
$key = $this->_tbl_key;
if (!$this->{$key}) {
$this->event_time = $this->_db->getUtcDateTime();
$this->user_id = Application::MyUser()->getUserId();
$this->ip_addresses = cbpaidRequest::getIPlist();
$this->log_version = 1;
}
return parent::store($updateNulls);
}
示例5: getCBpluginComponent
/**
* @param null $tab
* @param UserTable $user
* @param int $ui
* @param array $postdata
*/
public function getCBpluginComponent( $tab, $user, $ui, $postdata )
{
global $_CB_framework;
outputCbJs( 1 );
outputCbTemplate( 1 );
$action = $this->input( 'action', null, GetterInterface::STRING );
$function = $this->input( 'func', null, GetterInterface::STRING );
$id = $this->input( 'id', null, GetterInterface::INT );
$user = CBuser::getMyUserDataInstance();
$tab = new TabTable();
$tab->load( array( 'pluginclass' => 'cbinvitesTab' ) );
$profileUrl = $_CB_framework->userProfileUrl( $user->get( 'id' ), false, 'cbinvitesTab' );
if ( ! ( $tab->enabled && Application::MyUser()->canViewAccessLevel( $tab->viewaccesslevel ) ) ) {
cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' );
}
ob_start();
switch ( $action ) {
case 'preparaty':
switch ( $function ) {
case 'delete':
$this->deletePreparaty( $id, $user );
break;
}
break;
default:
cbRedirect( $profileUrl, CBTxt::T( 'Not authorized.' ), 'error' );
break;
}
$html = ob_get_contents();
ob_end_clean();
$class = $this->params->get( 'general_class', null );
$return = '<div id="cbInvites" class="cbInvites' . ( $class ? ' ' . htmlspecialchars( $class ) : null ) . '">'
. '<div id="cbInvitesInner" class="cbInvitesInner">'
. $html
. '</div>'
. '</div>';
echo $return;
}
示例6: sqlCleanQuote
/**
* Cleans the field value by type in a secure way for SQL
*
* @param mixed $fieldValue
* @param string $type const,sql,param : string,int,float,datetime,formula
* @param GetterInterface $pluginParams
* @param DatabaseDriverInterface $db
* @param array|null $extDataModels
* @return string|boolean STRING: sql-safe value, Quoted or type-casted to int or float, or FALSE in case of type error
*/
public static function sqlCleanQuote($fieldValue, $type, GetterInterface $pluginParams, DatabaseDriverInterface $db, array $extDataModels = null)
{
$typeArray = explode(':', $type, 3);
if (count($typeArray) < 2) {
$typeArray = array('const', $type);
}
if ($typeArray[0] == 'param') {
$fieldValue = $pluginParams->get($fieldValue);
} elseif ($typeArray[0] == 'user') {
// TODO: Change this to use Inversion Of Control, and allow XML valuetypes to be extended dynamically (e.g. instead of calling specifically CBLib\CB\User or similar when available, it is CB that adds the type and a closure to handle that type.
if ($fieldValue == 'viewaccesslevels') {
$fieldValue = Application::MyUser()->getAuthorisedViewLevels();
} else {
if ($fieldValue == 'usergroups') {
$fieldValue = Application::MyUser()->getAuthorisedGroups(false);
} else {
$fieldValue = \CBuser::getMyUserDataInstance()->get($fieldValue);
}
}
} elseif (in_array($typeArray[0], array('request', 'get', 'post', 'cookie', 'cbcookie', 'session', 'server', 'env'))) {
$fieldValue = self::_globalConv($typeArray[0], $fieldValue);
} elseif ($typeArray[0] == 'ext') {
if (isset($typeArray[2]) && $extDataModels && isset($extDataModels[$typeArray[2]])) {
$model = $extDataModels[$typeArray[2]];
if (is_object($model)) {
if ($model instanceof ParamsInterface) {
$fieldValue = $model->get($fieldValue);
} elseif (isset($model->{$fieldValue})) {
$fieldValue = $model->{$fieldValue};
}
} elseif (is_array($model)) {
if (isset($model[$fieldValue])) {
$fieldValue = $model[$fieldValue];
}
} else {
$fieldValue = $model;
}
} else {
trigger_error('SQLXML::sqlCleanQuote: ERROR: ext valuetype "' . htmlspecialchars($type) . '" has not been setExternalDataTypeValues.', E_USER_NOTICE);
}
// } elseif ( ( $typeArray[0] == 'const' ) || ( $cnt_valtypeArray[0] == 'sql' ) {
// $fieldValue = $fieldValue;
}
if (is_array($fieldValue)) {
return self::cleanArrayType($fieldValue, $typeArray[1], $db);
}
return self::cleanScalarType($fieldValue, $typeArray[1], $db);
}
示例7: getArticles
/**
* Gets articles
*
* @param int[] $paging
* @param string $where
* @param UserTable $viewer
* @param UserTable $user
* @param PluginTable $plugin
* @return Table[]
*/
public static function getArticles($paging, $where, $viewer, $user, $plugin)
{
global $_CB_database;
$categories = $plugin->params->get('article_k2_category', null);
$query = 'SELECT a.*' . ', b.' . $_CB_database->NameQuote('id') . ' AS category' . ', b.' . $_CB_database->NameQuote('name') . ' AS category_title' . ', b.' . $_CB_database->NameQuote('published') . ' AS category_published' . ', b.' . $_CB_database->NameQuote('alias') . ' AS category_alias' . "\n FROM " . $_CB_database->NameQuote('#__k2_items') . " AS a" . "\n LEFT JOIN " . $_CB_database->NameQuote('#__k2_categories') . " AS b" . ' ON b.' . $_CB_database->NameQuote('id') . ' = a.' . $_CB_database->NameQuote('catid') . "\n WHERE a." . $_CB_database->NameQuote('created_by') . " = " . (int) $user->get('id') . "\n AND a." . $_CB_database->NameQuote('published') . " = 1" . "\n AND a." . $_CB_database->NameQuote('trash') . " = 0" . "\n AND a." . $_CB_database->NameQuote('access') . " IN " . $_CB_database->safeArrayOfIntegers(Application::MyUser()->getAuthorisedViewLevels()) . "\n AND b." . $_CB_database->NameQuote('published') . " = 1" . "\n AND b." . $_CB_database->NameQuote('trash') . " = 0" . "\n AND b." . $_CB_database->NameQuote('access') . " IN " . $_CB_database->safeArrayOfIntegers(Application::MyUser()->getAuthorisedViewLevels());
if ($categories) {
$categories = explode('|*|', $categories);
cbArrayToInts($categories);
$query .= "\n AND a." . $_CB_database->NameQuote('catid') . " NOT IN ( " . implode(',', $categories) . " )";
}
$query .= $where . "\n ORDER BY a." . $_CB_database->NameQuote('created') . " DESC";
if ($paging) {
$_CB_database->setQuery($query, $paging[0], $paging[1]);
} else {
$_CB_database->setQuery($query);
}
return $_CB_database->loadObjectList(null, '\\CBLib\\Database\\Table\\Table', array(null, '#__k2_items', 'id'));
}
示例8: _authorizedEdit
/**
* Checks user access permission
*
* @param int $userIdPosted
* @return null|string
*/
private function _authorizedEdit($userIdPosted)
{
global $_CB_framework;
$iAmAdmin = Application::MyUser()->isSuperAdmin();
if (!$iAmAdmin) {
if (Application::MyUser()->isAuthorizedToPerformActionOnAsset('core.manage', 'com_users')) {
if ($userIdPosted == 0) {
$action = 'core.create';
} elseif ($userIdPosted == $_CB_framework->myId()) {
$action = 'core.edit.own';
} else {
$action = 'core.edit';
}
$iAmAdmin = Application::MyUser()->isAuthorizedToPerformActionOnAsset($action, 'com_users') && !Application::User((int) $userIdPosted)->isSuperAdmin();
}
}
if (!$iAmAdmin) {
return CBTxt::T("Not Authorized");
} else {
return null;
}
}
示例9: deleteUsers
function deleteUsers($cid, $inComprofilerOnly = false)
{
global $_CB_framework;
$msg = null;
if (!Application::MyUser()->isAuthorizedToPerformActionOnAsset('core.admin', 'com_comprofiler')) {
$msg = CBTxt::T('You cannot delete a user. Only higher-level users have this power.');
}
if (!$msg && is_array($cid) && count($cid)) {
new cbTabs(0, 2, null, false);
// loads plugins
foreach ($cid as $id) {
$obj = null;
if (!$inComprofilerOnly) {
$obj =& $_CB_framework->_getCmsUserObject((int) $id);
}
if ($obj !== null || $inComprofilerOnly) {
// Just a double-check as framework checks that too:
if ($_CB_framework->myId() != $id && ($obj === null || !(Application::User((int) $id)->isSuperAdmin() && !Application::MyUser()->isSuperAdmin()))) {
// delete user
$result = cbDeleteUser($id, null, $inComprofilerOnly);
if ($result === null) {
$msg .= CBTxt::T('User not found');
} elseif (is_string($result) && $result != "") {
$msg .= $result;
}
} else {
// cannot delete Super Admin where it is the only one that exists
$msg .= CBTxt::T('You cannot delete yourself nor a Super Administrator without being Super Administrator');
}
} else {
$msg .= CBTxt::T('User not found');
}
}
}
return $msg;
}
示例10: authoriseAction
/**
* Check for authorization to perform an action on an asset.
*
* $action:
* Configure core.admin
* Access component core.manage
* Create core.create
* Delete core.delete
* Edit core.edit
* Edit State core.edit.state (e.g. block users and get CB/users administration mails)
* Edit Own core.edit.own
*
* Baskets:
* Pay: baskets.pay
* Record payment baskets.recordpayment
* Refund: baskets.refund
*
* $assetname:
* 'com_comprofiler.plugin.cbsubs' (default) : For all CBSubs aspects except user management
* '.plan.id' : For plan number id
* 'com_users' : For all user management aspects (except core.manage, left for deactivating core Joomla User)
* null : For global super-user rights check: ( 'core.admin', null )
*
* @since 2.0
*
* @param string $action Action to perform: core.admin, core.manage, core.create, core.delete, core.edit, core.edit.state, core.edit.own, ...
* @param string $assetName OPTIONAL: asset name e.g. "com_comprofiler.plugin.$pluginId" or "com_users", or null for global rights
* @return boolean|null True: Authorized, False: Not Authorized, Null: Default (not authorized
* @throws \InvalidArgumentException
*/
public static function authoriseAction($action, $assetName = 'root')
{
global $_CB_framework;
if (!$assetName) {
trigger_error(CBTxt::T('ACTION_MISSING_ASSET_NAME', '[action] missing asset name', array('[action]' => $action)), E_USER_NOTICE);
$assetName = 'com_cbsubs';
// CBSubs GPL 3.0.0 is the only ones that will ever need that !
}
static $cache = array();
$myId = $_CB_framework->myId();
if (!isset($cache[$myId][$assetName][$action])) {
if (Application::MyUser()->isSuperAdmin()) {
// Super Admins have all rights:
$authorized = true;
} else {
// Send null asset name if requesting root permissions:
if ($assetName == 'root') {
$assetName = null;
}
$authorized = Application::MyUser()->isAuthorizedToPerformActionOnAsset($action, $assetName);
}
$cache[$myId][$assetName][$action] = $authorized;
}
return $cache[$myId][$assetName][$action];
}
示例11: die
<?php
/**
* Community Builder (TM)
* @version $Id: $
* @package CommunityBuilder
* @copyright (C) 2004-2015 www.joomlapolis.com / Lightning MultiCom SA - and its licensors, all rights reserved
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL version 2
*/
use CBLib\Application\Application;
use CBLib\Language\CBTxt;
if (!(defined('_VALID_CB') || defined('_JEXEC') || defined('_VALID_MOS'))) {
die('Direct Access to this location is not allowed.');
}
if (Application::MyUser()->isAuthorizedToPerformActionOnAsset('core.manage', 'com_comprofiler')) {
if ($params->get('menu_cb', 1) && file_exists($_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler')) {
$prevStateBase = 'option=com_comprofiler';
$cbMenu = array();
$cbMenu['component'] = array('title' => CBTxt::Th('Community Builder'));
$cbMenu['menu'] = array(array('title' => CBTxt::Th('Control Panel'), 'link' => $_CB_framework->backendViewUrl(null), 'icon' => 'cb-control_panel'), array('title' => CBTxt::Th('User Management'), 'link' => $_CB_framework->backendViewUrl('showusers'), 'access' => array('core.manage', 'com_users'), 'icon' => 'cb-user_management', 'submenu' => array(array('title' => CBTxt::Th('Add New User'), 'link' => $_CB_framework->backendViewUrl('new', true, array('cbprevstate' => base64_encode($prevStateBase . '&view=showusers'))), 'access' => array('core.create', 'com_users'), 'icon' => 'cb-new'))), array('title' => CBTxt::Th('Tab Management'), 'link' => $_CB_framework->backendViewUrl('showTab'), 'access' => array('core.manage', 'com_comprofiler.tabs'), 'icon' => 'cb-tab_management', 'submenu' => array(array('title' => CBTxt::Th('Add New Tab'), 'link' => $_CB_framework->backendViewUrl('editrow', true, array('table' => 'tabsbrowser', 'action' => 'editrow', 'cbprevstate' => base64_encode($prevStateBase . '&view=showTab'))), 'access' => array(array('core.create', 'core.edit'), 'com_comprofiler.tabs'), 'icon' => 'cb-new'))), array('title' => CBTxt::Th('Field Management'), 'link' => $_CB_framework->backendViewUrl('showField'), 'access' => array('core.manage', 'com_comprofiler.fields'), 'icon' => 'cb-field_management', 'submenu' => array(array('title' => CBTxt::Th('Add New Field'), 'link' => $_CB_framework->backendViewUrl('editrow', true, array('table' => 'fieldsbrowser', 'action' => 'editrow', 'cbprevstate' => base64_encode($prevStateBase . '&view=showField'))), 'access' => array(array('core.create', 'core.edit'), 'com_comprofiler.fields'), 'icon' => 'cb-new'))), array('title' => CBTxt::Th('List Management'), 'link' => $_CB_framework->backendViewUrl('showLists'), 'access' => array('core.manage', 'com_comprofiler.lists'), 'icon' => 'cb-list_management', 'submenu' => array(array('title' => CBTxt::Th('Add New List'), 'link' => $_CB_framework->backendViewUrl('editrow', true, array('table' => 'listsbrowser', 'action' => 'editrow', 'cbprevstate' => base64_encode($prevStateBase . '&view=showLists'))), 'access' => array(array('core.create', 'core.edit'), 'com_comprofiler.lists'), 'icon' => 'cb-new'))), array('title' => CBTxt::Th('Plugin Management'), 'link' => $_CB_framework->backendViewUrl('showPlugins'), 'access' => array('core.manage', 'com_comprofiler.plugins'), 'icon' => 'cb-plugin_management', 'submenu' => array(array('title' => CBTxt::Th('Install New Plugin'), 'link' => $_CB_framework->backendViewUrl('installcbplugin', true, array('cbprevstate' => base64_encode($prevStateBase . '&view=showPlugins'))), 'access' => array('core.admin', 'root'), 'icon' => 'cb-upload'))), array('title' => CBTxt::Th('Tools'), 'link' => $_CB_framework->backendViewUrl('tools', true, array('cbprevstate' => base64_encode($prevStateBase))), 'access' => array('core.manage', 'com_comprofiler.tools'), 'icon' => 'cb-tools'), array('title' => CBTxt::Th('Configuration'), 'link' => $_CB_framework->backendViewUrl('showconfig', true, array('cbprevstate' => base64_encode($prevStateBase))), 'access' => array('core.admin', 'com_comprofiler'), 'icon' => 'cb-configuration'), array('title' => CBTxt::Th('Credits'), 'link' => $_CB_framework->backendViewUrl('credits', true, array('cbprevstate' => base64_encode($prevStateBase))), 'icon' => 'cb-credits'));
$menu[] = $cbMenu;
}
if ($params->get('menu_cbsubs', 1) && file_exists($_CB_framework->getCfg('absolute_path') . '/components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions')) {
$query = 'SELECT ' . $_CB_database->NameQuote('id') . "\n FROM " . $_CB_database->NameQuote('#__comprofiler_plugin') . "\n WHERE " . $_CB_database->NameQuote('element') . ' = ' . $_CB_database->Quote('cbpaidsubscriptions');
$_CB_database->setQuery($query, 0, 1);
$pluginId = $_CB_database->loadResult();
if ($pluginId) {
$prevStateBase = 'option=com_comprofiler&view=editPlugin&pluginid=' . (int) $pluginId;
$cbsubsMenu = array();
$cbsubsMenu['component'] = array('title' => CBTxt::Th('Paid Subscriptions'));
$cbsubsMenu['menu'] = array(array('title' => CBTxt::Th('Payments Center'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId)), 'icon' => 'cbsubs-payments_center'), array('title' => CBTxt::Th('Settings'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showparams', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array('cbsubs.settings', 'com_cbsubs'), 'icon' => 'cbsubs-settings'), array('title' => CBTxt::Th('Gateways'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'gateways', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array('cbsubs.gateways', 'com_cbsubs'), 'icon' => 'cbsubs-gateways', 'submenu' => array(array('title' => CBTxt::Th('Add New Gateway'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'editrow', 'table' => 'gatewaysbrowser', 'cbprevstate' => base64_encode($prevStateBase . '&action=showtable&table=gateways'))), 'access' => array('cbsubs.gateways', 'com_cbsubs'), 'icon' => 'cb-new'))), array('title' => CBTxt::Th('Plans'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'plans', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array('cbsubs.marketing', 'com_cbsubs'), 'icon' => 'cbsubs-plans', 'submenu' => array(array('title' => CBTxt::Th('Add New Plan'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'editrow', 'table' => 'plansbrowser', 'cbprevstate' => base64_encode($prevStateBase . '&action=showtable&table=plans'))), 'access' => array('cbsubs.marketing', 'com_cbsubs'), 'icon' => 'cb-new'))), array('title' => CBTxt::Th('Subscriptions'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'subscriptions', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array('cbsubs.usersubscriptionview', 'com_cbsubs'), 'icon' => 'cbsubs-subscriptions'), array('title' => CBTxt::Th('Baskets'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'paymentbaskets', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array(array('cbsubs.sales', 'cbsubs.financial'), 'com_cbsubs'), 'icon' => 'cbsubs-baskets'), array('title' => CBTxt::Th('Payments'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'payments', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array(array('cbsubs.sales', 'cbsubs.financial'), 'com_cbsubs'), 'icon' => 'cbsubs-payments'), array('title' => CBTxt::Th('Notifications'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'notifications', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array(array('cbsubs.settings', 'cbsubs.gateways', 'cbsubs.sales'), 'com_cbsubs'), 'icon' => 'cbsubs-notifications'), array('title' => CBTxt::Th('Currencies'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'currencies', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array(array('cbsubs.marketing', 'cbsubs.financial'), 'com_cbsubs'), 'icon' => 'cbsubs-currencies'), array('title' => CBTxt::Th('Statistics'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstats', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics', 'submenu' => array(array('title' => CBTxt::Th('Payments Monthly'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatsmonthly', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_payments_monthly'), array('title' => CBTxt::Th('Payments Weekly'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatsweekly', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_payments_weekly'), array('title' => CBTxt::Th('Payments by Weekday'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatsdayofweek', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_payments_weekday'), array('title' => CBTxt::Th('Payments by Hour'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatshourofday', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_payments_hourly'), array('title' => CBTxt::Th('Payments by Country'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatscountrypayments', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_payments_country'), array('title' => CBTxt::Th('Payments Free Query'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatsfreequery', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_payments_query'), array('title' => CBTxt::Th('Sales Monthly'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatsitemsmonthly', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_sales_monthly'), array('title' => CBTxt::Th('Sales Weekly'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatsitemsweekly', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_sales_weekly'), array('title' => CBTxt::Th('Sales by Weekday'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showstatsitemsdayofweek', 'cbprevstate' => base64_encode($prevStateBase . '&action=showstats'))), 'access' => array('cbsubs.financial', 'com_cbsubs'), 'icon' => 'cbsubs-statistics_sales_weekday'))), array('title' => CBTxt::Th('Merchandise'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'merchandises', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array('cbsubs.merchandisemanage', 'com_cbsubs'), 'icon' => 'cbsubs-merchandise'), array('title' => CBTxt::Th('Donations'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'donations', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array('cbsubs.donationview', 'com_cbsubs'), 'icon' => 'cbsubs-donations'), array('title' => CBTxt::Th('Import'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'import', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array(array('cbsubs.settings', 'cbsubs.recordpayments'), 'com_cbsubs'), 'icon' => 'cbsubs-import'), array('title' => CBTxt::Th('History Logs'), 'link' => $_CB_framework->backendViewUrl('editPlugin', true, array('cid' => $pluginId, 'action' => 'showtable', 'table' => 'history', 'cbprevstate' => base64_encode($prevStateBase))), 'access' => array(array('cbsubs.settings', 'cbsubs.gateways'), 'com_cbsubs'), 'icon' => 'cbsubs-history_logs'));
示例12: getGroupOptions
/**
* Returns an options array of available groups
*
* @param bool $raw
* @param array $excludeCategories
* @param array $excludeGroups
* @return array|\stdClass[]
*/
static public function getGroupOptions( $raw = false, $excludeCategories = array(), $excludeGroups = array() )
{
global $_CB_database;
if ( Application::Cms()->getClientId() ) {
$raw = false;
$excludeCategories = array();
$excludeGroups = array();
}
static $cache = array();
$userId = Application::MyUser()->getUserId();
if ( ! isset( $cache[$userId] ) ) {
$query = 'SELECT g.' . $_CB_database->NameQuote( 'id' ) . ' AS value'
. ', g.' . $_CB_database->NameQuote( 'name' ) . ' AS text'
. ', g.' . $_CB_database->NameQuote( 'category' )
. ', c.' . $_CB_database->NameQuote( 'name' ) . ' AS category_name'
. "\n FROM " . $_CB_database->NameQuote( '#__groupjive_groups' ) . " AS g"
. "\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_categories' ) . " AS c"
. ' ON c.' . $_CB_database->NameQuote( 'id' ) . ' = g.' . $_CB_database->NameQuote( 'category' );
if ( ( ! self::isModerator( $userId ) ) && ( ! Application::Cms()->getClientId() ) ) {
$query .= "\n LEFT JOIN " . $_CB_database->NameQuote( '#__groupjive_users' ) . " AS u"
. ' ON u.' . $_CB_database->NameQuote( 'group' ) . ' = g.' . $_CB_database->NameQuote( 'id' )
. ' AND u.' . $_CB_database->NameQuote( 'user_id' ) . ' = ' . (int) $userId
. ' AND u.' . $_CB_database->NameQuote( 'status' ) . ' >= 1'
. "\n WHERE c." . $_CB_database->NameQuote( 'published' ) . " = 1"
. "\n AND c." . $_CB_database->NameQuote( 'access' ) . " IN " . $_CB_database->safeArrayOfIntegers( self::getAccess( $userId ) )
. "\n AND ( g." . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $userId
. ' OR ( ( g.' . $_CB_database->NameQuote( 'published' ) . ' = 1 )'
. ' AND ( ( g.' . $_CB_database->NameQuote( 'type' ) . ' IN ( 1, 2 ) )'
. ' OR ( u.' . $_CB_database->NameQuote( 'id' ) . ' IS NOT NULL ) ) ) )'
. ( $excludeCategories ? "\n AND c." . $_CB_database->NameQuote( 'id' ) . " NOT IN " . $_CB_database->safeArrayOfIntegers( $excludeCategories ) : null )
. ( $excludeGroups ? "\n AND g." . $_CB_database->NameQuote( 'id' ) . " NOT IN " . $_CB_database->safeArrayOfIntegers( $excludeGroups ) : null );
} else {
$query .= ( $excludeCategories ? "\n WHERE c." . $_CB_database->NameQuote( 'id' ) . " NOT IN " . $_CB_database->safeArrayOfIntegers( $excludeCategories ) : null )
. ( $excludeGroups ? "\n " . ( $excludeCategories ? 'AND' : 'WHERE' ) . " g." . $_CB_database->NameQuote( 'id' ) . " NOT IN " . $_CB_database->safeArrayOfIntegers( $excludeGroups ) : null );
}
$query .= "\n ORDER BY c." . $_CB_database->NameQuote( 'ordering' ) . ", g." . $_CB_database->NameQuote( 'ordering' );
$_CB_database->setQuery( $query );
$cache[$userId] = $_CB_database->loadObjectList();
}
if ( $raw === true ) {
return $cache[$userId];
}
$optGroups = array();
$options = array();
foreach ( $cache[$userId] as $group ) {
$category = (int) $group->category;
if ( ! in_array( $category, $optGroups ) ) {
$options[] = \moscomprofilerHTML::makeOptGroup( ( $category ? CBTxt::T( $group->category_name ) : CBTxt::T( 'Uncategorized' ) ) );
$optGroups[] = $category;
}
$options[] = \moscomprofilerHTML::makeOption( (int) $group->value, CBTxt::T( $group->text ) );
}
return $options;
}
示例13: saveInviteEdit
/**
* @param null|int $id
* @param UserTable $user
*/
private function saveInviteEdit( $id, $user )
{
global $_CB_framework, $_CB_database, $_PLUGINS;
$inviteLimit = (int) $this->params->get( 'invite_limit', null );
$cbModerator = Application::User( (int) $user->get( 'id' ) )->isGlobalModerator();
$row = new cbinvitesInviteTable();
$row->load( (int) $id );
$canAccess = false;
$inviteCount = 0;
if ( ! $row->get( 'id' ) ) {
if ( $cbModerator ) {
$canAccess = true;
} elseif ( $user->get( 'id' ) && Application::MyUser()->canViewAccessLevel( $this->params->get( 'invite_create_access', 2 ) ) ) {
if ( $inviteLimit ) {
$query = 'SELECT COUNT(*)'
. "\n FROM " . $_CB_database->NameQuote( '#__comprofiler_plugin_invites' )
. "\n WHERE " . $_CB_database->NameQuote( 'user_id' ) . " = " . (int) $user->get( 'id' )
. "\n AND ( " . $_CB_database->NameQuote( 'user' ) . " IS NULL OR " . $_CB_database->NameQuote( 'user' ) . " = " . $_CB_database->Quote( '' ) . " )";
$_CB_database->setQuery( $query );
$inviteCount = (int) $_CB_database->loadResult();
if ( $inviteCount < $inviteLimit ) {
$canAccess = true;
}
} else {
$canAccess = true;
}
}
} elseif ( $cbModerator || ( $row->get( 'user_id' ) == $user->get( 'id' ) ) ) {
$canAccess = true;
}
$profileUrl = $_CB_framework->userProfileUrl( $row->get( 'user_id', $user->get( 'id' ) ), false, 'cbinvitesTab' );
if ( $canAccess && ( ! $row->isAccepted() ) ) {
$toArray = explode( ',', $this->input( 'post/to', null, GetterInterface::STRING ) );
if ( ( ! $this->params->get( 'invite_multiple', 1 ) ) && ( ! $cbModerator ) && ( count( $toArray ) > 1 ) ) {
$this->showInviteEdit( $row->get( 'id' ), $user, CBTxt::T( 'Comma seperated lists are not supported! Please use a single To address.' ) ); return;
}
$sent = false;
if ( ! empty( $toArray ) ) {
foreach ( $toArray as $k => $to ) {
if ( $k != 0 ) {
$row->set( 'id', null );
$row->set( 'code', null );
}
$orgTo = $row->get( 'to' );
$row->set( 'to', $to );
$row->set( 'subject', $this->input( 'post/subject', $row->get( 'subject' ), GetterInterface::STRING ) );
if ( $this->params->get( 'invite_editor', 2 ) >= 2 ) {
$row->set( 'body', $this->input( 'post/body', $row->get( 'body' ), GetterInterface::HTML ) );
} else {
$row->set( 'body', $this->input( 'post/body', $row->get( 'body' ), GetterInterface::STRING ) );
}
$row->set( 'user_id', (int) $this->input( 'post/user_id', $row->get( 'user_id', $user->get( 'id' ) ), GetterInterface::INT ) );
if ( $cbModerator ) {
$row->set( 'user', (int) $this->input( 'post/user', $row->get( 'user' ), GetterInterface::INT ) );
}
if ( ! $row->get( 'code' ) ) {
$row->set( 'code', md5( uniqid() ) );
}
$new = ( $row->get( 'id' ) ? false : true );
if ( $new && $inviteLimit ) {
$inviteCount++;
if ( $inviteCount > $inviteLimit ) {
cbRedirect( $profileUrl, CBTxt::T( 'Invite limit reached!' ), 'error' );
}
}
if ( ! $row->get( 'user' ) ) {
$toUser = new UserTable();
$toUser->loadByEmail( $row->get( 'to' ) );
} else {
$toUser = CBuser::getUserDataInstance( (int) $row->get( 'user' ) );
}
if ( ! $row->get( 'to' ) ) {
$row->setError( CBTxt::T( 'To address not specified.' ) );
//.........这里部分代码省略.........
示例14: checkCanAdminPlugins
/**
* Checks if operation is allowed, and exits to previous page if not, as it should not be possible at all.
*
* @since 1.8
*
* @param string $actions Action to perform: core.admin, core.manage, core.create, core.delete, core.edit, core.edit.state, core.edit.own, ...
* @param array|int $cid Plugin-id
* @param string $assetname OPTIONAL: asset name e.g. com_comprofiler.plugin.$pluginId
* @return void
*/
function checkCanAdminPlugins($actions, $cid = null, $assetname = 'com_comprofiler')
{
$allowed = false;
foreach ((array) $actions as $action) {
$allowed = Application::MyUser()->isAuthorizedToPerformActionOnAsset($action, $assetname);
if ($allowed) {
break;
}
}
if (!$allowed) {
echo "<script type=\"text/javascript\"> alert('" . addslashes(CBTxt::T('Operation not allowed by the Permissions of your group(s).')) . "'); window.history.go(-1); </script>\n";
exit;
}
}
示例15: get_user_permission_task
/**
* @deprecated 2.0 We need to add that Config allowModeratorsUserEdit as param when we remove its use.
* Current uses are only: cbCheckIfUserCanPerformUserTask( $user->id, 'allowModeratorsUserEdit' )
*
* @param int $user_id
* @param string $action
* @return boolean|null|string
*/
public function get_user_permission_task($user_id, $action)
{
global $_CB_framework, $_PLUGINS, $ueConfig;
if ($user_id == 0) {
$user_id = $_CB_framework->myId();
} else {
$user_id = (int) $user_id;
}
if ($user_id == 0) {
$ret = false;
} elseif ($user_id == $_CB_framework->myId()) {
$ret = null;
} else {
if (!isset($ueConfig[$action]) || $ueConfig[$action] == 0) {
$ret = CBTxt::Th('UE_FUNCTIONALITY_DISABLED', 'This functionality is currently disabled.');
} elseif ($ueConfig[$action] == 1) {
$isModerator = Application::MyUser()->isGlobalModerator();
if (!$isModerator) {
$ret = false;
} else {
$isModerator_user = Application::User((int) $user_id)->isGlobalModerator();
if ($isModerator_user) {
/** @noinspection PhpDeprecationInspection */
$ret = $this->get_users_permission(array($user_id), 'edit', true);
} else {
$ret = null;
}
}
} elseif ($ueConfig[$action] > 1) {
// 8: super admins only
// 7: admins and super admins only
if (Application::MyUser()->isSuperAdmin()) {
$ret = null;
} elseif ($ueConfig[$action] != 7) {
$ret = false;
} else {
// Admins and Super-admins:
if (Application::MyUser()->isAuthorizedToPerformActionOnAsset('core.manage', 'com_users') && Application::MyUser()->isAuthorizedToPerformActionOnAsset('core.edit', 'com_users')) {
$ret = null;
} else {
$ret = false;
}
}
} else {
$ret = false;
}
}
if ($ret === false) {
$ret = CBTxt::Th('UE_NOT_AUTHORIZED', 'You are not authorized to view this page!');
if ($_CB_framework->myId() < 1) {
$ret .= '<br />' . CBTxt::Th('UE_DO_LOGIN', 'You need to log in.');
}
}
if ($_PLUGINS) {
$_PLUGINS->trigger('onUserPermissionTask', array($user_id, $action, &$ret));
}
return $ret;
}