die();
} // END - if
+// Private setter for current network id
+function setCurrentNetworkId ($id) {
+ $GLOBALS['current_network_id'] = bigintval($id);
+}
+
+// Private getter for current network id
+function getCurrentNetworkId () {
+ return $GLOBALS['current_network_id'];
+}
+
// Handle a (maybe) sent form here
function doNetworkHandleForm () {
// Was the form sent?
debug_report_bug('Network id ' . $id . ' is smaller than 1.');
} // END - if
+ // Set current network id
+ setCurrentNetworkId($id);
+
// Is it cached?
if (!isset($GLOBALS['network_data'][$id])) {
// By default we have no data
}
}
+// "Getter" for a network's data by provided type id number
+function getNetworkDataByTypeId ($id, $column = '') {
+ // 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
+
+ // Set current network id
+ setCurrentNetworkId($id);
+
+ // Is it cached?
+ if (!isset($GLOBALS['network_data'][$id])) {
+ // By default we have no data
+ $GLOBALS['network_data'][$id] = array();
+
+ // Query for the network data
+ $result = SQL_QUERY_ESC("SELECT
+ d.`network_id`, d.`network_short_name`, d.`network_title`, d.`network_reflink`, d.`network_data_seperator`, d.`network_row_seperator`, d.`network_request_type`, d.`network_charset`,
+ t.`network_type_handle`, t.`network_type_api_url`, t.`network_type_click_url`, t.`network_type_banner_url`
+FROM
+ `{?_MYSQL_PREFIX?}_network_data` AS d
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_network_types` AS t
+ON
+ d.`network_id`=t.`network_id`
+WHERE
+ t.`network_type_id`=%s
+LIMIT 1",
+ array(bigintval($id)), __FUNCTION__, __LINE__);
+
+ // Do we have an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Then get it
+ $GLOBALS['network_data'][$id] = SQL_FETCHARRAY($result);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+ } // END - if
+
+ // Return result
+ if (empty($column)) {
+ // Return array
+ return $GLOBALS['network_data'][$id];
+ } else {
+ // Return column
+ return $GLOBALS['network_data'][$id][$column];
+ }
+}
+
// "Getter" for a network type data by provided id number
function getNetworkTypeDataById ($id) {
// Ids lower one are not accepted
return $content;
}
+// Generator (somewhat getter) for a list of network types for all types
+function generateAdminDistinctNetworkTypeList () {
+ // Init content
+ $content = '';
+
+ // Query all types of this network
+ $result = SQL_QUERY("SELECT
+ t.`network_type_id`, t.`network_type_handle`, d.`network_title`
+FROM
+ `{?_MYSQL_PREFIX?}_network_types` AS t
+LEFT JOIN
+ `{?_MYSQL_PREFIX?}_network_data` AS d
+ON
+ t.`network_id`=d.`network_id`
+ORDER BY
+ d.`network_short_name` ASC,
+ t.`network_type_handle` ASC", __FILE__, __LINE__);
+
+ // Do we have entries?
+ if (SQL_NUMROWS($result) > 0) {
+ // List all entries
+ $rows = array();
+ while ($row = SQL_FETCHARRAY($result)) {
+ // Is this valid, then add it
+ if ((is_array($row)) && (isset($row['network_type_id']))) {
+ // Add entry
+ $rows[$row['network_type_id']] = $row;
+ } // END - if
+ } // END - while
+
+ // Generate the selection box
+ $content = generateSelectionBoxFromArray($rows, 'network_type', 'network_type_id', '', '_title');
+ } else {
+ // Nothing selected
+ $content = loadTemplate('admin_settings_unsaved', false, getMessage('ADMIN_ENTRIES_404'));
+ }
+
+ // Free the result
+ SQL_FREERESULT($result);
+ //* DEBUG: */ die('<pre>'.htmlentities($content).'</pre>');
+
+ // Return content
+ return $content;
+}
+
// Generator (somewhat getter) for network type options
function generateNetworkTypeOptions ($id) {
// Is this an array, then we just came back from edit/delete actions
if (!isset($GLOBALS['network_array_translation'][$default])) {
// Generate and cache it
$GLOBALS['network_array_translation'][$default] = generateOptionList(
- 'network_request_params',
- 'network_param_id',
- 'request_param_key',
+ 'network_translations',
+ 'network_translation',
+ 'network_translation',
$default,
'',
- sprintf("WHERE `network_id`='%s'", bigintval(getRequestParameter('network'))),
+ sprintf("WHERE `network_type_id`=%s",
+ bigintval(getRequestParameter('network_type'))
+ ),
$GLOBALS['network_array_translation_disabled'],
- 'ADMIN_NETWORK_REQUEST_PARAMETER_'
+ 'ADMIN_NETWORK_ARRAY_TRANSLATION_'
);
} // END - if
function doExpressionNetwork ($data) {
// Construct replacer
$replacer = sprintf(
- "\" . %s(%s, '%s') . \"",
+ "{DQUOTE} . %s(%s, '%s') . {DQUOTE}",
$data['callback'],
$data['matches'][4][$data['key']],
$data['extra_func']
);
+ // Replace %network% with the current network id
+ $replacer = str_replace('%network%', getCurrentNetworkId(), $replacer);
+
// Replace the code
$code = replaceExpressionCode($data, $replacer);
// [EOF]
?>
+