Example #1
0
 /**
  * @param integer $userid
  */
 static function setGIDs($userid, $gids)
 {
     $info = array();
     foreach ($gids as $gid) {
         $info[$gid] = xJACLhandler::setGIDsTakeNames($userid, $gid);
         xJACLhandler::setGID($userid, $gid, $info[$gid]);
     }
     return $info;
 }
Example #2
0
 public function issue($short, $tags, $text, $level = 2, $params = null, $force_notify = 0, $force_email = 0)
 {
     global $aecConfig;
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     // Event, Notice, Warning, Error
     $legal_levels = array(2, 8, 32, 128);
     if (!in_array((int) $level, $legal_levels)) {
         $level = $legal_levels[0];
     }
     $this->datetime = date('Y-m-d H:i:s', (int) gmdate('U'));
     $this->short = $short;
     $this->tags = $tags;
     $this->event = $text;
     $this->level = (int) $level;
     // Create a notification link if this matches the desired level
     if ($this->level >= $aecConfig->cfg['error_notification_level']) {
         $this->notify = 1;
     } else {
         $this->notify = $force_notify ? 1 : 0;
     }
     // Mail out notification to all admins if this matches the desired level
     if ($this->level >= $aecConfig->cfg['email_notification_level'] || $force_email) {
         // check if Global Config `mailfrom` and `fromname` values exist
         if ($app->getCfg('mailfrom') != '' && $app->getCfg('fromname') != '') {
             $adminName2 = $app->getCfg('fromname');
             $adminEmail2 = $app->getCfg('mailfrom');
         } else {
             $rows = xJACLhandler::getSuperAdmins();
             $adminName2 = $rows[0]->name;
             $adminEmail2 = $rows[0]->email;
         }
         if (!$lang->hasKey("AEC_NOTICE_NUMBER_" . $this->level)) {
             $lang = JFactory::getLanguage();
             $lang->load('com_acctexp.admin', JPATH_ADMINISTRATOR);
         }
         // Send notification to all administrators
         $subject2 = sprintf(JText::_('AEC_ASEND_NOTICE'), JText::_("AEC_NOTICE_NUMBER_" . $this->level), $this->short, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('AEC_ASEND_NOTICE_MSG'), $this->event);
         $subject2 = html_entity_decode($subject2, ENT_QUOTES, 'UTF-8');
         $message2 = html_entity_decode($message2, ENT_QUOTES, 'UTF-8');
         // get email addresses of all admins and superadmins set to recieve system emails
         $admins = AECToolbox::getAdminEmailList();
         foreach ($admins as $adminemail) {
             if (!empty($adminemail)) {
                 xJ::sendMail($adminEmail2, $adminEmail2, $adminemail, $subject2, $message2);
             }
         }
     }
     if (!empty($params) && is_array($params)) {
         $this->params = $params;
     }
     $this->check();
     $this->store();
 }
Example #3
0
 public function permissionResponse($restrictions)
 {
     if (is_array($restrictions) && !empty($restrictions)) {
         $return = array();
         foreach ($restrictions as $name => $value) {
             $invert = false;
             $status = false;
             // Might be zero, so do an expensive check
             if (!is_null($value) && !($value === "")) {
                 // Switch flag for inverted call
                 if (strpos($name, '_excluded') !== false) {
                     $invert = true;
                     $name = str_replace('_excluded', '', $name);
                 }
                 // Convert values to array or explode to array if none
                 if (!is_array($value)) {
                     if (strpos($value, ';') !== false) {
                         $check = explode(';', $value);
                     } else {
                         $check = array((int) $value);
                     }
                 } else {
                     $check = $value;
                 }
                 switch ($name) {
                     // Check for set userid
                     case 'userid':
                         if (is_object($this->cmsUser)) {
                             if ($this->cmsUser->id === $value) {
                                 $status = true;
                             }
                         }
                         break;
                         // Check for a certain GID
                     // Check for a certain GID
                     case 'fixgid':
                         if (is_object($this->cmsUser)) {
                             if ($this->hasGroup($value)) {
                                 $status = true;
                             }
                         }
                         break;
                         // Check for Minimum GID
                     // Check for Minimum GID
                     case 'mingid':
                         if (is_object($this->cmsUser)) {
                             if ($this->hasGroup($value)) {
                                 $status = true;
                             }
                         }
                         break;
                         // Check for Maximum GID
                     // Check for Maximum GID
                     case 'maxgid':
                         if (is_object($this->cmsUser)) {
                             $groups = xJACLhandler::getHigherACLGroups($value);
                             if (!$this->hasGroup($groups)) {
                                 $status = true;
                             }
                         } else {
                             // New user, so will always pass a max GID test
                             $status = true;
                         }
                         break;
                         // Check whether the user is currently in the right plan
                     // Check whether the user is currently in the right plan
                     case 'plan_present':
                         if ($this->hasSubscription) {
                             $subs = $this->getAllCurrentSubscriptionPlans();
                             foreach ($subs as $subid) {
                                 if (in_array((int) $subid, $check)) {
                                     $status = true;
                                 }
                             }
                         } else {
                             if (in_array(0, $check)) {
                                 // "None" chosen, so will always pass if new user
                                 $status = true;
                             }
                         }
                         break;
                         // Check whether the user was in the correct plan before
                     // Check whether the user was in the correct plan before
                     case 'plan_previous':
                         if ($this->hasSubscription) {
                             $previous = (int) $this->getPreviousPlan();
                             if (in_array($previous, $check) || in_array(0, $check) && is_null($previous)) {
                                 $status = true;
                             }
                         } else {
                             if (in_array(0, $check)) {
                                 // "None" chosen, so will always pass if new user
                                 $status = true;
                             }
                         }
                         break;
                         // Check whether the user has used the right plan before
                     // Check whether the user has used the right plan before
                     case 'plan_overall':
                         if ($this->hasSubscription) {
                             $subs = $this->getAllCurrentSubscriptionPlans();
                             $array = $this->meta->getUsedPlans();
                             foreach ($check as $v) {
                                 if (!empty($array[(int) $v]) || in_array($v, $subs)) {
                                     $status = true;
                                 }
                             }
                         } else {
                             if (in_array(0, $check)) {
                                 // "None" chosen, so will always pass if new user
                                 $status = true;
                             }
                         }
                         break;
                         // Check whether the user has used the plan at least a certain number of times
                     // Check whether the user has used the plan at least a certain number of times
                     case 'plan_amount_min':
                         if ($this->hasSubscription) {
                             $subs = $this->getAllCurrentSubscriptionPlans();
                             $usage = $this->meta->getUsedPlans();
                             if (!is_array($value)) {
                                 $check = array($value);
                             }
                             foreach ($check as $v) {
                                 $c = explode(',', $v);
                                 // Make sure we have an entry if the user is currently in this plan
                                 if (in_array($c[0], $subs)) {
                                     if (!isset($usage[(int) $c[0]])) {
                                         $usage[(int) $c[0]] = 1;
                                     }
                                 }
                                 if (isset($usage[(int) $c[0]])) {
                                     if ($usage[(int) $c[0]] >= (int) $c[1]) {
                                         $status = true;
                                     }
                                 }
                             }
                         }
                         break;
                         // Check whether the user has used the plan at max a certain number of times
                     // Check whether the user has used the plan at max a certain number of times
                     case 'plan_amount_max':
                         if ($this->hasSubscription) {
                             $subs = $this->getAllCurrentSubscriptionPlans();
                             $usage = $this->meta->getUsedPlans();
                             if (!is_array($value)) {
                                 $check = array($value);
                             }
                             foreach ($check as $v) {
                                 $c = explode(',', $v);
                                 // Make sure we have an entry if the user is currently in this plan
                                 if (in_array($c[0], $subs)) {
                                     if (!isset($usage[(int) $c[0]])) {
                                         $usage[(int) $c[0]] = 1;
                                     }
                                 }
                                 if (isset($usage[(int) $c[0]])) {
                                     if ($usage[(int) $c[0]] <= (int) $c[1]) {
                                         $status = true;
                                     }
                                 }
                             }
                         } else {
                             // New user will always pass max plan amount test
                             $status = true;
                         }
                         break;
                     default:
                         // If it's not there, it's super OK!
                         $status = true;
                         break;
                 }
             }
             // Swap if inverted and reestablish name
             if ($invert) {
                 $name .= '_excluded';
                 $return[$name] = !$status;
             } else {
                 $return[$name] = $status;
             }
         }
         return $return;
     } else {
         return array();
     }
 }
