2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 02/26/2005 *
\r
4 * ================ Last change: 02/26/2005 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : ext-newsletter.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Extension for sending newsletters *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Erweiterung zum Versenden von Newslettern *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
\r
42 $EXT_VERSION = "0.1.2";
\r
44 // Auto-set extension version
\r
45 if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
\r
47 // Version history array (add more with , "0.1" and so on)
\r
48 $EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2");
\r
50 switch ($EXT_LOAD_MODE)
\r
52 case "register": // Do stuff when installtion is running (modules.php?module=admin&action=login is called)
\r
53 // SQL commands to run
\r
57 case "remove": // Do stuff when removing extension
\r
58 // SQL commands to run
\r
59 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE action='newsletter' AND what != 'send_newsletter' LIMIT 3";
\r
60 $SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='newsletter' LIMIT 1";
\r
63 case "activate": // Do stuff when admin activates this extension
\r
64 // SQL commands to run
\r
65 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET locked='N', visible='Y' WHERE what='newsletter' LIMIT 1";
\r
68 case "deactivate": // Do stuff when admin deactivates this extension
\r
69 // SQL commands to run
\r
70 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET locked='Y', visible='N' WHERE what='newsletter' LIMIT 1";
\r
73 case "update": // Update an extension
\r
76 case "0.0.1": // SQL queries for v0.0.1
\r
77 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('newsletter', '', 'Newsletter', 'Einstellungen am Newsletter, Newsletter versenden, Abbestellungen auflisten usw.', 3)";
\r
78 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('newsletter', 'list_newsletter', 'Abbestellungen', 'Alle Abbestellungen auflisten und bearbeiten.', 2)";
\r
79 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) VALUES ('newsletter', 'config_newsletter', 'Einstellungen', 'Gebühr zum Abbestellen des Newsletters usw. sind hier einstellbar.', 3)";
\r
80 $SQLs[] = "UPDATE "._MYSQL_PREFIX."_admin_menu SET action='newsletter', what='send_newsletter', title='Versenden', sort='1' WHERE what='newsletter' LIMIT 1";
\r
81 $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (action, what, title, visible, locked, sort) VALUES ('main', 'newsletter', 'Newsletter-Empfang', 'N', 'Y', 10)";
\r
82 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD nl_charge float(10,2) not null default '5.00'";
\r
83 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD nl_receive enum('Y', 'N') not null default 'Y'";
\r
84 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD nl_until varchar(10) not null default '0'";
\r
85 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_user_data ADD nl_timespan varchar(10) not null default '0'";
\r
87 // Update notes (these will be set as task text!)
\r
88 $UPDATE_NOTES = "Vor der eigentlichen Freigabe dieser Erweiterungen habe ich sie versehendlich im Archiv mit auf den Server hochgeladen. Diese Version fügt die bereits angekündigte Funktionalitäten, wie zum Beispiel das Einstellen der Abschaltgebühr.";
\r
91 case "0.0.2": // SQL queries for v0.0.2
\r
92 // Update notes (these will be set as task text!)
\r
93 $UPDATE_NOTES = "URL im Versendeformular und Option <I>Immer aktiv</I> für diese Erweiterung deaktiviert.";
\r
96 case "0.0.3": // SQL queries for v0.0.3
\r
97 // Update notes (these will be set as task text!)
\r
98 $UPDATE_NOTES = "Wörter <STRONG>Mailtausch</STRONG>, <STRONG>Mailtausches</STRONG> und <STRONG>Mailtauscher</STRONG> sind austauschbar.";
\r
101 case "0.0.4": // SQL queries for v0.0.4
\r
102 // Update notes (these will be set as task text!)
\r
103 $UPDATE_NOTES = "HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert.";
\r
106 case "0.0.5": // SQL queries for v0.0.5
\r
107 // Update notes (these will be set as task text!)
\r
108 $UPDATE_NOTES = "Abspeichern von Einstellungen repariert.";
\r
111 case "0.0.6": // SQL queries for v0.0.6
\r
112 // Update notes (these will be set as task text!)
\r
113 $UPDATE_NOTES = "Bitte Script inc/monthly_newsletter.php löschen!";
\r
116 case "0.0.7": // SQL queries for v0.0.7
\r
117 // Update notes (these will be set as task text!)
\r
118 $UPDATE_NOTES = "Script <STRONG>inc/monthly/monthly_newsletter.php</STRONG> wird nicht mehr ausgeführt, wenn die Erweiterung nicht aktiviert ist.";
\r
121 case "0.0.8": // SQL queries for v0.0.8
\r
122 // Update notes (these will be set as task text!)
\r
123 $UPDATE_NOTES = "Sicherheitsupdate für die Include-Befehle.";
\r
126 case "0.0.9": // SQL queries for v0.0.9
\r
127 // Update notes (these will be set as task text!)
\r
128 $UPDATE_NOTES = "Nur bei installierter Erweiterung <STRONG>html_mail</STRONG> können Sie auch HTML-Mails versenden.";
\r
131 case "0.1.0": // SQL queries for v0.1.0
\r
132 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD nl_month char(2) not null default '".date("m", time())."'";
\r
134 // Update notes (these will be set as task text!)
\r
135 $UPDATE_NOTES = "Nur bei installierter Erweiterung <STRONG>html_mail</STRONG> können Sie auch HTML-Mails versenden.";
\r
138 case "0.1.1": // SQL queries for v0.1.1
\r
139 $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config DROP nl_currency";
\r
141 // Update notes (these will be set as task text!)
\r
142 $UPDATE_NOTES = "Währung auf die Erweiterung <A href=\"".SERVER_URL."/extensions/ext-other.zip\"><STRONG>ext-other.zip</STRONG></A> verlagert. Bitte auch diese aktualisieren.";
\r
145 case "0.1.2": // SQL queries for v0.1.2
\r
146 // Update notes (these will be set as task text!)
\r
147 $UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
\r
152 default: // Do stuff when extension is loaded
\r
153 $DUMMY = LOAD_CONFIG("0");
\r
154 $CONFIG['nl_charge'] = $DUMMY['nl_charge']; // Charge for your members to switch off the newsletter
\r
155 $CONFIG['nl_month'] = $DUMMY['nl_month']; // Last month of check interval
\r
158 // URL ends which are used to indentify the end of an URL or email link
\r
159 // Don't use these chars in links... ;-)
\r
168 // Valid email chars (without @, or do you want to have another @ inside your email addy?)
\r
169 $VALID_EMAIL_CHARS = array(
\r
170 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
\r
171 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
\r
172 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '-', '.', '_', '0', '1',
\r
173 '2', '3', '4', '5', '6', '7', '8', '9'
\r
176 if (defined('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1))
\r
178 // Daily reset was run so let's check out for expired newsletter orders
\r
179 $INC_POOL[] = PATH."inc/monthly/monthly_newsletter.php";
\r
184 // Language file prefix
\r
185 $EXT_LANG_PREFIX = "newsletter";
\r
187 // Extension is always active?
\r
188 $EXT_ALWAYS_ACTIVE = "N";
\r