X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-theme_import.php;h=cde282ba93e120f8cdd01ba672319ccc6b6de8db;hb=ab92fb7241d00636b0eb940f147449758820cba1;hp=d075327bfec9d4ec9a051f00afbc4add61b7ed84;hpb=dbe56bb043ba16ca1ec1e9efa9effdc1f0612261;p=mailer.git
diff --git a/inc/modules/admin/what-theme_import.php b/inc/modules/admin/what-theme_import.php
index d075327bfe..cde282ba93 100644
--- a/inc/modules/admin/what-theme_import.php
+++ b/inc/modules/admin/what-theme_import.php
@@ -32,13 +32,16 @@
************************************************************************/
// Some security stuff...
-if ((!defined('__SECURITY')) || (!is_admin())) {
+if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
require($INC);
+} elseif (!EXT_IS_ACTIVE("theme")) {
+ addFatalMessage(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "theme"));
+ return;
}
// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+ADD_DESCR("admin", __FILE__);
// Switch to testing mode
$THEME_MODE = "test";
@@ -48,13 +51,13 @@ if (!empty($_POST['theme'])) {
// Check if theme is there
if (!THEME_CHECK_EXIST($_POST['theme'])) {
// Import theme
- $file = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme']));
- if (FILE_READABLE($file)) {
+ $INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($_POST['theme']));
+ if (FILE_READABLE($INC)) {
// Load the theme header file
- include($file);
+ LOAD_INC($INC);
// Register it ith the exchange
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_themes (theme_path, theme_active, theme_ver, theme_name)
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_themes` (`theme_path`, `theme_active`, `theme_ver`, `theme_name`)
VALUES ('%s','N','%s','%s')",
array($_POST['theme'], $THEME_VERSION, $THEME_NAME), __FILE__, __LINE__);
@@ -74,7 +77,6 @@ VALUES ('%s','N','%s','%s')",
// Output message
LOAD_TEMPLATE("admin_settings_saved", false, $msg);
- OUTPUT_HTML("
");
} // END - if
// Initialize array
@@ -91,12 +93,12 @@ $THEMES = array(
$handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!");
while ($dir = readdir($handle)) {
// Construct absolute theme.php file name
- $theme = sprintf("%stheme/%s/theme.php", PATH, $dir);
+ $INC = sprintf("theme/%s/theme.php", $dir);
// Test it...
- if (($dir != ".") && ($dir != "..") && (FILE_READABLE($theme))) {
+ if (($dir != ".") && ($dir != "..") && (FILE_READABLE($INC))) {
// Found a valid directory so let's load it's theme.php file
- include($theme);
+ LOAD_INC($INC);
// Add found theme to array
$THEMES['theme_unix'][] = $dir;
@@ -120,30 +122,30 @@ foreach ($THEMES['theme_unix'] as $key => $unix) {
// Check if current theme is already imported or not
if (THEME_CHECK_EXIST($unix)) {
// Already installed
- $FOUND = "".ADMIN_THEME_ALREADY_INSTALLED."";
+ $FOUND = "