Example #4
0
 public function initAdmins()
 {
     $db = JFactory::getDBO();
     $incpath = JPATH_SITE . '/administrator/components/com_acctexp/install/inc';
     // Create root group
     require_once $incpath . '/create_rootgroup.inc.php';
     // Make all Superadmins excluded by default
     $administrators = xJACLhandler::getSuperAdmins();
     if (empty($administrators)) {
         return;
     }
     foreach ($administrators as $admin) {
         $metaUser = new metaUser($admin->id);
         if ($metaUser->hasSubscription) {
             continue;
         }
         $metaUser->objSubscription = new Subscription();
         $metaUser->objSubscription->createNew($admin->id, 'free', 0);
         $metaUser->objSubscription->setStatus('Excluded');
     }
 }
Example #5
0
 public function edit()
 {
     global $aecConfig;
     // See whether we have a duplication
     if ($aecConfig->RowDuplicationCheck()) {
         // Clean out duplication and reload settings
         $aecConfig->CleanDuplicatedRows();
         $aecConfig = new aecConfig();
     }
     $lists = array();
     $currency_code_list = AECToolbox::aecCurrencyField(true, true, true);
     $lists['currency_code_general'] = JHTML::_('select.genericlist', $currency_code_list, 'currency_code_general', 'size="10"', 'value', 'text', !empty($aecConfig->cfg['currency_code_general']) ? $aecConfig->cfg['currency_code_general'] : '');
     $available_plans = SubscriptionPlanHandler::getActivePlanList(true, false);
     if (!isset($aecConfig->cfg['entry_plan'])) {
         $aecConfig->cfg['entry_plan'] = 0;
     }
     $lists['entry_plan'] = JHTML::_('select.genericlist', $available_plans, 'entry_plan', 'size="' . min(10, count($available_plans) + 2) . '"', 'value', 'text', $aecConfig->cfg['entry_plan']);
     $gtree = xJACLhandler::getGroupTree(array(28, 29, 30));
     if (!isset($aecConfig->cfg['checkout_as_gift_access'])) {
         $aecConfig->cfg['checkout_as_gift_access'] = 0;
     }
     // Create GID related Lists
     $lists['checkout_as_gift_access'] = JHTML::_('select.genericlist', $gtree, 'checkout_as_gift_access', 'size="6"', 'value', 'text', $aecConfig->cfg['checkout_as_gift_access']);
     $tab_data = array();
     $params = array();
     $params[] = array('page-head', JText::_('General Configuration'));
     $params[] = array('section', 'access');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_ACCESS'));
     $params['require_subscription'] = array('toggle', 0);
     $params['adminaccess'] = array('toggle', 0);
     $params['manageraccess'] = array('toggle', 0);
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_PROCESSORS'));
     $params['gwlist'] = array('list', 0);
     $params['standard_currency'] = array('list_currency', 0);
     $params[] = array('section-end');
     $params[] = array('page-head', JText::_('Registration Flow'));
     $params[] = array('section', 'plans');
     $params['plans_first'] = array('toggle', 0);
     $params['integrate_registration'] = array('toggle', 0);
     $params['skip_confirmation'] = array('toggle', 0);
     $params[] = array('section-end');
     $params[] = array('section', 'plans');
     $params[] = array('section-head', JText::_('Plan List'));
     $params['root_group'] = array('list', 0);
     $params[] = array('section-end');
     $params[] = array('section', 'cart');
     $params[] = array('section-head', 'Shopping Cart');
     $params['enable_shoppingcart'] = array('toggle', '');
     $params['additem_stayonpage'] = array('toggle', '');
     $params[] = array('section-end');
     $params[] = array('section', 'checkout');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_CHECKOUT'));
     $params['checkout_coupons'] = array('toggle', 0);
     $params['user_checkout_prefill'] = array('inputD', 0);
     $rewriteswitches = array('cms', 'user', 'expiration', 'subscription');
     $params = AECToolbox::rewriteEngineInfo($rewriteswitches, $params);
     $params[] = array('section-end');
     $params[] = array('page-head', JText::_('Inner workings'));
     $params[] = array('section', 'heartbeat');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_SYSTEM'));
     $params['heartbeat_cycle'] = array('inputA', 0);
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_EMAIL'));
     $params['noemails'] = array('toggle', 0);
     $params['noemails_adminoverride'] = array('toggle', 0);
     $params['nojoomlaregemails'] = array('toggle', 0);
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_DEBUG'));
     $params['curl_default'] = array('toggle', 0);
     $params['simpleurls'] = array('toggle', 0);
     $params['debug_processor_notifications'] = array('toggle', 0);
     $params['error_notification_level'] = array('list', 0);
     $params['email_notification_level'] = array('list', 0);
     $params[] = array('section-end');
     @end($params);
     $tab_data[] = array(JText::_('CFG_TAB1_TITLE'), key($params), '<h2>' . JText::_('CFG_TAB1_SUBTITLE') . '</h2>');
     $params[] = array('page-head', JText::_('CFG_TAB_CUSTOMIZATION_TITLE'));
     $params[] = array('section', 'customredirect');
     $params[] = array('section-head', JText::_('CFG_CUSTOMIZATION_SUB_CREDIRECT'));
     $params['customintro'] = array('inputC', '');
     $params['customintro_userid'] = array('toggle', '');
     $params['customintro_always'] = array('toggle', '');
     $params[] = array('section-end');
     $params[] = array('section', 'invoice-number');
     $params[] = array('section-head', JText::_('CFG_CUSTOMIZATION_SUB_FORMAT_INUM'));
     $params['invoicenum_doformat'] = array('toggle', '');
     $params['invoicenum_formatting'] = array('inputD', '');
     $rewriteswitches = array('cms', 'user', 'expiration', 'subscription', 'plan', 'invoice');
     $params = AECToolbox::rewriteEngineInfo($rewriteswitches, $params);
     $params[] = array('section-end');
     $params[] = array('section', 'captcha');
     $params[] = array('section-head', JText::_('CFG_CUSTOMIZATION_SUB_CAPTCHA'));
     $params['use_recaptcha'] = array('toggle', '');
     $params['recaptcha_privatekey'] = array('inputC', '');
     $params['recaptcha_publickey'] = array('inputC', '');
     $params[] = array('section-end');
     $params[] = array('section', 'proxy');
     $params[] = array('section-head', JText::_('CFG_CUSTOMIZATION_SUB_PROXY'));
     $params['use_proxy'] = array('toggle', '');
     $params['proxy'] = array('inputC', '');
     $params['proxy_port'] = array('inputC', '');
     $params['proxy_username'] = array('inputC', '');
     $params['proxy_password'] = array('inputC', '');
     $params['gethostbyaddr'] = array('toggle', '');
     $params[] = array('section-end');
     $params[] = array('section', 'date');
     $params[] = array('section-head', JText::_('CFG_CUSTOMIZATION_SUB_FORMAT_DATE'));
     $params['display_date_backend'] = array('inputC', '%a, %d %b %Y %T %Z');
     $params['display_date_frontend'] = array('inputC', '%a, %d %b %Y %T %Z');
     $params['setlocale_date'] = array('inputD', '');
     $params[] = array('section-head', JText::_('CFG_CUSTOMIZATION_SUB_FORMAT_PRICE'));
     $params['amount_currency_symbol'] = array('toggle', 0);
     $params['amount_currency_symbolfirst'] = array('toggle', 0);
     $params['amount_use_comma'] = array('toggle', 0);
     $params[] = array('section-end');
     $params[] = array('section', 'itemid');
     $params[] = array('section-head', JText::_('CFG_CUSTOMIZATION_SUB_ITEMID'));
     $itemidlist = array('cart' => array('view' => 'cart', 'params' => false), 'checkout' => array('view' => 'checkout', 'params' => false), 'confirmation' => array('view' => 'confirmation', 'params' => false), 'subscribe' => array('view' => 'subscribe', 'params' => false), 'exception' => array('view' => 'exception', 'params' => false), 'thanks' => array('view' => 'thanks', 'params' => false), 'expired' => array('view' => 'expired', 'params' => false), 'hold' => array('view' => 'hold', 'params' => false), 'notallowed' => array('view' => 'notallowed', 'params' => false), 'pending' => array('view' => 'pending', 'params' => false), 'subscriptiondetails' => array('view' => 'subscriptiondetails', 'params' => false), 'subscriptiondetails_invoices' => array('view' => 'subscriptiondetails', 'params' => 'sub=invoices'), 'subscriptiondetails_details' => array('view' => 'subscriptiondetails', 'params' => 'sub=details'));
     foreach ($itemidlist as $param => $xparams) {
         $params['itemid_' . $param] = array('inputA', '');
     }
     $params['itemid_cb'] = array('inputA', '');
     $params['itemid_joomlauser'] = array('inputA', '');
     $params[] = array('section-end');
     @end($params);
     $tab_data[] = array(JText::_('CFG_TAB_CUSTOMIZATION_TITLE'), key($params), '<h2>' . JText::_('CFG_TAB_CUSTOMIZATION_SUBTITLE') . '</h2>');
     $params[] = array('page-head', JText::_('CFG_TAB_EXPERT_SUBTITLE'));
     $params[] = array('section', 'system');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_SYSTEM'));
     $params['alertlevel2'] = array('inputA', 0);
     $params['alertlevel1'] = array('inputA', 0);
     $params['expiration_cushion'] = array('inputA', 0);
     $params['invoice_cushion'] = array('inputA', 0);
     $params['invoice_spawn_new'] = array('toggle', 0);
     $params['heartbeat_cycle_backend'] = array('inputA', 0);
     $params['allow_frontend_heartbeat'] = array('toggle', 0);
     $params['disable_regular_heartbeat'] = array('toggle', 0);
     $params['custom_heartbeat_securehash'] = array('inputC', '');
     $params['countries_available'] = array('list_country_full', 0);
     $params['countries_top'] = array('list_country_full', 0);
     $params[] = array('section-end');
     $params[] = array('section', 'api');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_API'));
     $params['apiapplist'] = array('inputD', '');
     $params[] = array('section-end');
     $params[] = array('section', 'registration');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_REGFLOW'));
     $params['show_fixeddecision'] = array('toggle', 0);
     $params['temp_auth_exp'] = array('inputC', '');
     $params['intro_expired'] = array('toggle', 0);
     $params['skip_registration'] = array('toggle', 0);
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_CONFIRMATION'));
     $params['confirmation_coupons'] = array('toggle', 0);
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_CHECKOUT'));
     $params['checkoutform_jsvalidation'] = array('toggle', '');
     $params['checkout_coupons'] = array('toggle', 1);
     $params['checkout_as_gift'] = array('toggle', '');
     $params['checkout_as_gift_access'] = array('list', defined('JPATH_MANIFESTS') ? 2 : 18);
     $params['confirm_as_gift'] = array('toggle', '');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_PLANS'));
     $params['root_group_rw'] = array('inputD', 0);
     $params['entry_plan'] = array('list', 0);
     $params['per_plan_mis'] = array('toggle', 0);
     $params[] = array('section-end');
     $params[] = array('section', 'security');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_SECURITY'));
     $params['ssl_signup'] = array('toggle', 0);
     $params['ssl_profile'] = array('toggle', 0);
     $params['override_reqssl'] = array('toggle', 0);
     $params['altsslurl'] = array('inputC', '');
     $params['ssl_verifypeer'] = array('toggle', 0);
     $params['ssl_verifyhost'] = array('inputC', '');
     $params['ssl_cainfo'] = array('inputC', '');
     $params['ssl_capath'] = array('inputC', '');
     $params['allow_invoice_unpublished_item'] = array('toggle', 0);
     $params[] = array('section-end');
     $params[] = array('section', 'debug');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_DEBUG'));
     $params['bypassintegration'] = array('inputC', '');
     $params['breakon_mi_error'] = array('toggle', 0);
     $params['email_default_admins'] = array('toggle', 1);
     $params['email_extra_admins'] = array('inputD', '');
     $params[] = array('section-end');
     $params[] = array('section', 'uninstall');
     $params[] = array('section-head', JText::_('CFG_GENERAL_SUB_UNINSTALL'));
     $params['delete_tables'] = array('toggle', 0);
     $params['delete_tables_sure'] = array('toggle', 0);
     $params[] = array('section-end');
     @end($params);
     $tab_data[] = array(JText::_('CFG_TAB_EXPERT_TITLE'), key($params), '<h2>' . JText::_('CFG_TAB_EXPERT_SUBTITLE') . '</h2>');
     $error_reporting_notices[] = JHTML::_('select.option', 512, JText::_('AEC_NOTICE_NUMBER_512'));
     $error_reporting_notices[] = JHTML::_('select.option', 128, JText::_('AEC_NOTICE_NUMBER_128'));
     $error_reporting_notices[] = JHTML::_('select.option', 32, JText::_('AEC_NOTICE_NUMBER_32'));
     $error_reporting_notices[] = JHTML::_('select.option', 8, JText::_('AEC_NOTICE_NUMBER_8'));
     $error_reporting_notices[] = JHTML::_('select.option', 2, JText::_('AEC_NOTICE_NUMBER_2'));
     $lists['error_notification_level'] = JHTML::_('select.genericlist', $error_reporting_notices, 'error_notification_level', 'size="5"', 'value', 'text', $aecConfig->cfg['error_notification_level']);
     $lists['email_notification_level'] = JHTML::_('select.genericlist', $error_reporting_notices, 'email_notification_level', 'size="5"', 'value', 'text', $aecConfig->cfg['email_notification_level']);
     // Display Processor descriptions?
     if (!empty($aecConfig->cfg['gwlist'])) {
         $desc_list = $aecConfig->cfg['gwlist'];
     } else {
         $desc_list = array();
     }
     $lists['gwlist'] = PaymentProcessorHandler::getProcessorSelectList(true, $desc_list);
     $grouplist = ItemGroupHandler::getTree();
     $glist = array();
     foreach ($grouplist as $glisti) {
         if (defined('JPATH_MANIFESTS')) {
             $glist[] = JHTML::_('select.option', $glisti[0], str_replace('&nbsp;', ' ', $glisti[1]));
         } else {
             $glist[] = JHTML::_('select.option', $glisti[0], $glisti[1]);
         }
     }
     $lists['root_group'] = JHTML::_('select.genericlist', $glist, 'root_group', 'size="' . min(6, count($glist) + 1) . '"', 'value', 'text', $aecConfig->cfg['root_group']);
     foreach ($itemidlist as $idk => $idkp) {
         if (empty($aecConfig->cfg['itemid_' . $idk])) {
             $query = 'SELECT `id`' . ' FROM #__menu' . ' WHERE ( LOWER( `link` ) = \'index.php?option=com_acctexp&view=' . $idkp['view'] . '\'' . ' OR LOWER( `link` ) LIKE \'%' . 'layout=' . $idkp['view'] . '%\' )' . ' AND published = \'1\'';
             $this->db->setQuery($query);
             $mid = 0;
             if (empty($idkp['params'])) {
                 $mid = $this->db->loadResult();
             } else {
                 $mids = xJ::getDBArray($this->db);
                 if (!empty($mids)) {
                     $query = 'SELECT `id`' . ' FROM #__menu' . ' WHERE `id` IN (' . implode(',', $mids) . ')' . ' AND `params` LIKE \'%' . $idkp['params'] . '%\'' . ' AND published = \'1\'';
                     $this->db->setQuery($query);
                     $mid = $this->db->loadResult();
                 }
             }
             if ($mid) {
                 $aecConfig->cfg['itemid_' . $idk] = $mid;
             }
         }
     }
     if (!empty($aecConfig->cfg['apiapplist'])) {
         $string = "";
         foreach ($aecConfig->cfg['apiapplist'] as $app => $key) {
             $string .= $app . "=" . $key . "\n";
         }
         $aecConfig->cfg['apiapplist'] = $string;
     } else {
         $aecConfig->cfg['apiapplist'] = "";
     }
     $settings = new aecSettings('cfg', 'general');
     $settings->fullSettingsArray($params, $aecConfig->cfg, $lists);
     // Call HTML Class
     $aecHTML = new aecHTML($settings->settings, $settings->lists);
     if (!empty($customparamsarray)) {
         $aecHTML->customparams = $customparamsarray;
     }
     HTML_AcctExp::Settings($aecHTML, $params, $tab_data);
 }
 static function saveUserRegistration($var, $internal = false, $overrideActivation = false, $overrideEmails = false, $overrideJS = false)
 {
     $db = JFactory::getDBO();
     global $task, $aecConfig;
     $app = JFactory::getApplication();
     ob_start();
     // Let CB/JUSER think that everything is going fine
     if (aecComponentHelper::detect_component('anyCB')) {
         if (aecComponentHelper::detect_component('CBE') || $overrideActivation) {
             global $ueConfig;
         }
         $savetask = $task;
         $_REQUEST['task'] = 'done';
         include_once JPATH_SITE . '/components/com_comprofiler/comprofiler.php';
         $task = $savetask;
         if ($overrideActivation) {
             $ueConfig['reg_confirmation'] = 0;
         }
         if ($overrideEmails) {
             $ueConfig['reg_welcome_sub'] = '';
             // Only disable "Pending Approval / Confirmation" emails if it makes sense
             if (!$ueConfig['reg_confirmation'] || !$ueConfig['reg_admin_approval']) {
                 $ueConfig['reg_pend_appr_sub'] = '';
             }
         }
     } elseif (aecComponentHelper::detect_component('JUSER')) {
         $savetask = $task;
         $task = 'blind';
         include_once JPATH_SITE . '/components/com_juser/juser.php';
         include_once JPATH_SITE . '/administrator/components/com_juser/juser.class.php';
         $task = $savetask;
     } elseif (aecComponentHelper::detect_component('JOMSOCIAL')) {
     }
     // For joomla and CB, we must filter out some internal variables before handing over the POST data
     $badbadvars = array('userid', 'method_name', 'usage', 'processor', 'recurring', 'currency', 'amount', 'invoice', 'id', 'gid');
     foreach ($badbadvars as $badvar) {
         if (isset($var[$badvar])) {
             unset($var[$badvar]);
         }
     }
     if (empty($var['name']) && !empty($var['jform'])) {
         // Must be K2
         $var['name'] = aecEscape($var['jform']['name'], array('string', 'clear_nonalnum'));
         unset($var['jform']);
     }
     $_POST = $var;
     $var['username'] = aecEscape($var['username'], array('string', 'badchars'));
     $savepwd = aecEscape($var['password'], array('string', 'badchars'));
     if (aecComponentHelper::detect_component('anyCB')) {
         // This is a CB registration, borrowing their code to save the user
         if ($internal && !aecComponentHelper::detect_component('CBE')) {
             include_once JPATH_SITE . '/components/com_acctexp/lib/codeofshame/cbregister.php';
             if (empty($_POST['firstname']) && !empty($_POST['name'])) {
                 $name = metaUser::_explodeName($_POST['name']);
                 $_POST['firstname'] = $name['first'];
                 if (empty($name['last'])) {
                     $_POST['lastname'] = $name['first'];
                 } else {
                     $_POST['lastname'] = $name['last'];
                 }
             }
             $_POST['password__verify'] = $_POST['password2'];
             unset($_POST['password2']);
             @saveRegistrationNOCHECKSLOL('com_acctexp');
         } else {
             @saveRegistration('com_acctexp');
             $cbreply = ob_get_contents();
             $indicator = '<script type="text/javascript">alert(\'';
             $alertstart = strpos($cbreply, $indicator);
             // Emergency fallback
             if ($alertstart !== false) {
                 ob_clean();
                 $alertend = strpos($cbreply, '\'); </script>', $alertstart);
                 $alert = substr($cbreply, $alertstart + strlen($indicator), $alertend - $alertstart - strlen($indicator));
                 if ($aecConfig->cfg['plans_first']) {
                     aecErrorAlert($alert, $action = 'window.history.go(-2);');
                 } else {
                     aecErrorAlert($alert, $action = 'window.history.go(-3);');
                 }
             }
         }
     } elseif (aecComponentHelper::detect_component('JUSER')) {
         // This is a JUSER registration, borrowing their code to save the user
         saveRegistration('com_acctexp');
         $query = 'SELECT `id`' . ' FROM #__users' . ' WHERE `username` = \'' . $var['username'] . '\'';
         $db->setQuery($query);
         $uid = $db->loadResult();
         JUser::saveUser_ext($uid);
         //synchronize dublicate user data
         $query = 'SELECT `id`' . ' FROM #__juser_integration' . ' WHERE `published` = \'1\'' . ' AND `export_status` = \'1\'';
         $db->setQuery($query);
         $components = $db->loadObjectList();
         if (!empty($components)) {
             foreach ($components as $component) {
                 $synchronize = require_integration($component->id);
                 $synchronize->synchronizeFrom($uid);
             }
         }
     } elseif (aecComponentHelper::detect_component('JOMSOCIAL') && !$overrideJS) {
     } else {
         $data = array('username' => $var['username'], 'password' => $var['password'], 'password2' => $var['password2'], 'email' => $var['email'], 'name' => $var['name']);
         if (isset($var['jform']['profile'])) {
             $data['profile'] = $var['jform']['profile'];
         }
         if (defined('JPATH_MANIFESTS')) {
             $params = JComponentHelper::getParams('com_users');
             // Initialise the table with JUser.
             JUser::getTable('User', 'JTable');
             $user = new JUser();
             // Prepare the data for the user object.
             $useractivation = $params->get('useractivation');
             // Check if the user needs to activate their account.
             if (($useractivation == 1 || $useractivation == 2) && !$overrideActivation) {
                 jimport('joomla.user.helper');
                 $data['activation'] = xJ::getHash();
                 $data['block'] = 1;
             }
             $usersConfig = JComponentHelper::getParams('com_users');
             $system = $usersConfig->get('new_usertype', 2);
             $data['groups'][] = $system;
             // Bind the data.
             if (!$user->bind($data)) {
                 JError::raiseWarning(500, JText::sprintf('COM_USERS_REGISTRATION_BIND_FAILED', $user->getError()));
                 return false;
             }
             // Load the users plugin group.
             JPluginHelper::importPlugin('users');
             // Store the data.
             if (!$user->save()) {
                 JError::raiseWarning(500, JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $user->getError()));
                 return false;
             }
         } else {
             // This is a joomla registration, borrowing their code to save the user
             // Check for request forgeries
             if (!$internal) {
                 JRequest::checkToken() or die('Invalid Token');
             }
             // Get required system objects
             $user = clone JFactory::getUser();
             //$pathway 	=& $app->getPathway();
             $config = JFactory::getConfig();
             $authorize = JFactory::getACL();
             $document = JFactory::getDocument();
             // If user registration is not allowed, show 403 not authorized.
             $usersConfig = JComponentHelper::getParams('com_users');
             if ($usersConfig->get('allowUserRegistration') == '0') {
                 JError::raiseError(403, JText::_('Access Forbidden'));
                 return;
             }
             // Initialize new usertype setting
             $newUsertype = $usersConfig->get('new_usertype');
             if (!$newUsertype) {
                 $newUsertype = 'Registered';
             }
             // Bind the post array to the user object
             if (!$user->bind($data)) {
                 JError::raiseError(500, $user->getError());
                 unset($_POST);
                 subscribe('com_acctexp');
                 return false;
             }
             // Set some initial user values
             $user->set('id', 0);
             $user->set('usertype', '');
             $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
             $user->set('sendEmail', 0);
             $user->set('registerDate', date('Y-m-d H:i:s', (int) gmdate('U')));
             // If user activation is turned on, we need to set the activation information
             $useractivation = $usersConfig->get('useractivation');
             if ($useractivation == '1' && !$overrideActivation) {
                 jimport('joomla.user.helper');
                 $user->set('activation', md5(JUserHelper::genRandomPassword()));
                 $user->set('block', '1');
             }
             // If there was an error with registration, set the message and display form
             if (!$user->save()) {
                 JError::raiseWarning('', JText::_($user->getError()));
                 echo JText::_($user->getError());
                 return false;
             }
         }
         $row = $user;
         $name = $row->name;
         $email = $row->email;
         $username = $row->username;
         $subject = sprintf(JText::_('AEC_SEND_SUB'), $name, $app->getCfg('sitename'));
         $subject = html_entity_decode($subject, ENT_QUOTES, 'UTF-8');
         $usersConfig = JComponentHelper::getParams('com_users');
         $activation = $usersConfig->get('useractivation');
         if ($activation > 0 && !$overrideActivation) {
             $atext = JText::_('AEC_USEND_MSG_ACTIVATE');
             if (defined('JPATH_MANIFESTS')) {
                 $activation_link = JURI::root() . 'index.php?option=com_users&amp;task=registration.activate&amp;token=' . $row->activation;
                 if ($activation == 2) {
                     $atext = JText::_('COM_USERS_MSG_ADMIN_ACTIVATE');
                 }
             } else {
                 $activation_link = JURI::root() . 'index.php?option=com_user&amp;task=activate&amp;activation=' . $row->activation;
             }
             $message = sprintf($atext, $name, $app->getCfg('sitename'), $activation_link, JURI::root(), $username, $savepwd);
         } else {
             $message = sprintf(JText::_('AEC_USEND_MSG'), $name, $app->getCfg('sitename'), JURI::root());
         }
         $message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
         // check if Global Config `mailfrom` and `fromname` values exist
         if ($app->getCfg('mailfrom') != '' && $app->getCfg('fromname') != '') {
             $adminName2 = $app->getCfg('fromname');
             $adminEmail2 = $app->getCfg('mailfrom');
         } else {
             // use email address and name of first superadmin for use in email sent to user
             $rows = xJACLhandler::getSuperAdmins();
             $row2 = $rows[0];
             $adminName2 = $row2->name;
             $adminEmail2 = $row2->email;
         }
         // Send email to user
         if (!($aecConfig->cfg['nojoomlaregemails'] || $overrideEmails)) {
             xJ::sendMail($adminEmail2, $adminEmail2, $email, $subject, $message);
         }
         // Send notification to all administrators
         $aecUser = AECToolbox::aecIP();
         $subject2 = sprintf(JText::_('AEC_SEND_SUB'), $name, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('AEC_ASEND_MSG_NEW_REG'), $adminName2, $app->getCfg('sitename'), $row->name, $email, $username, $aecUser['ip'], $aecUser['isp']);
         $subject2 = html_entity_decode($subject2, ENT_QUOTES, 'UTF-8');
         $message2 = html_entity_decode($message2, ENT_QUOTES, 'UTF-8');
         // get email addresses of all admins and superadmins set to recieve system emails
         $admins = AECToolbox::getAdminEmailList();
         foreach ($admins as $adminemail) {
             if (!empty($adminemail)) {
                 xJ::sendMail($adminEmail2, $adminEmail2, $adminemail, $subject2, $message2);
             }
         }
     }
     ob_clean();
     // We need the new userid, so we're fetching it from the newly created entry here
     $query = 'SELECT `id`' . ' FROM #__users' . ' WHERE `username` = \'' . $var['username'] . '\'';
     $db->setQuery($query);
     return $db->loadResult();
 }
