Example #1
0
 static function getSystemLanguages()
 {
     $fdir = JPATH_SITE . '/language';
     $list = xJUtility::getFileArray($fdir, null, true, true);
     $adir = JPATH_SITE . '/administrator/language';
     $list = array_merge($list, xJUtility::getFileArray($fdir, null, true, true));
     $languages = array();
     foreach ($list as $li) {
         if (strpos($li, '-') !== false && !in_array($li, $languages)) {
             $languages[] = $li;
         }
     }
     return $languages;
 }
 public function getIntegrationList()
 {
     $list = xJUtility::getFileArray($this->mi_dir, '', true, true);
     $integration_list = array();
     foreach ($list as $name) {
         if (is_dir($this->mi_dir . '/' . $name)) {
             // Only add directories with the proper structure
             if (file_exists($this->mi_dir . '/' . $name . '/' . $name . '.php')) {
                 $integration_list[] = $name;
             }
         }
     }
     return $integration_list;
 }
 public static function getProcessorList()
 {
     $list = xJUtility::getFileArray(self::ppDir(), null, true, true);
     $pp_list = array();
     foreach ($list as $name) {
         if (is_dir(self::ppDir() . '/' . $name)) {
             // Only add directories with the proper structure
             if (file_exists(self::ppDir() . '/' . $name . '/' . $name . '.php')) {
                 $pp_list[] = $name;
             }
         }
     }
     return $pp_list;
 }
Example #4
0
 public static function getAvailableServices()
 {
     $list = xJUtility::getFileArray(self::getDir(), null, true, true);
     $services_list = array();
     foreach ($list as $name) {
         $path = self::getServicePath($name);
         if (!is_dir($path)) {
             continue;
         }
         // Only add directories with the proper structure
         if (file_exists($path . '/' . $name . '.php')) {
             $services_list[] = $name;
         }
     }
     return $services_list;
 }
Example #5
0
 static function versionSort($array)
 {
     // Bastardized Quicksort
     if (!isset($array[2])) {
         return $array;
     }
     $piv = $array[0];
     $x = $y = array();
     $len = count($array);
     $i = 1;
     while ($i < $len) {
         if (version_compare(xJUtility::normVersionName($array[$i]), xJUtility::normVersionName($piv), '<')) {
             $x[] = $array[$i];
         } else {
             $y[] = $array[$i];
         }
         ++$i;
     }
     return array_merge(xJUtility::versionSort($x), array($piv), xJUtility::versionSort($y));
 }
Example #6
0
 public function upgrade(&$errors, $eucaInstall, $eucaInstalldb)
 {
     $db = JFactory::getDBO();
     $app = JFactory::getApplication();
     // Overall Variables
     $tables = $db->getTableList();
     $incpath = JPATH_SITE . '/administrator/components/com_acctexp/install/inc';
     // Upgrade ancient settings
     include_once $incpath . '/settings_oldupgrade.inc.php';
     // Upgrade Settings to 0.12.6 status
     include_once $incpath . '/settings_0_12_6_upgrade.inc.php';
     // Load Class (and thus aecConfig)
     require_once JPATH_SITE . '/components/com_acctexp/acctexp.class.php';
     $aecConfig = new aecConfig();
     if (!empty($aecConfig->cfg)) {
         $this->new = false;
     }
     $aecConfig->initParams();
     $document = JFactory::getDocument();
     $document->addCustomTag('<link rel="stylesheet" type="text/css" media="all" href="' . JURI::root() . 'media/com_acctexp/css/admin.css?rev=' . _AEC_REVISION . '" />');
     if (isset($aecConfig->cfg['aec_version'])) {
         $oldversion = $aecConfig->cfg['aec_version'];
     } else {
         $oldversion = '0.0.1';
         if (!$eucaInstalldb->ColumninTable('ordering', 'coupons')) {
             $oldversion = '1.0.0';
         } else {
             $db->setQuery("SHOW INDEXES FROM #__acctexp_subscr");
             $indexes = $db->loadObjectList();
             foreach ($indexes as $index) {
                 if (strpos($index->Key_name, 'userid') !== false) {
                     $oldversion = '0.14.6';
                 }
             }
         }
     }
     if ($this->new) {
         return;
     }
     // Check if we are upgrading from before 0.12.6RC2j - then we need to check everything before that
     if (empty($oldversion) || version_compare($oldversion, '0.12.6RC2j') === 0) {
         if (version_compare($oldversion, '0.12.6RC2j') === 0) {
             $oldupdates = array('0_12_6RC2j');
         } else {
             $oldupdates = array('0_6_0', '0_8_0', '0_10_0', '0_12_0', '0_12_6RC2j');
         }
         foreach ($oldupdates as $upd) {
             require_once $incpath . '/upgrade_' . $upd . '.inc.php';
         }
     }
     $incfiles = xJUtility::getFileArray($incpath, 'inc.php', false, true);
     $versions = array();
     foreach ($incfiles as $filename) {
         if (strpos($filename, 'upgrade_') === false) {
             continue;
         } else {
             $versions[] = str_replace(array('upgrade_', '.inc.php'), array('', ''), $filename);
         }
     }
     $versions = xJUtility::versionSort($versions);
     $old = xJUtility::normVersionName($oldversion);
     foreach ($versions as $version) {
         $new = xJUtility::normVersionName($version);
         if (version_compare($new, $old, '>=')) {
             require_once $incpath . '/upgrade_' . $version . '.inc.php';
         }
     }
     $aecConfig->cfg['aec_version'] = _AEC_VERSION;
     $aecConfig->saveSettings();
 }
