X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=0.2.1%2Finc%2Fmodules%2Fadmin%2Fwhat-theme_import.php;h=aeda0eed62e0a06d16384982ef3b6536a465cc3e;hb=50646cc7b05cf5ff93e9b1e36ab03047cc0cd6bf;hp=6479641cf33600a579efba7ee9a2eebb47a8bfa6;hpb=4696b799ced069ba2a264fa3b38fc033e3dc31dc;p=mailer.git diff --git a/0.2.1/inc/modules/admin/what-theme_import.php b/0.2.1/inc/modules/admin/what-theme_import.php index 6479641cf3..aeda0eed62 100644 --- a/0.2.1/inc/modules/admin/what-theme_import.php +++ b/0.2.1/inc/modules/admin/what-theme_import.php @@ -1,177 +1,177 @@ -"); -} - -// 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 = "".ADMIN_THEME_ALREADY_INSTALLED.""; - } - else - { - // Theme not installed - $FOUND = "
- - -
"; - } - - // Add row - $OUT .= " - ".$unix." - ".$THEMES['theme_name'][$key]." - - ".$THEMES['theme_author'][$key]." - - - ".$THEMES['theme_url'][$key]." - - v".$THEMES['theme_ver'][$key]." - - ".$FOUND." - -\n"; - $SW = 3 - $SW; -} -if (empty($OUT)) -{ - // No themes found??? - $OUT .= " - - ".LOAD_TEMPLATE("admin_settings_saved", true, ADMIN_NO_THEMES_FOUND)." - -\n"; -} -define('__THEME_LIST', $OUT); - -// Load template -LOAD_TEMPLATE("admin_theme_import"); - -// -?> +"); +} + +// 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 = "".ADMIN_THEME_ALREADY_INSTALLED.""; + } + else + { + // Theme not installed + $FOUND = "
+ + +
"; + } + + // Add row + $OUT .= " + ".$unix." + ".$THEMES['theme_name'][$key]." + + ".$THEMES['theme_author'][$key]." + + + ".$THEMES['theme_url'][$key]." + + v".$THEMES['theme_ver'][$key]." + + ".$FOUND." + +\n"; + $SW = 3 - $SW; +} +if (empty($OUT)) +{ + // No themes found??? + $OUT .= " + + ".LOAD_TEMPLATE("admin_settings_saved", true, ADMIN_NO_THEMES_FOUND)." + +\n"; +} +define('__THEME_LIST', $OUT); + +// Load template +LOAD_TEMPLATE("admin_theme_import"); + +// +?>