source: extensions/lightbox/save_history.php @ 4440

Last change on this file since 4440 was 3609, checked in by patdenice, 15 years ago

Convert all php and tpl files in Unix format for my plugins.

File size: 1.4 KB
Line 
1<?php
2
3define('PHPWG_ROOT_PATH','../../');
4include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
5include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
6
7check_status(ACCESS_GUEST);
8
9if (!isset($_POST['imgid'])
10  or !($imgid = explode('img-', $_POST['imgid']))
11  or !is_numeric(@$imgid[1]))
12{
13  die;
14}
15
16$do_log = $conf['log'];
17if (is_admin())
18{
19  $do_log = $conf['history_admin'];
20}
21if (is_a_guest())
22{
23  $do_log = $conf['history_guest'];
24}
25
26if (!$do_log)
27{
28  exit();
29}
30
31$image_id = mysql_real_escape_string($imgid[1]);
32
33if (!empty($_POST['section']))
34{
35  $page['section'] = mysql_real_escape_string($_POST['section']);
36}
37if (!empty($_POST['catid']))
38{
39  $page['category']['id'] = mysql_real_escape_string($_POST['catid']);
40}
41if ('tags'==@$page['section'] and !empty($_POST['tagids']))
42{
43  $tags_string = mysql_real_escape_string($_POST['tagids']);
44}
45
46  $query = '
47INSERT INTO '.HISTORY_TABLE.'
48  (
49    date,
50    time,
51    user_id,
52    IP,
53    section,
54    category_id,
55    image_id,
56    image_type,
57    tag_ids,
58    lightbox
59  )
60  VALUES
61  (
62    CURDATE(),
63    CURTIME(),
64    '.$user['id'].',
65    \''.$_SERVER['REMOTE_ADDR'].'\',
66    '.(isset($page['section']) ? "'".$page['section']."'" : 'NULL').',
67    '.(isset($page['category']['id']) ? $page['category']['id'] : 'NULL').',
68    '.$image_id.',
69    "picture",
70    '.(isset($tags_string) ? "'".$tags_string."'" : 'NULL').',
71    "true"
72  )
73;';
74
75pwg_query($query);
76
77?>
Note: See TracBrowser for help on using the repository browser.