Example #7
0
 static function getAdminEmailList()
 {
     global $aecConfig;
     $adminlist = array();
     if ($aecConfig->cfg['email_default_admins']) {
         $admins = xJACLhandler::getSuperAdmins();
         foreach ($admins as $admin) {
             if (!empty($admin->sendEmail)) {
                 $adminlist[] = $admin->email;
             }
         }
     }
     if (!empty($aecConfig->cfg['email_extra_admins'])) {
         $al = explode(',', $aecConfig->cfg['email_extra_admins']);
         $adminlist = array_merge($adminlist, $al);
     }
     return $adminlist;
 }
 public function sendEmailRegistered($renew, $adminonly = false, $invoice = null)
 {
     global $aecConfig;
     $app = JFactory::getApplication();
     $free = strcmp(strtolower($this->type), 'none') == 0 || strcmp(strtolower($this->type), 'free') == 0;
     $urow = new cmsUser();
     $urow->load($this->userid);
     $plan = new SubscriptionPlan();
     $plan->load($this->plan);
     $name = $urow->name;
     $email = $urow->email;
     $username = $urow->username;
     $pwd = $urow->password;
     $activationcode = $urow->activation;
     $message = sprintf(JText::_('ACCTEXP_MAILPARTICLE_GREETING'), $name);
     // Assemble E-Mail Subject & Message
     if ($renew) {
         $subject = sprintf(JText::_('ACCTEXP_SEND_MSG_RENEW'), $name, $app->getCfg('sitename'));
         $message .= sprintf(JText::_('ACCTEXP_MAILPARTICLE_THANKSREN'), $app->getCfg('sitename'));
         if ($plan->email_desc) {
             $message .= "\n\n" . $plan->email_desc . "\n\n";
         } else {
             $message .= " ";
         }
         if ($free) {
             $message .= sprintf(JText::_('ACCTEXP_MAILPARTICLE_LOGIN'), JURI::root());
         } else {
             $message .= JText::_('ACCTEXP_MAILPARTICLE_PAYREC') . " " . sprintf(JText::_('ACCTEXP_MAILPARTICLE_LOGIN'), JURI::root());
         }
     } else {
         $subject = sprintf(JText::_('ACCTEXP_SEND_MSG'), $name, $app->getCfg('sitename'));
         $message .= sprintf(JText::_('ACCTEXP_MAILPARTICLE_THANKSREG'), $app->getCfg('sitename'));
         if ($plan->email_desc) {
             $message .= "\n\n" . $plan->email_desc . "\n\n";
         } else {
             $message .= " ";
         }
         if ($free) {
             $message .= sprintf(JText::_('ACCTEXP_MAILPARTICLE_LOGIN'), JURI::root());
         } else {
             $message .= JText::_('ACCTEXP_MAILPARTICLE_PAYREC') . " " . sprintf(JText::_('ACCTEXP_MAILPARTICLE_LOGIN'), JURI::root());
         }
     }
     $message .= JText::_('ACCTEXP_MAILPARTICLE_FOOTER');
     $subject = html_entity_decode($subject, ENT_QUOTES, 'UTF-8');
     $message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
     // Send email to user
     if ($app->getCfg('mailfrom') != '' && $app->getCfg('fromname') != '') {
         $adminName2 = $app->getCfg('fromname');
         $adminEmail2 = $app->getCfg('mailfrom');
     } else {
         $rows = xJACLhandler::getSuperAdmins();
         $row2 = $rows[0];
         $adminName2 = $row2->name;
         $adminEmail2 = $row2->email;
     }
     if (!$adminonly) {
         xJ::sendMail($adminEmail2, $adminEmail2, $email, $subject, $message);
     }
     $aecUser = array();
     if (is_object($invoice)) {
         if (!empty($invoice->params['creator_ip'])) {
             $aecUser['ip'] = $invoice->params['creator_ip'];
             // user Hostname (if not deactivated)
             if ($aecConfig->cfg['gethostbyaddr']) {
                 $aecUser['isp'] = gethostbyaddr($invoice->params['creator_ip']);
             } else {
                 $aecUser['isp'] = 'deactivated';
             }
         }
     }
     if (empty($aecUser)) {
         $aecUser = AECToolbox::aecIP();
     }
     // Send notification to all administrators
     if ($renew) {
         $subject2 = sprintf(JText::_('ACCTEXP_SEND_MSG_RENEW'), $name, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('ACCTEXP_ASEND_MSG_RENEW'), $adminName2, $app->getCfg('sitename'), $name, $email, $username, $plan->id, $plan->name, $aecUser['ip'], $aecUser['isp']);
     } else {
         $subject2 = sprintf(JText::_('ACCTEXP_SEND_MSG'), $name, $app->getCfg('sitename'));
         $message2 = sprintf(JText::_('ACCTEXP_ASEND_MSG'), $adminName2, $app->getCfg('sitename'), $name, $email, $username, $plan->id, $plan->name, $aecUser['ip'], $aecUser['isp']);
     }
     $subject2 = html_entity_decode($subject2, ENT_QUOTES, 'UTF-8');
     $message2 = html_entity_decode($message2, ENT_QUOTES, 'UTF-8');
     $admins = AECToolbox::getAdminEmailList();
     foreach ($admins as $adminemail) {
         if (!empty($adminemail)) {
             xJ::sendMail($adminEmail2, $adminEmail2, $adminemail, $subject2, $message2);
         }
     }
 }
 static function getLists($params_values, $restrictions_values)
 {
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $gtree = xJACLhandler::getGroupTree(array(28, 29, 30));
     // Create GID related Lists
     $lists['gid'] = JHTML::_('select.genericlist', $gtree, 'gid', 'size="6"', 'value', 'text', arrayValueDefault($params_values, 'gid', defined('JPATH_MANIFESTS') ? 2 : 18));
     $lists['mingid'] = JHTML::_('select.genericlist', $gtree, 'mingid', 'size="6"', 'value', 'text', arrayValueDefault($restrictions_values, 'mingid', defined('JPATH_MANIFESTS') ? 2 : 18));
     $lists['fixgid'] = JHTML::_('select.genericlist', $gtree, 'fixgid', 'size="6"', 'value', 'text', arrayValueDefault($restrictions_values, 'fixgid', defined('JPATH_MANIFESTS') ? 3 : 19));
     $lists['maxgid'] = JHTML::_('select.genericlist', $gtree, 'maxgid', 'size="6"', 'value', 'text', arrayValueDefault($restrictions_values, 'maxgid', defined('JPATH_MANIFESTS') ? 4 : 21));
     $available_plans = array();
     // Fetch Payment Plans
     $query = 'SELECT `id` AS value, `name` AS text' . ' FROM #__acctexp_plans';
     $db->setQuery($query);
     $plans = $db->loadObjectList();
     if (empty($plans)) {
         $plans = array();
     } else {
         $all_plans = $available_plans;
     }
     $planrest = array('previousplan_req', 'currentplan_req', 'overallplan_req', 'used_plan_min', 'used_plan_max', 'previousplan_req_excluded', 'currentplan_req_excluded', 'overallplan_req_excluded');
     foreach ($planrest as $name) {
         $lists[$name] = JHTML::_('select.genericlist', $plans, $name . '[]', 'size="1" multiple="multiple"', 'value', 'text', arrayValueDefault($restrictions_values, $name, 0));
     }
     $available_groups = array();
     // Fetch Item Groups
     $query = 'SELECT `id` AS value, `name` AS text' . ' FROM #__acctexp_itemgroups';
     $db->setQuery($query);
     $groups = $db->loadObjectList();
     if (empty($groups)) {
         $groups = array();
     }
     $grouprest = array('previousgroup_req', 'currentgroup_req', 'overallgroup_req', 'used_group_min', 'used_group_max', 'previousgroup_req_excluded', 'currentgroup_req_excluded', 'overallgroup_req_excluded');
     foreach ($grouprest as $name) {
         $lists[$name] = JHTML::_('select.genericlist', $groups, $name . '[]', 'size="1" multiple="multiple"', 'value', 'text', arrayValueDefault($restrictions_values, $name, 0));
     }
     return $lists;
 }
