本文整理汇总了PHP中cbArrayToInts函数的典型用法代码示例。如果您正苦于以下问题:PHP cbArrayToInts函数的具体用法?PHP cbArrayToInts怎么用?PHP cbArrayToInts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cbArrayToInts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPosts
/**
* @param UserTable $viewer Viewing User
* @param UserTable $user Viewed at User
* @param TabTable $tab Current Tab
* @param PluginTable $plugin Current Plugin
* @return string HTML
*/
public static function getPosts($viewer, $user, $tab, $plugin)
{
global $_CB_framework, $_CB_database;
if (!class_exists('KunenaForumMessageHelper')) {
return CBTxt::T('Kunena not installed, enabled, or failed to load.');
}
$exclude = $plugin->params->get('forum_exclude', null);
if ($exclude) {
$exclude = explode('|*|', $exclude);
cbArrayToInts($exclude);
$exclude = implode(',', $exclude);
}
cbimport('cb.pagination');
cbforumsClass::getTemplate('tab_posts');
$limit = (int) $tab->params->get('tab_posts_limit', 15);
$limitstart = $_CB_framework->getUserStateFromRequest('tab_posts_limitstart{com_comprofiler}', 'tab_posts_limitstart');
$filterSearch = $_CB_framework->getUserStateFromRequest('tab_posts_search{com_comprofiler}', 'tab_posts_search');
$where = array();
if (isset($filterSearch) && $filterSearch != '') {
$where[] = '( m.' . $_CB_database->NameQuote('subject') . ' LIKE ' . $_CB_database->Quote('%' . $_CB_database->getEscaped($filterSearch, true) . '%', false) . ' OR t.' . $_CB_database->NameQuote('message') . ' LIKE ' . $_CB_database->Quote('%' . $_CB_database->getEscaped($filterSearch, true) . '%', false) . ' )';
}
$searching = count($where) ? true : false;
if ($exclude) {
$where[] = '( m.' . $_CB_database->NameQuote('catid') . ' NOT IN ( ' . $exclude . ' ) )';
}
$params = array('user' => (int) $user->id, 'starttime' => -1, 'where' => count($where) ? implode(' AND ', $where) : null);
$posts = KunenaForumMessageHelper::getLatestMessages(false, 0, 0, $params);
$total = array_shift($posts);
if ($total <= $limitstart) {
$limitstart = 0;
}
$pageNav = new cbPageNav($total, $limitstart, $limit);
$pageNav->setInputNamePrefix('tab_posts_');
if ($tab->params->get('tab_posts_paging', 1)) {
$posts = KunenaForumMessageHelper::getLatestMessages(false, (int) $pageNav->limitstart, (int) $pageNav->limit, $params);
$posts = array_pop($posts);
} else {
$posts = array_pop($posts);
}
$rows = array();
/** @var KunenaForumMessage[] $posts */
if ($posts) {
foreach ($posts as $post) {
$row = new stdClass();
$row->id = $post->id;
$row->subject = $post->subject;
$row->message = $post->message;
$row->date = $post->time;
$row->url = $post->getUrl();
$row->category_id = $post->getCategory()->id;
$row->category_name = $post->getCategory()->name;
$row->category_url = $post->getCategory()->getUrl();
$rows[] = $row;
}
}
$input = array();
$input['search'] = '<input type="text" name="tab_posts_search" value="' . htmlspecialchars($filterSearch) . '" onchange="document.forumPostsForm.submit();" placeholder="' . htmlspecialchars(CBTxt::T('Search Posts...')) . '" class="form-control" />';
return HTML_cbforumsTabPosts::showPosts($rows, $pageNav, $searching, $input, $viewer, $user, $tab, $plugin);
}
示例2: setSelectedPlans
/**
* Sets selected plan (or gets the state with FALSE)
* @param int[]|boolean $plans
* @return array|null
*/
public function setSelectedPlans($plans)
{
static $state = null;
if ($plans === false) {
return $state;
}
if (is_array($plans)) {
cbArrayToInts($plans);
}
$state = $plans;
return null;
}
示例3: 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'));
}
示例4: execute
/**
* @param cbautoactionsActionTable $trigger
* @param UserTable $user
* @return mixed
*/
public function execute( $trigger, $user )
{
$params = $trigger->getParams()->subTree( 'action' );
$actions = $params->get( 'actions' );
$return = null;
if ( $actions ) {
$actions = explode( '|*|', $actions );
cbArrayToInts( $actions );
foreach ( $actions as $actionId ) {
$action = new cbautoactionsActionTable();
if ( $action->load( $actionId ) ) {
$return .= cbautoactionsClass::triggerAction( $action, $user, $trigger->get( '_password' ), $trigger->get( '_extras' ), $trigger->get( '_vars' ) );
}
}
}
return $return;
}
示例5: execute
/**
* @param cbautoactionsActionTable $trigger
* @param UserTable $user
*/
public function execute( $trigger, $user )
{
global $_CB_framework;
if ( ! $this->installed() ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_ACYMAILING_NOT_INSTALLED', ':: Action [action] :: AcyMailing is not installed', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
return;
}
$params = $trigger->getParams()->subTree( 'acymailing' );
require_once( $_CB_framework->getCfg( 'absolute_path' ) . '/administrator/components/com_acymailing/helpers/helper.php' );
/** @var subscriberClass $acySubscriberAPI */
$acySubscriberAPI = acymailing::get( 'class.subscriber' );
$subscriberId = $acySubscriberAPI->subid( (int) $user->get( 'id' ) );
if ( ! $subscriberId ) {
$newSubscriber = new stdClass();
$newSubscriber->email = $user->get( 'email' );
$newSubscriber->userid = (int) $user->get( 'id' );
$newSubscriber->name = $user->get( 'name' );
$newSubscriber->created = $_CB_framework->getUTCTimestamp( $user->get( 'registerDate' ) );
$newSubscriber->confirmed = 1;
$newSubscriber->enabled = 1;
$newSubscriber->accept = 1;
$newSubscriber->ip = $user->get( 'registeripaddr' );
$newSubscriber->html = 1;
$subscriberId = $acySubscriberAPI->save( $newSubscriber );
}
if ( ! $subscriberId ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_ACYMAILING_NO_SUB', ':: Action [action] :: AcyMailing skipped due to missing subscriber id', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
return;
}
$lists = array();
$subscribe = $params->get( 'subscribe' );
if ( $subscribe ) {
$subscribe = explode( '|*|', $subscribe );
cbArrayToInts( $subscribe );
foreach ( $subscribe as $listId ) {
$lists[$listId] = array( 'status' => 1 );
}
}
$unsubscribe = $params->get( 'unsubscribe' );
if ( $unsubscribe ) {
$unsubscribe = explode( '|*|', $unsubscribe );
cbArrayToInts( $unsubscribe );
foreach ( $unsubscribe as $listId ) {
$lists[$listId] = array( 'status' => -1 );
}
}
$remove = $params->get( 'remove' );
if ( $remove ) {
$remove = explode( '|*|', $remove );
cbArrayToInts( $remove );
foreach ( $remove as $listId ) {
$lists[$listId] = array( 'status' => 0 );
}
}
$pending = $params->get( 'pending' );
if ( $pending ) {
$pending = explode( '|*|', $pending );
cbArrayToInts( $pending );
foreach ( $pending as $listId ) {
$lists[$listId] = array( 'status' => 2 );
}
}
if ( $lists ) {
$acySubscriberAPI->saveSubscription( $subscriberId, $lists );
}
//.........这里部分代码省略.........
示例6: _fixCBmandatoryDb
//.........这里部分代码省略.........
$tabToKeep = $tId;
break;
}
}
}
// c) first enabled one:
if ( $tabToKeep === null ) {
foreach ( $tabidCandidatesToKeep as $tId ) {
if ( $tabs[$tId]->enabled == 1 ) {
$tabToKeep = $tId;
break;
}
}
}
// d) first one:
if ( $tabToKeep === null ) {
foreach ( $tabidCandidatesToKeep as $tId ) {
$tabToKeep = $tId;
break;
}
}
}
if ( $tabToKeep !== null ) {
$tabsToDelete = array_diff( array_keys( $tabIds ), array( $tabToKeep ) );
// first reassign the fields of the tabs to delete:
$fieldsToReassign = array();
foreach ( $tabIds as $tId => $tFields ) {
if ( ( $tId != $tabToKeep ) && count( $tFields ) > 0 ) {
$fieldsToReassign = array_merge( $fieldsToReassign, $tFields );
}
}
if ( count( $fieldsToReassign ) > 0 ) {
cbArrayToInts( $fieldsToReassign );
$sql = 'UPDATE `#__comprofiler_fields` SET `tabid` = ' . (int) $tabToKeep . ' WHERE `fieldid` IN (' . implode( ',', $fieldsToReassign ) . ')';
if ( ! $this->_sqlUpgrader->_doQuery( $sql ) ) {
$this->_sqlUpgrader->_setError( 'Failed changing fieldids ' . implode( ',', $fieldsToReassign ) . ' from duplicates of kept core tabid: ' . $tabToKeep . ' because of error:' . $this->_db->getErrorMsg(), $sql );
break;
} else {
$this->_sqlUpgrader->_setLog( 'Changed fieldids ' . implode( ',', $fieldsToReassign ) . ' from duplicates of kept core tabid: ' . $tabToKeep, $sql, 'change' );
}
}
cbArrayToInts( $tabsToDelete );
// c) remove duplicate core tabs:
$sql = 'DELETE FROM `#__comprofiler_tabs` WHERE `tabid` IN (' . implode( ',', $tabsToDelete ) . ')';
if ( ! $this->_sqlUpgrader->_doQuery( $sql ) ) {
$this->_sqlUpgrader->_setError( 'Failed deleting duplicates tabids ' . implode( ',', $tabsToDelete ) . ' of the used core tabid: ' . $tabToKeep . ' because of error:' . $this->_db->getErrorMsg(), $sql );
break;
} else {
$this->_sqlUpgrader->_setLog( 'Deleted duplicate core tabs tabids ' . implode( ',', $tabsToDelete ) . ' of the used core tabid: ' . $tabToKeep, $sql, 'change' );
}
}
}
}
// 5) refetch tabs with now free space at reserved positions:
$sql = 'SELECT * FROM `#__comprofiler_tabs` ORDER BY `tabid`'; // `tabid`, `pluginclass`
$this->_db->setQuery( $sql );
$tabs = $this->_db->loadObjectList( 'tabid' );
if ( $this->_db->getErrorNum() ) {
$this->_sqlUpgrader->_setError( 'Tabs 2nd selection query error: ' . $this->_db->getErrorMsg(), $sql );
return false;
}
unset( $coreTabs ); // this one is now invalid, and not needed anymore
示例7: cbToArrayOfInt
/**
* Sanitizes an array to array of (int) as RETURN
*
* @param array $array in ONLY
* @return array
*/
function cbToArrayOfInt($array)
{
return cbArrayToInts($array);
}
示例8: saveAutoEdit
private function saveAutoEdit( $id, $task, $user, $plugin ) {
$row = cbgjAutoData::getAutos( null, array( 'id', '=', (int) $id ), null, null, false );
$row->set( 'published', (int) cbgjClass::getCleanParam( true, 'published', $row->get( 'published' ) ) );
$row->set( 'title', cbgjClass::getCleanParam( true, 'title', $row->get( 'title' ) ) );
$row->set( 'description', cbgjClass::getCleanParam( true, 'description', $row->get( 'description' ) ) );
$row->set( 'trigger', str_replace( ' ', '', cbgjClass::getCleanParam( true, 'trigger', $row->get( 'trigger' ) ) ) );
$row->set( 'object', (int) cbgjClass::getCleanParam( true, 'object', $row->get( 'object' ) ) );
if ( $row->get( 'object' ) == 3 ) {
$row->set( 'variable', (int) cbgjClass::getCleanParam( true, 'variable_user', $row->get( 'variable' ) ) );
} elseif ( $row->get( 'object' ) == 2 ) {
$row->set( 'variable', null );
} elseif ( $row->get( 'object' ) == 1 ) {
$row->set( 'variable', (int) cbgjClass::getCleanParam( true, 'variable', $row->get( 'variable' ) ) );
}
$row->set( 'access', cbgjClass::getCleanParam( true, 'access', $row->get( 'access' ) ) );
$row->set( 'exclude', cbgjClass::getCleanParam( true, 'exclude', $row->get( 'exclude' ) ) );
$row->set( 'ordering', (int) cbgjClass::getCleanParam( true, 'ordering', $row->get( 'ordering' ) ) );
if ( $row->get( 'exclude' ) ) {
$exclude = explode( ',', $row->get( 'exclude' ) );
cbArrayToInts( $exclude );
$row->set( 'exclude', implode( ',', $exclude ) );
}
$row->setParams( $_POST['params'] );
if ( $row->get( 'trigger' ) == '' ) {
$row->set( '_error', CBTxt::T( 'Trigger not specified!' ) );
} elseif ( $row->get( 'access' ) == '' ) {
$row->set( '_error', CBTxt::T( 'Access not specified!' ) );
} elseif ( $row->get( 'object' ) ) {
if ( $row->get( 'object' ) == 3 ) {
if ( ! $row->get( 'variable' ) ) {
$row->set( '_error', CBTxt::T( 'Specific user not specified!' ) );
}
} elseif ( $row->get( 'object' ) == 1 ) {
if ( ! $row->get( 'variable' ) ) {
$row->set( '_error', CBTxt::T( 'User variable not specified!' ) );
}
}
} else {
$params = $row->getParams();
if ( $params->get( 'auto', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Auto not specified!' ) );
} else {
if ( $params->get( 'auto', null ) == 1 ) {
if ( $params->get( 'groups', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Groups not specified!' ) );
} elseif ( $params->get( 'status', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Status not specified!' ) );
}
} elseif ( $params->get( 'auto', null ) == 2 ) {
if ( $params->get( 'category', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Category not specified!' ) );
} elseif ( $params->get( 'grp_name', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Group Name not specified!' ) );
} elseif ( $params->get( 'type', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Type not specified!' ) );
} elseif ( $params->get( 'category', null ) == -1 ) {
if ( $params->get( 'cat_name', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Category Name not specified!' ) );
}
}
} elseif ( $params->get( 'auto', null ) == 3 ) {
if ( $params->get( 'cat_name', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Category Name not specified!' ) );
} elseif ( $params->get( 'types', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Types not specified!' ) );
}
} elseif ( $params->get( 'auto', null ) == 4 ) {
if ( $params->get( 'groups', null ) == '' ) {
$row->set( '_error', CBTxt::T( 'Groups not specified!' ) );
}
}
}
}
$row->setFields( $_POST['fields'] );
$row->setOperators( $_POST['operators'] );
$row->setValues( $_POST['values'] );
if ( $row->getError() || ( ! $row->store() ) ) {
return $this->getAutoEdit( $id, $user, $plugin, CBTxt::P( 'Auto failed to save! Error: [error]', array( '[error]' => $row->getError() ) ) );
}
if ( in_array( $task, array( 'apply', 'auto_apply' ) ) ) {
cbgjClass::getPluginURL( array( 'plugin', 'auto_edit', (int) $row->get( 'id' ) ), CBTxt::T( 'Auto saved successfully!' ), false, true );
} else {
cbgjClass::getPluginURL( array( 'plugin', 'auto' ), CBTxt::T( 'Auto saved successfully!' ), false, true );
}
}
示例9: getAccess
public function getAccess( $trigger, $fbConfig, $params ) {
if ( $trigger == 'getAllowedForumsRead' ) {
$plugin = cbgjClass::getPlugin();
$forum = $plugin->params->get( 'forum_id', null );
if ( $forum ) {
$forums = array();
$categories = cbgjData::getCategories( array( 'forum_cat_access' ), array( 'params', 'REGEX', 'forum_id=[[:digit:]]+' ) );
if ( $categories ) foreach ( $categories as $category ) {
$catParams = $category->getParams();
$forums[] = $catParams->get( 'forum_id', null );
}
$groups = cbgjData::getGroups( array( 'forum_grp_access' ), array( 'params', 'REGEX', 'forum_id=[[:digit:]]+' ) );
if ( $groups ) foreach ( $groups as $group ) {
$grpParams = $group->getParams();
$forums[] = $grpParams->get( 'forum_id', null );
}
if ( ! empty( $forums ) ) {
$forums[] = $forum;
$existingAccess = explode( ',', $params[1] );
$cleanAccess = array_diff( $forums, $existingAccess );
$newAccess = array_merge( $existingAccess, $cleanAccess );
cbArrayToInts( $newAccess );
$params[1] = implode( ',', $newAccess );
}
}
} elseif ( $trigger == 'checkSubscribers' ) {
$plugin = cbgjClass::getPlugin();
$forum = $plugin->params->get( 'forum_id', null );
if ( $forum ) {
$forumId = $params[0]->id;
$users = $params[1];
$ids = array();
if ( $forumId && $users ) foreach ( $users as $user ) {
$category = cbgjData::getCategories( array( array( 'forum_cat_access' ), $user ), array( 'params', 'REGEX', 'forum_id=[[:<:]]' . (int) $forumId . '[[:>:]]' ), null, null, false );
if ( $category->get( 'id' ) ) {
$ids[] = $user;
}
$group = cbgjData::getGroups( array( array( 'forum_grp_access' ), $user ), array( 'params', 'REGEX', 'forum_id=[[:<:]]' . (int) $forumId . '[[:>:]]' ), null, null, false );
if ( $group->get( 'id' ) ) {
$ids[] = $user;
}
}
if ( ! empty( $ids ) ) {
$existingAccess = $params[1];
$cleanAccess = array_diff( $ids, $existingAccess );
$newAccess = array_merge( $existingAccess, $cleanAccess );
cbArrayToInts( $newAccess );
$params[1] = array_values( array_unique( $newAccess ) );
}
}
} elseif ( ( $trigger == 'onStart' ) && cbGetParam( $_REQUEST, 'catid', 0 ) ) {
$plugin = cbgjClass::getPlugin();
$backlink = $plugin->params->get( 'forum_backlink', 1 );
$forum = $plugin->params->get( 'forum_id', null );
if ( $backlink && $forum ) {
cbgjClass::getTemplate( 'cbgroupjiveforums' );
$catid = (int) cbGetParam( $_REQUEST, 'catid', 0 );
if ( $forum == $catid ) {
echo '<div id="cbGj"><div id="cbGjInner"><div class="gjTop gjTopCenter"><a href="' . cbgjClass::getPluginURL( array( 'overview' ) ) . '" role="button" class="gjButton btn"><i class="icon-share-alt"></i> ' . CBTxt::P( 'Back to [overview]', array( '[overview]' => cbgjClass::getOverride( 'overview' ) ) ) . '</a></div></div></div>';
} else {
$category = cbgjData::getCategories( array( 'cat_access', 'mod_lvl1' ), array( 'params', 'REGEX', 'forum_id=[[:<:]]' . (int) $catid . '[[:>:]]' ), null, null, false );
if ( $category->get( 'id' ) ) {
echo '<div id="cbGj"><div id="cbGjInner"><div class="gjTop gjTopCenter"><a href="' . $category->getUrl() . '" role="button" class="gjButton btn"><i class="icon-share-alt"></i> ' . CBTxt::P( 'Back to [category]', array( '[category]' => cbgjClass::getOverride( 'category' ) ) ) . '</a></div></div></div>';
} else {
$group = cbgjData::getGroups( array( 'grp_access', 'mod_lvl2' ), array( 'params', 'REGEX', 'forum_id=[[:<:]]' . (int) $catid . '[[:>:]]' ), null, null, false );
if ( $group->get( 'id' ) ) {
echo '<div id="cbGj"><div id="cbGjInner"><div class="gjTop gjTopCenter"><a href="' . $group->getUrl() . '" role="button" class="gjButton btn"><i class="icon-share-alt"></i> ' . CBTxt::P( 'Back to [group]', array( '[group]' => cbgjClass::getOverride( 'group' ) ) ) . '</a></div></div></div>';
}
}
}
}
}
}
示例10: execute
//.........这里部分代码省略.........
if ( ! $group->get( 'id' ) ) {
$group->set( 'published', 1 );
$group->set( 'category', (int) $category->get( 'id' ) );
$group->set( 'user_id', $owner );
$group->set( 'name', $name );
$group->set( 'description', $trigger->getSubstituteString( $row->get( 'description', null, GetterInterface::STRING ) ) );
$group->set( 'types', (int) $row->get( 'type', 1, GetterInterface::INT ) );
$group->set( 'ordering', 1 );
if ( ! $group->store() ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_GROUPJIVE_FAILED', ':: Action [action] :: CB GroupJive failed to save. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $group->getError() ) ) );
}
continue;
}
} elseif ( $join ) {
$groupUser = new \CB\Plugin\GroupJive\Table\UserTable( $_CB_database );
$groupUser->load( array( 'group' => (int) $group->get( 'id' ), 'user_id' => (int) $user->get( 'id' ) ) );
if ( ! $groupUser->get( 'id' ) ) {
$groupUser->set( 'user_id', (int) $user->get( 'id' ) );
$groupUser->set( 'group', (int) $group->get( 'id' ) );
$groupUser->set( 'status', (int) $row->get( 'group_status', 1, GetterInterface::INT ) );
if ( ! $groupUser->store() ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_GROUPJIVE_FAILED', ':: Action [action] :: CB GroupJive failed to save. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $groupUser->getError() ) ) );
}
continue;
}
}
}
break;
case 4:
$groups = $row->get( 'groups', null, GetterInterface::STRING );
if ( $groups ) {
$groups = explode( '|*|', $groups );
cbArrayToInts( $groups );
foreach ( $groups as $groupId ) {
$group = new GroupTable();
$group->load( (int) $groupId );
if ( $group->get( 'id' ) ) {
$groupUser = new \CB\Plugin\GroupJive\Table\UserTable( $_CB_database );
$groupUser->load( array( 'group' => (int) $group->get( 'id' ), 'user_id' => (int) $user->get( 'id' ) ) );
if ( $groupUser->get( 'id' ) && ( $groupUser->get( 'status' ) != 4 ) ) {
$groupUser->delete();
}
}
}
}
break;
case 1:
default:
$groups = $row->get( 'groups', null, GetterInterface::STRING );
if ( $groups ) {
$groups = explode( '|*|', $groups );
cbArrayToInts( $groups );
foreach ( $groups as $groupId ) {
$group = new GroupTable();
$group->load( (int) $groupId );
if ( $group->get( 'id' ) ) {
$groupUser = new \CB\Plugin\GroupJive\Table\UserTable( $_CB_database );
$groupUser->load( array( 'group' => (int) $group->get( 'id' ), 'user_id' => (int) $user->get( 'id' ) ) );
if ( ! $groupUser->get( 'id' ) ) {
$groupUser->set( 'user_id', (int) $user->get( 'id' ) );
$groupUser->set( 'group', (int) $group->get( 'id' ) );
$groupUser->set( 'status', (int) $row->get( 'status', 1, GetterInterface::INT ) );
if ( ! $groupUser->store() ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_GROUPJIVE_FAILED', ':: Action [action] :: CB GroupJive failed to save. Error: [error]', array( '[action]' => (int) $trigger->get( 'id' ), '[error]' => $groupUser->getError() ) ) );
}
continue;
}
}
}
}
}
break;
}
}
}
示例11: loadPluginGroup
/**
* Loads all the bot files for a particular group (if group not already loaded)
* @param string $group The group name, relates to the sub-directory in the plugins directory
* @param mixed $ids array of int : ids of plugins to load. OR: string : name of element (OR new in CB 1.2.2: string if ends with a ".": elements starting with "string.")
* @param int $publishedStatus if 1 (DEFAULT): load only published plugins, if 0: load all plugins including unpublished ones
* @return boolean TRUE: load done, FALSE: no plugin loaded
*/
function loadPluginGroup($group, $ids = null, $publishedStatus = 1)
{
global $_CB_framework, $_CB_database;
static $dbCache = null;
$this->_iserror = false;
$group = trim($group);
if ($group && !isset($this->_pluginGroups[$group]) || !$this->all_in_array_key($ids, $this->_plugins)) {
$cmsAccess = CBuser::getMyInstance()->getAuthorisedViewLevelsIds(true);
$cmsAccessCleaned = implode(',', cbArrayToInts($cmsAccess));
if (!isset($dbCache[$publishedStatus][$cmsAccessCleaned][$group])) {
$where = array();
if ($publishedStatus == 1) {
$where[] = 'published = 1';
} else {
$where[] = 'published >= ' . (int) $publishedStatus;
}
$where[] = 'access IN (' . $cmsAccessCleaned . ')';
if ($group) {
$where[] = 'type = ' . $_CB_database->Quote(trim($group));
}
/*
if ( ( $ids !== null ) && ( count( $ids ) > 0 ) ) {
cbArrayToInts( $ids );
if ( count( $ids ) == 1 ) {
$where[] = 'id = ' . implode( '', $ids );
} else {
$where[] = 'id IN (' . implode( ',', $ids ) . ')';
}
}
*/
$_CB_database->setQuery("SELECT id, folder, element, published, type, params, CONCAT_WS('/',folder,element) AS lookup, name" . "\n FROM #__comprofiler_plugin" . "\n WHERE " . implode(' AND ', $where) . "\n ORDER BY ordering");
$dbCache[$publishedStatus][$cmsAccessCleaned][$group] = $_CB_database->loadObjectList();
if ($_CB_database->getErrorNum()) {
$dbCache[$publishedStatus][$cmsAccessCleaned][$group] = null;
return false;
}
}
if (count($ids) == 0) {
$ids = null;
}
foreach ($dbCache[$publishedStatus][$cmsAccessCleaned][$group] as $plugin) {
if ($ids === null || (is_array($ids) ? in_array($plugin->id, $ids) : (substr($ids, strlen($ids) - 1, 1) == '.' ? substr($plugin->element, 0, strlen($ids)) == $ids : $plugin->element == $ids))) {
if (!isset($this->_plugins[$plugin->id]) && $this->_loadPluginFile($plugin)) {
$this->_plugins[$plugin->id] = $plugin;
if (!isset($this->_pluginGroups[$plugin->type][$plugin->id])) {
$this->_pluginGroups[$plugin->type][$plugin->id] =& $this->_plugins[$plugin->id];
}
}
}
}
}
return true;
}
示例12: array
}
}
if ( in_array( $mode, array( 11, 12, 13, 14, 15 ) ) ) {
if ( $includeGrp ) {
$includeGrp = explode( ',', $includeGrp );
cbArrayToInts( $includeGrp );
$include_exclude[] = array( 'group', 'IN', $includeGrp );
}
if ( $excludeGrp ) {
$excludeGrp = explode( ',', $excludeGrp );
cbArrayToInts( $excludeGrp );
$include_exclude[] = array( 'group', '!IN', $excludeGrp );
}
}
if ( $mode == 0 ) {
$rows = cbgjData::getCategories( array( array( 'cat_access', 'mod_lvl1' ), $user ), $include_exclude, array( 'date', 'DESC' ), $display );
$return .= '<div class="gjLatestCategories' . $classLayout . '">';
if ( $rows ) foreach ( $rows as $row ) {
$authorized = cbgjClass::getAuthorization( $row, null, $user );
$nestedCount = ( ( ( ( ! $row->get( 'nested' ) ) && cbgjClass::hasAccess( 'mod_lvl1', $authorized ) ) || $row->get( 'nested' ) ) && $row->nestedCount() );
示例13: execute
/**
* @param cbautoactionsActionTable $trigger
* @param UserTable $user
*/
public function execute( $trigger, $user )
{
global $_CB_framework;
if ( ( ! $user->get( 'id' ) ) || ( ! $this->installed() ) ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_CBSUBS_NOT_INSTALLED', ':: Action [action] :: CB Paid Subscriptions is not installed', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
return;
}
foreach ( $trigger->getParams()->subTree( 'cbsubs' ) as $row ) {
/** @var ParamsInterface $row */
$plans = $row->get( 'plans' );
if ( $plans ) {
$plans = explode( '|*|', $plans );
cbArrayToInts( $plans );
$mode = $row->get( 'mode', 1, GetterInterface::INT );
$subscriptions = cbpaidSomethingMgr::getAllSomethingOfUser( $user, null );
$activePlans = array();
if ( $subscriptions ) foreach ( $subscriptions as $type ) {
foreach ( array_keys( $type ) as $typeId ) {
/** @var cbpaidSomething $subscription */
$subscription = $type[$typeId];
$subscriptionId = (int) $subscription->get( 'id' );
$subscriptionStatus = $subscription->get( 'status' );
$planId = (int) $subscription->get( 'plan_id' );
if ( in_array( $planId, $plans ) ) {
switch ( $mode ) {
case 2:
if ( $subscriptionStatus != 'A' ) {
$subscription->activate( $user, $_CB_framework->now(), true, 'R' );
}
break;
case 3:
if ( $subscriptionStatus == 'A' ) {
cbpaidControllerOrder::doUnsubscribeConfirm( $user, null, $planId, $subscriptionId );
}
break;
case 4:
if ( $subscription->canDelete() ) {
$subscription->revert( $user, 'Denied' );
$subscription->delete();
}
break;
case 1:
default:
if ( ( $subscriptionStatus == 'A' ) && ( ! in_array( $planId, $activePlans ) ) ) {
$activePlans[] = $planId;
}
break;
}
}
}
}
if ( $mode == 1 ) {
$plansMgr = cbpaidPlansMgr::getInstance();
$postData = array();
$chosenPlans = array();
foreach ( $plans as $planId ) {
if ( ! in_array( $planId, $activePlans ) ) {
$chosenPlans[$planId] = $plansMgr->loadPlan( $planId );
}
}
if ( $chosenPlans ) {
cbpaidControllerOrder::createSubscriptionsAndPayment( $user, $chosenPlans, $postData, null, null, 'A', null, 'U', 'free' );
}
}
}
}
}
示例14: _ArraysEquivalent
/**
* Are all of the int values of array $a1 in array $a2 and the other way around too (means arrays contain same integer values) ?
*
* @param array $a1
* @param array $a2
* @return boolean
*/
protected static function _ArraysEquivalent($a1, $a2)
{
cbArrayToInts($a1);
cbArrayToInts($a2);
return self::_allValuesOfArrayInArray($a1, $a2) && self::_allValuesOfArrayInArray($a2, $a1);
}
示例15: execute
/**
* @param cbautoactionsActionTable $trigger
* @param UserTable $user
*/
public function execute( $trigger, $user )
{
global $ueConfig;
if ( ! $user->get( 'id' ) ) {
if ( $trigger->getParams()->get( 'debug', false, GetterInterface::BOOLEAN ) ) {
var_dump( CBTxt::T( 'AUTO_ACTION_CONNECTION_NO_USER', ':: Action [action] :: Connection skipped due to no user', array( '[action]' => (int) $trigger->get( 'id' ) ) ) );
}
return;
}
foreach ( $trigger->getParams()->subTree( 'connection' ) as $row ) {
/** @var ParamsInterface $row */
$users = $trigger->getSubstituteString( $row->get( 'users', null, GetterInterface::STRING ) );
if ( $users ) {
$users = explode( ',', $users );
cbArrayToInts( $users );
$message = $trigger->getSubstituteString( $row->get( 'message', null, GetterInterface::RAW ), false );
$mutual = $row->get( 'mutual', 2, GetterInterface::INT );
$cross = $row->get( 'cross', 1, GetterInterface::INT );
$notify = $row->get( 'notify', 0, GetterInterface::BOOLEAN );
if ( $mutual ) {
$oldMutual = $ueConfig['useMutualConnections'];
$ueConfig['useMutualConnections'] = ( $mutual == 1 ? '1' : '0' );
}
if ( $cross ) {
$oldCross = $ueConfig['autoAddConnections'];
$ueConfig['autoAddConnections'] = ( $cross == 1 ? '1' : '0' );
}
if ( $row->get( 'direction', 0, GetterInterface::BOOLEAN ) ) {
foreach ( $users as $userId ) {
if ( $userId != $user->get( 'id' ) ) {
$connections = new cbConnection( $userId );
if ( ! $connections->getConnectionDetails( $userId, $user->get( 'id' ) ) ) {
$connections->addConnection( $user->get( 'id' ), $message, $notify );
}
}
}
} else {
$connections = new cbConnection( $user->get( 'id' ) );
foreach ( $users as $userId ) {
if ( $userId != $user->get( 'id' ) ) {
if ( ! $connections->getConnectionDetails( $user->get( 'id' ), $userId ) ) {
$connections->addConnection( $userId, $message, $notify );
}
}
}
}
if ( $mutual ) {
$ueConfig['useMutualConnections'] = $oldMutual;
}
if ( $cross ) {
$ueConfig['autoAddConnections'] = $oldCross;
}
}
}
}