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