Skip to content

Commit

Permalink
Inserted check if file is saved in UTF-8 format
Browse files Browse the repository at this point in the history
  • Loading branch information
hertsch committed Jun 20, 2012
1 parent ea5dbd6 commit 5e9f26f
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 46 deletions.
52 changes: 29 additions & 23 deletions languages/DE.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,39 @@

/**
* multipleEducated
*
* @author Ralf Hertsch (ralf.hertsch@phpmanufaktur.de)
*
* @author Ralf Hertsch <ralf.hertsch@phpmanufaktur.de>
* @link http://phpmanufaktur.de
* @copyright 2011
* @license GNU GPL (http://www.gnu.org/licenses/gpl.html)
* @version $Id$
*
* FOR VERSION- AND RELEASE NOTES PLEASE LOOK AT INFO.TXT!
* @copyright 2009 - 2012
* @license MIT License (MIT) http://www.opensource.org/licenses/MIT
*/

// try to include LEPTON class.secure.php to protect this file and the whole CMS!
if (defined('WB_PATH')) {
if (defined('LEPTON_VERSION')) include(WB_PATH.'/framework/class.secure.php');
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].'/framework/class.secure.php')) {
include($_SERVER['DOCUMENT_ROOT'].'/framework/class.secure.php');
} else {
$subs = explode('/', dirname($_SERVER['SCRIPT_NAME'])); $dir = $_SERVER['DOCUMENT_ROOT'];
$inc = false;
foreach ($subs as $sub) {
if (empty($sub)) continue; $dir .= '/'.$sub;
if (file_exists($dir.'/framework/class.secure.php')) {
include($dir.'/framework/class.secure.php'); $inc = true; break;
}
}
if (!$inc) trigger_error(sprintf("[ <b>%s</b> ] Can't include LEPTON class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
// include class.secure.php to protect this file and the whole CMS!
if (defined('WB_PATH')) {
if (defined('LEPTON_VERSION'))
include(WB_PATH.'/framework/class.secure.php');
}
else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
}
else {
trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
}
// end include class.secure.php

if ('á' != "\xc3\xa1") {
// important: language files must be saved as UTF-8 (without BOM)
trigger_error('The language file <b>'.basename(__FILE__).'</b> is damaged, it must be saved <b>UTF-8</b> encoded!', E_USER_ERROR);
}
// end include LEPTON class.secure.php

// module description for WebsiteBaker backend information
$module_description = 'multipleEducatd - Frage- und Antwortspiele im Stil der "Bildungshappen" (ZEIT) erstellen und verwalten';
Expand Down
52 changes: 29 additions & 23 deletions languages/EN.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,39 @@

/**
* multipleEducated
*
* @author Ralf Hertsch (ralf.hertsch@phpmanufaktur.de)
*
* @author Ralf Hertsch <ralf.hertsch@phpmanufaktur.de>
* @link http://phpmanufaktur.de
* @copyright 2011
* @license GNU GPL (http://www.gnu.org/licenses/gpl.html)
* @version $Id$
*
* FOR VERSION- AND RELEASE NOTES PLEASE LOOK AT INFO.TXT!
* @copyright 2009 - 2012
* @license MIT License (MIT) http://www.opensource.org/licenses/MIT
*/

// try to include LEPTON class.secure.php to protect this file and the whole CMS!
if (defined('WB_PATH')) {
if (defined('LEPTON_VERSION')) include(WB_PATH.'/framework/class.secure.php');
} elseif (file_exists($_SERVER['DOCUMENT_ROOT'].'/framework/class.secure.php')) {
include($_SERVER['DOCUMENT_ROOT'].'/framework/class.secure.php');
} else {
$subs = explode('/', dirname($_SERVER['SCRIPT_NAME'])); $dir = $_SERVER['DOCUMENT_ROOT'];
$inc = false;
foreach ($subs as $sub) {
if (empty($sub)) continue; $dir .= '/'.$sub;
if (file_exists($dir.'/framework/class.secure.php')) {
include($dir.'/framework/class.secure.php'); $inc = true; break;
}
}
if (!$inc) trigger_error(sprintf("[ <b>%s</b> ] Can't include LEPTON class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
// include class.secure.php to protect this file and the whole CMS!
if (defined('WB_PATH')) {
if (defined('LEPTON_VERSION'))
include(WB_PATH.'/framework/class.secure.php');
}
else {
$oneback = "../";
$root = $oneback;
$level = 1;
while (($level < 10) && (!file_exists($root.'/framework/class.secure.php'))) {
$root .= $oneback;
$level += 1;
}
if (file_exists($root.'/framework/class.secure.php')) {
include($root.'/framework/class.secure.php');
}
else {
trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR);
}
}
// end include class.secure.php

if ('á' != "\xc3\xa1") {
// important: language files must be saved as UTF-8 (without BOM)
trigger_error('The language file <b>'.basename(__FILE__).'</b> is damaged, it must be saved <b>UTF-8</b> encoded!', E_USER_ERROR);
}
// end include LEPTON class.secure.php

// module description for WebsiteBaker backend information
$module_description = 'multipleEducatd - create and organize quizzes like "Bildungshappen" (ZEIT) for WebsiteBaker';
Expand Down

0 comments on commit 5e9f26f

Please sign in to comment.