From b8c071f12a601619c4c02b9441b3e0e012db6ced Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 23 Nov 2009 20:01:21 +0000 Subject: [PATCH] Adding of network advert types partly finished, hard-coded table type fixed to dynamic --- .gitattributes | 1 + inc/db/lib-mysql3.php | 5 +- inc/extensions/ext-doubler.php | 24 ++++---- inc/extensions/ext-network.php | 7 +-- inc/extensions/ext-order.php | 2 +- inc/language/network_de.php | 35 ++++++++++- inc/libs/network_functions.php | 17 +++++- inc/modules/admin/what-list_network_types.php | 41 ++++++++++++- inc/modules/admin/what-list_networks.php | 13 +--- templates/de/html/admin/admin_add_network.tpl | 28 +-------- .../de/html/admin/admin_add_network_type.tpl | 61 +++++++++++++++++++ 11 files changed, 174 insertions(+), 60 deletions(-) create mode 100644 templates/de/html/admin/admin_add_network_type.tpl diff --git a/.gitattributes b/.gitattributes index 771eb88ed1..35d50cddab 100644 --- a/.gitattributes +++ b/.gitattributes @@ -873,6 +873,7 @@ templates/de/html/admin/admin_add_cat.tpl -text templates/de/html/admin/admin_add_country.tpl -text templates/de/html/admin/admin_add_max.tpl -text templates/de/html/admin/admin_add_network.tpl -text +templates/de/html/admin/admin_add_network_type.tpl -text templates/de/html/admin/admin_add_payment.tpl -text templates/de/html/admin/admin_add_points.tpl -text templates/de/html/admin/admin_add_points_all.tpl -text diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index 14a4b6f9cc..ab53b7041b 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -74,8 +74,9 @@ function SQL_QUERY ($sqlString, $F, $L) { // Replace {PER} $sqlString = str_replace('{PER}', '%', $sqlString); - // Compile config out - $sqlString = FILTER_COMPILE_CONFIG($sqlString, true); + // Compile config entries out + $eval = "\$sqlString = \"".FILTER_COMPILE_CONFIG(escapeQuotes($sqlString))."\";"; + eval($eval); // Starting time $querytimeBefore = microtime(true); diff --git a/inc/extensions/ext-doubler.php b/inc/extensions/ext-doubler.php index 2559665326..5e2416bf71 100644 --- a/inc/extensions/ext-doubler.php +++ b/inc/extensions/ext-doubler.php @@ -52,18 +52,18 @@ switch (getExtensionMode()) { // Doubler table addExtensionSql("DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_doubler`"); addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_doubler` ( -id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, -userid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -refid BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -points FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000, -remote_ip VARCHAR(15) NOT NULL DEFAULT '0.0.0.0', -timemark VARCHAR(10) NOT NULL DEFAULT '', -completed ENUM('Y','N') NOT NULL DEFAULT 'N', -is_ref ENUM('Y','N') NOT NULL DEFAULT 'N', -KEY (refid), -KEY (userid), -PRIMARY KEY (id) -)TYPE=MYISAM"); +`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`refid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, +`points` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000, +`remote_ip` VARCHAR(15) NOT NULL DEFAULT '0.0.0.0', +`timemark` VARCHAR(10) NOT NULL DEFAULT '', +`completed` ENUM('Y','N') NOT NULL DEFAULT 'N', +`is_ref` ENUM('Y','N') NOT NULL DEFAULT 'N', +KEY (`refid`), +KEY (`userid`), +PRIMARY KEY (`id`) +)TYPE={?_TABLE_TYPE?}"); // // --- SETTINGS --- diff --git a/inc/extensions/ext-network.php b/inc/extensions/ext-network.php index 2eabe994ea..c03a1ce049 100644 --- a/inc/extensions/ext-network.php +++ b/inc/extensions/ext-network.php @@ -68,17 +68,16 @@ PRIMARY KEY (`network_id`) ) TYPE={?_TABLE_TYPE?} COMMENT='Network data'"); // Types the network provider is supporting (e.g. Forced-Banner and so on) - // @TODO network_type_name is an internal name and needs documentation + // @TODO network_type_handle is an internal name and needs documentation addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_network_types`'); addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_network_types` ( `network_type_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `network_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -`network_type_name` VARCHAR(255) NOT NULL DEFAULT '', -`network_type_title` VARCHAR(255) NOT NULL DEFAULT '', +`network_type_handle` VARCHAR(255) NOT NULL DEFAULT '', `network_type_request_url` VARCHAR(255) NOT NULL DEFAULT '', `network_type_click_url` VARCHAR(255) NOT NULL DEFAULT '', `network_type_banner_url` VARCHAR(255) NOT NULL DEFAULT '', -UNIQUE `provider_type` (`network_id`,`network_type_name`), +UNIQUE `provider_type` (`network_id`,`network_type_handle`), PRIMARY KEY (`network_type_id`) ) TYPE={?_TABLE_TYPE?} COMMENT='Types provideable by networks. ONLY FILL OUT WITH PROPER idEA!'"); diff --git a/inc/extensions/ext-order.php b/inc/extensions/ext-order.php index 8c5b888796..99e87fd25c 100644 --- a/inc/extensions/ext-order.php +++ b/inc/extensions/ext-order.php @@ -307,7 +307,7 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), INDEX (`pool_id`) -) TYPE=MYISAM COMMENT='URL blacklist'"); +) TYPE={?_TABLE_TYPE?} COMMENT='URL blacklist'"); // Update notes (these will be set as task text!) setExtensionUpdateNotes("Tabelle für URL-Sperrliste angelegt."); diff --git a/inc/language/network_de.php b/inc/language/network_de.php index e360e4d8f6..c8001e8598 100644 --- a/inc/language/network_de.php +++ b/inc/language/network_de.php @@ -50,11 +50,13 @@ addMessages(array( 'ADMIN_NETWORK_NOTHING_FOUND' => "Es wurden keine Daten zum Editieren oder Löschen gefunden.", 'ADMIN_NETWORK_NOTHING_CHANGED' => "Es wurden keine Änderungen an den allgemeinen Daten ausgeführt.", 'ADMIN_NETWORK_NOTHING_REMOVED' => "Es wurden keine allgemeinen Daten gelöscht.", + 'ADMIN_NETWORK_TYPES_404' => "Es wurden keine Werbearten zum Werbenetzwerk %s gefunden.", // - Form titles 'ADMIN_NETWORK_ADD_TITLE' => "Neues Werbenetzwerk hinzufügen - Allgemeine Daten", 'ADMIN_NETWORK_EDIT_TITLE' => "Werbenetzwerk editieren - Allgemeine Daten", 'ADMIN_NETWORK_DELETE_TITLE' => "Werbenetzwerk löschen - Allgemeine Daten", 'ADMIN_NETWORK_SELECT_TITLE' => "Werbenetzwerk auswählen", + 'ADMIN_NETWORK_TYPE_ADD_TITLE' => "Werbenetzwerk verwalten - Neue Werbeart hinzufügen", // - Link titles 'ADMIN_NETWORK_LIST_TYPES_LINK_TITLE' => "Weiter zu den Werbearten", 'ADMIN_NETWORK_LIST_PARAMS_LINK_TITLE' => "Weiter zu den Abfrageparametern", @@ -67,9 +69,35 @@ addMessages(array( 'ADMIN_NETWORK_DELETE' => "Löschen", 'ADMIN_NETWORK_REMOVE' => "Daten entfernen", 'ADMIN_NETWORK_CHOOSE' => "Werbenetzwerk auswählen", + 'ADMIN_NETWORK_TYPE_ADD' => "Werbeart hinzufügen", // - Success nots 'ADMIN_NETWORK_UPDATED' => "Es wurden %s Einträge in den allgemeinen Daten aktualisiert.", 'ADMIN_NETWORK_REMOVED' => "Es wurden %s Einträge aus den allgemeinen Dateen gelöscht.", + // - Form notes + 'ADMIN_NETWORK_ADD_NOTE' => "Mehr Datenschutz bei POST-Abfragen bedeutet, dass die von den Internetanbietern betriebenen Caches (Proxy) die POST-Daten nicht mitloggen (so eine Art Kodex). Der Zeichensatz ist meistens ISO-8859-1 oder WINDOWS-1252.", + 'ADMIN_NETWORK_LIST_NOTE' => "Seien Sie mit dem Löschen und Editieren von Allgemeine Daten sehr vorsichtig. Sie sollten hierzu Rücksprache im Forum halten.", + 'ADMIN_NETWORK_TYPE_ADD_NOTE' => "Fügen Sie hier weitere Werbearten dem ausgwählten Werbenetzwerk hinzu. Die Abfrage-, Klick- und Banner-URL müssen dabei Platzhalter enthalten, die Sie der Dokumentation und dem Forum entnehmen können.", + // - Advertise types + 'ADMIN_NETWORK_TYPE_BANNERCLICK' => "Banner-Klick", + 'ADMIN_NETWORK_TYPE_BANNERVIEW' => "Banner-View", + 'ADMIN_NETWORK_TYPE_BANNERCLICK_VIEW' => "Banner-Klick/-View", + 'ADMIN_NETWORK_TYPE_SURFBARCLICK' => "Surfbar-Klick", + 'ADMIN_NETWORK_TYPE_SURFBARVIEW' => "Surfbar-View", + 'ADMIN_NETWORK_TYPE_SURFBARCLICK_VIEW' => "Surfbar-Klick/-View", + 'ADMIN_NETWORK_TYPE_FORCEDBANNER' => "Forced-Banner", + 'ADMIN_NETWORK_TYPE_TEXTLINKCLICK' => "Textlink-Klick", + 'ADMIN_NETWORK_TYPE_TEXTLINKVIEW' => "Textlink-View", + 'ADMIN_NETWORK_TYPE_TEXTLINKCLICK_VIEW' => "Textlink-Klick/-View", + 'ADMIN_NETWORK_TYPE_LAYERCLICK' => "Layer-Klick", + 'ADMIN_NETWORK_TYPE_LAYERVIEW' => "Layer-View", + 'ADMIN_NETWORK_TYPE_LAYERCLICK_VIEW' => "Layer-Klick/-View", + 'ADMIN_NETWORK_TYPE_POPUP' => "PopUp", + 'ADMIN_NETWORK_TYPE_POPDOWN' => "PopDown", + 'ADMIN_NETWORK_TYPE_TEXTMAIL' => "Textmail", + 'ADMIN_NETWORK_TYPE_HTMLMAIL' => "HTML-Mail", + 'ADMIN_NETWORK_TYPE_LEAD' => "Lead", + 'ADMIN_NETWORK_TYPE_SALE' => "Sale", + 'ADMIN_NETWORK_TYPE_PAYPERACTIVE' => "PayPerAktiv", // - Sponsor networks 'ADMIN_NETWORK_NONE_SUPPORTED' => "Es sind noch keine Werbenetzwerke eingerichtet.", 'ADMIN_NETWORK_SHORT_NAME' => "Kurzname", @@ -81,14 +109,17 @@ addMessages(array( 'ADMIN_NETWORK_REQUEST_TYPE_GET' => "GET (meistens richtig)", 'ADMIN_NETWORK_REQUEST_TYPE_POST' => "POST (mehr Datenschutz)", 'ADMIN_NETWORK_CHARSET' => "Zeichensatz", - 'ADMIN_NETWORK_ADD_NOTE' => "Mehr Datenschutz bei POST-Abfragen bedeutet, dass die von den Internetanbietern betriebenen Caches (Proxy) die POST-Daten nicht mitloggen (so eine Art Kodex). Der Zeichensatz ist meistens ISO-8859-1 oder WINDOWS-1252.", - 'ADMIN_NETWORK_LIST_NOTE' => "Seien Sie mit dem Löschen und Editieren von Allgemeine Daten sehr vorsichtig. Sie sollten hierzu Rücksprache im Forum halten.", 'ADMIN_NETWORK_ALREADY_ADDED' => "Ein Werbenetzwerk mit dem Kurznamen %s existiert bereits.", 'ADMIN_NETWORK_DATA_NOT_ADDED' => "Das Werbenetzwerk mit dem Kurznamen %s wurde nicht hinzugefügt.", 'ADMIN_NETWORK_ADDED_TITLE' => "Allgemeine Daten hinzugefügt.", 'ADMIN_NETWORK_SEPERATOR' => "Trennzeichen", 'ADMIN_NETWORK_DATA_SEPERATOR2' => "Daten", 'ADMIN_NETWORK_ROW_SEPERATOR2' => "Zeilen", + // - Advertise type + 'ADMIN_NETWORK_TYPE_HANDLE' => "Werbeart-Typ", + 'ADMIN_NETWORK_TYPE_REQUEST_URL' => "Basisabfrage-URL der Werbeart", + 'ADMIN_NETWORK_TYPE_CLICK_URL' => "Klick-URL der Werbeart", + 'ADMIN_NETWORK_TYPE_BANNER_URL' => "Banner-URL der Werbeart", )); // [EOF] diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index dfa15112c7..4953a1d097 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -41,6 +41,21 @@ if (!defined('__SECURITY')) { die(); } // END - if +// Handle a (maybe) sent form here +function doNetworkHandleForm () { + // Was the form sent? + if ((isFormSent()) || (isPostRequestElementSet('edit')) || (isPostRequestElementSet('del')) || (isPostRequestElementSet('change')) || (isPostRequestElementSet('remove'))) { + // Do we have a 'do'? + if (isGetRequestElementSet('do')) { + // Process the request + doAdminNetworkProcessForm(); + } else { + // No 'do' found + loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_DO_404')); + } + } // END - if +} + // Processes an admin form function doAdminNetworkProcessForm () { // Form really sent? @@ -60,7 +75,7 @@ function doAdminNetworkProcessForm () { // Is the function valid? if (!function_exists($functionName)) { // Invalid function name - debug_report_bug('Invalid do ' . getRequestElement('do') . ', function ' . $functionName .' does not exist.'); + debug_report_bug('Invalid do ' . getRequestElement('do') . ', function ' . $functionName .' does not exist.', false); } // END - if // Call-back the method handling our request diff --git a/inc/modules/admin/what-list_network_types.php b/inc/modules/admin/what-list_network_types.php index 4e856c6a32..41daad9463 100644 --- a/inc/modules/admin/what-list_network_types.php +++ b/inc/modules/admin/what-list_network_types.php @@ -44,11 +44,50 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addMenuDescription('admin', __FILE__); +// Handle form here +doNetworkHandleForm(); + // Do we have a network selected? if (isGetRequestElementSet('network')) { // Get its data for template $networkData = getNetworkDataById(getRequestElement('network')); - print('
'.print_r($networkData, true).'
'); + + // Load all advert types for given network + $result = SQL_QUERY_ESC("SELECT + `network_type_id`, `network_type_handle`, `network_type_request_url`, `network_type_click_url`, `network_type_banner_url` +FROM + `{?_MYSQL_PREFIX?}_network_types` +WHERE + `network_id`=%s +ORDER BY + `network_type_id` ASC", + array(getRequestElement('network')), __FILE__, __LINE__); + + // Do we have entries? + if (SQL_NUMROWS($result) > 0) { + // List all entries + $OUT = ''; $SW = 2; + while ($row = SQL_FETCHARRAY($result)) { + // Add/translate some data + $row['sw'] = $SW; + + // Add row template and switch color + $OUT .= loadTemplate('admin_list_network_types_row', true, $row); + $SW = 3 - $SW; + } // END - while + + // Load main template + loadTemplate('admin_list_network_types', false, $OUT); + } else { + // No entries found + loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_NETWORK_TYPES_404'), $networkData['network_title'])); + } + + // Free result + SQL_FREERESULT($result); + + // Add form for adding new types + loadTemplate('admin_add_network_type', false, $networkData); } else { // Generate network list for this script outputHtml(generateAdminNetworkList()); diff --git a/inc/modules/admin/what-list_networks.php b/inc/modules/admin/what-list_networks.php index 6b33104265..83f30c853c 100644 --- a/inc/modules/admin/what-list_networks.php +++ b/inc/modules/admin/what-list_networks.php @@ -47,17 +47,8 @@ addMenuDescription('admin', __FILE__); // By default we should display list/add new forms $GLOBALS['network_display'] = true; -// Was the form sent? -if ((isFormSent()) || (isPostRequestElementSet('edit')) || (isPostRequestElementSet('del')) || (isPostRequestElementSet('change')) || (isPostRequestElementSet('remove'))) { - // Do we have a 'do'? - if (isGetRequestElementSet('do')) { - // Process the request - doAdminNetworkProcessForm(); - } else { - // No 'do' found - loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_DO_404')); - } -} // END - if +// Handle form here +doNetworkHandleForm(); // Display forms? if ($GLOBALS['network_display'] === false) { diff --git a/templates/de/html/admin/admin_add_network.tpl b/templates/de/html/admin/admin_add_network.tpl index 7229fe8bbf..fcb53e07d2 100644 --- a/templates/de/html/admin/admin_add_network.tpl +++ b/templates/de/html/admin/admin_add_network.tpl @@ -6,54 +6,36 @@ {--ADMIN_NETWORK_ADD_TITLE--} - -   - {--ADMIN_NETWORK_SHORT_NAME--}: - -   - {--ADMIN_NETWORK_TITLE--}: - -   - {--ADMIN_NETWORK_REFLINK--}: - -   - {--ADMIN_NETWORK_DATA_SEPERATOR--}: - -   - {--ADMIN_NETWORK_ROW_SEPERATOR--}: - -   - {--ADMIN_NETWORK_REQUEST_TYPE--}: @@ -64,17 +46,11 @@ -   - - - {--ADMIN_NETWORK_CHARSET--}: - + {--ADMIN_NETWORK_CHARSET--}: + - -   - diff --git a/templates/de/html/admin/admin_add_network_type.tpl b/templates/de/html/admin/admin_add_network_type.tpl new file mode 100644 index 0000000000..ec946ffabf --- /dev/null +++ b/templates/de/html/admin/admin_add_network_type.tpl @@ -0,0 +1,61 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ {--ADMIN_NETWORK_TYPE_ADD_TITLE--} + +
{--ADMIN_NETWORK_TYPE_HANDLE--}: + +
{--ADMIN_NETWORK_TYPE_REQUEST_URL--}: + +
{--ADMIN_NETWORK_TYPE_CLICK_URL--}: + +
{--ADMIN_NETWORK_TYPE_BANNER_URL--}: + +
+
+
+ +
+ {--ADMIN_NETWORK_TYPE_ADD_NOTE--} +
-- 2.39.5