6 |
kaklik |
1 |
<?php
|
|
|
2 |
/*************************
|
|
|
3 |
Coppermine Photo Gallery
|
|
|
4 |
************************
|
|
|
5 |
Copyright (c) 2003-2005 Coppermine Dev Team
|
|
|
6 |
v1.1 originaly written by Gregory DEMAR
|
|
|
7 |
|
|
|
8 |
This program is free software; you can redistribute it and/or modify
|
|
|
9 |
it under the terms of the GNU General Public License as published by
|
|
|
10 |
the Free Software Foundation; either version 2 of the License, or
|
|
|
11 |
(at your option) any later version.
|
|
|
12 |
********************************************
|
|
|
13 |
Coppermine version: 1.3.3
|
|
|
14 |
$Source: /cvsroot/coppermine/stable/addfav.php,v $
|
|
|
15 |
$Revision: 1.6 $
|
|
|
16 |
$Author: gaugau $
|
|
|
17 |
$Date: 2005/04/19 03:12:58 $
|
|
|
18 |
**********************************************/
|
|
|
19 |
|
|
|
20 |
define('IN_COPPERMINE', true);
|
|
|
21 |
define('RATEPIC_PHP', true);
|
|
|
22 |
|
|
|
23 |
require('include/init.inc.php');
|
|
|
24 |
// Check if required parameters are present
|
|
|
25 |
if (!isset($HTTP_GET_VARS['pid'])) cpg_die(CRITICAL_ERROR, $lang_errors['param_missing'], __FILE__, __LINE__);
|
|
|
26 |
|
|
|
27 |
$pic = (int)$HTTP_GET_VARS['pid'];
|
|
|
28 |
// If user does not accept script's cookies, we don't accept the vote
|
|
|
29 |
if (!isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_data'])) {
|
|
|
30 |
header('Location: displayimage.php?pos=' . (- $pid));
|
|
|
31 |
exit;
|
|
|
32 |
}
|
|
|
33 |
// See if this picture is already present in the array
|
|
|
34 |
if (!in_array($pic, $FAVPICS)) {
|
|
|
35 |
$FAVPICS[] = $pic;
|
|
|
36 |
} else {
|
|
|
37 |
$key = array_search($pic, $FAVPICS);
|
|
|
38 |
unset ($FAVPICS[$key]);
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
$data = base64_encode(serialize($FAVPICS));
|
|
|
42 |
setcookie($CONFIG['cookie_name'] . '_fav', $data, time() + 86400 * 30, $CONFIG['cookie_path']);
|
|
|
43 |
|
|
|
44 |
$location = "displayimage.php?pos=" . (- $pic);
|
|
|
45 |
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
|
|
|
46 |
header($header_location . $location);
|
|
|
47 |
pageheader($lang_info, "<META http-equiv=\"refresh\" content=\"1;url=$location\">");
|
|
|
48 |
msg_box($lang_info, $lang_rate_pic_php['rate_ok'], $lang_continue, $location);
|
|
|
49 |
pagefooter();
|
|
|
50 |
ob_end_flush();
|
|
|
51 |
|
|
|
52 |
?>
|