X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fextensions%2Fext-rewrite.php;h=886f74997e26dd5fa72d41c553253fb0dd1e32a6;hb=4b0380051488bb228d151a36e059f257e2a50a69;hp=e3b6c75f4dd44870feacac5ab55f356b3e8158a1;hpb=3b85bd5030ad591b0c5cb038ca534a7b50e1b319;p=mailer.git diff --git a/inc/extensions/ext-rewrite.php b/inc/extensions/ext-rewrite.php index e3b6c75f4d..886f74997e 100644 --- a/inc/extensions/ext-rewrite.php +++ b/inc/extensions/ext-rewrite.php @@ -10,9 +10,14 @@ * -------------------------------------------------------------------- * * Kurzbeschreibung : Schreibt eigene Links um fuer Suchmaschinen * * -------------------------------------------------------------------- * - * * + * $Revision:: $ * + * $Date:: $ * + * $Tag:: 0.2.1-FINAL $ * + * $Author:: $ * + * Needs to be in all Files and every File needs "svn propset * + * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * - * Copyright (c) 2003 - 2008 by Roland Haeder * + * Copyright (c) 2003 - 2009 by Roland Haeder * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -33,140 +38,144 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; - require($INC); + die(); } // Version number -$EXT_VERSION = "0.1.3"; - -// Auto-set extension version -if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION; - -// Version history array (add more with , "0.1" and so on) -$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", "0.1.3"); - -switch ($EXT_LOAD_MODE) -{ -case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called) - // Check if mod_rewrite is loadeded - if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){ - $EXT_REPORTS_FAILURE = true; - ADD_FATAL(MOD_REWRITE_ERROR); - } // END - if - - // SQL commands to run - $SQLs[] = ""; - break; - -case "remove": // Do stuff when removing extension - // SQL commands to run - $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_rewrite' LIMIT 1"; - break; - -case "activate": // Do stuff when admin activates this extension - // Check if mod_rewrite is loadeded - if (!IF_APACHE_MODULE_LOADED('mod_rewrite')) { - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='N' WHERE ext_name='rewrite' LIMIT 1", array(), __FILE__, __LINE__); - $EXT_REPORTS_FAILURE = true; - ADD_FATAL(MOD_REWRITE_ERROR); - } // END - if - - // SQL commands to run - $SQLs[] = ""; - break; - -case "deactivate": // Do stuff when admin deactivates this extension - // SQL commands to run - $SQLs[] = ""; - break; - -case "update": // Update an extension - switch ($EXT_VER) - { - case "0.0.1": // SQL queries for v0.0.1 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Folgende Linkvariablen werden nun auch ausgetauscht: bid, mid, url, page, offset"; - break; +setThisExtensionVersion('0.1.3'); - case "0.0.2": // SQL queries for v0.0.2 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Folgende Linkvariablen werden nun auch ausgetauscht: type, do=search"; +// Version history array (add more with , '0.1.0' and so on) +setExtensionVersionHistory(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', '0.1.3')); - case "0.0.3": // SQL queries for v0.0.3 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "URLs zu MXChange.org (".SERVER_URL.") sind nun auch wieder gültig."; - break; - - case "0.0.4": // SQL queries for v0.0.4 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Folgende Linkvariablen werden nun auch ausgetausch: sub, home"; - break; +// This extension is deprecated! +// Only since 'seo' is ready! setExtensionDeprecated('Y'); - case "0.0.5": // SQL queries for v0.0.5 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Links im Admin- und Mitgliedsbereich werden nicht mehr umgeschrieben. Entsprechend fällt die neue .htaccess-Datei kleiner aus. Bitte anpassen!"; +switch (getExtensionMode()) { + case 'register': // Do stuff when installation is running (modules.php?module=admin is called) + // Check if mod_rewrite is loadeded + if (!isApacheModuleLoaded('mod_rewrite')) { + setExtensionReportsFailure(true); + addFatalMessage(__FILE__, __LINE__, getMessage('MOD_REWRITE_ERROR')); + } // END - if - case "0.0.6": // SQL queries for v0.0.6 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Links im Frametester-Modul werden nicht mehr umgeschrieben."; + // SQL commands to run + addExtensionSql(''); break; - case "0.0.7": // SQL queries for v0.0.7 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist."; + case 'remove': // Do stuff when removing extension + // SQL commands to run + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what`='config_rewrite'"); break; - case "0.0.8": // SQL queries for v0.0.8 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist."; - break; + case 'activate': // Do stuff when admin activates this extension + // Check if mod_rewrite is loadeded + if (!isApacheModuleLoaded('mod_rewrite')) { + SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__); + setExtensionReportsFailure(true); + addFatalMessage(__FILE__, __LINE__, getMessage('MOD_REWRITE_ERROR')); + } // END - if - case "0.0.9": // SQL queries for v0.0.9 - $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD rewrite_skip VARCHAR(255) NOT NULL DEFAULT 'login:admin:frametester:mailid'"; - $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_rewrite','Rewrite-Engine','Stellen Sie hier ein, welche Module übersprungen werden sollen, in denen also kein Umschreiben des HTML-Codes stattfinden soll.', 8)"; + // SQL commands to run + addExtensionSql(''); + break; - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Zu überspringende Module können per Admin-Bereich eingestellt werden."; + case 'deactivate': // Do stuff when admin deactivates this extension + // SQL commands to run + addExtensionSql(''); break; - case "0.1.0": // SQL queries for v0.2.1 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Wörter Mailtausch, Mailtausches und Mailtauscher sind austauschbar."; + case 'update': // Update an extension + switch (getCurrentExtensionVersion()) { + case '0.0.1': // SQL queries for v0.0.1 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Folgende Linkvariablen werden nun auch ausgetauscht: bid, mid, url, page, offset"); + break; + + case '0.0.2': // SQL queries for v0.0.2 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Folgende Linkvariablen werden nun auch ausgetauscht: type, do=search"); + + case '0.0.3': // SQL queries for v0.0.3 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("URLs zu MXChange.org ({?SERVER_URL?}) sind nun auch wieder gültig."); + break; + + case '0.0.4': // SQL queries for v0.0.4 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Folgende Linkvariablen werden nun auch ausgetausch: sub, home"); + break; + + case '0.0.5': // SQL queries for v0.0.5 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Links im Admin- und Mitgliedsbereich werden nicht mehr umgeschrieben. Entsprechend fällt die neue .htaccess-Datei kleiner aus. Bitte anpassen!"); + + case '0.0.6': // SQL queries for v0.0.6 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Links im Frametester-Modul werden nicht mehr umgeschrieben."); + break; + + case '0.0.7': // SQL queries for v0.0.7 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist."); + break; + + case '0.0.8': // SQL queries for v0.0.8 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Fehler beseitigt, wenn error_reporting=E_ALL gesetzt ist."); + break; + + case '0.0.9': // SQL queries for v0.0.9 + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_config` ADD rewrite_skip VARCHAR(255) NOT NULL DEFAULT 'login:admin:frametester:mailid'"); + addAdminMenuSql('setup','config_rewrite','Rewrite-Engine','Stellen Sie hier ein, welche Module übersprungen werden sollen, in denen also kein Umschreiben des HTML-Codes stattfinden soll.', 8); + + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Zu überspringende Module können per Admin-Bereich eingestellt werden."); + break; + + case '0.1.0': // SQL queries for v0.2.1 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Wörter Mailtausch, Mailtausches und Mailtauscher sind austauschbar."); + break; + + case '0.1.1': // SQL queries for v0.1.1 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert."); + break; + + case '0.1.2': // SQL queries for v0.1.2 + // Update notes (these will be set as task text!) + setExtensionUpdateNotes("Abspeichern von Einstellungen repariert."); + break; + case '0.1.3': + // Check if mod_rewrite is loadeded + if (!isApacheModuleLoaded('mod_rewrite')) { + setExtensionReportsFailure(true); + //addFatalMessage(__FILE__, __LINE__, getMessage('MOD_REWRITE_ERROR')); + } // END - if + setExtensionUpdateNotes("Es wird beim Registrieren und aktivieren geprüft, ob im Apache das Modul mod_rewrite geladen wurde. Wenn mod_rewrite nicht gefunden werden konnte, wird abgebrochen."); + break; + } break; - case "0.1.1": // SQL queries for v0.1.1 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "HTML-Code ausgelagert in Templates und SQL-Anweisungen abgesichert."; + case 'modify': // When the extension got modified break; - case "0.1.2": // SQL queries for v0.1.2 - // Update notes (these will be set as task text!) - $UPDATE_NOTES = "Abspeichern von Einstellungen repariert."; + case 'test': // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. break; - case "0.1.3": + + case 'init': // Do stuff when extension is initialized // Check if mod_rewrite is loadeded - if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){ - $EXT_REPORTS_FAILURE = true; - //ADD_FATAL(MOD_REWRITE_ERROR); + if (!isApacheModuleLoaded('mod_rewrite')) { + setExtensionReportsFailure(true); + SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_active`='N' WHERE `ext_name`='rewrite' LIMIT 1", __FILE__, __LINE__); + if (!isAdmin()) addFatalMessage(__FILE__, __LINE__, getMessage('MOD_REWRITE_ERROR')); } // END - if - $UPDATE_NOTES = "Es wird beim Registrieren und aktivieren geprüft, ob im Apache das Modul mod_rewrite geladen wurde. Wenn mod_rewrite nicht gefunden werden konnte, wird abgebrochen."; break; - } - break; - -case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305. - break; - -default: // Do stuff when extension is loaded - // Check if mod_rewrite is loadeded - if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){ - $EXT_REPORTS_FAILURE = true; - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_active='N' WHERE ext_name='rewrite' LIMIT 1", array(), __FILE__, __LINE__); - if (!IS_ADMIN())ADD_FATAL(MOD_REWRITE_ERROR); - } // END - if - break; + + default: // Unknown extension mode + DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown extension mode %s detected.", getExtensionMode())); + break; } -// +// [EOF] ?>