2 /************************************************************************
3 * MXChange v0.2.1 Start: 03/22/2004 *
4 * ================ Last change: 12/13/2004 *
6 * -------------------------------------------------------------------- *
7 * File : what-extentions.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Extension management *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Erweiterungen-Management *
12 * -------------------------------------------------------------------- *
14 * -------------------------------------------------------------------- *
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
16 * For more information visit: http://www.mxchange.org *
18 * This program is free software; you can redistribute it and/or modify *
19 * it under the terms of the GNU General Public License as published by *
20 * the Free Software Foundation; either version 2 of the License, or *
21 * (at your option) any later version. *
23 * This program is distributed in the hope that it will be useful, *
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
26 * GNU General Public License for more details. *
28 * You should have received a copy of the GNU General Public License *
29 * along with this program; if not, write to the Free Software *
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
32 ************************************************************************/
34 // Some security stuff...
35 if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
36 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
40 // Add description as navigation point
41 ADD_DESCR("admin", __FILE__);
43 global $cacheInstance, $cacheArray, $cacheMode;
45 // Normally we want the overview of all registered theme_check
49 // Get response from our server
50 $response = GET_URL("check-themes.php");
52 // Are theme_check found?
53 if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]"))
55 // Ok, mark found and create the array
57 'fname' => array(), // File names
58 'fsize' => array(), // File size
59 'fctime' => array(), // File creation timestamp
60 'infos' => array(), // File informations (maybe loaded!)
61 'ver' => array(), // Version number
62 'cver' => array(), // Current version number
65 // Get count of theme_check for validation
66 $count = trim($response[sizeof($response) - 2]);
67 foreach ($response as $idx => $value) {
68 $value = str_replace("\n", "", $value); $ver = "";
70 // Leave loop when data is invalid or EOF?
71 if ((substr($value, 0, 6) == "theme-") && (substr($value, -4) == ".zip")) {
72 $name = substr($value, 6, -4);
73 $file = sprintf("%sthemes/%s/theme.php", PATH, $name);
74 $ver = trim(substr($response[$idx + 3], 4));
77 $cver = THEME_GET_VERSION($name);
79 // Is the extension already installed or not?
80 if (((SQL_NUMROWS($result) == 0) && (!FILE_READABLE($file))) || ($ver != $cver)) {
81 // No, it isn't. So let's add this one!
82 $THEMES['fname'][] = $name;
83 $THEMES['fsize'][] = $response[$idx + 1];
84 $THEMES['fctime'][] = $response[$idx + 2];
85 $THEMES['ver'][] = $ver;
86 $THEMES['cver'][] = $cver;
88 $LANG_DUMMY = explode("[nl]", $response[$idx + 4]);
90 $INFO = ADMIN_EXT_NO_INFO_FOUND;
92 // Trim every data line
93 foreach ($LANG_DUMMY as $k => $v) {
95 if (substr($v, 3) == "") $v = "---";
97 if ($v == "xx:xx") break;
101 // If language is found stop searching on matching line
102 foreach($LANG as $search) {
103 if (substr($search, 0, 3) == (GET_LANGUAGE().":")) { $INFO = substr($search, 3); break; }
106 // Add informations to array
107 $THEMES['infos'][] = $INFO;
112 // Ok, themes are on our server but maybe you have already installed them?
113 if (sizeof($THEMES['fname']) > 0) {
114 // Sort array (I missed ver and cver here)
115 array_pk_sort($THEMES, array("cver", "fname"), 0, 1);
117 // Extensions where found which are not downloaded and installed
118 $SW = 2; $OUT = ""; $TSIZE = 0;
119 foreach ($THEMES['fname'] as $idx => $name) {
120 // Generate download link
121 $LINK = SERVER_URL."/themes/theme-".$name.".zip";
123 <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".($idx + 1).".</TD>
124 <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\"><A href=\"".$LINK."\">".$name."</A></TD>
125 <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".MAKE_DATETIME($THEMES['fctime'][$idx], "2")."</TD>
126 <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".TRANSLATE_COMMA(round($THEMES['fsize'][$idx] / 1.024) / 1000)." ".KBYTES."</TD>
127 <TD align=\"center\" class=\"switch_sw".$SW." bottom2\">".$THEMES['ver'][$idx]." (".$THEMES['cver'][$idx].")</TD>
130 <TD class=\"switch_sw".$SW." bottom2\"> </TD>
131 <TD colspan=\"4\" class=\"switch_sw".$SW." bottom2\">
132 <FONT class=\"tiny\">".$THEMES['infos'][$idx]."</FONT>
135 $TSIZE += $THEMES['fsize'][$idx];
138 define('__THEMES_ROWS', $OUT);
139 define('__TKBYTES_VALUE', TRANSLATE_COMMA(round($TSIZE / 1.024) / 1000));
140 define('__TTHEME_VALUE', sizeof($THEMES['fname']));
143 LOAD_TEMPLATE("admin_theme_list");
145 // All Themes are downloaded and installed
146 LOAD_TEMPLATE("admin_theme_installed", false, $count);
149 // No theme where found
150 LOAD_TEMPLATE("admin_theme_404");