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 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
47 // Normally we want the overview of all registered theme_check
51 // Get response from our server
52 $response = sendGetRequest('check-themes.php');
54 // Are theme_check found?
55 if (($response[count($response) - 1] == "[EOF]") && ($response[0] != "[EOF]")) {
56 // Ok, mark found and create the array
58 'fname' => array(), // File names
59 'fsize' => array(), // File size
60 'fctime' => array(), // File creation timestamp
61 'infos' => array(), // File informations (maybe loaded!)
62 'ver' => array(), // Version number
63 'cver' => array(), // Current version number
66 // Get count of theme_check for validation
67 $count = trim($response[count($response) - 2]);
68 foreach ($response as $idx => $value) {
69 $value = str_replace("\n", '', $value); $ver = '';
71 // Leave loop when data is invalid or EOF?
72 if ((substr($value, 0, 6) == "theme-") && (substr($value, -4) == ".zip")) {
73 // Extract name and version
74 $name = substr($value, 6, -4);
75 $ver = trim(substr($response[$idx + 3], 4));
78 $cver = getThemeVersion($name);
80 // Is the theme already installed or not?
81 if (($ver != $cver) && ($cver != '?') && ($cver != '!')) {
82 // No, it isn't. So let's add this one!
83 $themes['fname'][] = $name;
84 $themes['fsize'][] = $response[$idx + 1];
85 $themes['fctime'][] = $response[$idx + 2];
86 $themes['ver'][] = $ver;
87 $themes['cver'][] = $cver;
89 // Extract language strings from reponse
90 $langDummy = explode('[nl]', $response[$idx + 4]);
92 $themeInfo = getMessage('ADMIN_EXT_NO_INFO_FOUND');
94 // Trim every data line
95 foreach ($langDummy as $k => $v) {
97 if (substr($v, 3) == '') $v = '---';
99 if ($v == 'xx:xx') break;
103 // If language is found stop searching on matching line
104 foreach($languages as $search) {
105 if (substr($search, 0, 3) == (getLanguage().':')) { $themeInfo = substr($search, 3); break; }
108 // Add informations to array
109 $themes['infos'][] = $themeInfo;
114 // Ok, themes are on our server but maybe you have already installed them?
115 if (count($themes['fname']) > 0) {
116 // Sort array (I missed ver and cver here)
117 array_pk_sort($themes, array('cver', 'fname'), 0, 1);
119 // Extensions where found which are not downloaded and installed
120 $OUT = ''; $SW = 2; $totalSize = 0;
121 foreach ($themes['fname'] as $idx => $name) {
125 'index' => ($idx + 1),
127 'created' => generateDateTime($themes['fctime'][$idx], 2),
128 'size' => translateComma(round($themes['fsize'][$idx] / 1.024) / 1000),
129 'version' => $themes['ver'][$idx],
130 'current' => $themes['cver'][$idx],
131 'infos' => $themes['infos'][$idx],
135 $OUT .= loadTemplate('admin_list_theme_row', true, $content);
138 $totalSize += $themes['fsize'][$idx];
143 $content['rows'] = $OUT;
144 $content['total'] = count($themes['fname']);
145 $content['kbytes'] = translateComma(round($totalSize / 1.024) / 1000);
148 loadTemplate('admin_list_theme', false, $content);
150 // All Themes are downloaded and installed
151 loadTemplate('admin_theme_installed', false, $count);
154 // No theme where found
155 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_THEME_NOTHING_FOUND'));