('adcocktail', 'ADCocktail', 'http://www.adcocktail.com/?rid=2596', '|', '|', 'GET', 'WINDOWS-1252', 'N', 500, 'Y'),
('adpaid', 'AdPaid', 'http://www.adpaid.de?ref=1464', '|', '|', 'GET', 'ISO-8859-1', 'N', 0, 'N'),
('ads4', 'Ads4.de', 'http://www.ads4.de/?werber=Quix0r', '|', '|', 'GET', 'WINDOWS-1252', 'N', 96, 'Y'),
-('ads4webbis', 'Ads4Webbis', 'http://www.ads4webbis.de?ref=835', '|', '|', 'GET', 'WINDOWS-1252', 'N', 200, 'Y'),
+('ads4webbis', 'Ads4Webbis', 'http://www.ads4webbis.de?ref=835', '|', '|', 'GET', 'WINDOWS-1252', 'N', 200, 'N'),
('ads4world', 'Ads4World', 'http://www.ads4world.de?ref=252', '|', '|', 'GET', 'WINDOWS-1252', 'N', 0, 'N'),
('affiliblatt', 'Affiliblatt', 'http://www.affiliblatt.de/?sid=MTAzNQ==&site=home', '|', '|', 'GET', 'UTF-8', 'N', 0, 'Y'),
('allads4you', 'AllAds4You', 'http://www.allads4you.de?ref=1146', '|', '|', 'GET', 'ISO-8859-1', 'N', 150, 'Y'),
-('alstermarketing', 'Alster-Marketing', 'http://www.alstermarketing.de?ref=1851', '|', '|', 'GET', 'ISO-8859-16', 'N', 350, 'Y'),
+('alstermarketing', 'Alster-Marketing', 'http://www.alstermarketing.de?ref=1851', '|', '|', 'GET', 'ISO-8859-16', 'N', 350, 'N'),
('bonus', 'BonusSponsor', 'http://www.bonussponsor.de?ref=1286', '|', '|', 'GET', 'WINDOWS-1252', 'N', 150, 'Y'),
-('fusion', 'Fusion-Ads', 'http://www.fusion-ads.de/?ref=84', '|', '|', 'GET', 'ISO-8859-1', 'N', 150, 'Y'),
+('fusion', 'Fusion-Ads', 'http://www.fusion-ads.de/?ref=84', '|', '|', 'GET', 'ISO-8859-1', 'N', 150, 'N'),
('gigapromo', 'GigaPromo', 'http://www.gigapromo.de/index.php?ref=953', '|', '|', 'GET', 'WINDOWS-1252', 'N', 100, 'Y'),
('hpsponsor', 'HPSponsor', 'http://hpsponsor.at?ref=29', '|', '|', 'GET', 'WINDOWS-1252', 'N', 100, 'Y'),
('make-euros', 'Make-Euros.de', 'http://www.make-euros.de?ref=1184', '|', '|', 'GET', 'ISO-8859-1', 'Y', 150, 'N'),
('werbepartnercc', 'DerWerbepartner.cc', 'http://www.werbepartner.cc/sponsor/?ref=696', '|', '|', 'GET', 'WINDOWS-1252', 'N', 100, 'Y'),
('yoomedia', 'Yoo!Media', 'http://www.yoomedia.de?ref=1715', '|', '|', 'GET', 'WINDOWS-1252', 'N', 200, 'Y'),
('cityads', 'City-Ads', 'http://www.city-ads.de?ref=221', '|', '|', 'GET', 'WINDOWS-1252', 'N', 200, 'Y'),
-('goldsponsor', 'Gold-Sponsor', 'http://www.gold-sponsor.de?ref=42', '|', '|', 'GET', 'WINDOWS-1252', 'N', 200, 'Y'),
+('goldsponsor', 'Gold-Sponsor', 'http://www.gold-sponsor.de?ref=42', '|', '|', 'GET', 'WINDOWS-1252', 'N', 200, 'N'),
('doubleads', 'doubleads.de', 'http://www.doubleads.de?ref=1063', '|', '|', 'GET', 'ISO-8859-1','Y', 150, 'Y'),
('vipads', 'VIPads.de', 'http://vipads.de/index.php?seite=anmeldung&ref=Quix0r', '|', '|', 'GET', 'ISO-8859-1', 'N', 100, 'Y'),
('homeads', 'homeADS', 'http://www.homeads.de/?ref=1540', '|', '|', 'GET', 'WINDOWS-1252', 'N', 0, 'N'),
-('fucoexsponsor', 'FuCoExSponsor.net', 'http://fucoexsponsor.net/index.php?seite=anmeldung&ref=Quix0r', '|', '|', 'GET', 'ISO-8859-1', 'N', 100, 'Y'),
+('fucoexsponsor', 'FuCoExSponsor.net', 'http://fucoexsponsor.net/index.php?seite=anmeldung&ref=Quix0r', '|', '|', 'GET', 'ISO-8859-1', 'N', 100, 'N'),
('adconvention', 'AdConvention', 'http://www.adconvention.de?ref=233', '|', '|', 'GET', 'WINDOWS-1252', 'N', 300, 'Y'),
('ad-hit', 'Ad-Hit.de', 'http://www.ad-hit.de?ref=41', '|', '|', 'GET', 'WINDOWS-1252', 'N', 200, 'Y'),
('adcity', 'AdCity.eu', 'http://www.adcity.eu?ref=38', '|', '|', 'GET', 'WINDOWS-1252', 'N', 200, 'Y'),
// Checks whether the (short) network name is already used (valid)
function isNetworkNameValid ($name) {
- // Query for it
- $result = SQL_QUERY_ESC("SELECT `network_id` FROM `{?_MYSQL_PREFIX?}_network_data` WHERE `network_short_name`='%s' LIMIT 1",
- array($name), __FUNCTION__, __LINE__);
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__][$name])) {
+ // Does it exist?
+ $GLOBALS[__FUNCTION__][$name] = (countSumTotalData($name, 'network_data', 'network_id', 'network_short_name', true) == 1);
+ } // END - if
- // Does it exist?
- $isValid = (SQL_NUMROWS($result) == 1);
+ // Return result
+ return $GLOBALS[__FUNCTION__][$name];
+}
- // Free result
- SQL_FREERESULT($result);
+// Checks whether the (short) named network is activated
+function isNetworkActiveByShortName ($name) {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__][$name])) {
+ // Does it exist?
+ $GLOBALS[__FUNCTION__][$name] = ((isNetworkNameValid($name)) && (countSumTotalData($name, 'network_data', 'network_id', 'network_short_name', true, " AND `network_active`='Y'") == 1));
+ } // END - if
// Return result
- return $isValid;
+ return $GLOBALS[__FUNCTION__][$name];
+}
+
+// Checks whether the network by given id is activated
+function isNetworkActiveById ($networkId) {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__][$networkId])) {
+ // Does it exist?
+ $GLOBALS[__FUNCTION__][$networkId] = (countSumTotalData(bigintval($networkId), 'network_data', 'network_id', 'network_id', true, " AND `network_active`='Y'") == 1);
+ } // END - if
+
+ // Return result
+ return $GLOBALS[__FUNCTION__][$networkId];
+}
+
+// "Getter" for 'network_activated' column depending on current administrator's expert setting
+function getNetworkActivatedColumn ($whereAnd = 'WHERE', $table = '') {
+ // Is there cache?
+ if (!isset($GLOBALS[__FUNCTION__][$whereAnd][$table])) {
+ // Default is exclude deactivated networks
+ $GLOBALS[__FUNCTION__][$whereAnd][$table] = ' ' . $whereAnd . ' ' . $table . "`network_active`='Y'";
+
+ // Is the export setting on?
+ if (isAdminsExpertSettingEnabled()) {
+ // Then allow all networks
+ $GLOBALS[__FUNCTION__][$whereAnd][$table] = '';
+ } // END - if
+ } // END - if
+
+ // Return cache
+ return $GLOBALS[__FUNCTION__][$whereAnd][$table];
}
// Checks whether the given network type is already used (valid)
if ($networkId < 1) {
// Not good, should be fixed
reportBug(__FUNCTION__, __LINE__, 'Network id ' . $networkId . ' is smaller than 1.');
- } // END - if
+ } elseif ((!isNetworkActiveById($networkId)) && (!isAdminsExpertSettingEnabled())) {
+ // Do not load inactive network data
+ reportBug(__FUNCTION__, __LINE__, 'Network id ' . $networkId . ' is not active.');
+ }
// Set current network id
setCurrentNetworkId($networkId);
} // END - if
// Return result
- if (empty($column)) {
+ if ((empty($column)) && (isset($GLOBALS['network_data'][$networkId]))) {
// Return array
return $GLOBALS['network_data'][$networkId];
- } else {
+ } elseif (isset($GLOBALS['network_data'][$networkId][$column])) {
// Return column
return $GLOBALS['network_data'][$networkId][$column];
}
+
+ // Return NULL
+ return NULL;
}
// "Getter" for a network's data by provided type id number
if ($networkId < 1) {
// Not good, should be fixed
reportBug(__FUNCTION__, __LINE__, 'Network type id ' . $networkId . ' is smaller than 1.');
- } // END - if
+ } elseif ((!isNetworkActiveById($networkId)) && (!isAdminsExpertSettingEnabled())) {
+ // Do not load inactive network data
+ reportBug(__FUNCTION__, __LINE__, 'Network id ' . $networkId . ' is not active.');
+ }
// Set current network id
setCurrentNetworkId($networkId);
$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__);
// Is there 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'
+' . getNetworkActivatedColumn() . '
ORDER BY
- `network_short_name` ASC", __FUNCTION__, __LINE__);
+ `network_short_name` ASC', __FUNCTION__, __LINE__);
// Are there entries?
if (!SQL_HASZERONUMS($result)) {
`{?_MYSQL_PREFIX?}_network_types`
WHERE
`network_id`=%s
+ ' . getNetworkActivatedColumn('AND') . '
ORDER BY
`network_type_handler` ASC',
array(
$content = '';
// Query all types of this network
- $result = SQL_QUERY("SELECT
+ $result = SQL_QUERY('SELECT
t.`network_type_id`,
t.`network_type_handler`,
d.`network_title`
`{?_MYSQL_PREFIX?}_network_data` AS d
ON
t.`network_id`=d.`network_id`
-WHERE
- d.`network_active`='Y'
+' . getNetworkActivatedColumn('WHERE', 'd') . '
ORDER BY
d.`network_short_name` ASC,
- t.`network_type_handler` ASC", __FUNCTION__, __LINE__);
+ t.`network_type_handler` ASC', __FUNCTION__, __LINE__);
// Are there entries?
if (!SQL_HASZERONUMS($result)) {
function generateNetworkTypeOptions ($networkId) {
// Is this an array, then we just came back from edit/delete actions
if (is_array($networkId)) {
+ // Set it as empty string
$networkId = '';
} // END - if
$networkId,
'',
sprintf(
- "WHERE `network_id`=%s",
+ "WHERE `network_id`=%s" . getNetworkActivatedColumn('AND'),
bigintval(getRequestElement('network_id'))
),
'',
$GLOBALS[__FUNCTION__][$networkId] = '{--ADMIN_NETWORK_API_NOT_CONFIGURED--}';
// So is it configured?
- if (isNetworkApiConfigured($networkId)) {
+ if (!isNetworkActiveById($networkId)) {
+ // Network is not active
+ $GLOBALS[__FUNCTION__][$networkId] = '{--ADMIN_NETWORK_API_NOT_ACTIVE--}';
+ } elseif (isNetworkApiConfigured($networkId)) {
// Yes, it is
$GLOBALS[__FUNCTION__][$networkId] = '{--ADMIN_NETWORK_API_CONFIGURED--}';
} // END - if
// Already there
loadTemplate('admin_settings_unsaved', false, '{%message,ADMIN_NETWORK_ALREADY_ADDED=' . postRequestElement('network_short_name') . '%}');
return false;
- } // END - if
+ } elseif (!isNetworkActiveByShortName(postRequestElement('network_short_name'))) {
+ // Network is not active
+ loadTemplate('admin_settings_unsaved', false, '{%message,ADMIN_NETWORK_NOT_ACTIVE=' . postRequestElement('network_short_name') . '%}');
+ return false;
+ }
// Remove the 'ok' part
unsetPostRequestElement('ok');