/** * finds and accepts a users invites when registered within CB (front and backend) * * @param moscomprofilerUser $user */ public function acceptInvites( $user ) { $plugin = cbgjClass::getPlugin(); if ( $plugin->params->get( 'group_invites_accept', 1 ) ) { $invites = cbgjData::getInvites( null, array( 'email', '=', $user->email ) ); if ( $invites ) foreach ( $invites as $invite ) { $invite->set( 'accepted', cbgjClass::getUTCDate() ); $invite->set( 'user', (int) $user->id ); if ( $invite->store() ) { $row = cbgjData::getUsers( null, array( array( 'group', '=', (int) $invite->get( 'group' ) ), array( 'user_id', '=', (int) $user->id ) ), null, null, false ); if ( ! $row->get( 'id' ) ) { $row->set( 'user_id', (int) $user->id ); $row->set( 'group', (int) $invite->get( 'group' ) ); $row->set( 'date', cbgjClass::getUTCDate() ); $row->set( 'status', 1 ); $row->store(); } } $notification = cbgjData::getNotifications( array( array( 'grp_usr_notifications' ), 'owner' ), array( array( 'type', '=', 'group' ), array( 'item', '=', (int) $invite->get( 'group' ) ), array( 'user_id', '=', (int) $invite->get( 'user_id' ) ), array( 'params', 'CONTAINS', 'group_inviteaccept=1' ) ), null, null, false ); if ( $notification->get( 'id' ) ) { $subject = CBTxt::T( '[group_name] - Invite Accepted!' ); $message = CBTxt::T( '[user] has accepted your invite to join [group] in [category]!' ); cbgjClass::getNotification( $notification->get( 'user_id' ), $invite->get( 'user' ), $subject, $message, 1, $invite->getCategory(), $invite->getGroup() ); } } } }
/** * prepare frontend tab render * * @param object $tab * @param moscomprofilerUser $user * @param int $ui * @return mixed */ public function getDisplayTab( $tab, $user, $ui ) { global $_CB_framework; outputCbJs( 1 ); outputCbTemplate( 1 ); cbgjClass::getTemplate( 'tab' ); $plugin = cbgjClass::getPlugin(); $viewer =& CBuser::getUserDataInstance( $_CB_framework->myId() ); $categories = $this->getCategories( $user, $viewer, $plugin ); $groups = $this->getGroups( $user, $viewer, $plugin ); $joined = $this->getJoined( $user, $viewer, $plugin ); $invites = $this->getInvites( $user, $viewer, $plugin ); $invited = $this->getInvited( $user, $viewer, $plugin ); ob_start(); HTML_groupjiveTab::showTab( $categories, $groups, $joined, $invites, $invited, $user, $viewer, $plugin ); $html = ob_get_contents(); ob_end_clean(); $return = '<div id="cbGj" class="cbGroupJive' . htmlspecialchars( $plugin->params->get( 'general_class', null ) ) . '">' . '<div id="cbGjInner" class="cbGroupJiveInner">' . $html . '</div>' . '</div>'; return $return; }
public function setParams( $params, $html = true ) { global $_CB_framework, $_PLUGINS; $plugin = cbgjClass::getPlugin(); $user =& CBuser::getUserDataInstance( $_CB_framework->myId() ); $params = cbgjClass::parseParams( $params, $html, $this->getParams( $html ) ); $_PLUGINS->trigger( 'gjint_onBeforeSetAutoParams', array( &$params, &$this, $user, $plugin ) ); $this->set( 'params', trim( $params->toIniString() ) ); $_PLUGINS->trigger( 'gjint_onAfterSetAutoParams', array( $params, $this, $user, $plugin ) ); }
$_CB_framework->document->addHeadStyleSheet( $_CB_framework->getCfg( 'live_site' ) . '/modules/mod_cbgroupjive.css' ); } else { $_CB_framework->document->addHeadStyleSheet( $_CB_framework->getCfg( 'live_site' ) . '/modules/mod_cbgroupjive/mod_cbgroupjive.css' ); } $layout = (int) $params->get( 'gj_layout', 0 ); $display = (int) $params->get( 'gj_display', 5 ); $mode = (int) $params->get( 'gj_mode', 2 ); $nameLength = (int) $params->get( 'gj_length', 15 ); $include = $params->get( 'gj_include', null ); $exclude = $params->get( 'gj_exclude', null ); $includeCat = $params->get( 'gj_includecat', null ); $excludeCat = $params->get( 'gj_excludecat', null ); $includeGrp = $params->get( 'gj_includegrp', null ); $excludeGrp = $params->get( 'gj_excludegrp', null ); $plugin = cbgjClass::getPlugin(); $user =& CBuser::getUserDataInstance( $_CB_framework->myId() ); $classLayout = ( $layout ? 'H' : 'V' ); $return = '<div class="cbGjExternal cbGroupJiveModule">' . '<div class="cbGjExternalInner">'; $include_exclude = array(); if ( in_array( $mode, array( 0, 1, 2, 3 ) ) ) { if ( $include ) { $include = explode( ',', $include ); cbArrayToInts( $include ); $include_exclude[] = array( 'id', 'IN', $include ); }
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>'; } } } } } }
/** * Called at each change of user subscription state due to a plan activation or deactivation * * @param UserTable $user * @param string $status * @param int $planId * @param int $replacedPlanId * @param ParamsInterface $integrationParams * @param string $cause 'PaidSubscription' (first activation only), 'SubscriptionActivated' (renewals, cancellation reversals), 'SubscriptionDeactivated', 'Denied' * @param string $reason 'N' new subscription, 'R' renewal, 'U'=update ) * @param int $now Unix time */ public function onCPayUserStateChange( &$user, $status, /** @noinspection PhpUnusedParameterInspection */ $planId, /** @noinspection PhpUnusedParameterInspection */ $replacedPlanId, &$integrationParams, /** @noinspection PhpUnusedParameterInspection */ $cause, /** @noinspection PhpUnusedParameterInspection */ $reason, /** @noinspection PhpUnusedParameterInspection */ $now ) { global $_CB_framework; if ( ! is_object( $user ) ) { return; } $api = $_CB_framework->getCfg( 'absolute_path' ) . '/components/com_comprofiler/plugin/user/plug_cbgroupjive/cbgroupjive.class.php'; if ( ! file_exists( $api ) ) { return; } /** @noinspection PhpIncludeInspection */ require_once( $api ); $gj_plugin = cbgjClass::getPlugin(); $cbUser = CBuser::getInstance( $user->id ); if ( ! $cbUser ) { $cbUser = $cbUser->getInstance( null ); } for ( $i = 1; $i <= 5; $i++ ) { if ( $status == 'A' ) { if ( ( cbgjClass::getCleanParam( true, 'cbgj_auto_type' . $i, null, null, $integrationParams ) == 3 ) && cbgjClass::getCleanParam( true, 'cbgj_auto_name' . $i, null, null, $integrationParams ) ) { $parent = (int) cbgjClass::getCleanParam( true, 'cbgj_auto_cat_parent' . $i, '0', null, $integrationParams ); $name = $cbUser->replaceUserVars( cbgjClass::getCleanParam( true, 'cbgj_auto_name' . $i, null, null, $integrationParams ) ); if ( cbgjClass::getCleanParam( true, 'cbgj_auto_unique' . $i, 1, null, $integrationParams ) ) { $where = array( array( 'user_id', '=', $user->id ), array( 'name', '=', $name ), array( 'parent', '=', $parent ) ); } else { $where = array( array( 'name', '=', $name ), array( 'parent', '=', $parent ) ); } $row = cbgjData::getCategories( null, null, $where, null, null, false ); if ( ! $row->id ) { $category_editor = $gj_plugin->params->get( 'category_editor', 1 ); $types = cbgjClass::getCleanParam( true, 'cbgj_auto_cat_types' . $i, '1|*|2|*|3', null, $integrationParams ); $row->published = 1; $row->parent = $parent; $row->user_id = (int) $user->id; $row->name = $name; if ( ( $category_editor == 2 ) || ( $category_editor == 3 ) ) { $row->description = $cbUser->replaceUserVars( cbgjClass::getHTMLCleanParam( true, 'cbgj_auto_desc' . $i, null, null, $integrationParams ) ); } else { $row->description = $cbUser->replaceUserVars( cbgjClass::getCleanParam( true, 'cbgj_auto_desc' . $i, null, null, $integrationParams ) ); } $row->access = (int) $gj_plugin->params->get( 'category_access_default', -2 ); $row->types = ( $types ? $types : $gj_plugin->params->get( 'category_types_default', '1|*|2|*|3' ) ); $row->create = (int) $gj_plugin->params->get( 'category_create_default', 1 ); $row->create_access = (int) $gj_plugin->params->get( 'category_createaccess_default', -1 ); $row->nested = (int) $gj_plugin->params->get( 'category_nested_default', 1 ); $row->nested_access = (int) $gj_plugin->params->get( 'category_nestedaccess_default', -1 ); $row->date = date( 'Y-m-d H:i:s' ); $row->ordering = 99999; $row->store(); } } elseif ( ( cbgjClass::getCleanParam( true, 'cbgj_auto_type' . $i, null, null, $integrationParams ) == 2 ) && cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat' . $i, null, null, $integrationParams ) && cbgjClass::getCleanParam( true, 'cbgj_auto_name' . $i, null, null, $integrationParams ) ) { if ( ( cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat' . $i, null, null, $integrationParams ) == -1 ) && cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat_name' . $i, null, null, $integrationParams ) ) { $parent = (int) cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat_parent' . $i, '0', null, $integrationParams ); $name = $cbUser->replaceUserVars( cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat_name' . $i, null, null, $integrationParams ) ); if ( cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat_unique' . $i, 1, null, $integrationParams ) ) { $where = array( array( 'user_id', '=', $user->id ), array( 'name', '=', $name ), array( 'parent', '=', $parent ) ); } else { $where = array( array( 'name', '=', $name ), array( 'parent', '=', $parent ) ); } $category = cbgjData::getCategories( null, null, $where, null, null, false ); if ( ! $category->id ) { $category_editor = $gj_plugin->params->get( 'category_editor', 1 ); $types = cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat_types' . $i, '1|*|2|*|3', null, $integrationParams ); $category->published = 1; $category->parent = $parent; $category->user_id = (int) $user->id; $category->name = $name; if ( ( $category_editor == 2 ) || ( $category_editor == 3 ) ) { $category->description = $cbUser->replaceUserVars( cbgjClass::getHTMLCleanParam( true, 'cbgj_auto_grp_cat_desc' . $i, null, null, $integrationParams ) ); } else { $category->description = $cbUser->replaceUserVars( cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat_desc' . $i, null, null, $integrationParams ) ); } $category->access = (int) $gj_plugin->params->get( 'category_access_default', -2 ); $category->types = ( $types ? $types : $gj_plugin->params->get( 'category_types_default', '1|*|2|*|3' ) ); $category->create = (int) $gj_plugin->params->get( 'category_create_default', 1 ); $category->create_access = (int) $gj_plugin->params->get( 'category_createaccess_default', -1 ); $category->nested = (int) $gj_plugin->params->get( 'category_nested_default', 1 ); $category->nested_access = (int) $gj_plugin->params->get( 'category_nestedaccess_default', -1 ); $category->date = date( 'Y-m-d H:i:s' ); $category->ordering = 99999; $category->store(); } } else { $category = cbgjData::getCategories( null, null, array( 'id', '=', cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat' . $i, null, null, $integrationParams ) ), null, null, false ); } if ( $category->id ) { $parent = (int) cbgjClass::getCleanParam( true, 'cbgj_auto_grp_parent' . $i, '0', null, $integrationParams ); $name = $cbUser->replaceUserVars( cbgjClass::getCleanParam( true, 'cbgj_auto_name' . $i, null, null, $integrationParams ) ); $join = false; if ( cbgjClass::getCleanParam( true, 'cbgj_auto_unique' . $i, 1, null, $integrationParams ) ) { $where = array( array( 'category', '=', $category->id ), array( 'user_id', '=', $user->id ), array( 'name', '=', $name ), array( 'parent', '=', $parent ) ); } else { $where = array( array( 'category', '=', $category->id ), array( 'name', '=', $name ), array( 'parent', '=', $parent ) ); if ( cbgjClass::getCleanParam( true, 'cbgj_auto_grp_autojoin' . $i, 1, null, $integrationParams ) ) { $join = true; } } $row = cbgjData::getGroups( null, null, $where, null, null, false ); if ( ! $row->id ) { $group_editor = $gj_plugin->params->get( 'group_editor', 1 ); $type = cbgjClass::getCleanParam( true, 'cbgj_auto_grp_type' . $i, 1, null, $integrationParams ); $row->published = 1; $row->category = (int) $category->id; $row->parent = $parent; $row->user_id = (int) $user->id; $row->name = $name; if ( ( $group_editor == 2 ) || ( $group_editor == 3 ) ) { $row->description = $cbUser->replaceUserVars( cbgjClass::getHTMLCleanParam( true, 'cbgj_auto_desc' . $i, null, null, $integrationParams ) ); } else { $row->description = $cbUser->replaceUserVars( cbgjClass::getCleanParam( true, 'cbgj_auto_desc' . $i, null, null, $integrationParams ) ); } $row->access = (int) $gj_plugin->params->get( 'group_access_default', -2 ); $row->type = (int) ( $type ? $type : $gj_plugin->params->get( 'group_type_default', 1 ) ); $row->nested = (int) $gj_plugin->params->get( 'group_nested_default', 1 ); $row->nested_access = (int) $gj_plugin->params->get( 'group_nestedaccess_default', -1 ); $row->date = date( 'Y-m-d H:i:s' ); $row->ordering = 1; if ( $row->store() ) { $row->storeOwner( $row->user_id ); } } elseif ( $join ) { $usr = cbgjData::getUsers( null, null, array( array( 'group', '=', $row->id ), array( 'user_id', '=', $user->id ) ), null, null, false ); if ( ! $usr->id ) { $usr->user_id = (int) $user->id; $usr->group = (int) $row->id; $usr->date = date( 'Y-m-d H:i:s' ); $usr->status = (int) cbgjClass::getCleanParam( true, 'cbgj_auto_grp_usr_status' . $i, 1, null, $integrationParams ); if ( $usr->store() ) { if ( $usr->status == 4 ) { $row->storeOwner( $usr->user_id ); } } } } } } elseif ( ( cbgjClass::getCleanParam( true, 'cbgj_auto_type' . $i, null, null, $integrationParams ) == 1 ) && cbgjClass::getCleanParam( true, 'cbgj_auto_usr_groups' . $i, null, null, $integrationParams ) ) { $groups = cbgjClass::getCleanParam( true, 'cbgj_auto_usr_groups' . $i, null, null, $integrationParams ); if ( $groups ) { $groups = explode( '|*|', $groups ); cbArrayToInts( $groups ); } if ( $groups ) foreach ( $groups as $group_id ) { $group = cbgjData::getGroups( null, null, array( 'id', '=', $group_id ), null, null, false ); if ( $group->id ) { $row = cbgjData::getUsers( null, null, array( array( 'group', '=', $group->id ), array( 'user_id', '=', $user->id ) ), null, null, false ); if ( ! $row->id ) { $row->user_id = (int) $user->id; $row->group = (int) $group->id; $row->date = date( 'Y-m-d H:i:s' ); $row->status = (int) cbgjClass::getCleanParam( true, 'cbgj_auto_usr_status' . $i, 1, null, $integrationParams ); if ( $row->store() ) { if ( $row->status == 4 ) { $group->storeOwner( $row->user_id); } } } } } } } elseif ( cbgjClass::getCleanParam( true, 'cbgj_auto_remove' . $i, null, null, $integrationParams ) ) { if ( ( cbgjClass::getCleanParam( true, 'cbgj_auto_type' . $i, null, null, $integrationParams ) == 3 ) && cbgjClass::getCleanParam( true, 'cbgj_auto_name' . $i, null, null, $integrationParams ) ) { $name = $cbUser->replaceUserVars( cbgjClass::getCleanParam( true, 'cbgj_auto_name' . $i, null, null, $integrationParams ) ); if ( cbgjClass::getCleanParam( true, 'cbgj_auto_unique' . $i, 1, null, $integrationParams ) ) { $where = array( array( 'user_id', '=', $user->id ), array( 'name', '=', $name ) ); } else { $where = array( 'name', '=', $name ); } $row = cbgjData::getCategories( null, null, $where, null, null, false ); if ( $row->id ) { $row->deleteAll(); } } elseif ( ( cbgjClass::getCleanParam( true, 'cbgj_auto_type' . $i, null, null, $integrationParams ) == 2 ) && cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat' . $i, null, null, $integrationParams ) && cbgjClass::getCleanParam( true, 'cbgj_auto_name' . $i, null, null, $integrationParams ) ) { $name = $cbUser->replaceUserVars( cbgjClass::getCleanParam( true, 'cbgj_auto_name' . $i, null, null, $integrationParams ) ); if ( cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat' . $i, null, null, $integrationParams ) == -1 ) { if ( cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat_unique' . $i, 1, null, $integrationParams ) ) { $where = array( array( 'user_id', '=', $user->id ), array( 'name', '=', $name ) ); } else { $where = array( 'name', '=', $name ); } } else { $category = cbgjData::getCategories( null, null, array( 'id', '=', cbgjClass::getCleanParam( true, 'cbgj_auto_grp_cat' . $i, null, null, $integrationParams ) ), null, null, false ); if ( cbgjClass::getCleanParam( true, 'cbgj_auto_unique' . $i, 1, null, $integrationParams ) ) { $where = array( array( 'category', '=', $category->id ), array( 'user_id', '=', $user->id ), array( 'name', '=', $name ) ); } else { $where = array( array( 'category', '=', $category->id ), array( 'name', '=', $name ) ); } } $row = cbgjData::getGroups( null, null, $where, null, null, false ); if ( $row->id ) { $row->deleteAll(); } } elseif ( ( cbgjClass::getCleanParam( true, 'cbgj_auto_type' . $i, null, null, $integrationParams ) == 1 ) && cbgjClass::getCleanParam( true, 'cbgj_auto_usr_groups' . $i, null, null, $integrationParams ) ) { $groups = cbgjClass::getCleanParam( true, 'cbgj_auto_usr_groups' . $i, null, null, $integrationParams ); if ( $groups ) { $groups = explode( '|*|', $groups ); cbArrayToInts( $groups ); } if ( $groups ) foreach ( $groups as $group_id ) { $group = cbgjData::getGroups( null, null, array( 'id', '=', $group_id ), null, null, false ); if ( $group->id ) { $row = cbgjData::getUsers( null, null, array( array( 'group', '=', $group->id ), array( 'user_id', '=', $user->id ) ), null, null, false ); if ( $row->id ) { $row->deleteAll(); } } } } } } }
/** * constructor for groupjive paging * * @param string $name */ public function __construct( $name ) { $this->plugin = cbgjClass::getPlugin(); $this->name = $name; cbimport( 'cb.pagination' ); }
/** * render backend edit plugin view * * @param object $row * @param string $option * @param string $task * @param int $uid * @param string $action * @param string $element * @param int $mode * @param object $pluginParams */ public function editPluginView( $row, $option, $task, $uid, $action, $element, $mode, $pluginParams ) { global $_CB_framework, $_CB_database, $_CB_Backend_Menu, $_CB_Backend_task, $_GJ_Backend_Title, $_PLUGINS; if ( ! CBuser::getMyInstance()->authoriseAction( 'core.manage' ) ) { cbRedirect( $_CB_framework->backendUrl( 'index.php' ), _UE_NOT_AUTHORIZED, 'error' ); } outputCbJs( 2 ); outputCbTemplate( 2 ); $plugin = cbgjClass::getPlugin(); $_CB_framework->document->addHeadStyleSheet( $plugin->livePath . '/admin.' . $plugin->element . '.css' ); require_once( $plugin->absPath . '/admin.' . $plugin->element . '.html.php' ); $_CB_Backend_task = $task; $_GJ_Backend_Title = array(); $_CB_Backend_Menu->mode = $plugin->element . 'Admin'; $actions = explode( '.', $action ); $action = ( isset( $actions[0] ) ? $actions[0] : null ); $function = ( isset( $actions[1] ) ? $actions[1] : null ); $id = cbGetParam( $_REQUEST, 'id', array( 0 ) ); $order = cbGetParam( $_REQUEST, 'order', array( 0 ) ); $user =& CBuser::getUserDataInstance( $_CB_framework->myId() ); if ( ! is_array( $id ) ) { $id = array( $id ); } if ( ! $id ) { $id = array( 0 ); } if ( ! is_array( $order ) ) { $order = array( $order ); } if ( ! $order ) { $order = array( 0 ); } $save_mode = ( $mode == 'applyPlugin' ? 'apply' : $function ); ob_start(); switch ( $action ) { case 'categories': switch ( $function ) { case 'menu': $this->createCategoryMenu( $id[0], $user, $plugin ); break; case 'publish': cbSpoofCheck( 'plugin' ); $this->stateCategory( $id, 1, $user, $plugin ); break; case 'unpublish': cbSpoofCheck( 'plugin' ); $this->stateCategory( $id, 0, $user, $plugin ); break; case 'order': cbSpoofCheck( 'plugin' ); $this->orderCategory( $id, $order, $user, $plugin ); break; case 'orderup': cbSpoofCheck( 'plugin' ); $this->orderCategory( $id[0], -1, $user, $plugin ); break; case 'orderdown': cbSpoofCheck( 'plugin' ); $this->orderCategory( $id[0], 1, $user, $plugin ); break; case 'batch': $this->batchCategory( $id, $user, $plugin ); break; case 'copy': $this->copyCategory( $id, $user, $plugin ); break; case 'delete': cbSpoofCheck( 'plugin' ); $this->deleteCategory( $id, $user, $plugin ); break; case 'new': $this->showCategoryEdit( null, $user, $plugin ); break; case 'edit': $this->showCategoryEdit( $id[0], $user, $plugin ); break; case 'save': case 'apply': cbSpoofCheck( 'plugin' ); $this->saveCategoryEdit( $id[0], $save_mode, $user, $plugin ); break; case 'show': default: $this->showCategories( $user, $plugin ); break; } break; case 'groups': switch ( $function ) { case 'menu': $this->createGroupMenu( $id[0], $user, $plugin ); break; case 'publish': cbSpoofCheck( 'plugin' ); $this->stateGroup( $id, 1, $user, $plugin ); break; case 'unpublish': cbSpoofCheck( 'plugin' ); $this->stateGroup( $id, 0, $user, $plugin ); break; case 'order': cbSpoofCheck( 'plugin' ); $this->orderGroup( $id, $order, $user, $plugin ); break; case 'orderup': cbSpoofCheck( 'plugin' ); $this->orderGroup( $id[0], -1, $user, $plugin ); break; case 'orderdown': cbSpoofCheck( 'plugin' ); $this->orderGroup( $id[0], 1, $user, $plugin ); break; case 'batch': $this->batchGroup( $id, $user, $plugin ); break; case 'copy': $this->copyGroup( $id, $user, $plugin ); break; case 'delete': cbSpoofCheck( 'plugin' ); $this->deleteGroup( $id, $user, $plugin ); break; case 'new': $this->showGroupEdit( null, $user, $plugin ); break; case 'edit': $this->showGroupEdit( $id[0], $user, $plugin ); break; case 'save': case 'apply': cbSpoofCheck( 'plugin' ); $this->saveGroupEdit( $id[0], $save_mode, $user, $plugin ); break; case 'show': default: $this->showGroups( $user, $plugin ); break; } break; case 'users': switch ( $function ) { case 'ban': cbSpoofCheck( 'plugin' ); $this->statusUser( $id, -1, $user, $plugin ); break; case 'active': cbSpoofCheck( 'plugin' ); $this->statusUser( $id, 1, $user, $plugin ); break; case 'inactive': cbSpoofCheck( 'plugin' ); $this->statusUser( $id, 0, $user, $plugin ); break; case 'mod': cbSpoofCheck( 'plugin' ); $this->statusUser( $id, 2, $user, $plugin ); break; case 'admin': cbSpoofCheck( 'plugin' ); $this->statusUser( $id, 3, $user, $plugin ); break; case 'owner': cbSpoofCheck( 'plugin' ); $this->statusUser( $id, 4, $user, $plugin ); break; case 'batch': $this->batchUser( $id, $user, $plugin ); break; case 'delete': cbSpoofCheck( 'plugin' ); $this->deleteUser( $id, $user, $plugin ); break; case 'new': $this->showUserEdit( null, $user, $plugin ); break; case 'edit': $this->showUserEdit( $id[0], $user, $plugin ); break; case 'save': case 'apply': cbSpoofCheck( 'plugin' ); $this->saveUserEdit( $id[0], $save_mode, $user, $plugin ); break; case 'show': default: $this->showUsers( $user, $plugin ); break; } break; case 'invites': switch ( $function ) { case 'delete': cbSpoofCheck( 'plugin' ); $this->deleteInvite( $id, $user, $plugin ); break; case 'show': default: $this->showInvites( $user, $plugin ); break; } break; case 'config': switch ( $function ) { case 'save': cbSpoofCheck( 'plugin' ); $this->saveConfig( $_POST, $user, $plugin ); break; case 'show': default: $this->showConfig( $user, $plugin ); break; } break; case 'tools': switch ( $function ) { case 'migrate': $this->showMigrate( $user, $plugin ); break; case 'delmigrate': $this->deleteMigrate( $user, $plugin ); break; case 'show': default: $this->showTools( $user, $plugin ); break; } break; case 'fix': switch ( $function ) { case 'categories': $this->fixCategories( $id[0], $user, $plugin ); break; case 'groups': $this->fixGroups( $id[0], $user, $plugin ); break; case 'users': $this->fixUsers( $id[0], $user, $plugin ); break; default: $this->showTools( $user, $plugin ); break; } break; case 'integrations': $this->showIntegrations( $user, $plugin ); break; case 'menus': switch ( $function ) { case 'save': $this->saveMenus( $user, $plugin ); break; default: $this->showMenus( $user, $plugin ); break; } break; case 'plugin': $_PLUGINS->trigger( 'gj_onPluginBE', array( array( $function, $id, $order, $save_mode ), $user, $plugin ) ); break; default: switch ( $function ) { case 'menu': $this->createPluginMenu( $user, $plugin ); break; case 'show': default: $this->showPlugin( $user, $plugin ); break; } break; } $html = ob_get_contents(); ob_end_clean(); ob_start(); include( $_CB_framework->getCfg( 'absolute_path' ) . '/components/com_comprofiler/plugin/user/plug_cbgroupjive/toolbar.cbgroupjive.php' ); $toolbar = ob_get_contents(); ob_end_clean(); $title = ( isset( $_GJ_Backend_Title[0] ) ? $_GJ_Backend_Title[0] : null ); $class = ( isset( $_GJ_Backend_Title[1] ) ? ' ' . $_GJ_Backend_Title[1] : null ); $return = '<div style="margin:0px;border-width:0px;padding:0px;float:left;width:100%;text-align:left;" class="gjAdmin">' . '<div id="cbAdminMainWrapper" style="margin:0px;border-width:0px;padding:0px;float:none;width:auto;">' . '<div style="float:right;" class="gjAdminToolbar">' . $toolbar . '</div>' . '<div style="float:left;" class="header' . $class . '">' . $title . '</div>' . '<div style="clear:both;"></div>' . '<div style="float:left;width:100%;margin-top:10px;">' . $html . '</div>' . '<div style="clear:both;"></div>' . '</div>' . '</div>'; echo $return; }