2007-01-17 00:39:39 +01:00
|
|
|
<?php
|
|
|
|
// +-----------------------------------------------------------------------+
|
2011-01-18 01:02:52 +01:00
|
|
|
// | Piwigo - a PHP based photo gallery |
|
2008-04-05 00:57:23 +02:00
|
|
|
// +-----------------------------------------------------------------------+
|
2013-01-01 13:35:02 +01:00
|
|
|
// | Copyright(C) 2008-2013 Piwigo Team http://piwigo.org |
|
2008-04-05 00:57:23 +02:00
|
|
|
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
|
|
|
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | This program is free software; you can redistribute it and/or modify |
|
|
|
|
// | it under the terms of the GNU General Public License as published by |
|
|
|
|
// | the Free Software Foundation |
|
|
|
|
// | |
|
|
|
|
// | This program is distributed in the hope that it will be useful, but |
|
|
|
|
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
|
// | General Public License for more details. |
|
|
|
|
// | |
|
|
|
|
// | You should have received a copy of the GNU General Public License |
|
|
|
|
// | along with this program; if not, write to the Free Software |
|
|
|
|
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
2007-01-17 00:39:39 +01:00
|
|
|
// | USA. |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display filtered history lines
|
|
|
|
*/
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | functions |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | initialization |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
if (!defined('PHPWG_ROOT_PATH'))
|
|
|
|
{
|
|
|
|
die('Hacking attempt!');
|
|
|
|
}
|
|
|
|
|
|
|
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
2007-03-08 23:14:14 +01:00
|
|
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions_history.inc.php');
|
2007-01-17 00:39:39 +01:00
|
|
|
|
|
|
|
if (isset($_GET['start']) and is_numeric($_GET['start']))
|
|
|
|
{
|
|
|
|
$page['start'] = $_GET['start'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$page['start'] = 0;
|
|
|
|
}
|
|
|
|
|
2007-02-21 00:40:02 +01:00
|
|
|
$types = array('none', 'picture', 'high', 'other');
|
2010-04-02 20:32:23 +02:00
|
|
|
|
|
|
|
$display_thumbnails = array('no_display_thumbnail' => l10n('No display'),
|
|
|
|
'display_thumbnail_classic' => l10n('Classic display'),
|
|
|
|
'display_thumbnail_hoverbox' => l10n('Hoverbox display')
|
|
|
|
);
|
2007-02-21 00:40:02 +01:00
|
|
|
|
2007-01-17 00:39:39 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | Check Access and exit when user status is not ok |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
check_status(ACCESS_ADMINISTRATOR);
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | Build search criteria and redirect to results |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
2007-03-11 16:53:25 +01:00
|
|
|
$page['errors'] = array();
|
2007-01-17 00:39:39 +01:00
|
|
|
$search = array();
|
|
|
|
|
|
|
|
if (isset($_POST['submit']))
|
|
|
|
{
|
|
|
|
// dates
|
|
|
|
if (!empty($_POST['start_year']))
|
|
|
|
{
|
|
|
|
$search['fields']['date-after'] = sprintf(
|
|
|
|
'%d-%02d-%02d',
|
|
|
|
$_POST['start_year'],
|
|
|
|
$_POST['start_month'],
|
|
|
|
$_POST['start_day']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($_POST['end_year']))
|
|
|
|
{
|
|
|
|
$search['fields']['date-before'] = sprintf(
|
|
|
|
'%d-%02d-%02d',
|
|
|
|
$_POST['end_year'],
|
|
|
|
$_POST['end_month'],
|
|
|
|
$_POST['end_day']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2007-11-01 18:11:52 +01:00
|
|
|
if (empty($_POST['types']))
|
|
|
|
{
|
|
|
|
$search['fields']['types'] = $types;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$search['fields']['types'] = $_POST['types'];
|
|
|
|
}
|
2007-03-11 15:48:17 +01:00
|
|
|
|
|
|
|
$search['fields']['user'] = $_POST['user'];
|
2007-03-11 16:53:25 +01:00
|
|
|
|
|
|
|
if (!empty($_POST['image_id']))
|
|
|
|
{
|
|
|
|
$search['fields']['image_id'] = intval($_POST['image_id']);
|
|
|
|
}
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-03-11 16:53:25 +01:00
|
|
|
if (!empty($_POST['filename']))
|
|
|
|
{
|
|
|
|
$search['fields']['filename'] = str_replace(
|
|
|
|
'*',
|
|
|
|
'%',
|
2009-11-20 15:17:04 +01:00
|
|
|
pwg_db_real_escape_string($_POST['filename'])
|
2007-03-11 16:53:25 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-05-02 22:24:28 +02:00
|
|
|
if (!empty($_POST['ip']))
|
|
|
|
{
|
|
|
|
$search['fields']['ip'] = str_replace(
|
|
|
|
'*',
|
|
|
|
'%',
|
|
|
|
pwg_db_real_escape_string($_POST['ip'])
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2007-05-01 15:57:52 +02:00
|
|
|
$search['fields']['display_thumbnail'] = $_POST['display_thumbnail'];
|
|
|
|
// Display choise are also save to one cookie
|
2010-04-02 20:32:23 +02:00
|
|
|
if (!empty($_POST['display_thumbnail'])
|
|
|
|
and isset($display_thumbnails[$_POST['display_thumbnail']]))
|
|
|
|
{
|
|
|
|
$cookie_val = $_POST['display_thumbnail'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$cookie_val = null;
|
|
|
|
}
|
2012-05-02 22:24:28 +02:00
|
|
|
|
2010-04-02 20:32:23 +02:00
|
|
|
pwg_set_cookie_var('display_thumbnail', $cookie_val, strtotime('+1 month') );
|
2007-05-01 15:57:52 +02:00
|
|
|
|
2007-03-11 16:53:25 +01:00
|
|
|
// TODO manage inconsistency of having $_POST['image_id'] and
|
|
|
|
// $_POST['filename'] simultaneously
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-01-17 00:39:39 +01:00
|
|
|
if (!empty($search))
|
|
|
|
{
|
|
|
|
// register search rules in database, then they will be available on
|
|
|
|
// thumbnails page and picture page.
|
|
|
|
$query ='
|
|
|
|
INSERT INTO '.SEARCH_TABLE.'
|
|
|
|
(rules)
|
|
|
|
VALUES
|
|
|
|
(\''.serialize($search).'\')
|
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
|
2010-02-15 20:49:04 +01:00
|
|
|
$search_id = pwg_db_insert_id(SEARCH_TABLE);
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-01-17 00:39:39 +01:00
|
|
|
redirect(
|
|
|
|
PHPWG_ROOT_PATH.'admin.php?page=history&search_id='.$search_id
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-03-02 15:54:22 +01:00
|
|
|
array_push($page['errors'], l10n('Empty query. No criteria has been entered.'));
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | template init |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
2008-09-14 09:16:15 +02:00
|
|
|
$template->set_filename('history', 'history.tpl');
|
2007-03-08 23:14:14 +01:00
|
|
|
|
|
|
|
// TabSheet initialization
|
|
|
|
history_tabsheet();
|
2007-01-17 00:39:39 +01:00
|
|
|
|
2008-03-03 13:50:54 +01:00
|
|
|
$template->assign(
|
2007-01-17 00:39:39 +01:00
|
|
|
array(
|
2010-04-18 20:59:37 +02:00
|
|
|
'U_HELP' => get_root_url().'admin/popuphelp.php?page=history',
|
2008-03-03 13:50:54 +01:00
|
|
|
'F_ACTION' => get_root_url().'admin.php?page=history'
|
2007-01-17 00:39:39 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | history lines |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
if (isset($_GET['search_id'])
|
|
|
|
and $page['search_id'] = (int)$_GET['search_id'])
|
|
|
|
{
|
|
|
|
// what are the lines to display in reality ?
|
|
|
|
$query = '
|
|
|
|
SELECT rules
|
|
|
|
FROM '.SEARCH_TABLE.'
|
|
|
|
WHERE id = '.$page['search_id'].'
|
|
|
|
;';
|
2009-11-20 15:17:04 +01:00
|
|
|
list($serialized_rules) = pwg_db_fetch_row(pwg_query($query));
|
2007-01-17 00:39:39 +01:00
|
|
|
|
|
|
|
$page['search'] = unserialize($serialized_rules);
|
|
|
|
|
2007-03-11 15:48:17 +01:00
|
|
|
if (isset($_GET['user_id']))
|
|
|
|
{
|
|
|
|
if (!is_numeric($_GET['user_id']))
|
|
|
|
{
|
|
|
|
die('user_id GET parameter must be an integer value');
|
|
|
|
}
|
|
|
|
|
|
|
|
$page['search']['fields']['user'] = $_GET['user_id'];
|
2007-11-01 18:11:52 +01:00
|
|
|
|
2007-03-11 15:48:17 +01:00
|
|
|
$query ='
|
|
|
|
INSERT INTO '.SEARCH_TABLE.'
|
|
|
|
(rules)
|
|
|
|
VALUES
|
|
|
|
(\''.serialize($page['search']).'\')
|
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
|
2010-02-15 20:49:04 +01:00
|
|
|
$search_id = pwg_db_insert_id(SEARCH_TABLE);
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-03-11 15:48:17 +01:00
|
|
|
redirect(
|
|
|
|
PHPWG_ROOT_PATH.'admin.php?page=history&search_id='.$search_id
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2007-11-01 18:11:52 +01:00
|
|
|
$data = trigger_event('get_history', array(), $page['search'], $types);
|
|
|
|
usort($data, 'history_compare');
|
2007-03-09 17:28:49 +01:00
|
|
|
|
2007-11-01 18:11:52 +01:00
|
|
|
$page['nb_lines'] = count($data);
|
2007-03-09 17:28:49 +01:00
|
|
|
|
|
|
|
$history_lines = array();
|
|
|
|
$user_ids = array();
|
2007-03-29 00:28:54 +02:00
|
|
|
$username_of = array();
|
2007-03-09 17:28:49 +01:00
|
|
|
$category_ids = array();
|
|
|
|
$image_ids = array();
|
2012-05-02 22:24:28 +02:00
|
|
|
$has_tags = false;
|
2007-11-01 18:11:52 +01:00
|
|
|
|
|
|
|
foreach ($data as $row)
|
2007-01-17 00:39:39 +01:00
|
|
|
{
|
|
|
|
$user_ids[$row['user_id']] = 1;
|
|
|
|
|
|
|
|
if (isset($row['category_id']))
|
|
|
|
{
|
|
|
|
$category_ids[$row['category_id']] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($row['image_id']))
|
|
|
|
{
|
|
|
|
$image_ids[$row['image_id']] = 1;
|
|
|
|
}
|
|
|
|
|
2007-03-11 16:11:53 +01:00
|
|
|
if (isset($row['tag_ids']))
|
|
|
|
{
|
2012-05-02 22:24:28 +02:00
|
|
|
$has_tags = true;
|
2007-03-11 16:11:53 +01:00
|
|
|
}
|
|
|
|
|
2012-05-02 22:24:28 +02:00
|
|
|
$history_lines[] = $row;
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// prepare reference data (users, tags, categories...)
|
|
|
|
if (count($user_ids) > 0)
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
SELECT '.$conf['user_fields']['id'].' AS id
|
|
|
|
, '.$conf['user_fields']['username'].' AS username
|
|
|
|
FROM '.USERS_TABLE.'
|
|
|
|
WHERE id IN ('.implode(',', array_keys($user_ids)).')
|
|
|
|
;';
|
|
|
|
$result = pwg_query($query);
|
|
|
|
|
|
|
|
$username_of = array();
|
2009-11-20 15:17:04 +01:00
|
|
|
while ($row = pwg_db_fetch_assoc($result))
|
2007-01-17 00:39:39 +01:00
|
|
|
{
|
2009-11-18 21:07:20 +01:00
|
|
|
$username_of[$row['id']] = stripslashes($row['username']);
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count($category_ids) > 0)
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
SELECT id, uppercats
|
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE id IN ('.implode(',', array_keys($category_ids)).')
|
|
|
|
;';
|
|
|
|
$uppercats_of = simple_hash_from_query($query, 'id', 'uppercats');
|
|
|
|
|
|
|
|
$name_of_category = array();
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-01-17 00:39:39 +01:00
|
|
|
foreach ($uppercats_of as $category_id => $uppercats)
|
|
|
|
{
|
|
|
|
$name_of_category[$category_id] = get_cat_display_name_cache(
|
|
|
|
$uppercats
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count($image_ids) > 0)
|
|
|
|
{
|
|
|
|
$query = '
|
2007-03-09 17:28:49 +01:00
|
|
|
SELECT
|
|
|
|
id,
|
|
|
|
IF(name IS NULL, file, name) AS label,
|
|
|
|
filesize,
|
2007-04-29 21:04:57 +02:00
|
|
|
file,
|
|
|
|
path,
|
2011-12-27 06:26:44 +01:00
|
|
|
representative_ext
|
2007-01-17 00:39:39 +01:00
|
|
|
FROM '.IMAGES_TABLE.'
|
|
|
|
WHERE id IN ('.implode(',', array_keys($image_ids)).')
|
|
|
|
;';
|
2007-03-09 17:28:49 +01:00
|
|
|
// $label_of_image = simple_hash_from_query($query, 'id', 'label');
|
|
|
|
$label_of_image = array();
|
|
|
|
$filesize_of_image = array();
|
2007-04-29 21:04:57 +02:00
|
|
|
$file_of_image = array();
|
|
|
|
$path_of_image = array();
|
2011-12-27 06:26:44 +01:00
|
|
|
$representative_ext_of_image = array();
|
2007-04-29 21:04:57 +02:00
|
|
|
|
2007-03-09 17:28:49 +01:00
|
|
|
$result = pwg_query($query);
|
2009-11-20 15:17:04 +01:00
|
|
|
while ($row = pwg_db_fetch_assoc($result))
|
2007-03-09 17:28:49 +01:00
|
|
|
{
|
|
|
|
$label_of_image[ $row['id'] ] = $row['label'];
|
|
|
|
|
|
|
|
if (isset($row['filesize']))
|
|
|
|
{
|
|
|
|
$filesize_of_image[ $row['id'] ] = $row['filesize'];
|
|
|
|
}
|
|
|
|
|
2007-04-29 21:04:57 +02:00
|
|
|
$file_of_image[ $row['id'] ] = $row['file'];
|
|
|
|
$path_of_image[ $row['id'] ] = $row['path'];
|
2011-12-27 06:26:44 +01:00
|
|
|
$representative_ext_of_image[ $row['id'] ] = $row['representative_ext'];
|
2007-03-09 17:28:49 +01:00
|
|
|
}
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
2007-03-11 16:11:53 +01:00
|
|
|
|
2012-05-02 22:24:28 +02:00
|
|
|
if ($has_tags > 0)
|
2007-03-11 16:11:53 +01:00
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
SELECT
|
|
|
|
id,
|
2013-06-11 06:35:32 +02:00
|
|
|
name, url_name
|
2012-05-02 22:24:28 +02:00
|
|
|
FROM '.TAGS_TABLE;
|
2013-06-11 06:35:32 +02:00
|
|
|
$name_of_tag = array();
|
|
|
|
$result = pwg_query($query);
|
|
|
|
while ($row=pwg_db_fetch_assoc($result))
|
|
|
|
{
|
|
|
|
$name_of_tag[ $row['id'] ] = '<a href="'.make_index_url( array('tags'=>array($row))).'">'.trigger_event("render_tag_name", $row['name']).'</a>';
|
|
|
|
}
|
2007-03-11 16:11:53 +01:00
|
|
|
}
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-01-17 00:39:39 +01:00
|
|
|
$i = 0;
|
2007-03-09 17:28:49 +01:00
|
|
|
$first_line = $page['start'] + 1;
|
|
|
|
$last_line = $page['start'] + $conf['nb_logs_page'];
|
|
|
|
|
2007-03-11 18:40:59 +01:00
|
|
|
$summary['total_filesize'] = 0;
|
|
|
|
$summary['guests_IP'] = array();
|
2007-01-17 00:39:39 +01:00
|
|
|
|
|
|
|
foreach ($history_lines as $line)
|
|
|
|
{
|
2012-07-02 15:31:56 +02:00
|
|
|
if (isset($line['image_type']) and $line['image_type'] == 'high')
|
2007-03-09 17:28:49 +01:00
|
|
|
{
|
2012-07-02 15:31:56 +02:00
|
|
|
if (isset($filesize_of_image[$line['image_id']]))
|
2007-03-09 17:28:49 +01:00
|
|
|
{
|
2012-07-02 15:31:56 +02:00
|
|
|
$summary['total_filesize'] += $filesize_of_image[$line['image_id']];
|
2007-03-09 17:28:49 +01:00
|
|
|
}
|
|
|
|
}
|
2007-03-11 18:40:59 +01:00
|
|
|
|
|
|
|
if ($line['user_id'] == $conf['guest_id'])
|
|
|
|
{
|
|
|
|
if (!isset($summary['guests_IP'][ $line['IP'] ]))
|
|
|
|
{
|
|
|
|
$summary['guests_IP'][ $line['IP'] ] = 0;
|
|
|
|
}
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-03-11 18:40:59 +01:00
|
|
|
$summary['guests_IP'][ $line['IP'] ]++;
|
|
|
|
}
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-03-09 17:28:49 +01:00
|
|
|
$i++;
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-03-09 17:28:49 +01:00
|
|
|
if ($i < $first_line or $i > $last_line)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2007-03-11 15:48:17 +01:00
|
|
|
|
|
|
|
$user_string = '';
|
|
|
|
if (isset($username_of[$line['user_id']]))
|
|
|
|
{
|
|
|
|
$user_string.= $username_of[$line['user_id']];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$user_string.= $line['user_id'];
|
|
|
|
}
|
|
|
|
$user_string.= ' <a href="';
|
|
|
|
$user_string.= PHPWG_ROOT_PATH.'admin.php?page=history';
|
|
|
|
$user_string.= '&search_id='.$page['search_id'];
|
|
|
|
$user_string.= '&user_id='.$line['user_id'];
|
|
|
|
$user_string.= '">+</a>';
|
2007-03-11 16:11:53 +01:00
|
|
|
|
|
|
|
$tags_string = '';
|
|
|
|
if (isset($line['tag_ids']))
|
|
|
|
{
|
|
|
|
$tags_string = preg_replace(
|
|
|
|
'/(\d+)/e',
|
2013-03-28 22:38:36 +01:00
|
|
|
'isset($name_of_tag["$1"]) ? trigger_event("render_tag_name", $name_of_tag["$1"]) : "$1"',
|
2007-03-11 16:11:53 +01:00
|
|
|
str_replace(
|
|
|
|
',',
|
|
|
|
', ',
|
|
|
|
$line['tag_ids']
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2007-03-12 01:15:45 +01:00
|
|
|
|
|
|
|
$image_string = '';
|
|
|
|
if (isset($line['image_id']))
|
|
|
|
{
|
|
|
|
$picture_url = make_picture_url(
|
|
|
|
array(
|
|
|
|
'image_id' => $line['image_id'],
|
|
|
|
)
|
|
|
|
);
|
2007-05-01 15:57:52 +02:00
|
|
|
|
2011-03-21 14:24:02 +01:00
|
|
|
if (isset($file_of_image[$line['image_id']]))
|
|
|
|
{
|
|
|
|
$element = array(
|
|
|
|
'id' => $line['image_id'],
|
|
|
|
'file' => $file_of_image[$line['image_id']],
|
|
|
|
'path' => $path_of_image[$line['image_id']],
|
2011-12-27 06:26:44 +01:00
|
|
|
'representative_ext' => $representative_ext_of_image[$line['image_id']],
|
2011-03-21 14:24:02 +01:00
|
|
|
);
|
|
|
|
$thumbnail_display = $page['search']['fields']['display_thumbnail'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$thumbnail_display = 'no_display_thumbnail';
|
|
|
|
}
|
2007-05-01 15:57:52 +02:00
|
|
|
|
|
|
|
$image_title = '('.$line['image_id'].')';
|
|
|
|
|
2007-03-12 01:15:45 +01:00
|
|
|
if (isset($label_of_image[$line['image_id']]))
|
|
|
|
{
|
2007-05-01 15:57:52 +02:00
|
|
|
$image_title.= ' '.$label_of_image[$line['image_id']];
|
2007-03-12 01:15:45 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-05-01 15:57:52 +02:00
|
|
|
$image_title.= ' unknown filename';
|
|
|
|
}
|
|
|
|
|
|
|
|
$image_string = '';
|
|
|
|
|
2011-03-21 14:24:02 +01:00
|
|
|
switch ($thumbnail_display)
|
2007-05-01 15:57:52 +02:00
|
|
|
{
|
|
|
|
case 'no_display_thumbnail':
|
|
|
|
{
|
|
|
|
$image_string= '<a href="'.$picture_url.'">'.$image_title.'</a>';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'display_thumbnail_classic':
|
|
|
|
{
|
|
|
|
$image_string =
|
|
|
|
'<a class="thumbnail" href="'.$picture_url.'">'
|
2011-12-27 06:26:44 +01:00
|
|
|
.'<span><img src="'.DerivativeImage::thumb_url($element)
|
2007-05-01 15:57:52 +02:00
|
|
|
.'" alt="'.$image_title.'" title="'.$image_title.'">'
|
|
|
|
.'</span></a>';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'display_thumbnail_hoverbox':
|
|
|
|
{
|
|
|
|
$image_string =
|
|
|
|
'<a class="over" href="'.$picture_url.'">'
|
2011-12-27 06:26:44 +01:00
|
|
|
.'<span><img src="'.DerivativeImage::thumb_url($element)
|
2007-05-01 15:57:52 +02:00
|
|
|
.'" alt="'.$image_title.'" title="'.$image_title.'">'
|
|
|
|
.'</span>'.$image_title.'</a>';
|
|
|
|
break;
|
|
|
|
}
|
2007-03-12 01:15:45 +01:00
|
|
|
}
|
|
|
|
}
|
2008-03-03 13:50:54 +01:00
|
|
|
|
|
|
|
$template->append(
|
|
|
|
'search_results',
|
2007-01-17 00:39:39 +01:00
|
|
|
array(
|
|
|
|
'DATE' => $line['date'],
|
|
|
|
'TIME' => $line['time'],
|
2007-03-11 15:48:17 +01:00
|
|
|
'USER' => $user_string,
|
2007-01-17 00:39:39 +01:00
|
|
|
'IP' => $line['IP'],
|
2007-03-12 01:15:45 +01:00
|
|
|
'IMAGE' => $image_string,
|
2007-02-21 00:40:02 +01:00
|
|
|
'TYPE' => $line['image_type'],
|
2007-01-17 00:39:39 +01:00
|
|
|
'SECTION' => $line['section'],
|
|
|
|
'CATEGORY' => isset($line['category_id'])
|
2007-02-15 04:03:16 +01:00
|
|
|
? ( isset($name_of_category[$line['category_id']])
|
|
|
|
? $name_of_category[$line['category_id']]
|
|
|
|
: 'deleted '.$line['category_id'] )
|
2007-01-17 00:39:39 +01:00
|
|
|
: '',
|
2007-03-11 16:11:53 +01:00
|
|
|
'TAGS' => $tags_string,
|
2007-01-17 00:39:39 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2007-03-09 17:28:49 +01:00
|
|
|
|
2007-03-11 18:40:59 +01:00
|
|
|
$summary['nb_guests'] = 0;
|
|
|
|
if (count(array_keys($summary['guests_IP'])) > 0)
|
|
|
|
{
|
|
|
|
$summary['nb_guests'] = count(array_keys($summary['guests_IP']));
|
|
|
|
|
|
|
|
// we delete the "guest" from the $username_of hash so that it is
|
|
|
|
// avoided in next steps
|
|
|
|
unset($username_of[ $conf['guest_id'] ]);
|
|
|
|
}
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-03-11 18:40:59 +01:00
|
|
|
$summary['nb_members'] = count($username_of);
|
|
|
|
|
|
|
|
$member_strings = array();
|
|
|
|
foreach ($username_of as $user_id => $user_name)
|
|
|
|
{
|
|
|
|
$member_string = $user_name.' <a href="';
|
2008-03-03 13:50:54 +01:00
|
|
|
$member_string.= get_root_url().'admin.php?page=history';
|
2007-03-11 18:40:59 +01:00
|
|
|
$member_string.= '&search_id='.$page['search_id'];
|
|
|
|
$member_string.= '&user_id='.$user_id;
|
|
|
|
$member_string.= '">+</a>';
|
|
|
|
|
|
|
|
$member_strings[] = $member_string;
|
|
|
|
}
|
2008-03-03 13:50:54 +01:00
|
|
|
|
|
|
|
$template->assign(
|
|
|
|
'search_summary',
|
2007-03-09 17:28:49 +01:00
|
|
|
array(
|
2007-03-29 21:04:54 +02:00
|
|
|
'NB_LINES' => l10n_dec(
|
|
|
|
'%d line filtered', '%d lines filtered',
|
2007-03-11 18:40:59 +01:00
|
|
|
$page['nb_lines']
|
|
|
|
),
|
2012-07-02 15:31:56 +02:00
|
|
|
'FILESIZE' => $summary['total_filesize'] != 0 ? ceil($summary['total_filesize']/1024).' MB' : '',
|
2007-03-29 21:04:54 +02:00
|
|
|
'USERS' => l10n_dec(
|
|
|
|
'%d user', '%d users',
|
2007-03-11 18:40:59 +01:00
|
|
|
$summary['nb_members'] + $summary['nb_guests']
|
|
|
|
),
|
|
|
|
'MEMBERS' => sprintf(
|
2007-03-29 21:04:54 +02:00
|
|
|
l10n_dec('%d member', '%d members', $summary['nb_members']).': %s',
|
2007-03-11 18:40:59 +01:00
|
|
|
implode(
|
|
|
|
', ',
|
|
|
|
$member_strings
|
|
|
|
)
|
|
|
|
),
|
2007-03-29 21:04:54 +02:00
|
|
|
'GUESTS' => l10n_dec(
|
|
|
|
'%d guest', '%d guests',
|
2007-03-11 18:40:59 +01:00
|
|
|
$summary['nb_guests']
|
|
|
|
),
|
2007-03-09 17:28:49 +01:00
|
|
|
)
|
|
|
|
);
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | navigation bar |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
if (isset($page['search_id']))
|
|
|
|
{
|
|
|
|
$navbar = create_navigation_bar(
|
2008-03-03 13:50:54 +01:00
|
|
|
get_root_url().'admin.php'.get_query_string_diff(array('start')),
|
2007-01-17 00:39:39 +01:00
|
|
|
$page['nb_lines'],
|
|
|
|
$page['start'],
|
|
|
|
$conf['nb_logs_page']
|
|
|
|
);
|
|
|
|
|
2009-03-05 22:08:04 +01:00
|
|
|
$template->assign('navbar', $navbar);
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | filter form |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
$form = array();
|
|
|
|
|
|
|
|
if (isset($page['search']))
|
|
|
|
{
|
|
|
|
if (isset($page['search']['fields']['date-after']))
|
|
|
|
{
|
|
|
|
$tokens = explode('-', $page['search']['fields']['date-after']);
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-01-17 00:39:39 +01:00
|
|
|
$form['start_year'] = (int)$tokens[0];
|
|
|
|
$form['start_month'] = (int)$tokens[1];
|
|
|
|
$form['start_day'] = (int)$tokens[2];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($page['search']['fields']['date-before']))
|
|
|
|
{
|
|
|
|
$tokens = explode('-', $page['search']['fields']['date-before']);
|
2007-02-14 23:53:02 +01:00
|
|
|
|
|
|
|
$form['end_year'] = (int)$tokens[0];
|
|
|
|
$form['end_month'] = (int)$tokens[1];
|
|
|
|
$form['end_day'] = (int)$tokens[2];
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
2007-02-14 23:53:02 +01:00
|
|
|
|
2007-02-21 00:40:02 +01:00
|
|
|
$form['types'] = $page['search']['fields']['types'];
|
2007-03-11 15:48:17 +01:00
|
|
|
|
|
|
|
if (isset($page['search']['fields']['user']))
|
|
|
|
{
|
|
|
|
$form['user'] = $page['search']['fields']['user'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$form['user'] = null;
|
|
|
|
}
|
2007-03-11 16:53:25 +01:00
|
|
|
|
|
|
|
$form['image_id'] = @$page['search']['fields']['image_id'];
|
|
|
|
$form['filename'] = @$page['search']['fields']['filename'];
|
2012-05-02 22:24:28 +02:00
|
|
|
$form['ip'] = @$page['search']['fields']['ip'];
|
2007-05-01 15:57:52 +02:00
|
|
|
|
|
|
|
$form['display_thumbnail'] = @$page['search']['fields']['display_thumbnail'];
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// by default, at page load, we want the selected date to be the current
|
|
|
|
// date
|
|
|
|
$form['start_year'] = $form['end_year'] = date('Y');
|
|
|
|
$form['start_month'] = $form['end_month'] = date('n');
|
|
|
|
$form['start_day'] = $form['end_day'] = date('j');
|
2007-02-21 00:40:02 +01:00
|
|
|
$form['types'] = $types;
|
2007-05-01 15:57:52 +02:00
|
|
|
// Hoverbox by default
|
|
|
|
$form['display_thumbnail'] =
|
2010-04-02 20:32:23 +02:00
|
|
|
pwg_get_cookie_var('display_thumbnail', 'no_display_thumbnail');
|
2007-01-17 00:39:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-03 13:50:54 +01:00
|
|
|
$month_list = $lang['month'];
|
|
|
|
$month_list[0]='------------';
|
|
|
|
ksort($month_list);
|
|
|
|
|
|
|
|
$template->assign(
|
2007-01-17 00:39:39 +01:00
|
|
|
array(
|
2007-03-11 16:53:25 +01:00
|
|
|
'IMAGE_ID' => @$form['image_id'],
|
|
|
|
'FILENAME' => @$form['filename'],
|
2012-05-02 22:24:28 +02:00
|
|
|
'IP' => @$form['ip'],
|
2008-03-03 13:50:54 +01:00
|
|
|
|
|
|
|
'month_list' => $month_list,
|
|
|
|
|
|
|
|
'START_DAY_SELECTED' => @$form['start_day'],
|
|
|
|
'START_MONTH_SELECTED' => @$form['start_month'],
|
|
|
|
'START_YEAR' => @$form['start_year'],
|
|
|
|
|
|
|
|
'END_DAY_SELECTED' => @$form['end_day'],
|
|
|
|
'END_MONTH_SELECTED' => @$form['end_month'],
|
|
|
|
'END_YEAR' => @$form['end_year'],
|
2007-01-17 00:39:39 +01:00
|
|
|
)
|
|
|
|
);
|
2007-02-14 23:53:02 +01:00
|
|
|
|
2008-03-03 13:50:54 +01:00
|
|
|
$template->assign(
|
2007-02-21 00:40:02 +01:00
|
|
|
array(
|
2008-03-03 13:50:54 +01:00
|
|
|
'type_option_values' => $types,
|
|
|
|
'type_option_selected' => $form['types']
|
2007-03-11 15:48:17 +01:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2008-03-03 13:50:54 +01:00
|
|
|
|
2007-03-11 15:48:17 +01:00
|
|
|
$query = '
|
|
|
|
SELECT
|
|
|
|
'.$conf['user_fields']['id'].' AS id,
|
|
|
|
'.$conf['user_fields']['username'].' AS username
|
|
|
|
FROM '.USERS_TABLE.'
|
|
|
|
ORDER BY username ASC
|
|
|
|
;';
|
2008-03-03 13:50:54 +01:00
|
|
|
$template->assign(
|
|
|
|
array(
|
|
|
|
'user_options' => simple_hash_from_query($query, 'id','username'),
|
|
|
|
'user_options_selected' => array(@$form['user'])
|
|
|
|
)
|
|
|
|
);
|
2007-05-01 15:57:52 +02:00
|
|
|
|
2010-04-02 20:32:23 +02:00
|
|
|
$template->assign('display_thumbnails', $display_thumbnails);
|
|
|
|
$template->assign('display_thumbnail_selected', $form['display_thumbnail']);
|
2007-05-01 15:57:52 +02:00
|
|
|
|
2007-01-17 00:39:39 +01:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | html code display |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
$template->assign_var_from_handle('ADMIN_CONTENT', 'history');
|
2008-03-03 13:50:54 +01:00
|
|
|
?>
|