]> git.mxchange.org Git - mailer.git/blobdiff - inc/extensions/ext-surfbar.php
AJAX installation is 'basicly finished' :) Plus I threw in a small christmas present...
[mailer.git] / inc / extensions / ext-surfbar.php
index f3e8a896b83b3967ba336c144c318bb7bade3e20..84394b9cf001bfbac93008d9ccf4937993ab8a5c 100644 (file)
@@ -6,9 +6,9 @@
  * -------------------------------------------------------------------- *
  * File              : ext-surfbar.php                                  *
  * -------------------------------------------------------------------- *
- * Short description : A surfbar for your members                       *
+ * Short description : A visitor add-on for your members                *
  * -------------------------------------------------------------------- *
- * Kurzbeschreibung  : Eine Surfbar fuer Ihre Mitglieder                *
+ * Kurzbeschreibung  : Ein Besuchertausch fuer Ihre Mitglieder          *
  * -------------------------------------------------------------------- *
  * $Revision::                                                        $ *
  * $Date::                                                            $ *
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -47,54 +47,69 @@ setThisExtensionVersion('0.0.0');
 setExtensionVersionHistory(array('0.0.0'));
 
 // This extension is in development (non-productive)
-enableExtensionProductive(false);
+enableExtensionProductive(FALSE);
 
 switch (getExtensionMode()) {
        case 'register': // Do stuff when installation is running
                // SQL commands to run (surfbar URLs)
                addDropTableSql('surfbar_urls');
                addCreateTableSql('surfbar_urls', "
-`url_id` BIGINT(20) UNSIGNED  NOT NULL AUTO_INCREMENT,
-`url_userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
+`url_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`url_userid` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
+`url_package_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
 `url` VARCHAR(255) NOT NULL DEFAULT '',
 `url_last_salt` VARCHAR(255) NOT NULL DEFAULT '',
-`url_views_total` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
-`url_views_max` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
-`url_views_allowed` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
-`url_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NOT NULL DEFAULT 'PENDING',
+`url_views_total` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`url_views_max` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`url_views_allowed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`url_status` ENUM('PENDING', 'ACTIVE', 'LOCKED', 'STOPPED', 'REJECTED', 'DELETED', 'MIGRATED', 'DEPLETED') NOT NULL DEFAULT 'PENDING',
 `url_registered` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 `url_last_locked` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
 `url_lock_reason` VARCHAR(255) NOT NULL DEFAULT '',
 `url_reject_reason` VARCHAR(255) NOT NULL DEFAULT '',
 `url_fixed_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`url_fixed_waiting` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 PRIMARY KEY (`url_id`),
-UNIQUE KEY `userid_url` (`url_userid`,`url`),
-INDEX `status_userid` (`url_status`,`url_userid`)",
-                       'Surfbar URLs');
+UNIQUE INDEX `userid_url` (`url_userid`, `url`),
+INDEX `status_userid` (`url_status`, `url_userid`),
+INDEX (`url_package_id`)",
+                       'Visitor add-on URLs');
+
+               // Booking packages for members
+               addDropTableSql('surfbar_packages');
+               addCreateTableSql('surfbar_packages', "
+`package_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`package_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`package_waiting` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`package_points_costs` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+`package_points_reward` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
+PRIMARY KEY (`package_id`),
+UNIQUE INDEX `package` (`package_reload`, `package_waiting`)",
+                       'Booking packages');
 
                // Reload locks
                addDropTableSql('surfbar_locks');
                addCreateTableSql('surfbar_locks', "
 `locks_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-`locks_userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
-`locks_url_id` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
+`locks_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`locks_url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `locks_last_surfed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY (`locks_id`),
-UNIQUE KEY `userid_url` (`locks_userid`,`locks_url_id`),
+UNIQUE INDEX `userid_url` (`locks_userid`, `locks_url_id`),
 INDEX (`locks_url_id`)",
-                       'Surfbar reload locks');
+                       'Vistor-addon reload locks');
 
-               // Surfbar salts
+               // Visitor add-on salts
                addDropTableSql('surfbar_salts');
                addCreateTableSql('surfbar_salts', "
 `salts_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-`salts_userid` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
-`salts_url_id` BIGINT(20) UNSIGNED  NOT NULL DEFAULT 0,
+`salts_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
+`salts_url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `salts_last_salt` VARCHAR(255) NOT NULL DEFAULT '',
 PRIMARY KEY (`salts_id`),
-UNIQUE KEY `salts_userid_url` (`salts_userid`,`salts_url_id`),
+UNIQUE INDEX `salts_userid_url` (`salts_userid`, `salts_url_id`),
 INDEX (`salts_url_id`)",
-                       'Surfbar last used salts');
+                       'Visitor add-on last used salts');
 
                // Statistics
                addDropTableSql('surfbar_stats');
