source: trunk/admin/intro.php @ 2033

Last change on this file since 2033 was 2033, checked in by vdigital, 17 years ago

Bug 0000705: Upload error with incomplete URL.
+ Broken link in Admin/intro.php

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 8.4 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | file          : $Id: intro.php 2033 2007-06-12 21:52:46Z vdigital $
8// | last update   : $Date: 2007-06-12 21:52:46 +0000 (Tue, 12 Jun 2007) $
9// | last modifier : $Author: vdigital $
10// | revision      : $Revision: 2033 $
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General Public License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General Public License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General Public License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26
27if (!defined('PHPWG_ROOT_PATH'))
28{
29  die ("Hacking attempt!");
30}
31
32include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
33
34// +-----------------------------------------------------------------------+
35// | Check Access and exit when user status is not ok                      |
36// +-----------------------------------------------------------------------+
37check_status(ACCESS_ADMINISTRATOR);
38
39// +-----------------------------------------------------------------------+
40// |                                actions                                |
41// +-----------------------------------------------------------------------+
42
43// Check for upgrade : code inspired from punbb
44if (isset($_GET['action']) and 'check_upgrade' == $_GET['action'])
45{
46  if (!ini_get('allow_url_fopen'))
47  {
48    array_push(
49      $page['errors'],
50      l10n('Unable to check for upgrade since allow_url_fopen is disabled.')
51      );
52  }
53  else
54  {
55    $versions = array('current' => PHPWG_VERSION);
56    $lines = @file(PHPWG_URL.'/latest_version');
57
58    // if the current version is a BSF (development branch) build, we check
59    // the first line, for stable versions, we check the second line
60    if (preg_match('/^BSF/', $versions{'current'}))
61    {
62      $versions{'latest'} = trim($lines[0]);
63
64      // because integer are limited to 4,294,967,296 we need to split BSF
65      // versions in date.time
66      foreach ($versions as $key => $value)
67      {
68        $versions{$key} =
69          preg_replace('/BSF_(\d{8})(\d{4})/', '$1.$2', $value);
70      }
71    }
72    else
73    {
74      $versions{'latest'} = trim($lines[1]);
75    }
76
77    if ('' == $versions{'latest'})
78    {
79      array_push(
80        $page['errors'],
81        l10n('Check for upgrade failed for unknown reasons.')
82        );
83    }
84    // concatenation needed to avoid automatic transformation by release
85    // script generator
86    else if ('%'.'PWGVERSION'.'%' == $versions{'current'})
87    {
88      array_push(
89        $page['infos'],
90        l10n('You are running on development sources, no check possible.')
91        );
92    }
93    else if (version_compare($versions{'current'}, $versions{'latest'}) < 0)
94    {
95      array_push(
96        $page['infos'],
97        l10n('A new version of PhpWebGallery is available.')
98        );
99    }
100    else
101    {
102      array_push(
103        $page['infos'],
104        l10n('You are running the latest version of PhpWebGallery.')
105        );
106    }
107  }
108}
109// Show phpinfo() output
110else if (isset($_GET['action']) and 'phpinfo' == $_GET['action'])
111{
112  phpinfo();
113  exit();
114}
115
116// +-----------------------------------------------------------------------+
117// |                             template init                             |
118// +-----------------------------------------------------------------------+
119
120$template->set_filenames(array('intro' => 'admin/intro.tpl'));
121
122$php_current_timestamp = date("Y-m-d H:i:s");
123list($mysql_version, $db_current_timestamp) = mysql_fetch_row(pwg_query('SELECT VERSION(), CURRENT_TIMESTAMP;'));
124
125$query = '
126SELECT COUNT(*)
127  FROM '.IMAGES_TABLE.'
128;';
129list($nb_elements) = mysql_fetch_row(pwg_query($query));
130
131$query = '
132SELECT COUNT(*)
133  FROM '.CATEGORIES_TABLE.'
134;';
135list($nb_categories) = mysql_fetch_row(pwg_query($query));
136
137$query = '
138SELECT COUNT(*)
139  FROM '.CATEGORIES_TABLE.'
140  WHERE dir IS NULL
141;';
142list($nb_virtual) = mysql_fetch_row(pwg_query($query));
143
144$query = '
145SELECT COUNT(*)
146  FROM '.CATEGORIES_TABLE.'
147  WHERE dir IS NOT NULL
148;';
149list($nb_physical) = mysql_fetch_row(pwg_query($query));
150
151$query = '
152SELECT COUNT(*)
153  FROM '.IMAGE_CATEGORY_TABLE.'
154;';
155list($nb_image_category) = mysql_fetch_row(pwg_query($query));
156
157$query = '
158SELECT COUNT(*)
159  FROM '.TAGS_TABLE.'
160;';
161list($nb_tags) = mysql_fetch_row(pwg_query($query));
162
163$query = '
164SELECT COUNT(*)
165  FROM '.IMAGE_TAG_TABLE.'
166;';
167list($nb_image_tag) = mysql_fetch_row(pwg_query($query));
168
169$query = '
170SELECT COUNT(*)
171  FROM '.USERS_TABLE.'
172;';
173list($nb_users) = mysql_fetch_row(pwg_query($query));
174
175$query = '
176SELECT COUNT(*)
177  FROM '.GROUPS_TABLE.'
178;';
179list($nb_groups) = mysql_fetch_row(pwg_query($query));
180
181$query = '
182SELECT COUNT(*)
183  FROM '.COMMENTS_TABLE.'
184;';
185list($nb_comments) = mysql_fetch_row(pwg_query($query));
186
187$template->assign_vars(
188  array(
189    'PWG_VERSION' => PHPWG_VERSION,
190    'OS' => PHP_OS,
191    'PHP_VERSION' => phpversion(),
192    'MYSQL_VERSION' => $mysql_version,
193    'DB_ELEMENTS' => l10n_dec('%d element', '%d elements', $nb_elements),
194    'DB_CATEGORIES' =>
195      l10n_dec('cat_inclu_part1_S', 'cat_inclu_part1_P',
196        $nb_categories).
197      l10n_dec('cat_inclu_part2_S', 'cat_inclu_part2_P',
198        $nb_physical).
199      l10n_dec('cat_inclu_part3_S', 'cat_inclu_part3_P',
200        $nb_virtual),
201    'DB_IMAGE_CATEGORY' => l10n_dec('%d association', '%d associations', $nb_image_category),
202    'DB_TAGS' => l10n_dec('%d tag', '%d tags', $nb_tags),
203    'DB_IMAGE_TAG' => l10n_dec('%d association', '%d associations', $nb_image_tag),
204    'DB_USERS' => l10n_dec('%d user', '%d users', $nb_users),
205    'DB_GROUPS' => l10n_dec('%d group', '%d groups', $nb_groups),
206    'DB_COMMENTS' => l10n_dec('%d comment', '%d comments', $nb_comments),
207    'U_CHECK_UPGRADE' => PHPWG_ROOT_PATH.'admin.php?action=check_upgrade',
208    'U_PHPINFO' => PHPWG_ROOT_PATH.'admin.php?action=phpinfo',
209    'PHP_DATATIME' => $php_current_timestamp,
210    'DB_DATATIME' => $db_current_timestamp,
211    )
212  );
213
214if ($nb_elements > 0)
215{
216  $query = '
217SELECT MIN(date_available)
218  FROM '.IMAGES_TABLE.'
219;';
220  list($first_date) = mysql_fetch_row(pwg_query($query));
221
222  $template->assign_block_vars(
223    'first_added',
224    array(
225      'DB_DATE' =>
226      sprintf(
227        l10n('first element added on %s'),
228        format_date($first_date, 'mysql_datetime')
229        )
230      )
231    );
232}
233
234// waiting elements
235$query = '
236SELECT COUNT(*)
237  FROM '.WAITING_TABLE.'
238  WHERE validated=\'false\'
239;';
240list($nb_waiting) = mysql_fetch_row(pwg_query($query));
241
242if ($nb_waiting > 0)
243{
244  $template->assign_block_vars(
245    'waiting',
246    array(
247      'URL' => PHPWG_ROOT_PATH.'admin.php?page=upload',
248      'INFO' => sprintf(l10n('%d waiting for validation'), $nb_waiting)
249      )
250    );
251}
252
253// unvalidated comments
254$query = '
255SELECT COUNT(*)
256  FROM '.COMMENTS_TABLE.'
257  WHERE validated=\'false\'
258;';
259list($nb_comments) = mysql_fetch_row(pwg_query($query));
260
261if ($nb_comments > 0)
262{
263  $template->assign_block_vars(
264    'unvalidated',
265    array(
266      'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments',
267      'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
268      )
269    );
270}
271
272// Add the PhpWebGallery Official menu
273  $template->assign_block_vars( 'pwgmenu', pwg_URL() );
274 
275// +-----------------------------------------------------------------------+
276// |                           sending html code                           |
277// +-----------------------------------------------------------------------+
278
279$template->assign_var_from_handle('ADMIN_CONTENT', 'intro');
280
281?>
Note: See TracBrowser for help on using the repository browser.