]> git.mxchange.org Git - mailer.git/blobdiff - inc/loader/load-refsystem.php
Don't abuse isValidSqlLink() for checking results
[mailer.git] / inc / loader / load-refsystem.php
index 9e96d7de394a0e38ada584a088ae393ffc5565b6..f47f2db7b332135faf8e8e95aa9a357442fd82e2 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 - 2011 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;
 }
 
-// Next cached table is the referal system (refsystem)...
+// Next cached table is the referral system (refsystem)...
 if (($GLOBALS['cache_instance']->loadCacheFile('refsystem')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) {
-       // Load referal system from cache
+       // Load referral system from cache
        $GLOBALS['cache_array']['refsystem'] = $GLOBALS['cache_instance']->getArrayFromCache();
-} elseif (isHtmlOutputMode()) {
+} elseif ((isHtmlOutputMode()) || (isAjaxOutputMode()) || (isRawOutputMode())) {
        // Create cache file here
        $GLOBALS['cache_instance']->init();
 
-       // Load all modules and their data
-       $result = SQL_QUERY('SELECT `id`,`userid`,`level`,`counter` FROM `{?_MYSQL_PREFIX?}_refsystem` ORDER BY `userid` ASC, `level` ASC', __FILE__, __LINE__);
-       while ($content = SQL_FETCHARRAY($result)) {
+       // Query for all referrals
+       $result = sqlQuery('SELECT
+       `id`,
+       `userid`,
+       `level`,
+       `counter`
+FROM
+       `{?_MYSQL_PREFIX?}_refsystem`
+ORDER BY
+       `userid` ASC,
+       `level` ASC', __FILE__, __LINE__);
+
+       // Load all entries
+       while ($content = sqlFetchArray($result)) {
                // Add row to cache file
                $GLOBALS['cache_instance']->addRow($content);
        } // END - while
 
        // Free memory
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Close the cache
        $GLOBALS['cache_instance']->storeExtensionVersion('sql_patches');