+} // END - if
+
+// Queries the given Yoo!Media API 2.0 script
+function YOOMEDIA_QUERY_API ($script, $countQuery = true) {
+ // Init response array
+ $response = array();
+
+ // Enougth queries left?
+ if ((getConfig('yoomedia_requests_remain') > 0) || ($countQuery === false)) {
+ // Prepare request array
+ $requestData = array(
+ 'id' => getConfig('yoomedia_id'),
+ 'sid' => getConfig('yoomedia_sid'),
+ 'pw' => getConfig('yoomedia_passwd'),
+ 'reload' => getConfig('yoomedia_tm_max_reload'),
+ 'ma' => getConfig('yoomedia_tm_min_wait'),
+ 'uebrig' => getConfig('yoomedia_tm_clicks_remain'),
+ 'verguetung' => getConfig('yoomedia_tm_min_pay'),
+ 'erotik' => getConfig('yoomedia_erotic_allowed')
+ );
+
+ // Run the query
+ $response = sendGetRequest('http://www.yoomedia.de/interface_2.0/' . $script, $requestData, true);
+
+ // Convert from ISO to UTF-8 only if count is > 3 because <= 3 means timeout
+ if (count($response) > 3) {
+ // Convert all lines to UTF-8
+ foreach ($response as $k => $v) {
+ // Convert the line
+ $response[$k] = iconv('windows-1252', 'UTF-8//TRANSLIT', $v);
+ } // END - foreach
+ } // END - if
+
+ // Shall we count the query as used?
+ if ($countQuery === true) {
+ // Then update the config!
+ updateConfiguration('yoomedia_requests_remain', 1, '-');
+ } // END - if
+ } // END - if
+
+ // Return the data
+ return $response;