-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpview_comments_menu.php
305 lines (134 loc) · 6.35 KB
/
pview_comments_menu.php
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| http://e107.org
|
| PView Gallery by R.F. Carter
+---------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
// 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");
}
require_once(e_PLUGIN."pviewgallery/pview.class.php");
$PView = new PView;
global $sql;
global $tp;
$pv_path = e_PLUGIN."pviewgallery/";
if ($PView -> getPView_config("img_Link_menu_extJS")) {
$script = $PView -> getPView_config("img_Link_extJS");
} else {
$script = "noscript";
}
// comment count (own comments)
$commentArray = array();
$sql->db_Select("pview_comment", "*", "ORDER BY commentDate DESC", "nowhere");
while ($comment = $sql -> db_Fetch()) {
if ($PView->getPermission("image",$comment['commentImageId'],"View")) {
array_push($commentArray,$comment);
}
}
// here starts the html code
// script for DIV opener
$pv_text = "";
$pv_text .= "<script type='text/javascript' src = '".$pv_path."pview.js'></script>";
// basic stats
$pv_text .= "<center>";
$pv_text .= "<input class='button' type='button' value='".LAN_MENU_23."' onclick='pv_NewComments()'> ";
$pv_text .= "<input class='button' type='button' value='".LAN_MENU_24."' onclick='pv_OwnComments()'> ";
$pv_text .= "</center>";
$pv_text .= "<div name='pview_menu_NewComments' id='pview_menu_NewComments' style='display:block;'>";
$pv_text .= "<br /><table width='95%'>";
if (count($commentArray)) {
$comm_count = 1;
foreach($commentArray as $key => $dataset) {
$user = $PView ->getUserData($dataset['commente107userId']);
$resize = $PView -> getResizePath($dataset['commentImageId']);
$name = $PView -> getImageName($dataset['commentImageId']);
switch ($script) {
case "noscript":
// image will open in pviewgallery
$pv_Link = "<a href='".e_PLUGIN."pviewgallery/pviewgallery.php?image=".$dataset['commentImageId']."'>";
break;
case "lightbox":
// image will open in lightbox group
$pv_Link = "<a href='".$resize."' rel='lightbox[pview_menu_coml]' title='".$name."'>";
break;
case "shadowbox":
// image will open in shadowbox group
$pv_Link = "<a href='".$resize."' rel='shadowbox[pview_menu_coml]' title='".$name."'>";
break;
case "highslide":
// image will open in highslide group
if ($PView->getPView_config("img_Link_extJS_pview")) {
$pv_Link = "<a href='".$resize."' class='highslide' onclick=\"return hs.expand(this,pview_menu_coml)\" title='".$name."'>";
} else {
// ehighslide plugin compatible
$pv_Link = "<a href='".$resize."' class='highslide' onclick='return hs.expand(this)' title='".$name."'>";
}
break;
}
// Preview text without html format (delete also [html] tags if WYSIWYG is used for write comment)
$preview_Text = mb_substr(strip_tags($tp->toHTML($dataset['commentText'], TRUE)),0,$PView -> getPView_config('menu_comm_length'),'UTF-8');
$pv_text .= "<tr><td style='padding-bottom:5px;'>".$user['user_name'].", ".date('d.m.Y',$dataset['commentDate']).":<br />".$pv_Link.$preview_Text." ...</a></td></tr>";
if ($comm_count++ > $PView -> getPView_config('menu_comm_count')-1) { break; }
}
$pv_text .= "<tr><td><br />".LAN_MENU_25." ".$PView -> getPView_config('menu_comm_count')." ".LAN_MENU_26."</td></tr>";
} else {
$pv_text .= "<tr><td>".LAN_IMAGE_28."</td></tr>";
}
$pv_text .= "</table></div>";
$pv_text .= "<div name='pview_menu_OwnComments' id='pview_menu_OwnComments' style='display:none;'>";
$pv_text .= "<br /><table width='95%'>";
if (count($commentArray) AND USERID <> 0) {
$comm_count = 1;
foreach($commentArray as $key => $dataset) {
if (USERID == $dataset['commente107userId']){
$user = $PView ->getUserData($dataset['commente107userId']);
$resize = $PView -> getResizePath($dataset['commentImageId']);
$name = $PView -> getImageName($dataset['commentImageId']);
switch ($script) {
case "noscript":
// image will open in pviewgallery
$pv_Link = "<a href='".e_PLUGIN."pviewgallery/pviewgallery.php?image=".$dataset['commentImageId']."'>";
break;
case "lightbox":
// image will open in lightbox group
$pv_Link = "<a href='".$resize."' rel='lightbox[pview_menu_como]' title='".$name."'>";
break;
case "shadowbox":
// image will open in shadowbox group
$pv_Link = "<a href='".$resize."' rel='shadowbox[pview_menu_como]' title='".$name."'>";
break;
case "highslide":
// image will open in highslide group
if ($PView->getPView_config("img_Link_extJS_pview")) {
$pv_Link = "<a href='".$resize."' class='highslide' onclick=\"return hs.expand(this,pview_menu_como)\" title='".$name."'>";
} else {
// ehighslide plugin compatible
$pv_Link = "<a href='".$resize."' class='highslide' onclick='return hs.expand(this)' title='".$name."'>";
}
break;
}
// Preview text without html format (delete also [html] tags if WYSIWYG is used for write comment)
$preview_Text = mb_substr(strip_tags($tp->toHTML($dataset['commentText'], TRUE)),0,$PView -> getPView_config('menu_comm_length'),'UTF-8');
$pv_text .= "<tr><td style='padding-bottom:5px;'>".$user['user_name'].", ".date('d.m.Y',$dataset['commentDate']).":<br />".$pv_Link.$preview_Text." ...</a></td></tr>";
if ($comm_count++ > $PView -> getPView_config('menu_comm_count')-1) { break; }
}
}
if ($comm_count == 1){
$pv_text .= "<tr><td>".LAN_IMAGE_28."</td></tr>";
} else {
$pv_text .= "<tr><td><br />".LAN_MENU_25." ".$PView -> getPView_config('menu_comm_count')." ".LAN_MENU_26."</td></tr>";
}
} else {
$pv_text .= "<tr><td>".LAN_IMAGE_28."</td></tr>";
}
$pv_text .= "</table></div>";
$ns->tablerender(LAN_MENU_27, $pv_text,'pview');
?>