]> git.mxchange.org Git - mailer.git/blob - inc/extensions/surfbar/mode-setup.php
25493cc0816aeb7d85eeec8521b8c37f872d938e
[mailer.git] / inc / extensions / surfbar / mode-setup.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 06/25/2013 *
4  * ===================                          Last change: 06/25/2013 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : mode-setup.php                                   *
8  * -------------------------------------------------------------------- *
9  * Short description : A visitor add-on for your members                *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Ein Besuchertausch fuer Ihre Mitglieder          *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // @TODO Remove double tabs from all lines
44                 // SQL commands to run (surfbar URLs)
45                 addDropTableSql('surfbar_urls');
46                 addCreateTableSql('surfbar_urls', "
47 `url_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
48 `url_userid` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
49 `url_package_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL,
50 `url` VARCHAR(255) NOT NULL DEFAULT '',
51 `url_last_salt` VARCHAR(255) NOT NULL DEFAULT '',
52 `url_views_total` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
53 `url_views_max` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
54 `url_views_allowed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
55 `url_status` ENUM('PENDING', 'ACTIVE', 'LOCKED', 'STOPPED', 'REJECTED', 'DELETED', 'MIGRATED', 'DEPLETED') NOT NULL DEFAULT 'PENDING',
56 `url_registered` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
57 `url_last_locked` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
58 `url_lock_reason` VARCHAR(255) NOT NULL DEFAULT '',
59 `url_reject_reason` VARCHAR(255) NOT NULL DEFAULT '',
60 `url_fixed_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
61 `url_fixed_waiting` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
62 PRIMARY KEY (`url_id`),
63 UNIQUE INDEX `userid_url` (`url_userid`, `url`),
64 INDEX `status_userid` (`url_status`, `url_userid`),
65 INDEX (`url_package_id`)",
66                         'Visitor add-on URLs');
67
68                 // Booking packages for members
69                 addDropTableSql('surfbar_packages');
70                 addCreateTableSql('surfbar_packages', "
71 `package_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
72 `package_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
73 `package_waiting` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
74 `package_points_costs` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
75 `package_points_reward` FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.00000,
76 PRIMARY KEY (`package_id`),
77 UNIQUE INDEX `package` (`package_reload`, `package_waiting`)",
78                         'Booking packages');
79
80                 // Reload locks
81                 addDropTableSql('surfbar_locks');
82                 addCreateTableSql('surfbar_locks', "
83 `locks_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
84 `locks_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
85 `locks_url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
86 `locks_last_surfed` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
87 PRIMARY KEY (`locks_id`),
88 UNIQUE INDEX `userid_url` (`locks_userid`, `locks_url_id`),
89 INDEX (`locks_url_id`)",
90                         'Vistor-addon reload locks');
91
92                 // Visitor add-on salts
93                 addDropTableSql('surfbar_salts');
94                 addCreateTableSql('surfbar_salts', "
95 `salts_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
96 `salts_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
97 `salts_url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
98 `salts_last_salt` VARCHAR(255) NOT NULL DEFAULT '',
99 PRIMARY KEY (`salts_id`),
100 UNIQUE INDEX `salts_userid_url` (`salts_userid`, `salts_url_id`),
101 INDEX (`salts_url_id`)",
102                         'Visitor add-on last used salts');
103
104                 // Statistics
105                 addDropTableSql('surfbar_stats');
106                 addCreateTableSql('surfbar_stats', "
107 `stats_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
108 `stats_userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
109 `stats_url_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
110 `stats_count` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
111 `stats_last_surfed` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
112 PRIMARY KEY (`stats_id`),
113 UNIQUE INDEX `userid_url` (`stats_userid`, `stats_url_id`),
114 INDEX (`stats_url_id`)",
115                         'Visitor add-on Statistics');
116
117                 // Member actions pending on status
118                 addDropTableSql('surfbar_actions');
119                 addCreateTableSql('surfbar_actions', "
120 `actions_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
121 `actions_status` ENUM('PENDING', 'ACTIVE', 'LOCKED', 'STOPPED', 'REJECTED', 'DELETED', 'MIGRATED', 'DEPLETED') NULL DEFAULT NULL,
122 `actions_action` ENUM('EDIT', 'DELETE', 'PAUSE', 'UNPAUSE', 'FRAMETEST', 'RETREAT', 'RESUBMIT', 'BOOKNOW') NULL DEFAULT NULL,
123 `actions_new_status` ENUM('PENDING', 'ACTIVE', 'LOCKED', 'STOPPED', 'REJECTED', 'DELETED', 'MIGRATED', 'DEPLETED') NULL DEFAULT NULL,
124 PRIMARY KEY (`actions_id`),
125 UNIQUE INDEX `status_action` (`actions_status`, `actions_action`)",
126                         'Visitor add-on Member Actions');
127
128                 // Member actions
129                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('PENDING', 'RETREAT', 'DELETED')");
130                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('PENDING', 'FRAMETEST',NULL)");
131                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('PENDING', 'EDIT',NULL)");
132                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('ACTIVE', 'EDIT', 'PENDING')");
133                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('ACTIVE', 'DELETE', 'DELETED')");
134                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('ACTIVE', 'PAUSE', 'STOPPED')");
135                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('ACTIVE', 'FRAMETEST',NULL)");
136                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('LOCKED', 'DELETE', 'DELETED')");
137                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('LOCKED', 'FRAMETEST',NULL)");
138                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('LOCKED', 'RESUBMIT', 'PENDING')");
139                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('STOPPED', 'EDIT', 'PENDING')");
140                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('STOPPED', 'DELETE', 'DELETED')");
141                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('STOPPED', 'UNPAUSE', 'PENDING')");
142                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('DEPLETED', 'EDIT', 'PENDING')");
143                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('DEPLETED', 'DELETE', 'DELETED')");
144                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('REJECTED', 'EDIT', 'PENDING')");
145                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('REJECTED', 'DELETE', 'DELETED')");
146                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('REJECTED', 'FRAMETEST',NULL)");
147                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('REJECTED', 'RESUBMIT', 'PENDING')");
148                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('MIGRATED', 'EDIT', 'MIGRATED')");
149                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('MIGRATED', 'DELETE', 'DELETED')");
150                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('MIGRATED', 'FRAMETEST',NULL)");
151                 addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_surfbar_actions` (`actions_status`, `actions_action`, `actions_new_status`) VALUES ('MIGRATED', 'BOOKNOW', 'PENDING')");
152
153                 // Config entries
154                 addConfigAddSql('surfbar_payment_model', "ENUM('STATIC', 'DYNAMIC') NOT NULL DEFAULT 'STATIC'");
155                 addConfigAddSql('surfbar_static_reward', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 0.25000');
156                 addConfigAddSql('surfbar_static_costs', 'FLOAT(20,5) UNSIGNED NOT NULL DEFAULT 1.00000');
157                 addConfigAddSql('surfbar_static_time', 'SMALLINT(6) UNSIGNED NOT NULL DEFAULT 60');
158                 addConfigAddSql('surfbar_static_lock', 'SMALLINT(6) UNSIGNED NOT NULL DEFAULT ' . (60 * 5));
159                 addConfigAddSql('surfbar_dynamic_percent', 'FLOAT(10,5) UNSIGNED NOT NULL DEFAULT 10.00000');
160                 addConfigAddSql('surfbar_max_order', 'INT(7) UNSIGNED NOT NULL DEFAULT 10');
161                 addConfigAddSql('surfbar_restart_time', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (60 * 6));
162                 addConfigAddSql('surfbar_auto_start', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
163                 addConfigAddSql('surfbar_migrate_urls', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
164                 addConfigAddSql('surfbar_total_counter', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
165                 addConfigAddSql('surfbar_daily_counter', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
166                 addConfigAddSql('surfbar_yester_counter', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
167                 addConfigAddSql('surfbar_weekly_counter', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
168                 addConfigAddSql('surfbar_monthly_counter', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 0');
169                 addConfigAddSql('surfbar_stats_reload', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 30');
170                 addConfigAddSql('surfbar_purge_deleted', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 7));
171                 addConfigAddSql('surfbar_purge_migrated', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT ' . (getOneDay() * 3));
172                 addConfigAddSql('surfbar_pause_mode', "ENUM('INTERNAL', 'EXERNAL') NOT NULL DEFAULT 'INTERNAL'");
173                 addConfigAddSql('surfbar_pause_url', "VARCHAR(255) NOT NULL DEFAULT ''");
174                 addConfigAddSql('surfbar_notify_limits', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
175                 addConfigAddSql('surfbar_notify_admin_unlock', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
176                 addConfigAddSql('surfbar_warn_low_points', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT 100');
177                 addConfigAddSql('surfbar_low_interval', 'BIGINT(20) UNSIGNED NOT NULL DEFAULT {?ONE_DAY?}');
178                 addConfigAddSql('surfbar_migrate_order', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
179                 addConfigAddSql('surfbar_notification_mode', "ENUM('INSTANT', 'RESET') NOT NULL DEFAULT 'INSTANT'");
180                 addConfigAddSql('surfbar_guest_login_form', "ENUM('Y', 'N') NOT NULL DEFAULT 'Y'");
181
182                 // Extend user data
183                 addExtensionAddTableColumnSql('user_data', 'surfbar_low_notified', "TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00'");
184
185                 // Member menus
186                 addMemberMenuSql('surfbar', NULL, 'Besuchertausch', 4);
187                 addMemberMenuSql('surfbar', 'start_surfbar', 'Besuchertausch starten', 1);
188                 addMemberMenuSql('surfbar', 'book_surfbar', 'Seite buchen', 2);
189                 addMemberMenuSql('surfbar', 'list_surfbar', 'Seiten-Management', 3);
190                 addMemberMenuSql('surfbar', 'stats_surfbar', 'Seiten-Statistik', 4);
191
192                 // Admin menus
193                 addAdminMenuSql('surfbar', NULL, 'Besuchertausch', 'URLs im Besuchertausch verwalten, Einstellungen &auml;ndern und vieles mehr.', 7);
194                 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);
195                 addAdminMenuSql('surfbar', 'list_surfbar_urls', 'URLs verwalten', 'Verwalten Sie hier alle im Besuchertausch befindlichen URLs mit nur wenigen Klicks.', 2);
196                 addAdminMenuSql('surfbar', 'unlock_surfbar_urls', 'Wartende URLs freigeben', 'Geben Sie hier f&uuml;r den Besuchertausch gebuchte URLs frei.', 3);
197                 addAdminMenuSql('surfbar', 'list_surfbar_packages', 'Buchungspakete verwalten', '&quot;Buchungspakete&quot; erlauben dem Mitglied nur von Ihnen definierte Reloadzeiten und Mindestauffenthalte.', 4);
198                 addAdminMenuSql('surfbar', 'config_surfbar', 'Einstellungen', 'Einstellungen am Besuchertausch &auml;ndern, wie Festverg&uuml;tung, prozentuale Ref-Verg&uuml;tung und vieles mehr.', 5);
199                 addAdminMenuSql('surfbar', 'surfbar_stats', 'Statistiken', 'Detailierte Statistiken zu einer ausgew&auml;hlten URL anzeigen.', 6);
200                 addAdminMenuSql('surfbar', 'list_surfbar_actions', 'Mitglieder-Aktionen', 'Listet alle Mitglieder-Aktionen auf.', 7);
201
202                 // Register module
203                 addModuleSql('surfbar', '{OPEN_LANGUAGE}MODULE_SURFBAR_TITLE{CLOSE_LANGUAGE}', 'Y', 'Y', 'N', 'N');
204
205                 // Insert data for points accounts
206                 registerExtensionPointsData('monthly_surfbar', 'points', 'LOCKED', 'DIRECT');
207
208                 // Register filters
209                 registerFilter(__FILE__, __LINE__, 'post_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_STATUS', FALSE, TRUE, isExtensionDryRun());
210                 registerFilter(__FILE__, __LINE__, 'pre_change_surfbar_url_status', 'SURFBAR_CHANGE_URL_VALIDATE_DATA', FALSE, TRUE, isExtensionDryRun());
211
212 // [EOF]
213 ?>