-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpviewgallery.php
More file actions
253 lines (116 loc) · 4.31 KB
/
pviewgallery.php
File metadata and controls
253 lines (116 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| http://e107.org
|
| PView Gallery by R.F. Carter
| ronald.fuchs@hhweb.de
+---------------------------------------------------------------+
*/
require_once("../../class2.php");
// insert all wysiwyg textareas, comma separated
$e_wysiwyg = "pview_comment";
require_once(HEADERF);
// Include plugin language file, check first for site's preferred language
if (file_exists(e_PLUGIN . "pviewgallery/languages/" . e_LANGUAGE . ".php")){
include_once(e_PLUGIN."pviewgallery/languages/".e_LANGUAGE.".php");
}
else
{
include_once(e_PLUGIN . "pviewgallery/languages/German.php");
}
// Include pview.class
require_once(e_PLUGIN."pviewgallery/pview.class.php");
$PView = new PView;
// Include Template
include_once(e_PLUGIN."pviewgallery/templates/template.php");
if (!class_exists('Template')) {
$ns -> tablerender($PView -> getPView_config("pview_name"), LAN_ADMIN_61);
require_once(FOOTERF);
exit;
}
$Template = new Template;
// --------------------------- SESSION Handling for Viewer Sorting --------------------------------------------------------------
if ($PView->getPView_config("viewer_sort")){
session_start();
$sortArray = $PView->getSortArray();
if (isset($_POST['pv_album_sort'])){
$_SESSION['pv_album_sort'] = array_search($_POST['pv_album_sort'],$sortArray);
}
if (isset($_POST['pv_cat_sort'])){
$_SESSION['pv_cat_sort'] = array_search($_POST['pv_cat_sort'],$sortArray);
}
if (isset($_POST['pv_user_sort'])){
$_SESSION['pv_user_sort'] = array_search($_POST['pv_user_sort'],$sortArray);
}
}
// ----------------------------------- Render Gallery ---------------------------------------------------------------------------
$tmpHTML = $PView -> sc_Replace($Template -> getContent());
if (!$tmpHTML) {
$tmpHTML = "<div style='padding:10px;'>".LAN_GALLERY_9."</div>";
}
$ns -> tablerender($PView -> getPath(), $tmpHTML);
// ------------------------------------------ Views Count -----------------------------------------------------------------------
// Cookie handling for views count
if ($PView -> getPView_config('viewControl_by') == "cookie") {
// prepare cookie for cookies enabled check
if(!isset($_COOKIE['PView'])) {
if ($_GET['gallery'] OR $_GET['album']) {
setcookie("PView","ON");
}
} else {
// count imageviews if cookies enabled
if ($_GET['image']) {
$pv_Cookie = $_COOKIE['PView'];
if (strpos ($pv_Cookie, ",".$_GET['image'].",") === false) {
// incViews
$PView -> setImageViews($_GET['image']);
$pv_Cookie = $pv_Cookie.",".$_GET['image'].",";
setcookie ("PView", $pv_Cookie);
}
}
}
}
// Session handling for views count
if ($PView -> getPView_config('viewControl_by') == "session") {
session_start();
if ($_GET['image']) {
$pv_Session = $_SESSION['pv_images'];
if (strpos ($pv_Session, ",".$_GET['image'].",") === false & !SID) {
// incViews
$PView -> setImageViews($_GET['image']);
$_SESSION['pv_images'] = $_SESSION['pv_images']. ",".$_GET['image'].",";
}
}
}
// IP Addr. handling for views count
if ($PView -> getPView_config('viewControl_by') == "ip") {
// delete outdated entries
$PView -> deleteIPs();
if ($_GET['image']) {
$currentIP = $_SERVER['REMOTE_ADDR'];
$imagesViewed = $PView -> getImagesfromIP($currentIP);
if (strpos ($imagesViewed['images'], ",".$_GET['image'].",") === false) {
// incViews
$PView -> setImageViews($_GET['image']);
global $sql;
if ($imagesViewed) {
$newImagestring = $imagesViewed['images'].",".$_GET['image'].",";
$sql -> db_Update("pview_tmpip","images='$newImagestring',time='".time()."' WHERE ip_addr='$currentIP'");
} else {
$sql -> db_Insert("pview_tmpip","'$currentIP',',".$_GET['image'].",','".time()."'");
}
}
}
}
// views count without reload interlock
if (!$PView -> getPView_config('viewControl_by')) {
if ($_GET['image']) {
// incViews
$PView -> setImageViews($_GET['image']);
}
}
// ------------------------------------------ Views Count End --------------------------------------------------------------------
require_once(FOOTERF);
?>