]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/network_functions.php
Listing of API array elements basicly finished
[mailer.git] / inc / libs / network_functions.php
index 89392f1e1c73828748d25da4b3d631d77c3c8357..23ccf54b9027755f868a59006849b6a479b22b08 100644 (file)
@@ -634,6 +634,51 @@ function translateNetworkRequestType ($name) {
        return getMessage('ADMIN_NETWORK_REQUEST_TYPE_' . strtoupper($name) . '');
 }
 
+// Translates API index
+function translateNetworkApiIndex ($index) {
+       // Do we have cache?
+       if (!isset($GLOBALS['network_api_index'])) {
+               // Get an array of all API array indexes
+               $GLOBALS['network_api_index'] = array();
+
+               // Get all entries
+               $result = SQL_QUERY('SELECT
+       `network_api_id`, `network_api_index`, `network_translation_name`
+FROM
+       `{?_MYSQL_PREFIX?}_network_api_translation`
+INNER JOIN
+       `{?_MYSQL_PREFIX?}_network_translations`
+ON
+       `network_api_index`=`network_translation_id`
+ORDER BY
+       `network_api_id` ASC', __FUNCTION__, __LINE__);
+
+               // Do we have entries?
+               if (SQL_NUMROWS($result) > 0) {
+                       // Get all entries
+                       while ($row = SQL_FETCHARRAY($result)) {
+                               // Add it to our global array
+                               $GLOBALS['network_api_index'][$row['network_api_index']] = $row;
+                       } // END - while
+               } // END - if
+
+               // Free result
+               SQL_FREERESULT($result);
+       } // END - if
+
+       // Default name is unknown
+       $name = 'unknown';
+
+       // Is the entry there?
+       if (isset($GLOBALS['network_api_index'][$index])) {
+               // Then get the name
+               $name = $GLOBALS['network_api_index'][$index]['network_translation_name'];
+       } // END - if
+
+       // Return translation
+       return translateNetworkTranslationName($name);
+}
+
 //------------------------------------------------------------------------------
 //                             Call-back functions
 //------------------------------------------------------------------------------