Default times reduced in surfbar
[mailer.git] / inc / extensions / ext-surfbar.php
index fccd16b36b0a963cc61ded315529094cf29116fe..661dca0ea0f84573e3a4f880635794002e3e0ae7 100644 (file)
@@ -52,11 +52,14 @@ case "register": // Do stuff when installtion is running (modules.php?module=adm
        // SQL commands to run (surfbar URLs)
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_urls`";
        $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_urls` (
-`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
-`userid` BIGINT(20) NOT NULL DEFAULT '0',
+`id` BIGINT(20) UNSIGNED  NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT '0',
 `url` VARCHAR(255) NOT NULL DEFAULT '',
-`reward` double(20,5) NOT NULL DEFAULT '0.00000',
-`views_total` BIGINT(20) NOT NULL DEFAULT '0',
+`last_salt` VARCHAR( 255 ) NOT NULL DEFAULT '',
+`reward` FLOAT(10,5) UNSIGNED  NOT NULL DEFAULT '0.00000',
+`costs` FLOAT(10,5) UNSIGNED  NOT NULL DEFAULT '0.00000',
+`payment_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
+`views_total` BIGINT(20) UNSIGNED  NOT NULL DEFAULT '0',
 `status` ENUM('PENDING','CONFIRMED', 'LOCKED') NOT NULL DEFAULT 'CONFIRMED',
 `registered` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 `last_locked` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
@@ -69,20 +72,32 @@ UNIQUE KEY `userid_url` (`userid`, `url`)
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`";
        $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_locks` (
 `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
-`userid` BIGINT(20) NOT NULL DEFAULT '0',
-`url_id` BIGINT(20) NOT NULL DEFAULT '0',
+`userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT '0',
+`url_id` BIGINT(20) UNSIGNED  NOT NULL DEFAULT '0',
 `last_surfed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY(`id`),
-INDEX(`userid`),
-INDEX(`url_id`)
+INDEX (`userid`),
+INDEX (`url_id`)
 ) TYPE=MyISAM COMMENT='Surfbar reload locks'";
 
+       // Surfbar salts
+       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_salts`";
+       $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_salts` (
+`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT '0',
+`url_id` BIGINT(20) UNSIGNED  NOT NULL DEFAULT '0',
+`last_salt` VARCHAR(255) NOT NULL DEFAULT '',
+PRIMARY KEY(`id`),
+INDEX (`userid`),
+INDEX (`url_id`)
+) TYPE=MyISAM COMMENT='Surfbar last used salts'";
+
        // Reload locks
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_reflevels`";
        $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_reflevels` (
 `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
-`level` SMALLINT(6) NOT NULL DEFAULT '0',
-`percent` FLOAT(10,5) NOT NULL DEFAULT '0.00000',
+`level` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0',
+`percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT '0.00000',
 PRIMARY KEY(`id`)
 ) TYPE=MyISAM COMMENT='Surfbar referal levels'";
 
@@ -91,9 +106,14 @@ PRIMARY KEY(`id`)
 
        // Config entries
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_pay_model` ENUM('STATIC','DYNAMIC') NOT NULL DEFAULT 'STATIC'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_reward` FLOAT(20,5) NOT NULL DEFAULT '0.25000'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_time` SMALLINT(6) NOT NULL DEFAULT '60'";
-       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_lock` SMALLINT(6) NOT NULL DEFAULT '".(60*60)."'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_reward` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT '0.25000'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_costs` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT '1.00000'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_time` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '60'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_static_lock` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '".(60*5)."'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_notify_admin_unlock` ENUM('N','Y') NOT NULL DEFAULT 'N'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_dynamic_percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT '10.00000'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_max_order` INT(7) UNSIGNED NOT NULL DEFAULT '10'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_restart_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(60*6)."'";
 
        // Member menus
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar',NULL,'Surfbar','Y','Y',5)";
@@ -106,6 +126,9 @@ PRIMARY KEY(`id`)
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','unlock_surfbar_urls','Wartende URLs freigeben','Geben Sie hier nur direkt in der Surfbar gebuchte URLs frei.',2)";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','list_surfbar_reflvl','Referal-Ebenen einstellen','Stellen Sie hier die prozentuale Vergütung für Refs ein. Es wird nur die Basisvergütung zur Rechengrundlage der Referalvergütung verwendet.',3)";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','config_surfbar','Einstellungen','Einstellungen an der Surfbar ändern, wie Festvergütung, prozentuale Ref-Vergütung und vieles mehr.',4)";
+
+       // Load CSS?
+       $EXT_CSS = "Y";
        break;
 
 case "remove": // Do stuff when removing extension
@@ -113,6 +136,7 @@ case "remove": // Do stuff when removing extension
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_urls`";
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`";
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_reflevels`";
+       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_salts`";
        $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `action`='surfbar' LIMIT 3";
        $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='surfbar' LIMIT 5";
        break;
@@ -141,7 +165,7 @@ case "update": // Update an extension
 
 default: // Do stuff when extension is loaded
        $dummy = LOAD_CONFIG();
-       $_CONFIG = array_merge($_CONFIG, $dummy);
+       $_CONFIG = merge_array($_CONFIG, $dummy);
        unset($dummy);
        break;
 }