+// Test if the extension settings did work
+function YOOMEDIA_TEST_CONFIG ($data) {
+ // Is this admin?
+ if (!isAdmin()) {
+ // No admin!
+ return false;
+ } // END - if
+
+ // Transfer config data
+ mergeConfig($data);
+
+ // Temporary allow maximum
+ setConfigEntry('yoomedia_tm_max_reload' , 100000);
+ setConfigEntry('yoomedia_tm_min_wait' , 0);
+ setConfigEntry('yoomedia_tm_clicks_remain', 10);
+ setConfigEntry('yoomedia_tm_min_pay' , 0);
+ setConfigEntry('yoomedia_erotic_allowed' , 1);
+
+ // Query the API with a test request without couting it
+ // If zero reply comes back the data is invalid!
+ $response = YOOMEDIA_QUERY_API('out_textmail.php', true); // @TODO Ask Yoo!Media for test script
+
+ // Default error code is 0 = all fine!
+ $errorCode = YOOMEDIA_GET_ERRORCODE_FROM_RESULT($response);
+
+ // Log the response if failed
+ if (count($response) == 0) {
+ // Queries depleted (as we count here!)
+ logDebugMessage(__FUNCTION__, __LINE__, 'Requested depleted. Maxmimum was: ' . getConfig('yoomedia_requests_total'));
+ $errorCode = -1;
+ } elseif (!isset($response[8])) {
+ // Invalid response
+ logDebugMessage(__FUNCTION__, __LINE__, 'Missing response line [8]. Raw response=' . base64_encode(serialize($response)));
+ $errorCode = -1;
+ } elseif ((($errorCode <= 4) && ($errorCode > 0)) || ($errorCode >= 8)) {
+ // An error has returned from the account
+ logDebugMessage(__FUNCTION__, __LINE__, 'Unexpected error code ' . $errorCode . ' received.');
+ } elseif (count($response) < 9) {
+ // Log serialized raw response
+ logDebugMessage(__FUNCTION__, __LINE__, 'Raw response=' . base64_encode(serialize($response)));
+ $errorCode = -1;
+ } else {
+ // This is fine, because the result array is okay and the response code on element 8 is fine
+ $errorCode = '0';
+ }
+
+ // Do we have some data there?
+ return ($errorCode == '0');
+}
+