2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 03/22/2004 *
\r
4 * ================ Last change: 12/13/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-extentions.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Extension management *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Erweiterungen-Management *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2007 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
\r
40 // Add description as navigation point
\r
41 ADD_DESCR("admin", basename(__FILE__));
\r
43 global $CACHE, $KEEP_ACTIVE, $CACHE_FILE;
\r
45 // Normally we want the overview of all registered theme_check
\r
49 // Get response from our server
\r
50 $response = MXCHANGE_OPEN("check-themes.php");
\r
52 // Are theme_check found?
\r
53 if (($response[sizeof($response) - 1] == "[EOF]") && ($response[0] != "[EOF]"))
\r
55 // Ok, mark found and create the array
\r
57 'fname' => array(), // File names
\r
58 'fsize' => array(), // File size
\r
59 'fctime' => array(), // File creation timestamp
\r
60 'infos' => array(), // File informations (maybe loaded!)
\r
61 'ver' => array(), // Version number
\r
62 'cver' => array(), // Current version number
\r
65 // Get count of theme_check for validation
\r
66 $count = trim($response[sizeof($response) - 2]);
\r
67 foreach ($response as $idx=>$value)
\r
69 $value = str_replace("\n", "", $value); $ver = "";
\r
71 // Leave loop when data is invalid or EOF?
\r
72 if ((substr($value, 0, 6) == "theme-") && (substr($value, -4) == ".zip"))
\r
74 $name = substr($value, 6, -4);
\r
75 $file = PATH."themes/".$name."/theme.php";
\r
76 $ver = trim(substr($response[$idx + 3], 4));
\r
79 $result = SQL_QUERY_ESC("SELECT theme_ver FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
\r
80 array($name), __FILE__, __LINE__);
\r
81 list($cver) = SQL_FETCHROW($result);
\r
82 if (empty($cver)) $cver = "-.-";
\r
84 // Is the extension already installed or not?
\r
85 if (((SQL_NUMROWS($result) == 0) && (!file_exists($file))) || ($ver != $cver))
\r
87 // No, it isn't. So let's add this one!
\r
88 $THEMES['fname'][] = $name;
\r
89 $THEMES['fsize'][] = $response[$idx + 1];
\r
90 $THEMES['fctime'][] = $response[$idx + 2];
\r
91 $THEMES['ver'][] = $ver;
\r
92 $THEMES['cver'][] = $cver;
\r
94 $LANG_DUMMY = explode("[nl]", $response[$idx + 4]);
\r
96 $INFO = ADMIN_EXT_NO_INFO_FOUND;
\r
98 // Trim every data line
\r
99 foreach ($LANG_DUMMY as $k=>$v)
\r
102 if (substr($v, 3) == "") $v = "---";
\r
103 $LANG_DUMMY[$k] = $v;
\r
104 if ($v == "xx:xx") break;
\r
108 // If language is found stop searching on matching line
\r
109 foreach($LANG as $search)
\r
111 if (substr($search, 0, 3) == (GET_LANGUAGE().":")) { $INFO = substr($search, 3); break; }
\r
114 // Add informations to array
\r
115 $THEMES['infos'][] = $INFO;
\r
120 // Ok, themes are on our server but maybe you have already installed them?
\r
121 if (sizeof($THEMES['fname']) > 0)
\r
123 // Sort array (I missed ver and cver here)
\r
124 array_pk_sort($THEMES, array("cver", "fname"), 0, 1);
\r
126 // Extensions where found which are not downloaded and installed
\r
127 $SW = 2; $OUT = ""; $TSIZE = 0;
\r
128 foreach ($THEMES['fname'] as $idx=>$name)
\r
130 // Generate download link
\r
131 $LINK = SERVER_URL."/themes/theme-".$name.".zip";
\r
133 <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".($idx + 1).".</TD>
\r
134 <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\"><A href=\"".$LINK."\">".$name."</A></TD>
\r
135 <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".MAKE_DATETIME($THEMES['fctime'][$idx], "2")."</TD>
\r
136 <TD align=\"center\" class=\"switch_sw".$SW." bottom2 right2\">".TRANSLATE_COMMA(round($THEMES['fsize'][$idx] / 1.024) / 1000)." ".KBYTES."</TD>
\r
137 <TD align=\"center\" class=\"switch_sw".$SW." bottom2\">".$THEMES['ver'][$idx]." (".$THEMES['cver'][$idx].")</TD>
\r
140 <TD class=\"switch_sw".$SW." bottom2\"> </TD>
\r
141 <TD colspan=\"4\" class=\"switch_sw".$SW." bottom2\">
\r
142 <FONT class=\"tiny\">".stripslashes($THEMES['infos'][$idx])."</FONT>
\r
145 $TSIZE += $THEMES['fsize'][$idx];
\r
148 define('__THEMES_ROWS', $OUT);
\r
149 define('__TKBYTES_VALUE', TRANSLATE_COMMA(round($TSIZE / 1.024) / 1000));
\r
150 define('__TTHEME_VALUE', sizeof($THEMES['fname']));
\r
153 LOAD_TEMPLATE("admin_theme_list");
\r
157 // All Themes are downloaded and installed
\r
158 LOAD_TEMPLATE("admin_theme_installed", false, $count);
\r
163 // No theme where found
\r
164 LOAD_TEMPLATE("admin_theme_404");
\r