Example #7
0
 public function index($cmd)
 {
     $path = JPATH_SITE . '/components/com_acctexp/toolbox';
     if (empty($cmd)) {
         $list = array();
         $files = xJUtility::getFileArray($path, 'php', false, true);
         asort($files);
         foreach ($files as $n => $name) {
             $file = $path . '/' . $name;
             include_once $file;
             $class = str_replace('.php', '', $name);
             $tool = new $class();
             if (!method_exists($tool, 'Info')) {
                 continue;
             }
             $info = $tool->Info();
             $info['link'] = AECToolbox::deadsureURL('administrator/index.php?option=com_acctexp&task=index&entity=toolbox&cmd=' . $class);
             $list[] = $info;
         }
         HTML_AcctExp::toolBox('', $list);
     } else {
         $file = $path . '/' . $cmd . '.php';
         include_once $file;
         $tool = new $cmd();
         $info = $tool->Info();
         $return = '';
         if (!method_exists($tool, 'Action')) {
             $return .= '<section class="paper">' . '<p>Tool doesn\'t have an action to carry out!</p>' . '</section>';
         } else {
             $response = '</section><section class="paper"><h4>' . JText::_('Response') . '</h4>' . $tool->Action() . '</section>';
             if (method_exists($tool, 'Settings')) {
                 $tb_settings = $tool->Settings();
                 if (!empty($tb_settings)) {
                     $lists = array();
                     if (isset($tb_settings['lists'])) {
                         $lists = $tb_settings['lists'];
                         unset($tb_settings['lists']);
                     }
                     // Get preset values from POST
                     foreach ($tb_settings as $n => $v) {
                         if (isset($_POST[$n])) {
                             $tb_settings[$n][3] = $_POST[$n];
                         }
                     }
                     $settings = new aecSettings('TOOLBOX', 'E');
                     $settings->fullSettingsArray($tb_settings, array(), $lists);
                     // Call HTML Class
                     $aecHTML = new aecHTML($settings->settings, $settings->lists);
                     foreach ($tb_settings as $n => $v) {
                         $return .= $aecHTML->createSettingsParticle($n);
                     }
                     $return .= '<input type="submit" class="btn btn-primary pull-right"/><br/><br/>';
                 }
             }
             $return .= $response;
         }
         HTML_AcctExp::toolBox($cmd, $return, $info['name']);
     }
 }
Example #8
0
        $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);
        if (is_dir($mih->mi_dir . '/' . $mik) || strpos($mik, '.php') === false) {
            continue;
        }
        if (is_dir($mih->mi_dir . '/' . $handle)) {
            unlink($mih->mi_dir . '/' . $mik);