public function Settings() { $settings = array(); $settings['delete'] = array('list', 'Delete this', 'This processor will be deleted permanently.', 0); $settings['replace'] = array('list', 'Replace it with this', 'All references to the original processor (in plans, subscriptions, invoices and the transaction history) will be replaced with this.', 0); if (!isset($_POST['delete'])) { $_POST['delete'] = ''; } if (!isset($_POST['replace'])) { $_POST['replace'] = ''; } $settings['lists']['delete'] = PaymentProcessorHandler::getProcessorSelectList(false, $_POST['delete'], 'delete'); $settings['lists']['replace'] = PaymentProcessorHandler::getProcessorSelectList(false, $_POST['replace'], 'replace'); return $settings; }
public function touchProcessors() { // Make sure settings & info are updated $pplist = PaymentProcessorHandler::getInstalledNameList(); foreach ($pplist as $ppname) { $pp = new PaymentProcessor(); if (!$pp->loadName($ppname)) { continue; } $pp->copyAssets(); $pp->fullInit(); // Infos often change, so we protect the name and description and so on, but replace everything else $original = $pp->processor->info(); $protect = array('name', 'longname', 'statement', 'description'); foreach ($original as $name => $var) { if (!in_array($name, $protect)) { $pp->info[$name] = $var; } } $pp->processor->storeload(); } }
function export($type, $cmd = null) { $db = JFactory::getDBO(); $cmd_save = strcmp('save', $cmd) === 0; $cmd_apply = strcmp('apply', $cmd) === 0; $cmd_load = strcmp('load', $cmd) === 0; $cmd_export = strcmp('export', $cmd) === 0; $use_original = 0; $system_values = array(); $filter_values = array(); $options_values = array(); $params_values = array(); if ($type == 'sales') { $getpost = array('system' => array('selected_export', 'delete', 'save', 'save_name'), 'filter' => array('date_start', 'date_end', 'method', 'planid', 'groupid', 'status', 'orderby'), 'options' => array('collate', 'breakdown', 'breakdown_custom'), 'params' => array('export_method')); $pf = 8; } else { $getpost = array('system' => array('selected_export', 'delete', 'save', 'save_name'), 'filter' => array('planid', 'groupid', 'status', 'orderby'), 'options' => array('rewrite_rule'), 'params' => array('export_method')); $pf = 5; } $postfields = 0; foreach ($getpost as $name => $array) { $field = $name . '_values'; foreach ($array as $vname) { $vvalue = aecGetParam($vname, ''); if (!empty($vvalue)) { ${$field}[$vname] = $vvalue; $postfields++; } } } if (!empty($params_values['export_method'])) { $is_test = $params_values['export_method'] == 'test'; } else { $is_test = false; } $lists = array(); $pname = ""; if (!empty($system_values['selected_export']) || $cmd_save || $cmd_apply || $is_test) { $row = new aecExport($type == 'sales'); if (isset($system_values['selected_export'])) { $row->load($system_values['selected_export']); $pname = $row->name; } else { $row->load(0); } if (!empty($system_values['delete'])) { // User wants to delete the entry $row->delete(); } elseif (($cmd_save || $cmd_apply) && (!empty($system_values['selected_export']) || !empty($system_values['save_name']))) { // User wants to save an entry if (!empty($system_values['save'])) { // But as a copy of another entry $row->load(0); } $row->saveComplex($system_values['save_name'], $filter_values, $options_values, $params_values); if (!empty($system_values['save'])) { $system_values['selected_export'] = $row->getMax(); } } elseif (($cmd_save || $cmd_apply) && (empty($system_values['selected_export']) && !empty($system_values['save_name']) && $system_values['save']) && !$is_test) { // User wants to save a new entry $row->saveComplex($system_values['save_name'], $filter_values, $options_values, $params_values); } elseif ($cmd_load || count($postfields) && $postfields <= $pf && ($cmd_export || $is_test)) { if ($row->id) { // User wants to load an entry $filter_values = $row->filter; $options_values = $row->options; $params_values = $row->params; $pname = $row->name; $use_original = 1; } } } // Always store the last ten calls, but only if something is happening if ($cmd_save || $cmd_apply || $cmd_export) { $autorow = new aecExport($type == 'sales'); $autorow->load(0); $autorow->saveComplex('Autosave', $filter_values, $options_values, $params_values, true); if (isset($row)) { if ($autorow->filter == $row->filter && $autorow->options == $row->options && $autorow->params == $row->params) { $use_original = 1; } } } $filters = array('planid', 'groupid', 'status'); foreach ($filters as $filter) { if (!isset($filter_values[$filter])) { $filter_values[$filter] = array(); continue; } if (!is_array($filter_values[$filter])) { if (!empty($filter_values[$filter])) { $filter_values[$filter] = array($filter_values[$filter]); } else { $filter_values[$filter] = array(); } } } if ($is_test) { $row->params['export_method'] = 'test'; } // Create Parameters $params[] = array('userinfobox', 5); if ($type == 'members') { $params[] = array('section_paper', 'Compose Export'); $params['params_remap'] = array('subarea_change', 'params'); $params[] = array('div', '<div class="alert alert-info">'); $params[] = array('p', '<p>Take users that fit these criteria:</p>'); $params['groupid'] = array('list', ''); $params['planid'] = array('list', ''); $params['status'] = array('list', ''); $params[] = array('div_end', ''); $params[] = array('div', '<div class="alert alert-warning">'); $params[] = array('p', '<p>Order them like this:</p>'); $params['orderby'] = array('list', ''); $params[] = array('div_end', ''); $params[] = array('div', '<div class="alert alert-success">'); $params[] = array('p', '<p>And use these details for each line of the export:</p>'); $params['rewrite_rule'] = array('inputD', '[[user_id]];[[user_username]];[[subscription_expiration_date]]'); $params[] = array('div_end', ''); $params[] = array('section_end', ''); } else { $monthago = (int) gmdate('U') - 60 * 60 * 24 * 31; $params[] = array('section_paper', 'Compose Export'); $params['params_remap'] = array('subarea_change', 'params'); $params[] = array('div', '<div class="alert alert-info">'); $params[] = array('p', '<p>Collect Sales Data from this range:</p>'); $params['date_start'] = array('list_date', date('Y-m-d', $monthago)); $params['date_end'] = array('list_date', date('Y-m-d')); $params['method'] = array('list', ''); $params['planid'] = array('list', ''); $params['groupid'] = array('list', ''); $params[] = array('div_end', ''); $params[] = array('div', '<div class="alert alert-warning">'); $params[] = array('p', '<p>Collate it like this:</p>'); $params['collate'] = array('list', 'day'); $params[] = array('div_end', ''); $params[] = array('div', '<div class="alert alert-success">'); $params[] = array('p', '<p>Break down the data in each line like so:</p>'); $params['breakdown'] = array('list', 'month'); $params['breakdown_custom'] = array('inputD', ''); $params[] = array('div_end', ''); $params[] = array('section_end', ''); } if ($type == 'members') { $params[] = array('userinfobox', 5); $params[] = array('section_paper'); $rewriteswitches = array('cms', 'user', 'subscription', 'plan', 'invoice'); $params = AECToolbox::rewriteEngineInfo($rewriteswitches, $params); $params[] = array('section_end', ''); $params[] = array('2div_end', ''); } $params[] = array('2div_end', ''); $params[] = array('userinfobox', 5); $params[] = array('section_paper', 'Save or Load Export Presets'); $params[] = array('div', '<div class="form-wide">'); $params['selected_export'] = array('list', ''); $params['delete'] = array('checkbox'); $params['save'] = array('checkbox'); $params['save_name'] = array('inputC', $pname); $params[] = array('div_end', ''); $params[] = array('div', '<div class="right-btns">'); $params[] = array('p', '<a class="btn btn-primary" onclick="javascript: submitbutton(\'loadExport' . $type . '\')" href="#">' . aecHTML::Icon('upload') . ' Load Preset</a>'); $params[] = array('p', '<a class="btn btn-success" onclick="javascript: submitbutton(\'applyExport' . $type . '\')" href="#">' . aecHTML::Icon('download') . ' Save Preset</a>'); $params[] = array('p', '<a class="btn danger" onclick="javascript: submitbutton(\'saveExport' . $type . '\')" href="#">' . aecHTML::Icon('download-alt') . ' Save Preset & Exit</a>'); $params[] = array('div_end', ''); $params[] = array('section_end', ''); $params[] = array('2div_end', ''); $params[] = array('userinfobox', 5); $params[] = array('section_paper', 'Export'); $params['export_method'] = array('list', ''); $params[] = array('p', '<div class="right-btns"><div class="btn-group">'); $params[] = array('p', '<a class="btn btn-info" id="testexport" href="#export-result">' . aecHTML::Icon('eye-open') . ' Test Export</a>'); $params[] = array('p', '<a class="btn btn-success" onclick="javascript: submitbutton(\'exportExport' . $type . '\')" href="#">' . aecHTML::Icon('file') . ' Export Now</a>'); $params[] = array('2div_end', ''); $params[] = array('section_end', ''); $params[] = array('2div_end', ''); $params[] = array('userinfobox', 5); $params[] = array('div', '<div class="aec-settings-container" id="export-result">'); $params[] = array('h4', '<h4>Preview</h4>'); $params[] = array('2div_end', ''); // Create a list of export options // First, only the non-autosaved entries $query = 'SELECT `id`, `name`, `created_date`, `lastused_date`' . ' FROM #__acctexp_export' . ($type == 'sales' ? '_sales' : '') . ' WHERE `system` = \''; $db->setQuery($query . '0\''); $user_exports = $db->loadObjectList(); // Then the autosaved entries $db->setQuery($query . '1\''); $system_exports = $db->loadObjectList(); $entries = count($user_exports) + count($system_exports); $m = 0; if ($entries > 0) { $listitems = array(); $listitems[] = JHTML::_('select.option', 0, " --- Your Exports --- "); $user = false; for ($i = 0; $i < $entries; $i++) { if ($i >= count($user_exports) && $user === false) { $user = $i; $listitems[] = JHTML::_('select.option', 0, " --- Autosaves --- "); } if ($user === false) { if (!empty($user_exports[$i]->name)) { $used_date = $user_exports[$i]->lastused_date == '0000-00-00 00:00:00' ? 'never' : $user_exports[$i]->lastused_date; $listitems[] = JHTML::_('select.option', $user_exports[$i]->id, substr($user_exports[$i]->name, 0, 64) . ' - ' . 'last used: ' . $used_date . ', created: ' . $user_exports[$i]->created_date); } else { $m--; } } else { $ix = $i - $user; $used_date = $system_exports[$ix]->lastused_date == '0000-00-00 00:00:00' ? 'never' : $system_exports[$ix]->lastused_date; $listitems[] = JHTML::_('select.option', $system_exports[$ix]->id, substr($system_exports[$ix]->name, 0, 64) . ' - ' . 'last used: ' . $used_date . ', created: ' . $system_exports[$ix]->created_date); } } } else { $listitems[] = JHTML::_('select.option', 0, " --- No saved Preset available --- "); $listitems[] = JHTML::_('select.option', 0, " --- Your Exports --- ", 'value', 'text', true); $listitems[] = JHTML::_('select.option', 0, " --- Autosaves --- ", 'value', 'text', true); } $lists['selected_export'] = JHTML::_('select.genericlist', $listitems, 'selected_export', 'size="' . max(10, min(20, $entries + $m + 2)) . '" class="col-sm-7"', 'value', 'text', arrayValueDefault($system_values, 'selected_export', '')); // Get list of plans for filter $query = 'SELECT `id`, `name`' . ' FROM #__acctexp_plans' . ' ORDER BY `ordering`'; $db->setQuery($query); $db_plans = $db->loadObjectList(); $lists['planid'] = '<select id="plan-filter-select" class="col-sm-3" name="planid[]" multiple="multiple" size="5">'; foreach ($db_plans as $plan) { $lists['planid'] .= '<option value="' . $plan->id . '"' . (in_array($plan->id, $filter_values['planid']) ? ' selected="selected"' : '') . '>' . $plan->name . '</option>'; } $lists['planid'] .= '</select>'; $grouplist = ItemGroupHandler::getTree(); $lists['groupid'] = '<select id="group-filter-select" class="col-sm-3" name="groupid[]" multiple="multiple" size="5">'; foreach ($grouplist as $glisti) { if (defined('JPATH_MANIFESTS')) { $lists['groupid'] .= '<option value="' . $glisti[0] . '"' . (in_array($glisti[0], $filter_values['groupid']) ? ' selected="selected"' : '') . '>' . str_replace(' ', ' ', $glisti[1]) . '</option>'; } else { $lists['groupid'] .= '<option value="' . $glisti[0] . '"' . (in_array($glisti[0], $filter_values['groupid']) ? ' selected="selected"' : '') . '>' . $glisti[1] . '</option>'; } } $lists['groupid'] .= '</select>'; if ($type == 'members') { $status = array('excluded' => JText::_('AEC_SEL_EXCLUDED'), 'pending' => JText::_('AEC_SEL_PENDING'), 'active' => JText::_('AEC_SEL_ACTIVE'), 'expired' => JText::_('AEC_SEL_EXPIRED'), 'closed' => JText::_('AEC_SEL_CLOSED'), 'cancelled' => JText::_('AEC_SEL_CANCELLED'), 'hold' => JText::_('AEC_SEL_HOLD'), 'notconfig' => JText::_('AEC_SEL_NOT_CONFIGURED')); $lists['status'] = '<select id="status-group-select" name="status[]" multiple="multiple" size="5">'; foreach ($status as $id => $txt) { $lists['status'] .= '<option value="' . $id . '"' . (in_array($id, $filter_values['status']) ? ' selected="selected"' : '') . '>' . $txt . '</option>'; } $lists['status'] .= '</select>'; // Ordering $sel = array(); $sel[] = JHTML::_('select.option', 'expiration ASC', JText::_('EXP_ASC')); $sel[] = JHTML::_('select.option', 'expiration DESC', JText::_('EXP_DESC')); $sel[] = JHTML::_('select.option', 'name ASC', JText::_('NAME_ASC')); $sel[] = JHTML::_('select.option', 'name DESC', JText::_('NAME_DESC')); $sel[] = JHTML::_('select.option', 'username ASC', JText::_('LOGIN_ASC')); $sel[] = JHTML::_('select.option', 'username DESC', JText::_('LOGIN_DESC')); $sel[] = JHTML::_('select.option', 'signup_date ASC', JText::_('SIGNUP_ASC')); $sel[] = JHTML::_('select.option', 'signup_date DESC', JText::_('SIGNUP_DESC')); $sel[] = JHTML::_('select.option', 'lastpay_date ASC', JText::_('LASTPAY_ASC')); $sel[] = JHTML::_('select.option', 'lastpay_date DESC', JText::_('LASTPAY_DESC')); $sel[] = JHTML::_('select.option', 'plan_name ASC', JText::_('PLAN_ASC')); $sel[] = JHTML::_('select.option', 'plan_name DESC', JText::_('PLAN_DESC')); $sel[] = JHTML::_('select.option', 'status ASC', JText::_('STATUS_ASC')); $sel[] = JHTML::_('select.option', 'status DESC', JText::_('STATUS_DESC')); $sel[] = JHTML::_('select.option', 'type ASC', JText::_('TYPE_ASC')); $sel[] = JHTML::_('select.option', 'type DESC', JText::_('TYPE_DESC')); $lists['orderby'] = JHTML::_('select.genericlist', $sel, 'orderby', 'class="inputbox" size="1"', 'value', 'text', arrayValueDefault($filter_values, 'orderby', '')); } else { $collate_selection = array(); $collate_selection[] = JHTML::_('select.option', 'day', JText::_('Day')); $collate_selection[] = JHTML::_('select.option', 'week', JText::_('Week')); $collate_selection[] = JHTML::_('select.option', 'month', JText::_('Month')); $collate_selection[] = JHTML::_('select.option', 'year', JText::_('Year')); $selected_collate = 0; if (!empty($options_values['collate'])) { $selected_collate = $options_values['collate']; } else { $selected_collate = 'day'; } $lists['collate'] = JHTML::_('select.genericlist', $collate_selection, 'collate', 'size="1"', 'value', 'text', $selected_collate); $breakdown_selection = array(); $breakdown_selection[] = JHTML::_('select.option', '0', JText::_('None')); $breakdown_selection[] = JHTML::_('select.option', 'plan', JText::_('Plan')); $breakdown_selection[] = JHTML::_('select.option', 'group', JText::_('Group')); $selected_breakdown = 0; if (!empty($options_values['breakdown'])) { $selected_breakdown = $options_values['breakdown']; } $lists['breakdown'] = JHTML::_('select.genericlist', $breakdown_selection, 'breakdown', 'size="1"', 'value', 'text', $selected_breakdown); $processors = PaymentProcessorHandler::getInstalledObjectList(); $proc_list = array(); $selected_proc = array(); foreach ($processors as $proc) { $pp = new PaymentProcessor(); $pp->loadName($proc->name); $pp->getInfo(); $proc_list[] = JHTML::_('select.option', $pp->id, $pp->info['longname']); if (!empty($filter_values['method'])) { foreach ($filter_values['method'] as $id) { if ($id == $pp->id) { $selected_proc[] = JHTML::_('select.option', $id, $pp->info['longname']); } } } } $lists['method'] = JHTML::_('select.genericlist', $proc_list, 'method[]', 'size="8" multiple="multiple"', 'value', 'text', $selected_proc); } // Export Method $list = xJUtility::getFileArray(JPATH_SITE . '/components/com_acctexp/lib/export', 'php', false, true); $sel = array(); foreach ($list as $ltype) { $ltype = str_replace('.php', '', $ltype); if ($ltype != 'test') { $sel[] = JHTML::_('select.option', $ltype, $ltype); } } if (empty($params_values['export_method'])) { $params_values['export_method'] = 'csv'; } $lists['export_method'] = JHTML::_('select.genericlist', $sel, 'export_method', 'class="inputbox" size="1"', 'value', 'text', $params_values['export_method']); $settings = new aecSettings('export', 'general'); // Repackage the objects as array foreach ($getpost as $name => $array) { $field = $name . '_values'; foreach ($array as $vname) { if (!empty(${$field}->{$name})) { $settingsparams[$name] = ${$field}->{$name}; } else { $settingsparams[$name] = ""; } } } if (empty($params_values['rewrite_rule'])) { //$params_values['rewrite_rule'] = '[[user_id]];[[user_username]];[[subscription_expiration_date]]'; } $settingsparams = array_merge($filter_values, $options_values, $params_values); $settings->fullSettingsArray($params, $settingsparams, $lists); // Call HTML Class $aecHTML = new aecHTML($settings->settings, $settings->lists); if ($cmd_export && !empty($params_values['export_method'])) { if ($use_original) { $row->useExport(); } else { $autorow->useExport(); } } if ($cmd_save) { aecRedirect('index.php?option=com_acctexp&task=showCentral'); } else { HTML_AcctExp::export($type, $aecHTML); } }
} $rowstyle = 'invoice-unpaid'; } if (!in_array($invoice->method, $pplist)) { $pplist[] = $invoice->method; } $invoice->formatInvoiceNumber(); $invoices[$invoiceid]['object'] = $invoice; $invoices[$invoiceid]['invoice_number'] = $invoice->invoice_number; $invoices[$invoiceid]['amount'] = $invoice->amount; $invoices[$invoiceid]['currency_code'] = $invoice->currency; $invoices[$invoiceid]['actions'] = $actionsarray; $invoices[$invoiceid]['class'] = $rowstyle; $invoices[$invoiceid]['transactiondate'] = $invoice->getTransactionStatus(); } $pps = PaymentProcessorHandler::getObjectList($pplist, true); $hasforms = false; // Get the tabs information from the plan if (!empty($subscriptions)) { foreach ($subscriptions as $usid => $subscription) { $mis = $subscription->objPlan->getMicroIntegrations(); if (!count($mis)) { continue; } foreach ($mis as $mi_id) { if ($mi_id) { $mi = new MicroIntegration(); $mi->load($mi_id); if (!$mi->callIntegration()) { continue; }
public function loadPlanObject($testmi = false, $quick = false) { if (empty($this->usage) && !empty($this->passthrough['usage'])) { $this->usage = $this->passthrough['usage']; } if (!$this->isCart()) { // get the payment plan $this->plan = new SubscriptionPlan(); $this->plan->load($this->usage); if (empty($this->processor)) { // Recover from missing processor selection if (!empty($this->invoice->made_free) || $this->plan->params['full_free'] && empty($this->invoice->counter) && empty($this->plan->params['trial_period']) || $this->plan->params['full_free'] && $this->invoice->counter || $this->plan->params['trial_free'] && empty($this->invoice->counter)) { if (!isset($this->recurring)) { $this->recurring = 0; } // Only allow clearing while recurring if everything is free if (!($this->recurring && (empty($this->plan->params['full_free']) || empty($this->plan->params['trial_free'])))) { $this->processor = 'free'; } } if (empty($this->processor)) { // It's not free, so select the only processor we have available if (!empty($this->plan->params['processors'])) { foreach ($this->plan->params['processors'] as $proc) { $pp = new PaymentProcessor(); if (!$pp->loadId($proc)) { continue; } $this->processor = $pp->processor_name; break; } } } } if (!is_object($this->plan)) { return getView('access_denied'); } } elseif (!empty($this->usage)) { if (empty($this->metaUser)) { return getView('access_denied'); } if (!isset($this->cartprocexceptions)) { $this->getCart(); $this->usage = 'c.' . $this->cartobject->id; $procs = aecCartHelper::getCartProcessorList($this->cartobject); if (count($procs) > 1) { $this->recurring = null; $this->cartItemsPPselectForm(); } else { if (isset($procs[0])) { $pgroups = aecCartHelper::getCartProcessorGroups($this->cartobject, $this->recurring); $proc = $pgroups[0]['processors'][0]; if (strpos($proc, '_recurring')) { $this->recurring = 1; $proc = str_replace('_recurring', '', $proc); } $procname = PaymentProcessorHandler::getProcessorNamefromId($proc); if (!empty($procname)) { $this->processor = $procname; } $this->plan = aecCartHelper::getCartItemObject($this->cartobject, 0); } else { $am = $this->cartobject->getAmount($this->metaUser, 0, $this); if ($am['amount'] == "0.00") { $this->processor = 'free'; } else { $this->processor = 'none'; } } } $this->cartprocexceptions = true; } if (!isset($this->mi_error)) { $this->mi_error = array(); } $offset = 0; if (!empty($this->exceptions)) { $offset = count($this->exceptions); } if (empty($this->cart) || $quick) { return null; } foreach ($this->cart as $cid => $cartitem) { if (empty($cartitem['obj'])) { continue; } $mi_form = $cartitem['obj']->getMIformParams($this->metaUser, $this->mi_error); $lists = null; if (isset($mi_form['lists']) && !empty($mi_form['lists'])) { $lists = $mi_form['lists']; unset($mi_form['lists']); } if (empty($mi_form)) { continue; } if (!empty($lists)) { // Rewrite lists so they fit a multi-plan context foreach ($lists as $lkey => $litem) { $mi_form['lists'][$offset . '_' . $lkey] = str_replace($lkey, $offset . '_' . $lkey, $litem); } } $this->mi_error = array(); $check = $this->verifyMIForms($cartitem['obj'], $mi_form, $offset . '_'); $offset++; if (!$check) { $ex = array(); $ex['head'] = ""; if (!empty($this->mi_error)) { $ex['desc'] = "<p>" . implode("</p><p>", $this->mi_error) . "</p>"; } else { $ex['desc'] = ""; } $ex['rows'] = $mi_form; $this->raiseException($ex); } if (is_array($this->passthrough)) { foreach ($mi_form as $mik => $miv) { if ($mik == 'lists') { continue; } foreach ($this->passthrough as $pid => $pk) { if (!is_array($pk)) { continue; } if ($pk[0] == $mik || $pk[0] == $mik . '[]') { unset($this->passthrough[$pid]); } } } } } } }
<?php /** * @version $Id: processor_list.php * @package AEC - Account Control Expiration - Membership Manager * @subpackage Main Frontend * @copyright 2012 Copyright (C) David Deutsch * @author David Deutsch <*****@*****.**> & Team AEC - http://www.valanx.org * @license GNU/GPL v.3 http://www.gnu.org/licenses/gpl.html or, at your option, any later version */ // Dont allow direct linking defined('_JEXEC') or die('Direct Access to this location is not allowed.'); $processors = array(); if (!empty($tmpl->cfg['gwlist'])) { $gwnames = PaymentProcessorHandler::getInstalledNameList(true); if (!empty($gwnames)) { foreach ($gwnames as $procname) { if (!in_array($procname, $tmpl->cfg['gwlist'])) { continue; } $processor = trim($procname); $processors[$processor] = new PaymentProcessor(); if ($processors[$processor]->loadName($processor)) { $processors[$processor]->init(); $processors[$processor]->getInfo(); $processors[$processor]->getSettings(); } else { unset($processors[$processor]); } } }
public function explodePlanList($recurring) { global $aecConfig; $groups = array(); $plans = array(); $gs = array(); $ps = array(); // Break apart groups and items, make sure we have no duplicates foreach ($this->list as $litem) { if ($litem['type'] == 'group') { if (!in_array($litem['id'], $gs)) { $gs[] = $litem['id']; $groups[] = $litem; } } else { if (!in_array($litem['id'], $ps)) { if (ItemGroupHandler::checkParentRestrictions($litem['plan'], 'item', $this->metaUser)) { $ps[] = $litem['id']; $plans[] = $litem; } } } } foreach ($plans as $pid => $plan) { if (!isset($plan['plan']->params['cart_behavior'])) { $plan['plan']->params['cart_behavior'] = 0; } if ($this->metaUser->userid && !$this->expired && ($aecConfig->cfg['enable_shoppingcart'] || $plan['plan']->params['cart_behavior'] == 1) && $plan['plan']->params['cart_behavior'] != 2) { // We have a shopping cart situation, care about processors later if ($plan['plan']->params['processors'] == '' || is_null($plan['plan']->params['processors'])) { if (!$plan['plan']->params['full_free']) { continue; } } $plans[$pid]['gw'][0] = new stdClass(); $plans[$pid]['gw'][0]->processor_name = 'add_to_cart'; $plans[$pid]['gw'][0]->info['statement'] = ''; $plans[$pid]['gw'][0]->recurring = 0; continue; } if (empty($plan['select_mode'])) { $select_mode = '0'; } else { $select_mode = $plan['select_mode']; } if ($select_mode == 1) { // We want to only select the processors on confirmation if ($plan['plan']->params['processors'] == '' || is_null($plan['plan']->params['processors'])) { if (!$plan['plan']->params['full_free']) { continue; } } $plans[$pid]['gw'][0] = new stdClass(); $plans[$pid]['gw'][0]->processor_name = 'select'; $plans[$pid]['gw'][0]->info['statement'] = ''; $plans[$pid]['gw'][0]->recurring = 0; continue; } if ($plan['plan']->params['full_free']) { $plans[$pid]['gw'][0] = new stdClass(); $plans[$pid]['gw'][0]->processor_name = 'free'; $plans[$pid]['gw'][0]->info['statement'] = ''; $plans[$pid]['gw'][0]->recurring = 0; } else { if ($plan['plan']->params['processors'] != '' && !is_null($plan['plan']->params['processors'])) { $processors = array_reverse($plan['plan']->params['processors']); // Restrict to pre-chosen processor (if set) if (!empty($this->processor)) { $processorid = PaymentProcessorHandler::getProcessorIdfromName($this->processor); if (in_array($processorid, $processors)) { $processors = array($processorid); } } $plan_gw = array(); if (count($processors)) { foreach ($processors as $n) { if (empty($n)) { continue; } $pp = new PaymentProcessor(); if (!$pp->loadId($n)) { continue; } if (!$pp->processor->active) { continue; } $pp->init(); $pp->getInfo(); $pp->exchangeSettingsByPlan($plan['plan']); $recurring = $pp->is_recurring($recurring, true); if ($recurring > 1) { $pp->recurring = 0; $plan_gw[] = $pp; if (!$plan['plan']->params['lifetime']) { $pp = new PaymentProcessor(); $pp->loadId($n); $pp->init(); $pp->getInfo(); $pp->exchangeSettingsByPlan($plan['plan']); $pp->recurring = 1; $plan_gw[] = $pp; } } elseif (!($plan['plan']->params['lifetime'] && $recurring)) { if (is_int($recurring)) { $pp->recurring = $recurring; } $plan_gw[] = $pp; } } } if (!empty($plan_gw)) { $plans[$pid]['gw'] = $plan_gw; } else { unset($plans[$pid]); } } } } $this->list = array_merge($groups, $plans); }
foreach ($olddirs as $olddir) { $eucaInstall->rrmdir(PaymentProcessorHandler::pp_dir() . '/' . $olddir); } // Remove old processor integrations foreach ($oldprocs as $proc) { $ppath = PaymentProcessorHandler::pp_dir() . '/' . $proc . '.php'; if (file_exists($ppath)) { unlink($ppath); } } $customprocs = xJUtility::getFileArray(PaymentProcessorHandler::pp_dir(), false, false); foreach ($customprocs as $cproc) { if (strpos($cproc, '.php')) { $newdir = PaymentProcessorHandler::pp_dir() . '/' . str_replace('.php', '', $cproc); mkdir($newdir); rename(PaymentProcessorHandler::pp_dir() . '/' . $cproc, $newdir . '/' . $cproc); } } } $mih = new microIntegrationHandler(); $testmis = xJUtility::getFileArray($mih->mi_dir, false, false); // Check if there are old mi files if (count($testmis) > 5) { // Remove other old integration dirs $olddirs = array('mi_example', 'mi_htaccess'); foreach ($olddirs as $olddir) { $eucaInstall->rrmdir($mih->mi_dir . '/' . $olddir); } // Try to preserve custom MIs foreach ($testmis as $mik) { $handle = str_replace(array('mi_', '.php'), '', $mik);
/** * @version $Id: upgrade_1_2_0.inc.php * @package AEC - Account Control Expiration - Membership Manager * @subpackage Install Includes * @copyright 2011-2015 Copyright (C) David Deutsch * @author David Deutsch <*****@*****.**> & Team AEC - http://www.valanx.org * @license GNU/GPL v.3 http://www.gnu.org/licenses/gpl.html or, at your option, any later version */ // Dont allow direct linking defined('_JEXEC') or die('Direct Access to this location is not allowed.'); $eucaInstalldb->addColifNotExists('hidden', "int(4) NOT NULL default '0'", 'microintegrations'); $eucaInstalldb->addColifNotExists('restrictions', "text NULL", 'microintegrations'); // Due to a bug around 1.2 development, ALL processors were installed. Frequently. // This fixes them. $processors = PaymentProcessorHandler::getInstalledObjectList(); if (count($processors) > 50) { $plans = SubscriptionPlanHandler::getPlanList(); $used_processors = array(); foreach ($plans as $planid) { $plan = new SubscriptionPlan(); $plan->load($planid); if (empty($plan->params['processors'])) { continue; } foreach ($plan->params['processors'] as $processor_id) { if (in_array($processor_id, $used_processors)) { continue; } $used_processors[] = $processor_id; }
public function readProcessors() { $lang = JFactory::getLanguage(); $readout = array(); $r = array(); $r['head'] = "Processors"; $processors = PaymentProcessorHandler::getInstalledNameList(); foreach ($processors as $procname) { $pp = null; $pp = new PaymentProcessor(); if (!$pp->loadName($procname)) { continue; } $pp->fullInit(); $readout[] = $r; $r = array(); $r['head'] = $pp->info['longname']; $r['type'] = "table"; $r['sub'] = true; $r['def'] = array("ID" => array('id'), "Published" => array('active', 'bool')); foreach ($pp->info as $iname => $ic) { if (empty($iname)) { continue; } $cname = 'CFG_' . strtoupper($procname) . '_' . strtoupper($iname) . '_NAME'; $gname = 'CFG_PROCESSOR_' . strtoupper($iname) . '_NAME'; if ($lang->hasKey($cname)) { $tname = JText::_($cname); } elseif ($lang->hasKey($gname)) { $tname = JText::_($gname); } else { $tname = $iname; } $r['def'][$tname] = array(array('info', $iname), 'smartlimit'); } $bsettings = $pp->getBackendSettings(); foreach ($bsettings as $psname => $sc) { if (empty($psname) || is_numeric($psname) || $psname == 'lists') { continue; } $cname = 'CFG_' . strtoupper($procname) . '_' . strtoupper($psname) . '_NAME'; $gname = 'CFG_PROCESSOR_' . strtoupper($psname) . '_NAME'; if ($lang->hasKey($cname)) { $tname = JText::_($cname); } elseif ($lang->hasKey($gname)) { $tname = JText::_($gname); } else { $tname = $psname; } if ($sc[0] == 'list_yesno') { $stype = 'bool'; } else { $stype = 'smartlimit'; } $r['def'][$tname] = array(array('settings', $psname), $stype); } $ps = array(); foreach ($r['def'] as $nn => $def) { $ps = array_merge($ps, $this->conversionHelper($def, $pp)); } $r['set'] = array(0 => $ps); } $readout[] = $r; return $readout; }
public function loadName($name) { if (strtolower($name) == 'free' || strtolower($name) == 'none') { return null; } $db = JFactory::getDBO(); // Set Name $this->processor_name = strtolower($name); // See if the processor is installed & set id $query = 'SELECT id, active' . ' FROM #__acctexp_config_processors' . ' WHERE `name` = \'' . $this->processor_name . '\''; $db->setQuery($query); $res = $db->loadObject(); if (!empty($res) && is_object($res)) { $this->id = $res->id ? $res->id : 0; } $this->path = PaymentProcessorHandler::ppDir() . '/' . $this->processor_name; $file = $this->path . '/' . $this->processor_name . '.php'; // Check whether processor exists if (file_exists($file)) { // Call Integration file include_once $this->path . '/' . $this->processor_name . '.php'; // Initiate Payment Processor Class $class_name = 'processor_' . $this->processor_name; $this->processor = new $class_name(); $this->processor->load($this->id); $this->processor->name = $this->processor_name; if (is_object($res)) { $this->processor->active = $res->active; } else { $this->processor->active = 0; } return true; } else { $short = 'processor loading failure'; $event = 'When composing processor info list, tried to load processor: ' . $name; $tags = 'processor,loading,error'; $params = array(); $eventlog = new eventLog(); $eventlog->issue($short, $tags, $event, 128, $params); return false; } }