Example #10
0
File: j15.php Project: Ibrahim1/aec
 /**
  * @param integer $userid
  */
 public function instantGIDchange($userid, $gid, $removegid = array(), $sessionextra = null)
 {
     $user = JFactory::getUser();
     if (!is_array($gid) && !empty($gid)) {
         $gid = array($gid);
     } elseif (empty($gid)) {
         $gid = array();
     }
     if (!is_array($removegid) && !empty($removegid)) {
         $removegid = array($removegid);
     }
     if (!empty($removegid)) {
         xJACLhandler::removeGIDs((int) $userid, $removegid);
     }
     // Set GID and usertype
     if (!empty($gid)) {
         $info = xJACLhandler::setGIDs((int) $userid, $gid);
     }
     $session = $this->getSession($userid);
     if (empty($session)) {
         return true;
     }
     if (!empty($sessionextra)) {
         if (is_array($sessionextra)) {
             foreach ($sessionextra as $sk => $sv) {
                 $session['user']->{$sk} = $sv;
                 if ($userid == $user->id) {
                     $user->{$sk} = $sv;
                 }
             }
         }
     }
     if (isset($session['user'])) {
         if (!empty($gid[0])) {
             $session['user']->gid = $gid[0];
             $session['user']->usertype = $info[$gid[0]];
             if ($userid == $user->id) {
                 $user->gid = $gid[0];
                 $user->usertype = $info[$gid[0]];
             }
         }
     }
     return $this->putSession($userid, $session, $gid[0], $info[$gid[0]]);
 }
