예제 #1
0
<?php

/**
 * @version $Id: acctexp.class.php
 * @package AEC - Account Control Expiration - Membership Manager
 * @subpackage Core Class
 * @copyright 2006-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.');
define('_AEC_VERSION', '1.2');
define('_AEC_REVISION', '6772');
include_once JPATH_SITE . '/components/com_acctexp/lib/compat.php';
$langlist = array('com_acctexp' => JPATH_SITE, 'com_acctexp.iso3166-1a2' => JPATH_SITE, 'com_acctexp.iso639-1' => JPATH_SITE, 'com_acctexp.microintegrations' => JPATH_SITE, 'com_acctexp.processors' => JPATH_SITE);
xJLanguageHandler::loadList($langlist);
if (!class_exists('paramDBTable')) {
    include_once JPATH_SITE . '/components/com_acctexp/lib/eucalib/eucalib.php';
}
$aecclasses = array('api', 'bucket', 'cart', 'component', 'config', 'coupon', 'displaypipeline', 'event', 'eventlog', 'functions', 'heartbeat', 'history', 'html', 'invoice', 'itemgroup', 'itemterms', 'microintegration', 'paymentprocessor', 'registration', 'restriction', 'rewriteengine', 'service', 'settings', 'subscription', 'subscriptionplan', 'template', 'temptoken', 'toolbox', 'user');
foreach ($aecclasses as $class) {
    include_once dirname(__FILE__) . '/classes/acctexp.' . $class . '.class.php';
}
global $aecConfig;
if (!is_object($aecConfig)) {
    $aecConfig = new aecConfig();
}
 public function callIntegration($override = false)
 {
     $handle = str_replace('mi_', '', $this->class_name);
     $basepath = JPATH_SITE . '/components/com_acctexp/micro_integration/' . $handle;
     $filename = $basepath . '/' . $handle . '.php';
     $file_exists = file_exists($filename);
     if ((!$this->active && !empty($this->id) || !$file_exists) && !$override) {
         // MI does not exist or is deactivated
         return false;
     } elseif ($file_exists) {
         include_once $filename;
         if (empty($this->id) && !$override) {
             $this->copyAssets();
         } elseif ($override) {
             xJLanguageHandler::loadList(array('com_acctexp.mi.' . $handle => $basepath));
         }
         if (!$override) {
             xJLanguageHandler::loadList(array('com_acctexp.mi.' . $handle => JPATH_SITE));
         }
         $class = $this->class_name;
         $this->mi_class = new $class();
         $this->mi_class->id = $this->id;
         $this->getInfo();
         if (is_null($this->name) || $this->name == '') {
             $this->name = $this->info['name'];
         }
         if (is_null($this->desc) || $this->desc == '') {
             $this->desc = $this->info['desc'];
         }
         $this->settings =& $this->params;
         $this->mi_class->info =& $this->info;
         $this->mi_class->settings =& $this->settings;
         return true;
     } else {
         return false;
     }
 }
예제 #3
0
 private function loadLanguage()
 {
     $basepath = JPATH_SITE . '/components/com_acctexp/services/' . $this->type;
     if (empty($this->id)) {
         $this->copyAssets();
     }
     xJLanguageHandler::loadList(array('com_acctexp.services.' . $this->type => JPATH_SITE));
 }
예제 #4
0
 public function fileEventlog()
 {
     // Make sure we have all the language stuff loaded
     $langlist = array('com_acctexp.admin' => JPATH_ADMINISTRATOR);
     xJLanguageHandler::loadList($langlist);
     $short = JText::_('AEC_LOG_SH_HEARTBEAT');
     $event = array(JText::_('AEC_LOG_LO_HEARTBEAT') . ' ');
     $tags = array('heartbeat');
     $level = 2;
     if ($this->result['expired']) {
         if ($this->result['expired'] > 1) {
             $event[] = 'Expires ' . $this->result['expired'] . ' subscriptions';
         } else {
             $event[] = 'Expires 1 subscription';
         }
         $tags[] = 'expiration';
     }
     if ($this->result['fallback']) {
         if ($this->result['fallback'] > 1) {
             $event[] = $this->result['fallback'] . ' subscriptions assigned to a fallback subscription plan';
         } else {
             $event[] = '1 subscription assigned to a fallback subscription plan';
         }
         $tags[] = 'fallback';
     }
     if ($this->result['fail_expired']) {
         if ($this->result['fail_expired'] > 1) {
             $event[] = 'Failed to expire ' . $this->result['fail_expired'] . ' subscriptions';
         } else {
             $event[] = 'Failed to expire 1 subscription';
         }
         $event[] = '- please check your subscriptions for problems';
         $tags[] = 'error';
         $level = 128;
     }
     if ($this->result['pre_exp_actions']) {
         $event[] = $this->result['pre_exp_actions'] . ' Pre-expiration action';
         $event[] = $this->result['pre_exp_actions'] > 1 ? 's' : '';
         $event[] = ' for ' . $this->result['pre_expired'] . ' subscription';
         $event[] = $this->result['pre_expired'] > 1 ? 's' : '';
         $tags[] = 'pre-expiration';
     }
     if ($this->result['skipped']) {
         if ($this->result['fail_expired'] > 1) {
             $event[] = 'Skipped ' . $this->result['fail_expired'] . ' subscriptions';
         } else {
             $event[] = 'Skipped 1 subscription';
         }
     }
     if (count($event) === 0) {
         $event[] = JText::_('AEC_LOG_AD_HEARTBEAT_DO_NOTHING');
     }
     $eventlog = new eventLog();
     $eventlog->issue($short, implode(',', $tags), implode(" ", $event), $level);
 }
 public function install()
 {
     // Create new db entry
     $this->processor->load(0);
     $this->copyAssets();
     xJLanguageHandler::loadList(array('com_acctexp.processors.' . $this->processor_name => JPATH_SITE));
     // Call default values for Info and Settings
     $this->getInfo();
     $this->getSettings();
     // Set name and activate
     $this->processor->name = $this->processor_name;
     $this->processor->active = 1;
     // Set values from defaults and store
     $this->processor->info = $this->info;
     $this->processor->settings = $this->settings;
     $this->processor->storeload();
     $this->id = $this->processor->id;
 }