]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-order.php
General directory structure added for debug extension
[mailer.git] / inc / extensions / ext-order.php
index aaa0982e295962ace1d813844e3cdab8a4b0bdaa..ff17638453563a78b33d7bd9dbfac596e0af602c 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF']))) {
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
 
 // Version number
-$EXT_VERSION = "0.4.9";
+$EXT_VERSION = "0.5.0";
 
 // Auto-set extension version
 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
 
 // Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.1", "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");
+$EXT_VER_HISTORY = array("0.0", "0.1", "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");
 
 switch ($EXT_LOAD_MODE)
 {
-case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
+case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
        // SQL commands to run
        $SQLs[] = "";
        break;
 
 case "remove": // Do stuff when removing extension
        // SQL commands to run
-       $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP order_max_full";
-       $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_order' LIMIT 1";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_order' LIMIT 1";
        break;
 
 case "activate": // Do stuff when admin activates this extension
        // SQL commands to run
-       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='order' LIMIT 1";
+       $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='Y', locked='N' WHERE what='order' LIMIT 1";
        $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='N', hidden='N', admin_only='N', mem_only='Y' WHERE module='order' LIMIT 1";
        break;
 
 case "deactivate": // Do stuff when admin deactivates this extension
        // SQL commands to run
-       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='order' LIMIT 1";
-       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='order' LIMIT 1";
+       $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what='order' LIMIT 1";
+       $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET visible='N', locked='Y' WHERE module='order' LIMIT 1";
        break;
 
 case "update": // Update an extension
        switch ($EXT_VER)
        {
        case "0.1": // SQL queries for v0.1
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_max_full enum('ORDER', 'MAX') not null default 'MAX'";
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('setup', 'config_order', 'Mailbuchungsseite', '7', 'Einstellungen am Mailbuchungsformular.')";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_max_full ENUM('ORDER','MAX') NOT NULL DEFAULT 'MAX'";
+               $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Maximale Mailbuchungen sind nun vom maximalen Empfang abhägig.";
                break;
 
        case "0.1.1": // SQL queries for v0.1.1
-               $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_order' LIMIT 1";
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, sort, descr) VALUES ('setup', 'config_order', 'Mailbuchungsseite', '7', 'Einstellungen am Mailbuchungsformular.')";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD mail_orders bigint(20) not null default '0'";
+               $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_order' LIMIT 1";
+               $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`, `what`, `title`, `sort`, `descr`) VALUES ('setup','config_order','Mailbuchungsseite','7','Einstellungen am Mailbuchungsformular.')";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD mail_orders BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Maximale Mailbuchung vervollständigt (Admin-Bereich und im Buchungsformular selber).";
@@ -128,7 +127,7 @@ case "update": // Update an extension
 
        case "0.2.0": // SQL queries for v0.2.0
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Seit <A href=\"".SERVER_URL."/patches/340-Gast_Mitgliedsmenue_Deaktivieren.zip\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
+               $UPDATE_NOTES = "Seit <A href=\"#\">Patch 340</A> &uuml;berfl&uuml;ssige HTML-Tags entfernt.";
                break;
 
        case "0.2.1": // SQL queries for v0.2.1
@@ -142,7 +141,7 @@ case "update": // Update an extension
                break;
 
        case "0.2.3": // SQL queries for v0.2.3
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_min bigint(20) not null default '10'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_min BIGINT(20) UNSIGNED NOT NULL DEFAULT 10";
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Minimum an Empf&auml;nger pro Mailbuchung einstellbar. Standart: 10 Empf&auml;nger";
@@ -194,8 +193,8 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us
                break;
 
        case "0.3.1": // SQL queries for v0.3.1
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_select varchar(255) not null default 'userid'";
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD order_mode enum('ASC', 'DESC') not null default 'DESC'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_select VARCHAR(255) NOT NULL DEFAULT 'userid'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD order_mode ENUM('ASC','DESC') NOT NULL DEFAULT 'DESC'";
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Beworbene URL wird nun getestet.";
@@ -272,9 +271,9 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us
                break;
 
        case "0.4.6": // SQL queries for v0.4.6
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('order', NULL, 'Mailbuchungen', 3, 'Y', 'N')";
-               $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, sort, visible, locked) VALUES ('order', 'order2', 'Framekiller-Mails', 2, 'Y', 'N')";
-               $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET action='order', sort='1', title='Klick-Mails' WHERE what='order' LIMIT 1";
+               $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('order',NULL,'Mailbuchungen',3,'Y','N')";
+               $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('order','order2','Framekiller-Mails',2,'Y','N')";
+               $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='order', sort='1', title='Klick-Mails' WHERE what='order' LIMIT 1";
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Mitgliedsmen&uuml; komplett umgebaut.";
@@ -286,40 +285,47 @@ nicht die vom Mitglied eingegebene. Resultat: Das Script beschwerte sich, der Us
                break;
 
        case "0.4.8": // SQL queries for v0.4.8
-               $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET title='Mailbuchung' WHERE action='setup' AND what='config_order' LIMIT 1";
+               $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET title='Mailbuchung' WHERE what='config_order' LIMIT 1";
 
                // Update notes (these will be set as task text!)
                $UPDATE_NOTES = "Men&uuml;punkt &quot;Mailbuchungsseite&quot; nach &quot;Mailbuchung&quot; umbenannt und weitere Einstellungen aus Sonstige Einstellungen verschoben.";
                break;
 
        case "0.4.9": // SQL queries for v0.4.9
-               $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD repay_deleted_mails ENUM('REPAY', 'JACKPOT', 'SHRED') not null default 'REPAY'";
+               $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD repay_deleted_mails ENUM('REPAY','JACKPOT','SHRED') NOT NULL DEFAULT 'REPAY'";
 
                // Update notes (these will be set as task text!)
-               $UPDATE_NOTES = "Bei L&ouml;schung von Mailbuchungen kann nun global entschieden werden (Einstellungen also), ob die verbliebenen ".POINTS." wieder gutgeschrieben werden sollen oder in den Jackpot landen.";
+               $UPDATE_NOTES = "Bei L&ouml;schung von Mailbuchungen kann nun global entschieden werden (Einstellungen also), ob die verbliebenen {!POINTS!} wieder gutgeschrieben werden sollen oder in den Jackpot landen.";
                break;
 
+       case "0.5.0": // SQL queries for v0.5.0
+               $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_url_blacklist`";
+               $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_url_blacklist` (
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`url` VARCHAR(255) NOT NULL DEFAULT '',
+`pool_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`),
+INDEX (`pool_id`)
+) TYPE=MYISAM COMMENT='URL blacklist'";
+
+               // Update notes (these will be set as task text!)
+               $UPDATE_NOTES = "Tabelle f&uuml;r URL-Sperrliste angelegt.";
+               break;
        }
        break;
 
-default: // Do stuff when extension is loaded
-       $dummy = LOAD_CONFIG();
-       $_CONFIG = array_merge($_CONFIG, $dummy);
-       unset($dummy);
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+       break;
 
+default: // Do stuff when extension is loaded
        // Do daily reset only when installed and extension version is at least 0.1.1
-       if ((defined('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1"))
-       {
+       if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1")) {
                // Reset mail order values
-               $result_ext = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
-       }
+               $result_ext = SQL_QUERY("UPDATE `"._MYSQL_PREFIX."_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
+       } // END - if
        break;
 }
-// Language file prefix
-$EXT_LANG_PREFIX = "order";
-
-// Extension is always active?
-$EXT_ALWAYS_ACTIVE = 'N';
 
 //
 ?>