@@ -105,48 +120,48 @@ INDEX (`salts_url_id`)",
 `stats_count` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
 `stats_last_surfed` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY (`stats_id`),
-UNIQUE KEY `userid_url` (`stats_userid`,`stats_url_id`),
+UNIQUE INDEX `userid_url` (`stats_userid`, `stats_url_id`),
 INDEX (`stats_url_id`)",
-                       'Surfbar Statistics');
+                       'Visitor add-on Statistics');
 
                // Member actions pending on status
                addDropTableSql('surfbar_actions');
                addCreateTableSql('surfbar_actions', "
 `actions_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-`actions_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NULL DEFAULT NULL,
-`actions_action` ENUM('EDIT','DELETE','PAUSE','UNPAUSE','FRAMETEST','RETREAT','RESUBMIT','BOOKNOW') NULL DEFAULT NULL,
-`actions_new_status` ENUM('PENDING','ACTIVE','LOCKED','STOPPED','REJECTED','DELETED','MIGRATED','DEPLETED') NULL DEFAULT NULL,
+`actions_status` ENUM('PENDING', 'ACTIVE', 'LOCKED', 'STOPPED', 'REJECTED', 'DELETED', 'MIGRATED', 'DEPLETED') NULL DEFAULT NULL,
+`actions_action` ENUM('EDIT', 'DELETE', 'PAUSE', 'UNPAUSE', 'FRAMETEST', 'RETREAT', 'RESUBMIT', 'BOOKNOW') NULL DEFAULT NULL,
+`actions_new_status` ENUM('PENDING', 'ACTIVE', 'LOCKED', 'STOPPED', 'REJECTED', 'DELETED', 'MIGRATED', 'DEPLETED') NULL DEFAULT NULL,
 PRIMARY KEY (`actions_id`),
-UNIQUE KEY `status_action` (`actions_status`,`actions_action`)",
-                       'Surfbar Member Actions');
+UNIQUE INDEX `status_action` (`actions_status`, `actions_action`)",
+                       'Visitor add-on Member Actions');
 
                // Member actions
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('PENDING','RETREAT','DELETED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('PENDING','FRAMETEST',NULL)");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('PENDING','EDIT',NULL)");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('ACTIVE','EDIT','PENDING')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('ACTIVE','DELETE','DELETED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('ACTIVE','PAUSE','STOPPED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('ACTIVE','FRAMETEST',NULL)");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('LOCKED','DELETE','DELETED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('LOCKED','FRAMETEST',NULL)");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('LOCKED','RESUBMIT','PENDING')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('STOPPED','EDIT','PENDING')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('STOPPED','DELETE','DELETED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('STOPPED','UNPAUSE','PENDING')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('DEPLETED','EDIT','PENDING')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('DEPLETED','DELETE','DELETED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('REJECTED','EDIT','PENDING')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('REJECTED','DELETE','DELETED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('REJECTED','FRAMETEST',NULL)");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('REJECTED','RESUBMIT','PENDING')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','EDIT','MIGRATED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','DELETE','DELETED')");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','FRAMETEST',NULL)");
-               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`,`actions_action`,`actions_new_status`) VALUES ('MIGRATED','BOOKNOW','PENDING')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('PENDING', 'RETREAT', 'DELETED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('PENDING', 'FRAMETEST',NULL)");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('PENDING', 'EDIT',NULL)");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('ACTIVE', 'EDIT', 'PENDING')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('ACTIVE', 'DELETE', 'DELETED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('ACTIVE', 'PAUSE', 'STOPPED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('ACTIVE', 'FRAMETEST',NULL)");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('LOCKED', 'DELETE', 'DELETED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('LOCKED', 'FRAMETEST',NULL)");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('LOCKED', 'RESUBMIT', 'PENDING')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('STOPPED', 'EDIT', 'PENDING')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('STOPPED', 'DELETE', 'DELETED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('STOPPED', 'UNPAUSE', 'PENDING')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('DEPLETED', 'EDIT', 'PENDING')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('DEPLETED', 'DELETE', 'DELETED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('REJECTED', 'EDIT', 'PENDING')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('REJECTED', 'DELETE', 'DELETED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('REJECTED', 'FRAMETEST',NULL)");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('REJECTED', 'RESUBMIT', 'PENDING')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('MIGRATED', 'EDIT', 'MIGRATED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('MIGRATED', 'DELETE', 'DELETED')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('MIGRATED', 'FRAMETEST',NULL)");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('MIGRATED', 'BOOKNOW', 'PENDING')");
 
                // Config entries
-               addConfigAddSql('surfbar_payment_model', "ENUM('STATIC','DYNAMIC') NOT NULL DEFAULT 'STATIC'");
+               addConfigAddSql('surfbar_payment_model', "ENUM('STATIC', 'DYNAMIC') NOT NULL DEFAULT 'STATIC'");
                addConfigAddSql('surfbar_static_reward', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.25000');
                addConfigAddSql('surfbar_static_costs', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000');
                addConfigAddSql('surfbar_static_time', 'SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60');
@@ -154,8 +169,8 @@ UNIQUE KEY `status_action` (`actions_status`,`actions_action`)",
                addConfigAddSql('surfbar_dynamic_percent', 'FLOAT(10,5) UNSIGNED NOT NULL DEFAULT 10.00000');
                addConfigAddSql('surfbar_max_order', 'INT(7) UNSIGNED NOT NULL DEFAULT 10');
                addConfigAddSql('surfbar_restart_time', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (60 * 6));
-               addConfigAddSql('surfbar_autostart', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
-               addConfigAddSql('surfbar_migrate_urls', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+               addConfigAddSql('surfbar_auto_start', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
+               addConfigAddSql('surfbar_migrate_urls', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
                addConfigAddSql('surfbar_total_counter', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
                addConfigAddSql('surfbar_daily_counter', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
                addConfigAddSql('surfbar_yester_counter', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
@@ -164,41 +179,45 @@ UNIQUE KEY `status_action` (`actions_status`,`actions_action`)",
                addConfigAddSql('surfbar_stats_reload', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 30');
                addConfigAddSql('surfbar_purge_deleted', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 7));
                addConfigAddSql('surfbar_purge_migrated', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 3));
-               addConfigAddSql('surfbar_pause_mode', "ENUM('INTERNAL','EXERNAL') NOT NULL DEFAULT 'INTERNAL'");
+               addConfigAddSql('surfbar_pause_mode', "ENUM('INTERNAL', 'EXERNAL') NOT NULL DEFAULT 'INTERNAL'");
                addConfigAddSql('surfbar_pause_url', "VARCHAR(255) NOT NULL DEFAULT ''");
-               addConfigAddSql('surfbar_notify_limits', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
-               addConfigAddSql('surfbar_notify_admin_unlock', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+               addConfigAddSql('surfbar_notify_limits', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
+               addConfigAddSql('surfbar_notify_admin_unlock', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
                addConfigAddSql('surfbar_warn_low_points', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 100');
                addConfigAddSql('surfbar_low_interval', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT {?ONE_DAY?}');
-               addConfigAddSql('surfbar_migrate_order', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
-               addConfigAddSql('surfbar_notification_mode', "ENUM('INSTANT','RESET') NOT NULL DEFAULT 'INSTANT'");
-               addConfigAddSql('surfbar_guest_login_form', "ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+               addConfigAddSql('surfbar_migrate_order', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
+               addConfigAddSql('surfbar_notification_mode', "ENUM('INSTANT', 'RESET') NOT NULL DEFAULT 'INSTANT'");
+               addConfigAddSql('surfbar_guest_login_form', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
 
                // Extend user data
-               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `surfbar_low_notified` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'");
+               addExtensionAddTableColumnSql('user_data', 'surfbar_low_notified', "TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'");
 
                // Member menus
-               addMemberMenuSql('surfbar', NULL, 'Surfbar', 4);
-               addMemberMenuSql('surfbar', 'start_surfbar', 'Surfbar starten', 1);
+               addMemberMenuSql('surfbar', NULL, 'Besuchertausch', 4);
+               addMemberMenuSql('surfbar', 'start_surfbar', 'Besuchertausch starten', 1);
                addMemberMenuSql('surfbar', 'book_surfbar', 'Seite buchen', 2);
                addMemberMenuSql('surfbar', 'list_surfbar', 'Seiten-Management', 3);
                addMemberMenuSql('surfbar', 'stats_surfbar', 'Seiten-Statistik', 4);
 
                // Admin menus
-               addAdminMenuSql('surfbar', NULL, 'Surfbar', 'URLs in der Surfbar verwalten, Einstellungen ändern und vieles mehr.', 7);
-               addAdminMenuSql('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);
-               addAdminMenuSql('surfbar', 'list_surfbar_urls', 'URLs verwalten', 'Verwalten Sie hier alle in der Surfbar befindlichen URLs mit nur wenigen Klicks.', 2);
-               addAdminMenuSql('surfbar', 'unlock_surfbar_urls', 'Wartende URLs freigeben', 'Geben Sie hier nur direkt in der Surfbar gebuchte URLs frei.', 3);
-               addAdminMenuSql('surfbar', 'config_surfbar', 'Einstellungen', 'Einstellungen an der Surfbar &auml;ndern, wie Festverg&uuml;tung, prozentuale Ref-Verg&uuml;tung und vieles mehr.', 4);
-               addAdminMenuSql('surfbar', 'surfbar_stats', 'Statistiken', 'Detailierte Statistiken zu einer ausgew&auml;hlten URL anzeigen.', 5);
-               addAdminMenuSql('surfbar', 'list_surfbar_actions', 'Mitgliederaktionen', 'Listet alle Mitgliederaktionen auf.', 6);
+               addAdminMenuSql('surfbar', NULL, 'Besuchertausch', 'URLs im Besuchertausch verwalten, Einstellungen &auml;ndern und vieles mehr.', 7);
+               addAdminMenuSql('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 im Besuchertausch einzuf&uuml;gen.', 1);
+               addAdminMenuSql('surfbar', 'list_surfbar_urls', 'URLs verwalten', 'Verwalten Sie hier alle im Besuchertausch befindlichen URLs mit nur wenigen Klicks.', 2);
+               addAdminMenuSql('surfbar', 'unlock_surfbar_urls', 'Wartende URLs freigeben', 'Geben Sie hier f&uuml;r den Besuchertausch gebuchte URLs frei.', 3);
+               addAdminMenuSql('surfbar', 'list_surfbar_packages', 'Buchungspakete verwalten', '&quot;Buchungspakete&quot; erlauben dem Mitglied nur von Ihnen definierte Reloadzeiten und Mindestauffenthalte.', 4);
+               addAdminMenuSql('surfbar', 'config_surfbar', 'Einstellungen', 'Einstellungen am Besuchertausch &auml;ndern, wie Festverg&uuml;tung, prozentuale Ref-Verg&uuml;tung und vieles mehr.', 5);
+               addAdminMenuSql('surfbar', 'surfbar_stats', 'Statistiken', 'Detailierte Statistiken zu einer ausgew&auml;hlten URL anzeigen.', 6);
+               addAdminMenuSql('surfbar', 'list_surfbar_actions', 'Mitglieder-Aktionen', 'Listet alle Mitglieder-Aktionen auf.', 7);
 
                // Register module
-               addModuleSql('surfbar', 'Y', 'Y', 'N', 'N');
+               addModuleSql('surfbar', '{OPEN_TEMPLATE}MODULE_SURFBAR_TITLE{CLOSE_TEMPLATE}', 'Y', 'Y', 'N', 'N');
+
+               // Insert data for points accounts
+               registerExtensionPointsData('monthly_surfbar', 'points', 'LOCKED', 'DIRECT');
 
                // Register filters
-               registerFilter('post_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_STATUS', false, true, isExtensionDryRun());
-               registerFilter('pre_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_VALIDATE_DATA', false, true, isExtensionDryRun());
+               registerFilter(__FILE__, __LINE__, 'post_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_STATUS', FALSE, TRUE, isExtensionDryRun());
+               registerFilter(__FILE__, __LINE__, 'pre_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_VALIDATE_DATA', FALSE, TRUE, isExtensionDryRun());
                break;
 
        case 'remove': // Do stuff when removing extension
@@ -207,6 +226,7 @@ UNIQUE KEY `status_action` (`actions_status`,`actions_action`)",
                addDropTableSql('surfbar_locks');
                addDropTableSql('surfbar_salts');
                addDropTableSql('surfbar_stats');
+               addDropTableSql('surfbar_packages');
                addDropTableSql('surfbar_urls');
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='surfbar'");
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='surfbar'");
@@ -214,20 +234,23 @@ UNIQUE KEY `status_action` (`actions_status`,`actions_action`)",
                // Unregister module
                addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='surfbar' LIMIT 1");
 
+               // Unregister points data
+               unregisterExtensionPointsData('monthly_surfbar');
+
                // Unregister filter
-               unregisterFilter(__FUNCTION__, __LINE__, 'post_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_STATUS', true, isExtensionDryRun());
-               unregisterFilter(__FUNCTION__, __LINE__, 'pre_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_VALIDATE_DATA', true, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'post_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_STATUS', TRUE, isExtensionDryRun());
+               unregisterFilter(__FILE__, __LINE__, 'pre_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_VALIDATE_DATA', TRUE, isExtensionDryRun());
                break;
 
        case 'activate': // Do stuff when admin activates this extension
                // SQL commands to run
-               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y', `locked`='N' WHERE `action`='surfbar' LIMIT 5");
-               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N', `hidden`='N', `admin_only`='N', `mem_only`='Y' WHERE `module`='surfbar' LIMIT 1");
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='Y',`locked`='N' WHERE `action`='surfbar' LIMIT 5");
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='N',`hidden`='N',`admin_only`='N',`mem_only`='Y' WHERE `module`='surfbar' LIMIT 1");
                break;
 
        case 'deactivate': // Do stuff when admin deactivates this extension
                // SQL commands to run
-               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N', `locked`='Y' WHERE `action` = 'surfbar' LIMIT 5");
+               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='N',`locked`='Y' WHERE `action` = 'surfbar' LIMIT 5");
                addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_mod_reg` SET `locked`='Y' WHERE `module`='surfbar' LIMIT 1");
                break;