]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/yoomedia_functions.php
Mahor rewrite:
[mailer.git] / inc / libs / yoomedia_functions.php
index 54bc99017850463c540695991688a20243114f04..22a0fb9c6b63581017352520582112903acf56f4 100644 (file)
@@ -38,7 +38,7 @@ if (!defined('__SECURITY')) {
 }
 
 // Test if the extension settings did work
-function YOOMEDIDA_TEST_CONFIG ($data) {
+function YOOMEDIA_TEST_CONFIG ($data) {
        global $_CONFIG;
 
        // Is this admin?
@@ -48,14 +48,14 @@ function YOOMEDIDA_TEST_CONFIG ($data) {
        } // END - if
 
        // Transfer config data
-       $_CONFIG = array_merge($_CONFIG, $data);
+       $_CONFIG = merge_array($_CONFIG, $data);
 
        // Temporary allow maximum
-       $_CONFIG['yoomedia_tm_max_reload']    = 1000;
-       $_CONFIG['yoomedia_tm_min_wait']      = 0;
-       $_CONFIG['yoomedia_tm_clicks_remain'] = 10;
-       $_CONFIG['yoomedia_tm_min_pay']       = 0;
-       $_CONFIG['yoomedia_erotic_allowed']   = 1;
+       getConfig('yoomedia_tm_max_reload')    = 1000;
+       getConfig('yoomedia_tm_min_wait')      = 0;
+       getConfig('yoomedia_tm_clicks_remain') = 10;
+       getConfig('yoomedia_tm_min_pay')       = 0;
+       getConfig('yoomedia_erotic_allowed')   = 1;
 
        // Query the API with a test request without couting it
        // If zero reply comes back the data is invalid!
@@ -64,10 +64,10 @@ function YOOMEDIDA_TEST_CONFIG ($data) {
        // Log the response if failed
        if (count($response) == 0) {
                // Queries depleted (as we count here!)
-               DEBUG_LOG(__FUNCTION__."(".__LINE__."): Requested depleted. Maxmimum was: ".$_CONFIG['yoomedia_requests_total']);
+               DEBUG_LOG(__FUNCTION__, __LINE__, " Requested depleted. Maxmimum was: ".getConfig('yoomedia_requests_total'));
        } elseif (count($response) <= 10) {
                // Log serialized raw response
-               DEBUG_LOG(__FUNCTION__."(".__LINE__."): Raw response=".base64_encode(serialize($response)));
+               DEBUG_LOG(__FUNCTION__, __LINE__, " Raw response=".base64_encode(serialize($response)));
        } // END - if
 
        // Do we have some data there?
@@ -76,24 +76,22 @@ function YOOMEDIDA_TEST_CONFIG ($data) {
 
 // Queries the given Yoo!Media API 2.0 script
 function YOOMEDIA_QUERY_API ($script, $countQuery = true) {
-       global $_CONFIG;
-
        // Init response array
        $response = array();
 
        // Enougth queries left?
-       if (($_CONFIG['yoomedia_requests_remain'] > 0) || (!$countQuery)) {
+       if ((getConfig('yoomedia_requests_remain') > 0) || (!$countQuery)) {
                // Prepare the low-level request
                $requestString = sprintf("http://www.yoomedia.de/interface_2.0/%s?id=%s&sid=%s&pw=%s&reload=%s&ma=%s&uebrig=%s&verguetung=%s&erotik=%s",
                        $script,
-                       bigintval($_CONFIG['yoomedia_id']),
-                       bigintval($_CONFIG['yoomedia_sid']),
-                       $_CONFIG['yoomedia_passwd'],
-                       bigintval($_CONFIG['yoomedia_tm_max_reload']),
-                       bigintval($_CONFIG['yoomedia_tm_min_wait']),
-                       bigintval($_CONFIG['yoomedia_tm_clicks_remain']),
-                       bigintval($_CONFIG['yoomedia_tm_min_pay']),
-                       bigintval($_CONFIG['yoomedia_erotic_allowed'])
+                       bigintval(getConfig('yoomedia_id')),
+                       bigintval(getConfig('yoomedia_sid')),
+                       getConfig('yoomedia_passwd'),
+                       bigintval(getConfig('yoomedia_tm_max_reload')),
+                       bigintval(getConfig('yoomedia_tm_min_wait')),
+                       bigintval(getConfig('yoomedia_tm_clicks_remain')),
+                       bigintval(getConfig('yoomedia_tm_min_pay')),
+                       bigintval(getConfig('yoomedia_erotic_allowed'))
                );
 
                // Run the query
@@ -173,8 +171,6 @@ function YOOMEDIA_PARSE_RESPONSE ($response, $type) {
 
 // Prepares a bonus mail for delivery. Works only if extension "bonus" is active
 function YOOMEDIA_PREPARE_MAIL_DELIVERY ($data) {
-       global $_CONFIG;
-
        // Is this an admin?
        if (!IS_ADMIN()) {
                // Abort here
@@ -194,7 +190,7 @@ function YOOMEDIA_PREPARE_MAIL_DELIVERY ($data) {
        if ($data['reward'] < 1) $data['reward'] = 1;
 
        // Add website id
-       $data['sid'] = $_CONFIG['yoomedia_sid'];
+       $data['sid'] = getConfig('yoomedia_sid');
 
        // Add total receivers
        $data['all'] = TRANSLATE_COMMA(GET_TOTAL_RECEIVERS());
@@ -208,8 +204,6 @@ function YOOMEDIA_PREPARE_MAIL_DELIVERY ($data) {
 
 // Adds the mail to the bonus mail pool
 function YOOMEDIA_SEND_BONUS_MAIL ($data, $mode) {
-       global $_CONFIG;
-
        // Is this an admin?
        if (!IS_ADMIN()) {
                // Abort here
@@ -248,7 +242,7 @@ function YOOMEDIA_EXCLUDE_MAIL ($data, $mode) {
                $mode = YOOMEDIA_CONVERT_MODE($mode);
 
                // Add the entry
-               $result = SQL_QUERY_ESC("INSERT INTO `"._MYSQL_PREFIX."_yoomedia_reload` (`type`,`y_id`,`y_reload`,`inserted`) VALUES('%s',%s,%s,'0000-00-00 00:00')",
+               $result = SQL_QUERY_ESC("INSERT INTO `"._MYSQL_PREFIX."_yoomedia_reload` (`type`,`y_id`,`y_reload`,`inserted`) VALUES ('%s',%s,%s,'0000-00-00 00:00')",
                        array($mode, bigintval($data['id']), bigintval($data['reload'])), __FILE__, __LINE__);
        } // END - if
 }
@@ -276,7 +270,7 @@ function YOOMEDIA_TRANSLATE_INDEX ($type, $index) {
                $return = $yoomediaTranslationTable[$type][$index];
        } else {
                // Not found!
-               DEBUG_LOG(__FUNCTION__."(".__LINE__."): type={$type},index={$index} not found.");
+               DEBUG_LOG(__FUNCTION__, __LINE__, " type={$type},index={$index} not found.");
        }
 
        // Return value
@@ -296,7 +290,7 @@ function YOOMEDIA_TRANSLATE_ERROR ($errorCode) {
                $return = $yoomediaTranslationTable['error_codes'][$errorCode];
        } else {
                // Log missing entries
-               DEBUG_LOG(__FUNCTION__."(".__LINE__."): errorCode={$errorCode}");
+               DEBUG_LOG(__FUNCTION__, __LINE__, " errorCode={$errorCode}");
        }
 
        // Return value
@@ -343,7 +337,7 @@ function YOOMEDIA_RELOAD_LOCK ($data, $mode) {
                $mode = YOOMEDIA_CONVERT_MODE($mode);
 
                // Add the entry
-               $result = SQL_QUERY_ESC("INSERT INTO `"._MYSQL_PREFIX."_yoomedia_reload` (`type`,`y_id`,`y_reload`) VALUES('%s',%s,%s)",
+               $result = SQL_QUERY_ESC("INSERT INTO `"._MYSQL_PREFIX."_yoomedia_reload` (`type`,`y_id`,`y_reload`) VALUES ('%s',%s,%s)",
                        array($mode, bigintval($data['id']), bigintval($data['reload'])), __FILE__, __LINE__);
        } // END - if
 }