2 /************************************************************************
3 * Mailer v0.2.1-FINAL 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
50 // Get response from our server
51 $response = sendGetRequest('check-themes.php');
53 // Are theme_check found?
54 if (($response[count($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[count($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 // Extract name and version
73 $name = substr($value, 6, -4);
74 $ver = trim(substr($response[$idx + 3], 4));
77 $cver = getThemeVersion($name);
79 // Is the theme already installed or not?
80 if (($ver != $cver) && ($cver != '?') && ($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 // Extract language strings from reponse
89 $langDummy = explode('[nl]', $response[$idx + 4]);
91 $themeInfo = getMessage('ADMIN_EXT_NO_INFO_FOUND');
93 // Trim every data line
94 foreach ($langDummy as $k => $v) {
96 if (substr($v, 3) == '') $v = '---';
98 if ($v == 'xx:xx') break;
102 // If language is found stop searching on matching line
103 foreach($languages as $search) {
104 if (substr($search, 0, 3) == (getLanguage().':')) { $themeInfo = substr($search, 3); break; }
107 // Add informations to array
108 $themes['infos'][] = $themeInfo;
113 // Ok, themes are on our server but maybe you have already installed them?
114 if (count($themes['fname']) > 0) {
115 // Sort array (I missed ver and cver here)
116 array_pk_sort($themes, array('cver', 'fname'), 0, 1);
118 // Extensions where found which are not downloaded and installed
119 $OUT = ''; $SW = 2; $totalSize = '0';
120 foreach ($themes['fname'] as $idx => $name) {
124 'index' => ($idx + 1),
126 'created' => generateDateTime($themes['fctime'][$idx], 2),
127 'size' => translateComma(round($themes['fsize'][$idx] / 1.024) / 1000),
128 'version' => $themes['ver'][$idx],
129 'current' => $themes['cver'][$idx],
130 'infos' => $themes['infos'][$idx],
134 $OUT .= loadTemplate('admin_list_theme_row', true, $content);
137 $totalSize += $themes['fsize'][$idx];
142 $content['rows'] = $OUT;
143 $content['total'] = count($themes['fname']);
144 $content['kbytes'] = translateComma(round($totalSize / 1.024) / 1000);
147 loadTemplate('admin_list_theme', false, $content);
149 // All Themes are downloaded and installed
150 loadTemplate('admin_theme_installed', false, $count);
153 // No theme where found
154 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_THEME_NOTHING_FOUND'));