+ return $GLOBALS[__FUNCTION__];
+}
+
+// Generator (somewhat getter) for (return) array translation
+function generateNetworkTranslationOptions ($default = '') {
+ // Is it cached?
+ if (!isset($GLOBALS[__FUNCTION__][$default])) {
+ // Generate and cache it
+ $GLOBALS[__FUNCTION__][$default] = generateOptionList(
+ 'network_translations',
+ 'network_translation_id',
+ 'network_translation_name',
+ $default,
+ '',
+ '',
+ $GLOBALS['network_translation_disabled'],
+ 'translateNetworkTranslationName'
+ );
+ } // END - if
+
+ // Return content
+ return $GLOBALS[__FUNCTION__][$default];
+}
+
+// Generates an option list of request types
+function generateNetworkRequestTypeOptions ($default = '') {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__][$default])) {
+ // Generate the list
+ $GLOBALS[__FUNCTION__][$default] = generateOptionList(
+ '/ARRAY/',
+ array(
+ 'GET',
+ 'POST'
+ ),
+ array(
+ '{--ADMIN_NETWORK_REQUEST_TYPE_GET--}',
+ '{--ADMIN_NETWORK_REQUEST_TYPE_POST--}'
+ ),
+ $default
+ );
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__][$default];
+}
+
+// Generates an option list of network_api_active
+function generateNetworkApiActiveOptions ($default = '') {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__][$default])) {
+ // Generate the list
+ $GLOBALS[__FUNCTION__][$default] = generateYesNoOptionList($default);
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__][$default];
+}
+
+// Translates 'translate_name' for e.g. templates
+function translateNetworkTranslationName ($name) {
+ // Get the message id
+ return '{--ADMIN_NETWORK_TRANSLATE_' . strtoupper($name) . '_NAME--}';
+}
+
+// Translates the network type handler (e.g. banner, paidmail) for templates
+function translateNetworkTypeHandler ($type) {
+ // Get the message id
+ return '{--ADMIN_NETWORK_TYPES_' . strtoupper($type) . '--}';
+}
+
+// Translates request type
+function translateNetworkRequestType ($type) {
+ // Get the message id
+ return '{--ADMIN_NETWORK_REQUEST_TYPE_' . strtoupper($type) . '--}';
+}
+
+// Translates request parameter
+function translateNetworkRequestElement ($param) {
+ // Get the message id
+ return '{--ADMIN_NETWORK_REQUEST_PARAMETER_' . strtoupper($param) . '--}';
+}
+
+// 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
+ `sort` ASC', __FUNCTION__, __LINE__);
+
+ // Do we have entries?
+ if (!SQL_HASZERONUMS($result)) {
+ // 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);
+}
+
+// Translates network API configuration status (see function isNetworkApiConfigured()) by given id
+function translateNetworkApiConfiguredStatusById ($networkId) {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__][$networkId])) {
+ // By default it is not configured
+ $GLOBALS[__FUNCTION__][$networkId] = '{--ADMIN_NETWORK_API_NOT_CONFIGURED--}';
+
+ // So is it configured?
+ if (isNetworkApiConfigured($networkId)) {
+ // Yes, it is
+ $GLOBALS[__FUNCTION__][$networkId] = '{--ADMIN_NETWORK_API_CONFIGURED--}';
+ } // END - if
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__][$networkId];
+}
+
+// Checks if the given network is configured by looking its API configuration entry up
+function isNetworkApiConfigured ($networkId) {
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__][$networkId])) {
+ // Check for an entry in network_api_config
+ $GLOBALS[__FUNCTION__][$networkId] = (countSumTotalData(
+ bigintval($networkId),
+ 'network_api_config',
+ 'network_id',
+ 'network_id',
+ true
+ ) == 1);
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__][$networkId];