- Major change in menu system. You need to rewrite/update your member and guest
[mailer.git] / inc / extensions / ext-surfbar.php
index 862fd1459857498425afddbd6657483ce724df30..6151ba4a98004075a7772ce54a134dc7ec7b5307 100644 (file)
@@ -12,7 +12,7 @@
  * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003, 2004, 2005, 2006, 2007 by Roland Haeder          *
+ * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -58,7 +58,6 @@ case "register": // Do stuff when installtion is running (modules.php?module=adm
 `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,
@@ -71,7 +70,7 @@ UNIQUE KEY `userid_url` (`userid`, `url`)
        // Reload locks
        $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_locks`";
        $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_locks` (
-`id` BIGINT(20) NOT NULL AUTO_INCREMENT,
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
 `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,
@@ -83,7 +82,7 @@ INDEX (`url_id`)
        // 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,
+`id` BIGINT(20) UNSIGNED 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 '',
@@ -92,40 +91,48 @@ 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) UNSIGNED NOT NULL DEFAULT '0',
-`percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT '0.00000',
-PRIMARY KEY(`id`)
-) TYPE=MyISAM COMMENT='Surfbar referal levels'";
-
-       // Add default referal level 0 with 100%
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_surfbar_reflevels` (`level`, `percent`) VALUES (0, 100)";
+       // Statistics
+       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_stats`";
+       $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_surfbar_stats` (
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`count` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`last_online` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`id`),
+INDEX (`userid`,`url_id`)
+) TYPE=MyISAM COMMENT='Surfbar Statistics'";
 
        // 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) 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)."'";
+       $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_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)."";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_autostart` ENUM('Y','N') NOT NULL DEFAULT 'Y'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_total_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_daily_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_yester_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_weekly_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_monthly_counter` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_stats_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 30";
 
        // Member menus
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar',NULL,'Surfbar','Y','Y',5)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar',NULL,'Surfbar','Y','Y',4)";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_start','Surfbar starten','Y','Y',1)";
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_book','Surfbar buchen','Y','Y',2)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_book','URL buchen','Y','Y',2)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar','surfbar_stats','URL-Statistiken','Y','Y',3)";
 
        // Admin menus
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','','Surfbar','URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.',7)";
-       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','list_surfbar_urls','URLs verwalten','Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.',1)";
-       $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',NULL,'Surfbar','URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.',7)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','add_surfbar_url','URL hinzuf&uuml;gen','F&uuml;gen Sie URLs z.B. von Werbenetzwerken hinzu, oder Ihre eigenen Projekte. <strong>Vorsicht!</strong> Ihnen muss es auch gestattet sein, URLs aus dem Werbenetzwerk in die Surfbar einzuf&uuml;gen.',1)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','list_surfbar_urls','URLs verwalten','Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.',2)";
+       $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.',3)";
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','config_surfbar','Einstellungen','Einstellungen an der Surfbar &auml;ndern, wie Festverg&uuml;tung, prozentuale Ref-Verg&uuml;tung und vieles mehr.',4)";
+       $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('surfbar','surfbar_stats','Statistiken','Detailierte Statistiken zu einer ausgew&auml;hlten URL anzeigen.',5)";
 
        // Load CSS?
        $EXT_CSS = "Y";
@@ -135,10 +142,10 @@ case "remove": // Do stuff when removing extension
        // SQL commands to run
        $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";
+       $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_surfbar_stats`";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE `action`='surfbar' LIMIT 4";
+       $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='surfbar' LIMIT 6";
        break;
 
 case "activate": // Do stuff when admin activates this extension