Example #11
0
 /**
  * @param integer $userid
  */
 public function instantGIDchange($userid, $gid, $removegid = array(), $sessionextra = null)
 {
     $user = JFactory::getUser();
     if (!is_array($gid) && !empty($gid)) {
         $gid = array($gid);
     } elseif (empty($gid)) {
         $gid = array();
     }
     if (!is_array($removegid) && !empty($removegid)) {
         $removegid = array($removegid);
     }
     if (!empty($removegid)) {
         xJACLhandler::removeGIDs((int) $userid, $removegid);
     }
     // Set GID and usertype
     if (!empty($gid)) {
         $info = xJACLhandler::setGIDs((int) $userid, $gid);
     }
     $session = $this->getSession($userid);
     if (empty($session)) {
         return true;
     }
     if (!empty($sessionextra)) {
         if (is_array($sessionextra)) {
             foreach ($sessionextra as $sk => $sv) {
                 $session['user']->{$sk} = $sv;
                 if ($userid == $user->id) {
                     $user->{$sk} = $sv;
                 }
             }
         }
     }
     if (isset($session['user'])) {
         $user = JFactory::getUser();
         $sgsids = JAccess::getGroupsByUser($userid);
         if (!empty($gid)) {
             foreach ($gid as $g) {
                 if (!in_array($g, $sgsids)) {
                     $sgsids[] = $g;
                 }
             }
         }
         if (!empty($removegid)) {
             foreach ($sgsids as $k => $g) {
                 if (in_array($g, $removegid)) {
                     unset($sgsids[$k]);
                 }
             }
         }
         $db = JFactory::getDBO();
         $query = 'SELECT `title`, `id`' . ' FROM #__usergroups' . ' WHERE `id` IN (' . implode(',', $sgsids) . ')';
         $db->setQuery($query);
         $sgslist = $db->loadObjectList();
         $sgs = array();
         foreach ($sgslist as $gidgroup) {
             if (!in_array($gidgroup->id, $removegid)) {
                 $sgs[$gidgroup->title] = $gidgroup->id;
             }
         }
         if ($userid == $user->id) {
             $user->set('groups', $sgs);
             $user->set('_authLevels', xJSessionHandler::getAuthorisedViewLevels($userid));
             $user->set('_authGroups', xJSessionHandler::getGroupsByUser($userid));
         }
         $session['user']->set('groups', $sgs);
         $session['user']->set('_authLevels', xJSessionHandler::getAuthorisedViewLevels($userid));
         $session['user']->set('_authGroups', xJSessionHandler::getGroupsByUser($userid));
     }
     $this->putSession($userid, $session, $gid[0], $info[$gid[0]]);
 }
