-<?php\r
-/************************************************************************\r
- * MXChange v0.2.1 Start: 02/12/2004 *\r
- * ================ Last change: 11/12/2004 *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * File : what-theme_import.php *\r
- * -------------------------------------------------------------------- *\r
- * Short description : Import of new themes *\r
- * -------------------------------------------------------------------- *\r
- * Kurzbeschreibung : Importieren von neuen Themes *\r
- * -------------------------------------------------------------------- *\r
- * *\r
- * -------------------------------------------------------------------- *\r
- * Copyright (c) 2003 - 2008 by Roland Haeder *\r
- * For more information visit: http://www.mxchange.org *\r
- * *\r
- * This program is free software; you can redistribute it and/or modify *\r
- * it under the terms of the GNU General Public License as published by *\r
- * the Free Software Foundation; either version 2 of the License, or *\r
- * (at your option) any later version. *\r
- * *\r
- * This program is distributed in the hope that it will be useful, *\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\r
- * GNU General Public License for more details. *\r
- * *\r
- * You should have received a copy of the GNU General Public License *\r
- * along with this program; if not, write to the Free Software *\r
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *\r
- * MA 02110-1301 USA *\r
- ************************************************************************/\r
-\r
-// Some security stuff...\r
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))\r
-{\r
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
- require($INC);\r
-}\r
-\r
-// Add description as navigation point\r
-ADD_DESCR("admin", basename(__FILE__));\r
-\r
-// Switch to testing mode\r
-$THEME_MODE = "test";\r
-\r
-// Import selected theme if not present\r
-if (!empty($_POST['theme']))\r
-{\r
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",\r
- array($_POST['theme']), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result) == 0)\r
- {\r
- // Import theme\r
- $file = PATH."theme/".$_POST['theme']."/theme.php";\r
- if (file_exists($file))\r
- {\r
- include($file);\r
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_themes (theme_path, theme_active, theme_ver)\r
-VALUES ('%s', 'N', '%s')",\r
- array($_POST['theme'], $THEME_VERSION), __FILE__, __LINE__);\r
- $msg = ADMIN_THEME_IMPORTED_1.$_POST['theme'].ADMIN_THEME_IMPORTED_2;\r
- }\r
- else\r
- {\r
- // Include file not found!\r
- $msg = ADMIN_THEME_INC_404_1.$_POST['theme'].ADMIN_THEME_INC_404_2;\r
- }\r
- }\r
- else\r
- {\r
- // Free memory\r
- SQL_FREERESULT($result);\r
-\r
- // Theme already imported\r
- $msg = ADMIN_THEME_ALREADY_1.$_POST['theme'].ADMIN_THEME_ALREADY_2;\r
- }\r
-\r
- // Output message\r
- LOAD_TEMPLATE("admin_settings_saved", false, $msg);\r
- OUTPUT_HTML ("<BR>");\r
-}\r
-\r
-// Initialize array\r
-$THEMES = array(\r
- 'theme_unix' => array(), // Unix name from filesystem\r
- 'theme_name' => array(), // Title\r
- 'theme_author' => array(), // Theme author's name\r
- 'theme_email' => array(), // Author's email address\r
- 'theme_url' => array(), // URL were you can download it from\r
- 'theme_ver' => array(), // Version number of theme\r
-);\r
-\r
-// Read directory "themes"\r
-$handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!");\r
-while ($dir = readdir($handle))\r
-{\r
- // Construct absolute theme.php file name\r
- $theme = PATH."theme/".$dir."/"."theme.php";\r
-\r
- // Test it...\r
- if (($dir != ".") && ($dir != "..") && (file_exists($theme)))\r
- {\r
- // Found a valid directory so let's load it's theme.php file\r
- include($theme);\r
-\r
- // Add found theme to array\r
- $THEMES['theme_unix'][] = $dir;\r
- $THEMES['theme_name'][] = $THEME_NAME;\r
- $THEMES['theme_author'][] = $THEME_AUTHOR;\r
- $THEMES['theme_email'][] = $THEME_EMAIL;\r
- $THEMES['theme_url'][] = $THEME_URL;\r
- $THEMES['theme_ver'][] = $THEME_VERSION;\r
- }\r
-}\r
-closedir($handle);\r
-\r
-// Sort array by Uni* name\r
-array_pk_sort($THEMES, array("theme_name"));\r
-\r
-// Generate output lines for the template\r
-$OUT = ""; $SW = 2;\r
-foreach ($THEMES['theme_unix'] as $key=>$unix)\r
-{\r
- // Check if current theme is already imported or not\r
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",\r
- array($unix), __FILE__, __LINE__);\r
- if (SQL_NUMROWS($result) == 1)\r
- {\r
- // Free memory\r
- SQL_FREERESULT($result);\r
-\r
- // Already installed\r
- $FOUND = "<FONT class=\"admin_note\">".ADMIN_THEME_ALREADY_INSTALLED."</FONT>";\r
- }\r
- else\r
- {\r
- // Theme not installed\r
- $FOUND = "<FORM action=\"".URL."/modules.php?module=admin&what=theme_import\" method=\"POST\">\r
- <INPUT type=\"submit\" name=\"ok\" class=\"admin_submit\" value=\"".ADMIN_INSTALL_THEME."\">\r
- <INPUT type=\"hidden\" name=\"theme\" value=\"".$unix."\">\r
-</FORM>";\r
- }\r
-\r
- // Add row\r
- $OUT .= "<TR>\r
- <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\" height=\"30\">".$unix."</TD>\r
- <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">".$THEMES['theme_name'][$key]."</TD>\r
- <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">\r
- <A href=\"mailto:".$THEMES['theme_email'][$key]."?Subject=[Theme:] ".$THEMES['theme_name'][$key]." (".$unix.")"."\">".$THEMES['theme_author'][$key]."</A>\r
- </TD>\r
- <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">\r
- <A href=\"".DEREFERER($THEMES['theme_url'][$key])."\" target=\"_blank\">".$THEMES['theme_url'][$key]."</A>\r
- </TD>\r
- <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">v".$THEMES['theme_ver'][$key]."</TD>\r
- <TD class=\"switch_sw".$SW." bottom2\" align=\"center\">\r
- ".$FOUND."\r
- </TD>\r
-</TR>\n";\r
- $SW = 3 - $SW;\r
-}\r
-if (empty($OUT))\r
-{\r
- // No themes found???\r
- $OUT .= "<TR>\r
- <TD colspan=\"6\" class=\"bottom2\" height=\"80\">\r
- ".LOAD_TEMPLATE("admin_settings_saved", true, ADMIN_NO_THEMES_FOUND)."\r
- </TD>\r
-</TR>\n";\r
-}\r
-define('__THEME_LIST', $OUT);\r
-\r
-// Load template\r
-LOAD_TEMPLATE("admin_theme_import");\r
-\r
-//\r
-?>\r
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 02/12/2004 *
+ * ================ Last change: 11/12/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : what-theme_import.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Import of new themes *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Importieren von neuen Themes *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!is_admin()))
+{
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ require($INC);
+}
+
+// Add description as navigation point
+ADD_DESCR("admin", basename(__FILE__));
+
+// Switch to testing mode
+$THEME_MODE = "test";
+
+// Import selected theme if not present
+if (!empty($_POST['theme']))
+{
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
+ array($_POST['theme']), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 0)
+ {
+ // Import theme
+ $file = PATH."theme/".$_POST['theme']."/theme.php";
+ if (file_exists($file))
+ {
+ include($file);
+ $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_themes (theme_path, theme_active, theme_ver)
+VALUES ('%s', 'N', '%s')",
+ array($_POST['theme'], $THEME_VERSION), __FILE__, __LINE__);
+ $msg = ADMIN_THEME_IMPORTED_1.$_POST['theme'].ADMIN_THEME_IMPORTED_2;
+ }
+ else
+ {
+ // Include file not found!
+ $msg = ADMIN_THEME_INC_404_1.$_POST['theme'].ADMIN_THEME_INC_404_2;
+ }
+ }
+ else
+ {
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Theme already imported
+ $msg = ADMIN_THEME_ALREADY_1.$_POST['theme'].ADMIN_THEME_ALREADY_2;
+ }
+
+ // Output message
+ LOAD_TEMPLATE("admin_settings_saved", false, $msg);
+ OUTPUT_HTML ("<BR>");
+}
+
+// Initialize array
+$THEMES = array(
+ 'theme_unix' => array(), // Unix name from filesystem
+ 'theme_name' => array(), // Title
+ 'theme_author' => array(), // Theme author's name
+ 'theme_email' => array(), // Author's email address
+ 'theme_url' => array(), // URL were you can download it from
+ 'theme_ver' => array(), // Version number of theme
+);
+
+// Read directory "themes"
+$handle = opendir(PATH."theme/") or mxchange_die("Cannot read themes dir!");
+while ($dir = readdir($handle))
+{
+ // Construct absolute theme.php file name
+ $theme = PATH."theme/".$dir."/"."theme.php";
+
+ // Test it...
+ if (($dir != ".") && ($dir != "..") && (file_exists($theme)))
+ {
+ // Found a valid directory so let's load it's theme.php file
+ include($theme);
+
+ // Add found theme to array
+ $THEMES['theme_unix'][] = $dir;
+ $THEMES['theme_name'][] = $THEME_NAME;
+ $THEMES['theme_author'][] = $THEME_AUTHOR;
+ $THEMES['theme_email'][] = $THEME_EMAIL;
+ $THEMES['theme_url'][] = $THEME_URL;
+ $THEMES['theme_ver'][] = $THEME_VERSION;
+ }
+}
+closedir($handle);
+
+// Sort array by Uni* name
+array_pk_sort($THEMES, array("theme_name"));
+
+// Generate output lines for the template
+$OUT = ""; $SW = 2;
+foreach ($THEMES['theme_unix'] as $key=>$unix)
+{
+ // Check if current theme is already imported or not
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
+ array($unix), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1)
+ {
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Already installed
+ $FOUND = "<FONT class=\"admin_note\">".ADMIN_THEME_ALREADY_INSTALLED."</FONT>";
+ }
+ else
+ {
+ // Theme not installed
+ $FOUND = "<FORM action=\"".URL."/modules.php?module=admin&what=theme_import\" method=\"POST\">
+ <INPUT type=\"submit\" name=\"ok\" class=\"admin_submit\" value=\"".ADMIN_INSTALL_THEME."\">
+ <INPUT type=\"hidden\" name=\"theme\" value=\"".$unix."\">
+</FORM>";
+ }
+
+ // Add row
+ $OUT .= "<TR>
+ <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\" height=\"30\">".$unix."</TD>
+ <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">".$THEMES['theme_name'][$key]."</TD>
+ <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">
+ <A href=\"mailto:".$THEMES['theme_email'][$key]."?Subject=[Theme:] ".$THEMES['theme_name'][$key]." (".$unix.")"."\">".$THEMES['theme_author'][$key]."</A>
+ </TD>
+ <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">
+ <A href=\"".DEREFERER($THEMES['theme_url'][$key])."\" target=\"_blank\">".$THEMES['theme_url'][$key]."</A>
+ </TD>
+ <TD class=\"switch_sw".$SW." bottom2 right2\" align=\"center\">v".$THEMES['theme_ver'][$key]."</TD>
+ <TD class=\"switch_sw".$SW." bottom2\" align=\"center\">
+ ".$FOUND."
+ </TD>
+</TR>\n";
+ $SW = 3 - $SW;
+}
+if (empty($OUT))
+{
+ // No themes found???
+ $OUT .= "<TR>
+ <TD colspan=\"6\" class=\"bottom2\" height=\"80\">
+ ".LOAD_TEMPLATE("admin_settings_saved", true, ADMIN_NO_THEMES_FOUND)."
+ </TD>
+</TR>\n";
+}
+define('__THEME_LIST', $OUT);
+
+// Load template
+LOAD_TEMPLATE("admin_theme_import");
+
+//
+?>