]> git.mxchange.org Git - mailer.git/blobdiff - inc/loader/load-payments.php
Updated copyright year.
[mailer.git] / inc / loader / load-payments.php
index c11c58f63f11391e85e8d20d47763e0f9952baaa..164471d2b8c53a83c98098821359a210bbde27b2 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Mehr Cache-Dateien nachladen                     *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-} elseif (isInstallationPhase()) {
-       // Use this code if you don't want to run this cache loader on installation phase
-       return;
+} elseif (isInstaller()) {
+       // Do not run in installation phase
+       //* DEBUG: */ logDebugMessage(__FILE__, __LINE__, 'Run from installation phase.');
+       return FALSE;
 }
 
 // Let's start with the admins table...
 if (($GLOBALS['cache_instance']->loadCacheFile('payments')) && ($GLOBALS['cache_instance']->extensionVersionMatches('payments'))) {
        // Load cache
        $GLOBALS['cache_array']['payments'] = $GLOBALS['cache_instance']->getArrayFromCache();
-} elseif (isHtmlOutputMode()) {
+
+       // Init temporary array
+       $paymentsData = array();
+
+       // Rewrite all to id
+       foreach ($GLOBALS['cache_array']['payments']['id'] as $key => $id) {
+               // Re-add key with id
+               foreach ($GLOBALS['cache_array']['payments'] as $key2 => $array) {
+                       // Is key2 not 'id'?
+                       if ($key2 != 'id') {
+                               // Then Add it
+                               $paymentsData[$id][$key2] = $GLOBALS['cache_array']['payments'][$key2][$key];
+                       } // END - if
+               } // END - foreach
+       } // END - foreach
+
+       // Set the array back and remove temporary
+       $GLOBALS['cache_array']['payments'] = $paymentsData;
+       unset($paymentsData);
+} elseif ((isHtmlOutputMode()) || (isAjaxOutputMode()) || (isRawOutputMode())) {
        // Create cache file
        $GLOBALS['cache_instance']->init();
 
-       // Load every data from DB to cache file
-       //$add = runFilterChain('sql_admin_extra_data');
-
        // Query the database about this
-       $result = SQL_QUERY('SELECT * FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `id` ASC', __FILE__, __LINE__);
-       while ($dummy = SQL_FETCHARRAY($result)) {
+       $result = sqlQuery('SELECT * FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `id` ASC', __FILE__, __LINE__);
+       while ($data = sqlFetchArray($result)) {
                // Save row
-               $GLOBALS['cache_instance']->addRow($dummy);
+               $GLOBALS['cache_instance']->addRow($data);
        } // END - while
 
        // Free memory
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Close cache
        $GLOBALS['cache_instance']->storeExtensionVersion('payments');