debug_report_bug(__FUNCTION__, __LINE__, 'Invalid do ' . getRequestElement('do') . ', function ' . $functionName .' does not exist.', false);
} // END - if
+ // Init global arrays
+ $GLOBALS['network_types_disabled'] = array();
+
// Call-back the method handling our request
call_user_func($functionName);
}
$GLOBALS['network_data'][$networkId] = array();
// Query for the network data
- $result = SQL_QUERY_ESC('SELECT
+ $result = SQL_QUERY_ESC("SELECT
`network_id`,
`network_short_name`,
`network_title`,
`{?_MYSQL_PREFIX?}_network_data`
WHERE
`network_id`=%s
-LIMIT 1',
+LIMIT 1",
array(bigintval($networkId)), __FUNCTION__, __LINE__);
// Do we have an entry?
$GLOBALS['network_data'][$networkId] = array();
// Query for the network data
- $result = SQL_QUERY_ESC('SELECT
+ $result = SQL_QUERY_ESC("SELECT
d.`network_id`,
d.`network_short_name`,
d.`network_title`,
d.`network_id`=t.`network_id`
WHERE
t.`network_type_id`=%s
-LIMIT 1',
+LIMIT 1",
array(bigintval($networkId)), __FUNCTION__, __LINE__);
// Do we have an entry?
$content = '';
// Query for all networks
- $result = SQL_QUERY('SELECT
+ $result = SQL_QUERY("SELECT
`network_id`,
`network_short_name`,
`network_title`
FROM
`{?_MYSQL_PREFIX?}_network_data`
+WHERE
+ `network_active`='Y'
ORDER BY
- `network_short_name` ASC', __FUNCTION__, __LINE__);
+ `network_short_name` ASC", __FUNCTION__, __LINE__);
// Do we have entries?
if (!SQL_HASZERONUMS($result)) {
$content = '';
// Query all types of this network
- $result = SQL_QUERY('SELECT
- t.`network_type_id`, t.`network_type_handler`, d.`network_title`
+ $result = SQL_QUERY("SELECT
+ t.`network_type_id`,
+ t.`network_type_handler`,
+ 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`
+WHERE
+ d.`network_active`='Y'
ORDER BY
d.`network_short_name` ASC,
- t.`network_type_handler` ASC', __FUNCTION__, __LINE__);
+ t.`network_type_handler` ASC", __FUNCTION__, __LINE__);
// Do we have entries?
if (!SQL_HASZERONUMS($result)) {
}
// Generates an options list of all available (hard-coded) handlers
-function generateNetworkTypesAvailableOptions () {
+function generateNetworkTypesAvailableOptions ($defaultType = NULL) {
// Is it cached?
- if (!isset($GLOBALS[__FUNCTION__])) {
+ if (!isset($GLOBALS[__FUNCTION__][$defaultType])) {
// Generate list
- $GLOBALS[__FUNCTION__] = generateOptionList(
+ $GLOBALS[__FUNCTION__][$defaultType] = generateOptionList(
'/ARRAY/',
array(
'banner',
'traffic'
),
array(),
- '',
+ $defaultType,
'', '',
$GLOBALS['network_types_disabled'],
'translateNetworkTypeHandler'
} // END - if
// Return content
- return $GLOBALS[__FUNCTION__];
+ return $GLOBALS[__FUNCTION__][$defaultType];
}
// Generates an options list (somewhat getter) ofr request keys
// Translates 'translate_name' for e.g. templates
function translateNetworkTranslationName ($name) {
- // Get the message id
- return '{--ADMIN_NETWORK_TRANSLATE_' . strtoupper($name) . '_NAME--}';
+ // Generate id
+ $messageId = 'ADMIN_NETWORK_TRANSLATE_' . strtoupper($name) . '_NAME';
+
+ // Is the message id there?
+ if (!isMessageIdValid($messageId)) {
+ // Not valid type
+ debug_report_bug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
+ } // END - if
+
+ // Return message id
+ return '{--' . $messageId . '--}';
}
// Translates the network type handler (e.g. banner, paidmail) for templates
function translateNetworkTypeHandler ($type) {
- // Get the message id
- return '{--ADMIN_NETWORK_TYPE_HANDLER_' . strtoupper($type) . '--}';
+ // Generate id
+ $messageId = 'ADMIN_NETWORK_TYPE_HANDLER_' . strtoupper($type);
+
+ // Is the message id there?
+ if (!isMessageIdValid($messageId)) {
+ // Not valid type
+ debug_report_bug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
+ } // END - if
+
+ // Return message id
+ return '{--' . $messageId . '--}';
}
// Translates request type
function translateNetworkRequestType ($type) {
- // Get the message id
- return '{--ADMIN_NETWORK_REQUEST_TYPE_' . strtoupper($type) . '--}';
+ // Generate id
+ $messageId = 'ADMIN_NETWORK_REQUEST_TYPE_' . strtoupper($type) . '';
+
+ // Is the message id there?
+ if (!isMessageIdValid($messageId)) {
+ // Not valid type
+ debug_report_bug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
+ } // END - if
+
+ // Return message id
+ return '{--' . $messageId . '--}';
}
// Translates request parameter
function translateNetworkRequestParamKey ($param) {
- // Get the message id
- return '{--ADMIN_NETWORK_REQUEST_PARAMETER_' . strtoupper($param) . '--}';
+ // Generate id
+ $messageId = 'ADMIN_NETWORK_REQUEST_PARAMETER_' . strtoupper($param) . '';
+
+ // Is the message id there?
+ if (!isMessageIdValid($messageId)) {
+ // Not valid param
+ debug_report_bug(__FUNCTION__, __LINE__, 'param=' . $param . ' is invalid.');
+ } // END - if
+
+ // Return message id
+ return '{--' . $messageId . '--}';
}
// Translates API index
`network_type_handler`,
`network_type_api_url`,
`network_type_click_url`,
- `network_type_banner_url`
+ `network_type_banner_url`,
+ `network_type_reload_time_unit`
FROM
`{?_MYSQL_PREFIX?}_network_types`
WHERE
// Is the column NULL?
if (is_null($content['network_type_banner_url'])) {
// Column is NULL
- $SQL .= "NULL),\n";
+ $SQL .= 'NULL';
} else {
// Column is set
- $SQL .= $content['network_type_banner_url'] . "'),\n";
+ $SQL .= "'" . $content['network_type_banner_url'] . "'";
}
+
+ // Add more
+ $SQL .= $content['network_type_reload_time_unit'] . "')\n";
} // END - while
// Remove last commata and close braces
$content['network_id'] . ', ' .
$content['network_type_id'] . ", '" .
$content['network_request_param_key'] . "', '" .
- $content['network_request_param_value'] . "', '";
+ $content['network_request_param_value'] . "', ";
// Is the column NULL?
if (is_null($content['network_request_param_default'])) {
$SQL .= "NULL),\n";
} else {
// Column is set
- $SQL .= $content['network_request_param_default'] . "'),\n";
+ $SQL .= "'" . $content['network_request_param_default'] . "'),\n";
}
} // END - while