Example #12
0
 /**
  * @param string $method
  */
 public function aecReadout($optionlist, $method)
 {
     $this->optionlist = $optionlist;
     $this->method = "conversionHelper" . strtoupper($method);
     $this->lists = array();
     $this->acllist = xJACLhandler::aclList();
     foreach ($this->acllist as $aclitem) {
         $this->lists['gid'][$aclitem->group_id] = $aclitem->name;
     }
     $this->planlist = SubscriptionPlanHandler::getFullPlanList();
     foreach ($this->planlist as $planitem) {
         $this->lists['plan'][$planitem->id] = $planitem->name;
     }
     $this->milist = microIntegrationHandler::getMIList(null, null, isset($_POST['use_ordering']), true);
     foreach ($this->milist as $miitem) {
         $this->lists['mi'][$miitem->id] = $miitem->name;
     }
 }
Example #13
0
File: acl.php Project: Ibrahim1/aec
 public function Settings()
 {
     $settings = array();
     $rewriteswitches = array('cms', 'user', 'expiration', 'subscription', 'plan', 'invoice');
     if (defined('JPATH_MANIFESTS')) {
         $settings['set_gid'] = array('toggle');
         $settings['gid'] = array('list');
         $settings['gid_rw'] = array('inputD');
         $settings['set_removegid'] = array('toggle');
         $settings['removegid'] = array('list');
         $settings['removegid_rw'] = array('inputD');
         $settings['aectab_exp'] = array('tab', 'Expiration Action', 'Expiration Action');
         $settings['set_gid_exp'] = array('toggle');
         $settings['gid_exp'] = array('list');
         $settings['gid_rw_exp'] = array('inputD');
         $settings['set_removegid_exp'] = array('toggle');
         $settings['removegid_exp'] = array('list');
         $settings = AECToolbox::rewriteEngineInfo($rewriteswitches, $settings);
         $settings['aectab_preexp'] = array('tab', 'Pre-Expiration Action', 'Pre-Expiration Action');
         $settings['set_gid_pre_exp'] = array('toggle');
         $settings['gid_pre_exp'] = array('list');
         $settings['gid_rw_pre_exp'] = array('inputD');
         $settings['set_removegid_pre_exp'] = array('toggle');
         $settings['removegid_pre_exp'] = array('list');
         $settings['removegid_rw_pre_exp'] = array('inputD');
         $settings = AECToolbox::rewriteEngineInfo($rewriteswitches, $settings);
     } else {
         $settings['jaclpluspro'] = array('toggle');
         $settings['delete_subgroups'] = array('toggle');
         $settings['set_gid'] = array('toggle');
         $settings['gid'] = array('list');
         $settings['gid_rw'] = array('inputD');
         $settings['sub_set_gid'] = array('toggle');
         $settings['sub_gid_del'] = array('list');
         $settings['sub_gid'] = array('list');
         $settings['aectab_exp'] = array('tab', 'Expiration Action', 'Expiration Action');
         $settings['set_gid_exp'] = array('toggle');
         $settings['gid_exp'] = array('list');
         $settings['gid_rw_exp'] = array('inputD');
         $settings['sub_set_gid_exp'] = array('toggle');
         $settings['sub_gid_exp_del'] = array('list');
         $settings['sub_gid_exp'] = array('list');
         $settings['aectab_preexp'] = array('tab', 'Pre-Expiration Action', 'Pre-Expiration Action');
         $settings['set_gid_pre_exp'] = array('toggle');
         $settings['gid_pre_exp'] = array('list');
         $settings['gid_rw_pre_exp'] = array('inputD');
         $settings['sub_set_gid_pre_exp'] = array('toggle');
         $settings['sub_gid_pre_exp_del'] = array('list');
         $settings['sub_gid_pre_exp'] = array('list');
     }
     $gtree = xJACLhandler::getGroupTree(array(28, 29, 30));
     $gidlists = array('gid', 'gid_exp', 'gid_pre_exp', 'removegid', 'removegid_exp', 'removegid_pre_exp');
     foreach ($gidlists as $name) {
         if (defined('JPATH_MANIFESTS')) {
             $selected = array();
         } else {
             $selected = 18;
         }
         if (!empty($this->settings[$name])) {
             if (is_array($this->settings[$name])) {
                 foreach ($this->settings[$name] as $value) {
                     $selected[] = (object) array('value' => $value);
                 }
             } else {
                 $selected = $this->settings[$name];
             }
         }
         if (defined('JPATH_MANIFESTS')) {
             $settings['lists'][$name] = JHTML::_('select.genericlist', $gtree, $name . '[]', 'size="6" multiple="multiple"', 'value', 'text', $selected);
         } else {
             $settings['lists'][$name] = JHTML::_('select.genericlist', $gtree, $name, 'size="6"', 'value', 'text', $selected);
         }
     }
     $subgroups = array('sub_gid_del', 'sub_gid', 'sub_gid_exp_del', 'sub_gid_exp', 'sub_gid_pre_exp_del', 'sub_gid_pre_exp');
     foreach ($subgroups as $groupname) {
         $selected = array();
         if (!empty($this->settings[$groupname])) {
             foreach ($this->settings[$groupname] as $value) {
                 $selected[] = (object) array('value' => $value);
             }
         }
         $settings['lists'][$groupname] = JHTML::_('select.genericlist', $gtree, $groupname . '[]', 'size="6" multiple="multiple"', 'value', 'text', $selected);
     }
     return $settings;
 }