From a1ab2fa4296e58f66a15ac7b568a1454713a61ee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 25 Nov 2009 18:48:36 +0000 Subject: [PATCH] Fixes saving of settings, inconsistency fixed in config entries --- inc/extensions/ext-order.php | 14 +++++++++-- inc/language/order_de.php | 11 ++++++--- inc/language/other_de.php | 5 ---- inc/modules/admin/admin-inc.php | 23 ++++++++++--------- inc/modules/admin/what-config_order.php | 4 ++-- inc/modules/member/what-order.php | 6 ++--- install/tables.sql | 2 -- .../de/html/admin/admin_config_order.tpl | 8 +++---- .../de/html/admin/admin_config_order_form.tpl | 2 ++ 9 files changed, 43 insertions(+), 32 deletions(-) diff --git a/inc/extensions/ext-order.php b/inc/extensions/ext-order.php index 99e87fd25c..8e6b2b8321 100644 --- a/inc/extensions/ext-order.php +++ b/inc/extensions/ext-order.php @@ -42,10 +42,10 @@ if (!defined('__SECURITY')) { } // END - if // Version number -setThisExtensionVersion('0.5.1'); +setThisExtensionVersion('0.5.2'); // Version history array (add more with , '0.1.0' and so on) -setExtensionVersionHistory(array('0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1')); +setExtensionVersionHistory(array('0.0', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2')); switch (getExtensionMode()) { case 'register': // Do stuff when installation is running (modules.php?module=admin is called) @@ -319,6 +319,16 @@ INDEX (`pool_id`) // Update notes (these will be set as task text!) setExtensionUpdateNotes("Weiteren Menü-Query in Erweiterung verlagert."); break; + + case '0.5.2': // SQL queries for v0.5.2 + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_text`"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` DROP `test_subj`"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `allow_url_in_text` ENUM('Y','N') NOT NULL DEFAULT 'N'"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD `allow_url_in_subject` ENUM('Y','N') NOT NULL DEFAULT 'N'"); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Inkonsistenz in Konfigurationsnamen korregiert."); + break; } break; diff --git a/inc/language/order_de.php b/inc/language/order_de.php index d353725732..6de8129495 100644 --- a/inc/language/order_de.php +++ b/inc/language/order_de.php @@ -49,13 +49,18 @@ addMessages(array( 'ADMIN_ORDER_MIN_RECEIVER_PER_ORDER' => "Minimale Anzahl Empfänger pro Mailbuchung", 'ADMIN_ORDER_MAX' => "So viele wie möglich.", 'ADMIN_ORDER_ORDER' => "So viele wie auf Empfang eingestellt.", - 'MEMBER_ORDER_ALLOWED_RECEIVE' => "Sie können heute noch %s von %s Mailbuchungen aufgeben.", - 'MEMBER_ORDER_ALLOWED_MAX' => "Sie können solange Mailbuchungen aufgeben, bis alle Mitglieder nicht mehr empfangsbereit sind.", - 'MEMBER_ORDER_ALLOWED_UNKNOWN' => "Fehler in Konfiguration erkannt! cfg={?order_max_full?} Bitte den Administrator benachrichtigen.", 'ADMIN_ORDER_SELECTION_COLUMN' => "Tabellenspalte, nach der umsortiert werden soll", 'ADMIN_ORDER_SELECTION_MODE' => "Sortierreihenfolge", 'ADMIN_ORDER_SELECTION_SETTINGS' => "Auswahlverfahren der Empfänger", + 'ADMIN_OPTION_MAX_TEXT_LENGTH' => "Maximale Länge des Werbetextes", + 'ADMIN_OPTION_MAX_UNCONFIRMED_MAILS' => "Maximale Anzahl unbest. Mails (Mailbuchung)", + 'ADMIN_OPTION_CHECK_EMAIL_TEXT' => "Sind URLs im Werbetext erlaubt?", + 'ADMIN_OPTION_CHECK_EMAIL_SUBJ' => "Sind URLs in der Betreffzeile erlaubt?", + 'ADMIN_OPTION_URL_BLACKLIST' => "Black-Liste für gebuchte URLs aktivieren?", + 'MEMBER_ORDER_ALLOWED_RECEIVE' => "Sie können heute noch %s von %s Mailbuchungen aufgeben.", + 'MEMBER_ORDER_ALLOWED_MAX' => "Sie können solange Mailbuchungen aufgeben, bis alle Mitglieder nicht mehr empfangsbereit sind.", + 'MEMBER_ORDER_ALLOWED_UNKNOWN' => "Fehler in Konfiguration erkannt! cfg={?order_max_full?} Bitte den Administrator benachrichtigen.", 'MEMBER_ORDER_MAX_ALLOWED' => "Maximale Mailbuchungen", 'MEMBER_ORDER_ALLOWED_EXHAUSTED' => "Sie können keine weiteren Mails mehr versenden, oder stellen Sie bitte den Empfang höher ein.", 'MEMBER_ENTER_INVALID_URL' => "Ungütige URL eingegeben.", diff --git a/inc/language/other_de.php b/inc/language/other_de.php index 779ae5c98c..744f9823ab 100644 --- a/inc/language/other_de.php +++ b/inc/language/other_de.php @@ -46,12 +46,7 @@ addMessages(array( 'ADMIN_OTHER_SETTINGS' => "Sonstige Einstellungen", 'ADMIN_OPTION_URL_TIME_LOCK' => "Selbe beworbene URL nicht mehr bewerbar (0 = URL sofort erneut buchbar)", 'ADMIN_OPTION_POOL_MAX_SEND' => "Anzahl zu sendender Mails aus dem Pool", - 'ADMIN_OPTION_MAX_UNCONFIRMED_MAILS' => "Maximale Anzahl unbest. Mails (Mailbuchung)", 'ADMIN_OPTION_LOCK_PROFILE_TIME' => "Sperrzeit des Mitgliedprofiles nach Änderung (0 = Keine Sperrzeit)", - 'ADMIN_OPTION_MAX_TEXT_LENGTH' => "Maximale Länge des Werbetextes", - 'ADMIN_OPTION_CHECK_EMAIL_TEXT' => "Sind URLs im Werbetext erlaubt?", - 'ADMIN_OPTION_CHECK_EMAIL_SUBJ' => "Sind URLs in der Betreffzeile erlaubt?", - 'ADMIN_OPTION_URL_BLACKLIST' => "Black-Liste für gebuchte URLs aktivieren?", 'ADMIN_OPTION_AUTOSEND_ACTIVE' => "Ist der Auto-Versand aktiv?", 'ADMIN_OPTION_NOTIFY_ADMIN' => "Benachrichtigung bei Profiländerung?", 'ADMIN_OPTION_MAX_ONLINETIME' => "Timeout für Who-is-Online", diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index ac2747eb35..0f8382245e 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -573,7 +573,7 @@ function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement // Save settings to the database function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) { // Prepare all arrays, variables - $DATA = array(); + $tableData = array(); $skip = false; // Now, walk through all entries and prepare them for saving @@ -581,7 +581,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement // Process only formular field but not submit buttons ;) if ($id != 'ok') { // Do not save the ok value - convertSelectionsToTimestamp($postData, $DATA, $id, $skip); + convertSelectionsToTimestamp($postData, $tableData, $id, $skip); // Shall we process this id? It muss not be empty, of course if (($skip === false) && (!empty($id)) && (!isset($GLOBALS['skip_config'][$id]))) { @@ -595,10 +595,10 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement $test = (float)$val; if ('' . $val . '' == '' . $test . '') { // Add numbers - $DATA[] = sprintf("`%s`=%s", $id, $test); + $tableData[] = sprintf("`%s`=%s", $id, $test); } else { // Add strings - $DATA[] = sprintf("`%s`='%s'", $id, trim($val)); + $tableData[] = sprintf("`%s`='%s'", $id, trim($val)); } // Do not add a config entry twice @@ -622,31 +622,32 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement if (SQL_NUMROWS($result) == 1) { // "Implode" all data to single string - $DATA_UPDATE = implode(', ', $DATA); + $updatedData = implode(', ', $tableData); // Generate SQL string $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}%s` SET %s WHERE %s LIMIT 1", $tableName, - $DATA_UPDATE, + $updatedData, $whereStatement ); } else { // Add Line (does only work with auto_increment! - $KEYs = array(); $values = array(); - foreach ($DATA as $entry) { + $keys = array(); $values = array(); + foreach ($tableData as $entry) { // Split up $line = explode('=', $entry); - $KEYs[] = $line[0]; $values[] = $line[1]; + $keys[] = $line[0]; + $values[] = $line[1]; } // END - foreach // Add both in one line - $KEYs = implode('`, `', $KEYs); + $keys = implode('`, `', $keys); $values = implode(', ', $values); // Generate SQL string $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}%s` (%s) VALUES (%s)", $tableName, - $KEYs, + $keys, $values ); } diff --git a/inc/modules/admin/what-config_order.php b/inc/modules/admin/what-config_order.php index ca821658bc..2b349bb58e 100644 --- a/inc/modules/admin/what-config_order.php +++ b/inc/modules/admin/what-config_order.php @@ -49,12 +49,12 @@ if (isFormSent()) { adminSaveSettingsFromPostData(); } else { // Init all selection entries - foreach (array('order_max_full_order', 'order_max_full_max', 'order_mode_asc', 'order_mode_desc', 'test_text_y', 'test_text_n', 'test_subj_y', 'test_subj_n', 'url_blacklist_y', 'url_blacklist_n', 'repay_deleted_mails_repay', 'repay_deleted_mails_jackpot', 'repay_deleted_mails_shred') as $entry) { + foreach (array('order_max_full_order', 'order_max_full_max', 'order_mode_asc', 'order_mode_desc', 'allow_url_in_text_y', 'allow_url_in_text_n', 'allow_url_in_subject_y', 'allow_url_in_subject_n', 'url_blacklist_y', 'url_blacklist_n', 'repay_deleted_mails_repay', 'repay_deleted_mails_jackpot', 'repay_deleted_mails_shred') as $entry) { $content[$entry] = ''; } // END - foreach // Set all default checks - foreach (array('order_max_full', 'order_mode', 'test_text', 'test_subj', 'url_blacklist') as $entry) { + foreach (array('order_max_full', 'order_mode', 'allow_url_in_text', 'allow_url_in_subject', 'url_blacklist') as $entry) { $content[$entry . '_' . strtolower(getConfig($entry))] = ' checked="checked"'; } // END - foreach diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index 31b3327451..e4cd406947 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -127,9 +127,9 @@ LIMIT 1", // No entry found, so we need to check out the stats table as well... :) // We have to add that suff here, now we continue WITHOUT checking and check the text and subject against some filters $URL = ''; - if (getConfig('test_text') == 'Y') { + if (getConfig('allow_url_in_text') == 'Y') { // Test submitted text against some filters (length, URLs in text etc.) - if ((strpos(strtolower(postRequestElement('text')), "https://") > -1) || (strpos(strtolower(postRequestElement('text')), 'http://') > -1) || (strpos(strtolower(postRequestElement('text')), "www") > -1)) { + if ((strpos(strtolower(postRequestElement('text')), 'https://') > -1) || (strpos(strtolower(postRequestElement('text')), 'http://') > -1) || (strpos(strtolower(postRequestElement('text')), "www") > -1)) { // URL found! $URL = 'modules.php?module=login&what=order&code=' . getCode('URL_FOUND'); } // END - if @@ -145,7 +145,7 @@ LIMIT 1", } // END - if // Shall I test the subject line against URLs? - if (getConfig('test_subj') == 'Y') { + if (getConfig('allow_url_in_subject') == 'Y') { // Check the subject line for issues setRequestPostElement('subject', str_replace("\\", '[nl]', substr(postRequestElement('subject'), 0, 200))); if ((strpos(strtolower(postRequestElement('subject')), 'http://') > -1) || (strpos(strtolower(postRequestElement('subject')), "www") > -1)) { diff --git a/install/tables.sql b/install/tables.sql index 3e62332519..f7be8e2ab1 100644 --- a/install/tables.sql +++ b/install/tables.sql @@ -39,9 +39,7 @@ CREATE TABLE `{?_MYSQL_PREFIX?}_config` ( `check_double_pass` ENUM('Y','N') NOT NULL DEFAULT 'N', `admin_notify` ENUM('Y','N') NOT NULL DEFAULT 'Y', `url_tlock` BIGINT(20) UNSIGNED NOT NULL DEFAULT '86400', - `test_text` ENUM('Y','N') NOT NULL DEFAULT 'Y', `max_tlength` BIGINT(20) UNSIGNED NOT NULL DEFAULT '1000', - `test_subj` ENUM('Y','N') NOT NULL DEFAULT 'Y', `autosend_active` ENUM('Y','N') NOT NULL DEFAULT 'N', `max_send` TINYINT(3) UNSIGNED NOT NULL DEFAULT '100', `url_blacklist` ENUM('Y','N') NOT NULL DEFAULT 'Y', diff --git a/templates/de/html/admin/admin_config_order.tpl b/templates/de/html/admin/admin_config_order.tpl index 02e114688c..10a85a00de 100644 --- a/templates/de/html/admin/admin_config_order.tpl +++ b/templates/de/html/admin/admin_config_order.tpl @@ -40,8 +40,8 @@ {--ADMIN_OPTION_CHECK_EMAIL_TEXT--}: - {--YES--}:   - {--NO--}:  + {--YES--}:   + {--NO--}:  @@ -50,8 +50,8 @@ {--ADMIN_OPTION_CHECK_EMAIL_SUBJ--}: - {--YES--}:   - {--NO--}:  + {--YES--}:   + {--NO--}:  diff --git a/templates/de/html/admin/admin_config_order_form.tpl b/templates/de/html/admin/admin_config_order_form.tpl index 870072a26c..0941769441 100644 --- a/templates/de/html/admin/admin_config_order_form.tpl +++ b/templates/de/html/admin/admin_config_order_form.tpl @@ -1,3 +1,4 @@ +
@@ -68,3 +69,4 @@
+
-- 2.30.2