// Handle a (maybe) sent form here
function doNetworkHandleForm () {
- // Do we have a form sent?
+ // Is there a form sent?
if (countRequestPost() > 0) {
// Detect sent POST form
detectNetworkProcessForm();
LIMIT 1",
array(bigintval($networkId)), __FUNCTION__, __LINE__);
- // Do we have an entry?
+ // Is there an entry?
if (SQL_NUMROWS($result) == 1) {
// Then get it
$GLOBALS['network_data'][$networkId] = SQL_FETCHARRAY($result);
t.`network_type_handler`,
t.`network_type_api_url`,
t.`network_type_click_url`,
- t.`network_type_banner_url`
+ t.`network_type_banner_url`,
+ t.`network_text_encoding`
FROM
`{?_MYSQL_PREFIX?}_network_data` AS d
LEFT JOIN
LIMIT 1",
array(bigintval($networkId)), __FUNCTION__, __LINE__);
- // Do we have an entry?
+ // Is there an entry?
if (SQL_NUMROWS($result) == 1) {
// Then get it
$GLOBALS['network_data'][$networkId] = SQL_FETCHARRAY($result);
LIMIT 1',
array(bigintval($networkId)), __FUNCTION__, __LINE__);
- // Do we have an entry?
+ // Is there an entry?
if (SQL_NUMROWS($result) == 1) {
// Then get it
$GLOBALS['network_type_data'][$networkId] = SQL_FETCHARRAY($result);
LIMIT 1',
array(bigintval($networkId)), __FUNCTION__, __LINE__);
- // Do we have an entry?
+ // Is there an entry?
if (SQL_NUMROWS($result) == 1) {
// Then get it
$networkRequestData = SQL_FETCHARRAY($result);
ORDER BY
`network_short_name` ASC", __FUNCTION__, __LINE__);
- // Do we have entries?
+ // Are there entries?
if (!SQL_HASZERONUMS($result)) {
// List all entries
$rows = array();
bigintval($networkId)
), __FUNCTION__, __LINE__);
- // Do we have entries?
+ // Are there entries?
if (!SQL_HASZERONUMS($result)) {
// List all entries
$rows = array();
d.`network_short_name` ASC,
t.`network_type_handler` ASC", __FUNCTION__, __LINE__);
- // Do we have entries?
+ // Are there entries?
if (!SQL_HASZERONUMS($result)) {
// List all entries
$rows = array();
return $GLOBALS[__FUNCTION__][$defaultType];
}
+// Generates an options list of all available (hard-coded) text encoders
+function generateNetworkTextEncodingAvailableOptions ($defaultEncoding = NULL) {
+ // Is it cached?
+ if (!isset($GLOBALS[__FUNCTION__][$defaultEncoding])) {
+ // Generate list
+ $GLOBALS[__FUNCTION__][$defaultEncoding] = generateOptions(
+ '/ARRAY/',
+ array(
+ 'NONE',
+ 'BASE64',
+ ),
+ array(),
+ $defaultEncoding,
+ '', '',
+ array(),
+ 'translateNetworkTextEncoding'
+ );
+ } // END - if
+
+ // Return content
+ return $GLOBALS[__FUNCTION__][$defaultEncoding];
+}
+
// Generates an options list (somewhat getter) for request keys
function generateNetworkRequestKeyOptions () {
// Is it cached?
$GLOBALS[__FUNCTION__] = generateOptions(
'/ARRAY/',
array(
- 'id',
+ 'affiliate_id',
'sid',
'hash',
'password',
// Generates an option list of request types
function generateNetworkRequestTypeOptions ($default = '') {
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$default])) {
// Generate the list
$GLOBALS[__FUNCTION__][$default] = generateOptions(
// Generates an option list of network_api_active
function generateNetworkApiActiveOptions ($default = '') {
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$default])) {
// Generate the list
$GLOBALS[__FUNCTION__][$default] = generateYesNoOptions($default);
// Is the message id there?
if (!isMessageIdValid($messageId)) {
- // Not valid type
- reportBug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
+ // Not valid name
+ reportBug(__FUNCTION__, __LINE__, 'name=' . $name . ' is invalid.');
} // END - if
// Return message id
return '{--' . $messageId . '--}';
}
+// Translate text-encoding
+function translateNetworkTextEncoding ($encoding) {
+ // Generate id
+ $messageId = 'ADMIN_NETWORK_TYPE_TEXT_ENCODING_' . strtoupper($encoding) . '';
+
+ // Is the message id there?
+ if (!isMessageIdValid($messageId)) {
+ // Not valid encoding
+ reportBug(__FUNCTION__, __LINE__, 'encoding=' . $encoding . ' is invalid.');
+ } // END - if
+
+ // Return message id
+ return '{--' . $messageId . '--}';
+}
+
// Translates API index
function translateNetworkApiIndex ($index) {
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS['network_array_index'])) {
// Get an array of all API array indexes
$GLOBALS['network_array_index'] = array();
ORDER BY
`sort` ASC', __FUNCTION__, __LINE__);
- // Do we have entries?
+ // Are there entries?
if (!SQL_HASZERONUMS($result)) {
// Get all entries
while ($row = SQL_FETCHARRAY($result)) {
// Translates network API configuration status (see function isNetworkApiConfigured()) by given id
function translateNetworkApiConfiguredStatusById ($networkId) {
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$networkId])) {
// By default it is not configured
$GLOBALS[__FUNCTION__][$networkId] = '{--ADMIN_NETWORK_API_NOT_CONFIGURED--}';
// Checks if the given network is configured by looking its API configuration entry up
function isNetworkApiConfigured ($networkId) {
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$networkId])) {
// Check for an entry in network_api_config
$GLOBALS[__FUNCTION__][$networkId] = (countSumTotalData(
// Checks whether the given network type handler is configured
function isNetworkTypeHandlerConfigured ($networkId, $networkTypeId) {
- // Do we have cache?
+ // Is there cache?
if (!isset($GLOBALS[__FUNCTION__][$networkId][$networkTypeId])) {
// Determine it
$GLOBALS[__FUNCTION__][$networkId][$networkTypeId] = (countSumTotalData(
// Displays selected networks for editing
function doAdminNetworkProcessHandleNetworks () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// Something has been selected, so start displaying one by one
$OUT = '';
// Load this network's data
$networkData = getNetworkDataById($networkId);
- // Do we have found the network?
+ // Is there found the network?
if (count($networkData) > 0) {
// Add row template with given form name
$OUT .= loadTemplate('admin_' . $GLOBALS['network_form_name'] . '_networks_row', true, $networkData);
// Handle network type form
function doAdminNetworkProcessHandleNetworkTypes () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// Load network data
$networkData = getNetworkDataById(getRequestElement('network_id'));
// Load this network's data
$networkTypeData = getNetworkTypeDataById($networkId);
- // Do we have found the network?
+ // Is there found the network?
if (count($networkTypeData) > 0) {
if (isFormSent('edit')) {
// Add row template for deleting
// Handle network request parameter form
function doAdminNetworkProcessHandleRequestParams () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// Init cache array
$GLOBALS['network_request_params_disabled'] = array();
// Load this network's data
$networkRequestData = getNetworkRequestParamsDataById($networkId);
- // Do we have found the network?
+ // Is there found the network?
if (count($networkRequestData) > 0) {
if (isFormSent('edit')) {
// Add row template for deleting
// Changes given networks
function doAdminNetworkProcessChangeNetworks () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// By default nothing is updated
$updated = 0;
continue;
} // END - if
- // Do we have this enty?
+ // Is there this enty?
if (!isset($entry[$networkId])) {
// Not found, needs fixing
reportBug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
} // END - if
} // END - foreach
- // Do we have updates?
+ // Is there updates?
if ($updated > 0) {
// Updates done
displayMessage('{%message,ADMIN_NETWORK_UPDATED=' . $updated . '%}');
// Removes given networks
function doAdminNetworkProcessRemoveNetworks () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// By default nothing is removed
$removed = 0;
} // END - if
} // END - foreach
- // Do we have removes?
+ // Is there removes?
if ($removed > 0) {
// Removals done
displayMessage('{%message,ADMIN_NETWORK_REMOVED=' . $removed . '%}');
// Changes given network type handlers
function doAdminNetworkProcessChangeHandlerTypes () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// By default nothing is updated
$updated = 0;
continue;
} // END - if
- // Do we have this enty?
+ // Is there this enty?
if (!isset($entry[$networkId])) {
// Not found, needs fixing
reportBug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
} // END - if
} // END - foreach
- // Do we have updates?
+ // Is there updates?
if ($updated > 0) {
// Updates done
displayMessage('{%message,ADMIN_NETWORK_TYPE_HANDLER_UPDATED=' . $updated . '%}');
// Changes given network request parameters
function doAdminNetworkProcessChangeRequestParams () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// By default nothing is updated
$updated = 0;
continue;
} // END - if
- // Do we have this enty?
+ // Is there this enty?
if (!isset($entry[$networkId])) {
// Not found, needs fixing
reportBug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
} // END - if
} // END - foreach
- // Do we have updates?
+ // Is there updates?
if ($updated > 0) {
// Updates done
displayMessage('{%message,ADMIN_NETWORK_REQUEST_PARAMETER_UPDATED=' . $updated . '%}');
// Removes given network type handlers
function doAdminNetworkProcessRemoveNetworkTypes () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// By default nothing is removed
$removed = 0;
} // END - if
} // END - foreach
- // Do we have removes?
+ // Is there removes?
if ($removed > 0) {
// Removals done
displayMessage('{%message,ADMIN_NETWORK_TYPE_HANDLER_REMOVED=' . $removed . '%}');
// Removes given network request parameters
function doAdminNetworkProcessRemoveNetworkRequestParams () {
- // Do we have selections?
+ // Is there selections?
if (ifPostContainsSelections()) {
// By default nothing is removed
$removed = 0;
} // END - if
} // END - foreach
- // Do we have removes?
+ // Is there removes?
if ($removed > 0) {
// Removals done
displayMessage('{%message,ADMIN_NETWORK_REQUEST_PARAMETER_REMOVED=' . $removed . '%}');
$result = SQL_QUERY_ESC('SELECT `network_type_id` FROM `{?_MYSQL_PREFIX?}_network_types` WHERE `network_id`=%s ORDER BY `network_type_id` ASC',
array(bigintval(getRequestElement('network_id'))), __FUNCTION__, __LINE__);
- // Do we have entries?
+ // Are there entries?
if (SQL_HASZERONUMS($result)) {
// No, then abort here
displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404--}');
$result = SQL_QUERY_ESC('SELECT `network_data_id` FROM `{?_MYSQL_PREFIX?}_network_types_config` WHERE `network_id`=%s ORDER BY `network_type_id` ASC',
array(bigintval(getRequestElement('network_id'))), __FUNCTION__, __LINE__);
- // Do we have entries?
+ // Are there entries?
if (SQL_HASZERONUMS($result)) {
// No, then abort here
displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404--}');
// Init table with all valid what->table entries
$validExports = array(
// General network data
- 'list_networks' => 'data',
+ 'list_network_data' => 'data',
// Network type handler
'list_network_types' => 'types',
// Network request parameter
__FUNCTION__, __LINE__);
// Start an empty SQL query
- $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_data` (`network_short_name`,`network_title`,`network_reflink`,`network_data_separator`,`network_row_separator`,`network_request_type`,`network_charset`,`network_require_id_card`,`network_query_amount`,`network_active`) VALUES\n";
+ $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_data` (`network_short_name`, `network_title`, `network_reflink`, `network_data_separator`, `network_row_separator`, `network_request_type`, `network_charset`, `network_require_id_card`, `network_query_amount`, `network_active`) VALUES\n";
// Load all entries
while ($content = SQL_FETCHARRAY($result)) {
`network_type_api_url`,
`network_type_click_url`,
`network_type_banner_url`,
- `network_type_reload_time_unit`
+ `network_type_reload_time_unit`,
+ `network_text_encoding`
FROM
`{?_MYSQL_PREFIX?}_network_types`
WHERE
), __FUNCTION__, __LINE__);
// Start an empty SQL query
- $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_types` (`network_type_id`,`network_id`,`network_type_handler`,`network_type_api_url`,`network_type_click_url`,`network_type_banner_url`,`network_type_reload_time_unit`) VALUES\n";
+ $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_types` (`network_type_id`, `network_id`, `network_type_handler`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url`, `network_type_reload_time_unit`, `network_text_encoding`) VALUES\n";
// Load all entries
while ($content = SQL_FETCHARRAY($result)) {
}
// Add more
- $SQL .= ",'" . $content['network_type_reload_time_unit'] . "'),\n";
+ $SQL .= ",'" . $content['network_type_reload_time_unit'] . "','" . $content['network_text_encoding'] . "'),\n";
} // END - while
// Remove last commata and close braces
), __FUNCTION__, __LINE__);
// Start an empty SQL query
- $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`,`network_type_id`,`network_request_param_key`,`network_request_param_value`,`network_request_param_default`) VALUES\n";
+ $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_request_params` (`network_id`, `network_type_id`, `network_request_param_key`, `network_request_param_value`, `network_request_param_default`) VALUES\n";
// Load all entries
while ($content = SQL_FETCHARRAY($result)) {
), __FUNCTION__, __LINE__);
// Start an empty SQL query
- $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_vcheck_params` (`network_id`,`network_vcheck_param_key`,`network_vcheck_param_value`,`network_vcheck_param_default`) VALUES\n";
+ $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_vcheck_params` (`network_id`, `network_vcheck_param_key`, `network_vcheck_param_value`, `network_vcheck_param_default`) VALUES\n";
// Load all entries
while ($content = SQL_FETCHARRAY($result)) {
), __FUNCTION__, __LINE__);
// Start an empty SQL query
- $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_array_translation` (`network_id`,`network_type_id`,`network_array_index`,`sort`) VALUES\n";
+ $SQL = "INSERT INTO `{?_MYSQL_PREFIX?}_network_array_translation` (`network_id`, `network_type_id`, `network_array_index`, `sort`) VALUES\n";
// Load all entries
while ($content = SQL_FETCHARRAY($result)) {