Mahor rewrite:
[mailer.git] / inc / libs / yoomedia_functions.php
index 04deb26e9d62b6a78f81606d8ecfce8f269bc077..22a0fb9c6b63581017352520582112903acf56f4 100644 (file)
@@ -48,14 +48,14 @@ function YOOMEDIA_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,7 +64,7 @@ function YOOMEDIA_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)));
@@ -76,24 +76,22 @@ function YOOMEDIA_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