return $networkData;
}
+// "Getter" for a network type data by provided id number
+function getNetworkTypeDataById ($id) {
+ // Ids lower one are not accepted
+ if ($id < 1) {
+ // Not good, should be fixed
+ debug_report_bug('Network type id ' . $id . ' is smaller than 1.');
+ } // END - if
+
+ // By default we have no data
+ $networkTypeData = array();
+
+ // Query for the network data
+ $result = SQL_QUERY_ESC("SELECT
+ `network_type_id`, `network_id`, `network_type_handle`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url`
+FROM
+ `{?_MYSQL_PREFIX?}_network_types`
+WHERE
+ `network_type_id`=%s
+LIMIT 1",
+ array(bigintval($id)), __FUNCTION__, __LINE__);
+
+ // Do we have an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Then get it
+ $networkTypeData = SQL_FETCHARRAY($result);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Return result
+ return $networkTypeData;
+}
+
// Updates given network (id) with data from array
function doNetworkUpdateDataByArray ($id, $networkData) {
// Ids lower one are not accepted
} // END - if
}
+// Handle network type form
+function doAdminNetworkProcessHandlenetworktypeForm () {
+ // Do we have selections?
+ if (countPostSelection() > 0) {
+ // Load network data
+ $networkData = getNetworkDataById(getRequestElement('network'));
+
+ // Something has been selected, so start displaying one by one
+ $SW = 2; $OUT = '';
+ foreach (postRequestElement('sel') as $id => $sel) {
+ // Is this selected?
+ if ($sel == 1) {
+ // Load this network's data
+ $networkTypeData = getNetworkTypeDataById($id);
+
+ // Do we have found the network?
+ if (count($networkTypeData) > 0) {
+ // Add color
+ $networkTypeData['sw'] = $SW;
+
+ if (isPostRequestElementSet('edit')) {
+ // Add row template for deleting
+ $OUT .= loadTemplate('admin_edit_network_types_row', true, $networkTypeData);
+ } elseif (isPostRequestElementSet('del')) {
+ // Fix empty banner URL
+ if (trim($networkTypeData['network_type_banner_url']) == '') $networkTypeData['network_type_banner_url'] = '---';
+
+ // Add row template for deleting
+ $OUT .= loadTemplate('admin_del_network_types_row', true, $networkTypeData);
+ } else {
+ // Problem!
+ debug_report_bug('Cannot detect edit/del.');
+ }
+
+ // Switch colors
+ $SW = 3 - $SW;
+ } // END - if
+ } // END - if
+ } // END - foreach
+
+ // If we have no rows, we don't need to display the edit form
+ if (!empty($OUT)) {
+ // Prepare content for template
+ $content = array(
+ 'rows' => $OUT,
+ 'network_data' => getNetworkDataById(getRequestElement('network'))
+ );
+
+ // Output main template
+ if (isPostRequestElementSet('edit')) {
+ loadTemplate('admin_edit_network_types', false, $content);
+ } elseif (isPostRequestElementSet('del')) {
+ loadTemplate('admin_del_network_types', false, $content);
+ } else {
+ // Problem!
+ debug_report_bug('Cannot detect edit/del.');
+ }
+
+ // Don't display the list/add new form
+ $GLOBALS['network_display'] = false;
+ } else {
+ // Nothing selected/found
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_TYPE_NOTHING_FOUND'));
+ }
+ } // END - if
+}
+
// Changes given networks
function doAdminNetworkProcessChangenetworkForm () {
// Do we have selections?