SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | /* | |
3 | ===================================================== | |
4 | DataLife Engine - by SoftNews Media Group | |
5 | ----------------------------------------------------- | |
6 | http://dle-news.ru/ | |
7 | ----------------------------------------------------- | |
8 | Copyright (c) 2004-2018 SoftNews Media Group | |
9 | ===================================================== | |
10 | This code is protected by copyright | |
11 | ===================================================== | |
12 | File: show.full.php | |
13 | ----------------------------------------------------- | |
14 | Use: View full news and comments | |
15 | ===================================================== | |
16 | */ | |
17 | ||
18 | if( !defined('DATALIFEENGINE') ) { | |
19 | header( "HTTP/1.1 403 Forbidden" ); | |
20 | header ( 'Location: ../../' ); | |
21 | die( "Hacking attempt!" ); | |
22 | } | |
23 | ||
24 | //first | |
25 | function fadhelbbcode($content) { | |
26 | $search = array ( | |
27 | '/(\[b\])(.*?)(\[\/b\])/', | |
28 | '/(\[i\])(.*?)(\[\/i\])/', | |
29 | '/(\[u\])(.*?)(\[\/u\])/', | |
30 | '/(\[img\])(.*?)(\[\/img\])/', | |
31 | '/(\[ul\])(.*?)(\[\/ul\])/', | |
32 | '/(\[li\])(.*?)(\[\/li\])/', | |
33 | '/(\[url=)(.*?)(\])(.*?)(\[\/url\])/', | |
34 | '/(\[url\])(.*?)(\[\/url\])/' | |
35 | ); | |
36 | ||
37 | $replace = array ( | |
38 | '<strong>$2</strong>', | |
39 | '<em>$2</em>', | |
40 | '<u>$2</u>', | |
41 | '<img src="$2" />', | |
42 | '<ul>$2</ul>', | |
43 | '<li>$2</li>', | |
44 | '<a href="$2" target="_blank">$4</a>', | |
45 | '<a href="$2" target="_blank">$2</a>' | |
46 | ); | |
47 | ||
48 | return preg_replace($search, $replace, str_replace("\n", "<br />", $content)); | |
49 | } | |
50 | ||
51 | function getLangue($langueid) { | |
52 | switch($langueid) | |
53 | { | |
54 | case 1: | |
55 | return "FRENCH"; | |
56 | break; | |
57 | case 2: | |
58 | return "TRUEFRENCH"; | |
59 | break; | |
60 | case 3: | |
61 | return "VOSTFR"; | |
62 | break; | |
63 | case 4: | |
64 | return "VO"; | |
65 | break; | |
66 | case 5: | |
67 | return "VFSTFR"; | |
68 | break; | |
69 | case 6: | |
70 | return "MULTI"; | |
71 | break; | |
72 | default: | |
73 | return "Introuvable"; | |
74 | break; | |
75 | } | |
76 | } | |
77 | ||
78 | function getqualite($qualiteid) { | |
79 | $qualite = "Inconnue"; | |
80 | switch($qualiteid) { | |
81 | case 1: $qualite = "DVDRIP"; break; | |
82 | case 2: $qualite = "BDRIP"; break; | |
83 | case 3: $qualite = "BRRIP"; break; | |
84 | case 4: $qualite = "Webrip"; break; | |
85 | case 5: $qualite = "TeleSync (TS)"; break; | |
86 | case 6: $qualite = "CAM"; break; | |
87 | case 7: $qualite = "DVDSCR"; break; | |
88 | case 8: $qualite = "R5"; break; | |
89 | case 9: $qualite = "R6"; break; | |
90 | case 10: $qualite = "DVD-R"; break; | |
91 | case 11: $qualite = "Full-DVD"; break; | |
92 | case 12: $qualite = "IMG"; break; | |
93 | case 13: $qualite = "ISO"; break; | |
94 | case 14: $qualite = "HDTV"; break; | |
95 | case 15: $qualite = "HDRip"; break; | |
96 | case 16: $qualite = "Blu-Ray 720p"; break; | |
97 | case 17: $qualite = "Blu-Ray 1080p"; break; | |
98 | case 18: $qualite = "Blu-Ray 3D"; break; | |
99 | case 19: $qualite = "PDTV"; break; | |
100 | case 20: $qualite = "TVrip"; break; | |
101 | case 21: $qualite = "TeleCine (TC)"; break; | |
102 | case 22: $qualite = "EXE"; break; | |
103 | case 23: $qualite = "MP3"; break; | |
104 | case 24: $qualite = "FLAC"; break; | |
105 | case 25: $qualite = "M4A"; break; | |
106 | case 26: $qualite = "PDF"; break; | |
107 | case 27: $qualite = "Autre"; break; | |
108 | case 28: $qualite = "CBR"; break; | |
109 | case 29: $qualite = "CBZ"; break; | |
110 | case 30: $qualite = "IPA"; break; | |
111 | case 31: $qualite = "HD 720p"; break; | |
112 | case 32: $qualite = "DVDRIP MD"; break; | |
113 | case 33: $qualite = "DVDRIP LD"; break; | |
114 | case 34: $qualite = "BDRIP MD"; break; | |
115 | case 35: $qualite = "BDRIP LD"; break; | |
116 | case 36: $qualite = "BRRIP MD"; break; | |
117 | case 37: $qualite = "BRRIP LD"; break; | |
118 | case 38: $qualite = "DVDSCR MD"; break; | |
119 | case 39: $qualite = "DVDSCR LD"; break; | |
120 | case 40: $qualite = "R5 MD"; break; | |
121 | case 41: $qualite = "TS MD"; break; | |
122 | case 42: $qualite = "TS LD"; break; | |
123 | case 43: $qualite = "Web-DL"; break; | |
124 | case 44: $qualite = "HDRiP MD"; break; | |
125 | case 45: $qualite = "HDTS MD"; break; | |
126 | case 46: $qualite = "CAM MD"; break; | |
127 | case 47: $qualite = "HDCAM"; break; | |
128 | case 48: $qualite = "TC"; break; | |
129 | case 49: $qualite = "HDLight 720p"; break; | |
130 | case 50: $qualite = "HDLight 1080p"; break; | |
131 | case 51: $qualite = "DVDRIP MKV"; break; | |
132 | case 52: $qualite = "HD 1080p"; break; | |
133 | case 53: $qualite = "ULTRA HD (X265)"; break; | |
134 | case 54: $qualite = "WEB-DL 720p"; break; | |
135 | case 55: $qualite = "WEB-DL 1080p"; break; | |
136 | } | |
137 | return $qualite; | |
138 | } | |
139 | function decrypt($str) { | |
140 | ||
141 | } | |
142 | function getHost($lien) { | |
143 | $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/telechargement.gif\" />"; | |
144 | echo $lien; | |
145 | if(preg_match('/1fichier.com/i',$lien)) { $lienss = "<div style=\"font-weight:bold;color:black\">1fichier</div>"; } | |
146 | else if(preg_match('/queenshare.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/queenshare.gif\" />"; } | |
147 | else if(preg_match('/depositfiles.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/depositfiles.gif\" />"; } | |
148 | else if(preg_match('/uptobox.com/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:#333ba8\">Uptobox</div>"; } | |
149 | else if(preg_match('/ul.to/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:#536aae\">Uploaded</div>"; } | |
150 | else if(preg_match('/uploaded.net/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:#536aae\">Uploaded</div>"; } | |
151 | else if(preg_match('/bayfiles.net/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/bayfiles.gif\" />"; } | |
152 | else if(preg_match('/uploadhero.co/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/uploadhero.gif\" />"; } | |
153 | else if(preg_match('/go4up.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/go4up.gif\" />"; } | |
154 | else if(preg_match('/turbobit.net/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:#f47445\">Turbobit</div>"; } | |
155 | else if(preg_match('/dl.free.fr/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/free.gif\" />"; } | |
156 | else if(preg_match('/mega.co.nz/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/mega.gif\" />"; } | |
157 | else if(preg_match('/clz.to/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/cloudzer.gif\" />"; } | |
158 | else if(preg_match('/rapidgator/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:#fbaf4e\">Rapidgator</div>"; } | |
159 | else if(preg_match('/hitfile.net/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/hitfile.gif\" />"; } | |
160 | else if(preg_match('/fileparadox.in/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/fileparadox.gif\" />"; } | |
161 | else if(preg_match('/bitshare.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/bitshare.gif\" />"; } | |
162 | else if(preg_match('/freakshare.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/freakshare.gif\" />"; } | |
163 | else if(preg_match('/megashares.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/megashares.gif\" />"; } | |
164 | else if(preg_match('/usefile.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/usefile.gif\" />"; } | |
165 | else if(preg_match('/uploadable.ch/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/uploadable.gif\" />"; } | |
166 | else if(preg_match('/letitbit.net/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/letitbit.gif\" />"; } | |
167 | else if(preg_match('/hulkfile.eu/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/hulkfile.gif\" />"; } | |
168 | else if(preg_match('/billionuploads.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/billionuploads.gif\" />"; } | |
169 | else if(preg_match('/youwatch.org/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:#167b98\">Youwatch</div>"; } | |
170 | else if(preg_match('/videoweed.es/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/videoweed.gif\" />"; } | |
171 | else if(preg_match('/exashare.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/exashare.gif\" />"; } | |
172 | else if(preg_match('/nowvideo.sx/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/nowvideo.gif\" />"; } | |
173 | else if(preg_match('/moevideo.net/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/moevideo.gif\" />"; } | |
174 | else if(preg_match('/streaming.zone-telechargement1.com/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:green\">REGARDER EN STREAMING</div>"; } | |
175 | else if(preg_match('/streamzt.com/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:#087f34\">REGARDER EN STREAMING </div>"; } | |
176 | else if(preg_match('/nitroflare.com/',$lien)) { $lienss = "<div style=\"font-weight:bold;color:#5390a8\">Nitroflare</div>"; } | |
177 | else if(preg_match('/exoshare.com/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/exoshare.gif\" />"; } | |
178 | else if(preg_match('/jheberg.net/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/jheberg.gif\" />"; } | |
179 | else if(preg_match('/multiup.org/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/multiup.gif\" />"; } | |
180 | else if(preg_match('/rockfile.eu/',$lien)) { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/rockfile.gif\" />"; } | |
181 | else { $lienss = "<img style=\"padding-bottom: 5px;padding-top: 5px;\" src=\"http://www.telechargementz.tv/prez/images/hosts/telechargement.gif\" />"; } | |
182 | return "<b>".$lienss."</b>"; | |
183 | } | |
184 | ||
185 | function isStreaming($lien) | |
186 | { | |
187 | if(preg_match('/youwatch.org/',$lien)) { return 1; } | |
188 | if(preg_match('/videoweed.es/',$lien)) { return 1; } | |
189 | if(preg_match('/exashare.com/',$lien)) { return 1; } | |
190 | if(preg_match('/nowvideo.sx/',$lien)) { return 1; } | |
191 | if(preg_match('/moevideo.net/',$lien)) { return 1; } | |
192 | if(preg_match('/streamzt.com/',$lien)) { return 1; } | |
193 | ||
194 | return 0; | |
195 | } | |
196 | function protectidd($lienapdd, $proti) | |
197 | { | |
198 | $desxk = $lienapdd; | |
199 | if($proti == true) | |
200 | { | |
201 | // $desxk = str_replace(["http://","https://","uptobox","1fichier","uploaded","ul.to","rapidgator","turbobit","nitroflare","streaming.zone-telechargement1",".com",".net",".org","video","embed","/","#", "?"], ["123455600","123455601","123455602","123455603","123455604","123455605","123455606","123455607","123455608","123455609","123455610","123455611","123455612","123455613","123455614","123455615","123455616","123455617"], $desxk); | |
202 | $hash = ''; | |
203 | $_3num = ''; | |
204 | $noAlphChar = array(':' => 27 , '.' => 28 , '?' => 29, '#' => 30 ,'-' => 31 , '/' => 32 ); | |
205 | $number = array('f','l','r','k','z','x','h','o','m','n'); | |
206 | foreach (str_split($desxk) as $pos => $var) | |
207 | { | |
208 | if(ctype_alpha($var)) | |
209 | { | |
210 | if(ctype_upper($var)) | |
211 | { | |
212 | $num = (ord($var) - ord('A') + 1) + (rand(1,5)*33); | |
213 | $hash .= '00'.$num ; | |
214 | } | |
215 | else | |
216 | { | |
217 | $num = (ord($var) - ord('a') + 1) + (rand(1,5)*33) ; | |
218 | $hash .= $num ; | |
219 | } | |
220 | } | |
221 | else | |
222 | { | |
223 | if(isset($noAlphChar[$var])) | |
224 | $num = $noAlphChar[$var] + (rand(1,5)*33); | |
225 | else | |
226 | $num = $number[intval($var)] ; | |
227 | $hash .= '0'.$num; | |
228 | } | |
229 | //this code for now when we shold get 3 number or just 2 number | |
230 | if($num >= 100) | |
231 | { | |
232 | $split_array = array('u','w','i','b','v','c','t','q'); | |
233 | $_3num .= $split_array[rand(0,7)].$pos; | |
234 | } | |
235 | } | |
236 | ||
237 | $hash .= $_3num; | |
238 | } | |
239 | //return $desxk; | |
240 | return $hash; | |
241 | } | |
242 | function formatLiens($lienet, $prot = true) | |
243 | { | |
244 | $word = iconv("UTF-8", "ISO-8859-1", "Télécharger"); | |
245 | ||
246 | if(isStreaming($lienet)) | |
247 | { | |
248 | $word = "Regarder"; | |
249 | } | |
250 | if(strpos($lienet, "::") !== false) | |
251 | { | |
252 | $expx = explode("::", $lienet); | |
253 | $word = "Episode ".$expx[0]; | |
254 | $lienet = $expx[1]; | |
255 | } | |
256 | if(strpos($lienet, ";") !== false) | |
257 | { | |
258 | $word = "Partie "; | |
259 | $parties = explode(";", $lienet); | |
260 | $partiet = ""; | |
261 | for($i = 0; $i <= sizeof($parties); $i++) | |
262 | { | |
263 | if(isset($parties[$i])) | |
264 | { | |
265 | $partiet .= '<a target="_blank" href="https://www.dl-protect1.com/'.protectidd($parties[$i], $prot).'">'.utf8_encode($word.($i+1)).'</a><br />'; | |
266 | } | |
267 | } | |
268 | return $partiet; | |
269 | } | |
270 | else | |
271 | { | |
272 | return '<a target="_blank" href="https://www.dl-protect1.com/'.protectidd($lienet, $prot).'">'.utf8_encode($word).'</a>'; | |
273 | } | |
274 | } | |
275 | // | |
276 | ||
277 | $allow_list = explode( ',', $user_group[$member_id['user_group']]['allow_cats'] ); | |
278 | $not_allow_cats = explode ( ',', $user_group[$member_id['user_group']]['not_allow_cats'] ); | |
279 | ||
280 | $perm = 1; | |
281 | $i = 0; | |
282 | $news_found = false; | |
283 | $allow_full_cache = false; | |
284 | ||
285 | if ( $config['allow_alt_url'] AND !$config['seo_type'] ) $cprefix = "full"; else $cprefix = "full_".$newsid; | |
286 | ||
287 | $row = dle_cache ( $cprefix, $sql_news ); | |
288 | ||
289 | if( $row ) { | |
290 | ||
291 | $row = json_decode($row, true); | |
292 | ||
293 | } | |
294 | ||
295 | if ( is_array($row) ) { | |
296 | ||
297 | $full_cache = true; | |
298 | ||
299 | } else { | |
300 | ||
301 | $row = $db->super_query( $sql_news ); | |
302 | $full_cache = false; | |
303 | } | |
304 | ||
305 | $options = news_permission( $row['access'] ); | |
306 | ||
307 | if( $options[$member_id['user_group']] AND $options[$member_id['user_group']] != 3 ) $perm = 1; | |
308 | if( $options[$member_id['user_group']] == 3 ) $perm = 0; | |
309 | ||
310 | if( $options[$member_id['user_group']] == 1 ) $user_group[$member_id['user_group']]['allow_addc'] = 0; | |
311 | if( $options[$member_id['user_group']] == 2 ) $user_group[$member_id['user_group']]['allow_addc'] = 1; | |
312 | ||
313 | if( $row['id'] AND !$row['approve'] AND $member_id['name'] != $row['autor'] AND !$user_group[$member_id['user_group']]['allow_all_edit'] ) $perm = 0; | |
314 | if( !$row['approve'] ) $allow_comments = false; | |
315 | ||
316 | if ($row['id'] AND $config['no_date'] AND !$config['news_future'] AND !$user_group[$member_id['user_group']]['allow_all_edit']) { | |
317 | ||
318 | if( strtotime($row['date']) > $_TIME ) { | |
319 | $perm = 0; | |
320 | } | |
321 | ||
322 | } | |
323 | ||
324 | if ($row['id'] AND $row['need_pass'] AND $member_id['user_group'] > 2 ) { | |
325 | ||
326 | if( trim($_POST['news_password']) ) { | |
327 | $pass = $db->super_query( "SELECT password FROM " . PREFIX . "_post_pass WHERE news_id='{$row['id']}' " ); | |
328 | $pass = explode("\n", str_replace("\r", "", $pass['password'])); | |
329 | $n_passwords = array(); | |
330 | ||
331 | foreach ($pass as $value) { | |
332 | $value = trim( $value ); | |
333 | if($value) $n_passwords[] = $value; | |
334 | } | |
335 | ||
336 | unset($value);unset($pass); | |
337 | ||
338 | if (in_array(trim($_POST['news_password']), $n_passwords)) { | |
339 | $_SESSION['news_pass_'.$row['id'].''] = 1; | |
340 | } | |
341 | ||
342 | unset($n_passwords); | |
343 | } | |
344 | ||
345 | if( !$_SESSION['news_pass_'.$row['id'].''] ) { | |
346 | ||
347 | $perm = 0; | |
348 | ||
349 | } else $row['need_pass'] = false; | |
350 | ||
351 | } | |
352 | ||
353 | if ($config['category_separator'] != ',') $config['category_separator'] = ' '.$config['category_separator']; | |
354 | ||
355 | if( ! $row['category'] ) { | |
356 | $my_cat = "---"; | |
357 | $my_cat_link = "---"; | |
358 | } else { | |
359 | ||
360 | $my_cat = array (); | |
361 | $my_cat_link = array (); | |
362 | $cat_list = explode( ',', $row['category'] ); | |
363 | ||
364 | if( count( $cat_list ) == 1 ) { | |
365 | ||
366 | if( $allow_list[0] != "all" AND !in_array( $cat_list[0], $allow_list ) ) $perm = 0; | |
367 | ||
368 | if( $not_allow_cats[0] != "" AND in_array( $cat_list[0], $not_allow_cats ) ) $perm = 0; | |
369 | ||
370 | $my_cat[] = $cat_info[$cat_list[0]]['name']; | |
371 | ||
372 | $my_cat_link = get_categories( $cat_list[0], $config['category_separator'] ); | |
373 | ||
374 | } else { | |
375 | ||
376 | foreach ( $cat_list as $element ) { | |
377 | ||
378 | if( $allow_list[0] != "all" AND !in_array( $element, $allow_list ) ) $perm = 0; | |
379 | ||
380 | if( $not_allow_cats[0] != "" AND in_array( $element, $not_allow_cats ) ) $perm = 0; | |
381 | ||
382 | if( $element ) { | |
383 | $my_cat[] = $cat_info[$element]['name']; | |
384 | if( $config['allow_alt_url'] ) $my_cat_link[] = "<a href=\"" . $config['http_home_url'] . get_url( $element ) . "/\">{$cat_info[$element]['name']}</a>"; | |
385 | else $my_cat_link[] = "<a href=\"$PHP_SELF?do=cat&category={$cat_info[$element]['alt_name']}\">{$cat_info[$element]['name']}</a>"; | |
386 | } | |
387 | } | |
388 | ||
389 | $my_cat_link = implode( "{$config['category_separator']} ", $my_cat_link ); | |
390 | } | |
391 | ||
392 | $my_cat = implode( "{$config['category_separator']} ", $my_cat ); | |
393 | } | |
394 | ||
395 | if ( $row['id'] AND $perm ) { | |
396 | ||
397 | $config['fullcache_days'] = intval($config['fullcache_days']); | |
398 | ||
399 | if( $config['fullcache_days'] < 1 ) $config['fullcache_days'] = 30; | |
400 | ||
401 | if( strtotime($row['date']) >= ($_TIME - ($config['fullcache_days'] * 86400)) ) { | |
402 | ||
403 | $allow_full_cache = true; | |
404 | ||
405 | } | |
406 | ||
407 | define( 'NEWS_ID', $row['id'] ); | |
408 | ||
409 | $disable_index = $row['disable_index']; | |
410 | $news_author = $row['user_id']; | |
411 | ||
412 | $xfields = xfieldsload(); | |
413 | ||
414 | if( $row['votes'] AND $view_template != "print" ) include_once (DLEPlugins::Check(ENGINE_DIR . '/modules/poll.php')); | |
415 | ||
416 | $category_id = intval( $row['category'] ); | |
417 | ||
418 | if( $view_template == "print" ) $tpl->load_template( 'print.tpl' ); | |
419 | elseif( $category_id and $cat_info[$category_id]['full_tpl'] != '' ) $tpl->load_template( $cat_info[$category_id]['full_tpl'] . '.tpl' ); | |
420 | else $tpl->load_template( 'fullstory.tpl' ); | |
421 | ||
422 | if( stripos( $tpl->copy_template, "{next-url}" ) !== false OR stripos( $tpl->copy_template, "{prev-url}" ) !== false) { | |
423 | $link = ""; | |
424 | $prev_next = false; | |
425 | ||
426 | if( $allow_full_cache ) { | |
427 | $prev_next = dle_cache ( "news", "next_prev_l_".$row['id'] ); | |
428 | if( $prev_next ) $prev_next = json_decode($prev_next, true); | |
429 | } | |
430 | ||
431 | if( !is_array($prev_next) ) { | |
432 | ||
433 | $row_link = $db->super_query( "SELECT id, date, category, alt_name FROM " . PREFIX . "_post WHERE category = '{$row['category']}' AND date >= '{$row['date']}' AND id != '{$row['id']}' AND approve = '1' ORDER BY date ASC LIMIT 1" ); | |
434 | ||
435 | if( $row_link['id'] ) { | |
436 | if( $config['allow_alt_url'] ) { | |
437 | if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 ) { | |
438 | if( intval( $row_link['category'] ) and $config['seo_type'] == 2 ) { | |
439 | $link = $config['http_home_url'] . get_url( intval( $row_link['category'] ) ) . "/" . $row_link['id'] . "-" . $row_link['alt_name'] . ".html"; | |
440 | } else { | |
441 | $link = $config['http_home_url'] . $row_link['id'] . "-" . $row_link['alt_name'] . ".html"; | |
442 | } | |
443 | } else { | |
444 | $link = $config['http_home_url'] . date( 'Y/m/d/', strtotime( $row_link['date'] ) ) . $row_link['alt_name'] . ".html"; | |
445 | } | |
446 | } else { | |
447 | $link = $config['http_home_url'] . "index.php?newsid=" . $row_link['id']; | |
448 | } | |
449 | } | |
450 | $prev_next['next_link'] = $link; | |
451 | $link = ""; | |
452 | ||
453 | $row_link = $db->super_query( "SELECT id, date, category, alt_name FROM " . PREFIX . "_post WHERE category = '{$row['category']}' AND date <= '{$row['date']}' AND id != '{$row['id']}' AND approve = '1' ORDER BY date DESC LIMIT 1" ); | |
454 | ||
455 | if( $row_link['id'] ) { | |
456 | if( $config['allow_alt_url'] ) { | |
457 | if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 ) { | |
458 | if( intval( $row_link['category'] ) and $config['seo_type'] == 2 ) { | |
459 | $link = $config['http_home_url'] . get_url( intval( $row_link['category'] ) ) . "/" . $row_link['id'] . "-" . $row_link['alt_name'] . ".html"; | |
460 | } else { | |
461 | $link = $config['http_home_url'] . $row_link['id'] . "-" . $row_link['alt_name'] . ".html"; | |
462 | } | |
463 | } else { | |
464 | $link = $config['http_home_url'] . date( 'Y/m/d/', strtotime( $row_link['date'] ) ) . $row_link['alt_name'] . ".html"; | |
465 | } | |
466 | } else { | |
467 | $link = $config['http_home_url'] . "index.php?newsid=" . $row_link['id']; | |
468 | } | |
469 | } | |
470 | $prev_next['prev_link'] = $link; | |
471 | ||
472 | if ($allow_full_cache) create_cache ( "news", json_encode($prev_next, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ), "next_prev_l_".$row['id'] ); | |
473 | ||
474 | } | |
475 | ||
476 | if ( $prev_next['next_link'] ) { | |
477 | $tpl->set( '[next-url]', "" ); | |
478 | $tpl->set( '[/next-url]', "" ); | |
479 | $tpl->set( '{next-url}', $prev_next['next_link'] ); | |
480 | } else { | |
481 | $tpl->set( '{next-url}', "" ); | |
482 | $tpl->set_block( "'\\[next-url\\](.*?)\\[/next-url\\]'si", "" ); | |
483 | } | |
484 | if ( $prev_next['prev_link'] ) { | |
485 | $tpl->set( '[prev-url]', "" ); | |
486 | $tpl->set( '[/prev-url]', "" ); | |
487 | $tpl->set( '{prev-url}', $prev_next['prev_link'] ); | |
488 | } else { | |
489 | $tpl->set( '{prev-url}', "" ); | |
490 | $tpl->set_block( "'\\[prev-url\\](.*?)\\[/prev-url\\]'si", "" ); | |
491 | } | |
492 | ||
493 | } | |
494 | ||
495 | if( $config['allow_read_count'] AND !$news_page AND !$cstart) { | |
496 | if ( $config['allow_read_count'] == 2 ) { | |
497 | ||
498 | $readcount = $db->super_query( "SELECT count(*) as count FROM " . PREFIX . "_read_log WHERE news_id='{$row['id']}' AND ip='{$_IP}'" ); | |
499 | ||
500 | if( !$readcount['count'] ) { | |
501 | ||
502 | if( $config['cache_count'] ) $db->query( "INSERT INTO " . PREFIX . "_views (news_id) VALUES ('{$row['id']}')" ); | |
503 | else $db->query( "UPDATE " . PREFIX . "_post_extras SET news_read=news_read+1 WHERE news_id='{$row['id']}'" ); | |
504 | ||
505 | $db->query( "INSERT INTO " . PREFIX . "_read_log (news_id, ip) VALUES ('{$row['id']}', '{$_IP}')" ); | |
506 | } | |
507 | ||
508 | } else { | |
509 | ||
510 | if( $config['cache_count'] ) $db->query( "INSERT INTO " . PREFIX . "_views (news_id) VALUES ('{$row['id']}')" ); | |
511 | else $db->query( "UPDATE " . PREFIX . "_post_extras SET news_read=news_read+1 WHERE news_id='{$row['id']}'" ); | |
512 | } | |
513 | } | |
514 | ||
515 | if ($allow_full_cache AND !$full_cache) create_cache ( $cprefix, json_encode($row, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ), $sql_news ); | |
516 | ||
517 | $news_found = TRUE; | |
518 | $row['date'] = strtotime( $row['date'] ); | |
519 | ||
520 | if( (strlen( $row['full_story'] ) < 13) and (strpos( $tpl->copy_template, "{short-story}" ) === false) ) { | |
521 | $row['full_story'] = $row['short_story']; | |
522 | } | |
523 | ||
524 | if( ! $news_page ) { | |
525 | $news_page = 1; | |
526 | } | |
527 | ||
528 | if( $config['allow_alt_url'] ) { | |
529 | ||
530 | if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 ) { | |
531 | ||
532 | if( $category_id AND $config['seo_type'] == 2 ) { | |
533 | ||
534 | $c_url = get_url( $category_id ); | |
535 | $full_link = $config['http_home_url'] . $c_url . "/" . $row['id'] . "-" . $row['alt_name'] . ".html"; | |
536 | ||
537 | if ($config['seo_control'] AND ( isset($_GET['seourl']) OR strpos ( $_SERVER['REQUEST_URI'], "?" ) !== false ) ) { | |
538 | ||
539 | if ($_GET['seourl'] != $row['alt_name'] OR $_GET['seocat'] != $c_url OR strpos ( $_SERVER['REQUEST_URI'], "?" ) !== false OR ($_GET['news_page'] == 1 AND $cstart < 2 AND $view_template != "print") OR ($view_template == "print" AND $news_page > 1) ) { | |
540 | ||
541 | $re_url = explode ( "index.php", strtolower ( $_SERVER['PHP_SELF'] ) ); | |
542 | $re_url = reset ( $re_url ); | |
543 | ||
544 | header("HTTP/1.0 301 Moved Permanently"); | |
545 | header("Location: {$re_url}{$c_url}/{$row['id']}-{$row['alt_name']}.html"); | |
546 | die("Redirect"); | |
547 | ||
548 | } | |
549 | ||
550 | } | |
551 | ||
552 | $print_link = $config['http_home_url'] . $c_url . "/print:page,1," . $row['id'] . "-" . $row['alt_name'] . ".html"; | |
553 | $short_link = $config['http_home_url'] . $c_url . "/"; | |
554 | $row['alt_name'] = $row['id'] . "-" . $row['alt_name']; | |
555 | $link_page = $config['http_home_url'] . $c_url . "/" . 'page,' . $news_page . ','; | |
556 | $news_name = $row['alt_name']; | |
557 | ||
558 | } else { | |
559 | ||
560 | $full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html"; | |
561 | ||
562 | if ($config['seo_control'] AND ( isset($_GET['seourl']) OR strpos ( $_SERVER['REQUEST_URI'], "?" ) !== false ) ) { | |
563 | ||
564 | if ($_GET['seourl'] != $row['alt_name'] OR $_GET['seocat'] OR $_GET['news_name'] OR strpos ( $_SERVER['REQUEST_URI'], "?" ) !== false OR ($_GET['news_page'] == 1 AND $cstart < 2 AND $view_template != "print") OR ($view_template == "print" AND $news_page > 1) ) { | |
565 | ||
566 | $re_url = explode ( "index.php", strtolower ( $_SERVER['PHP_SELF'] ) ); | |
567 | $re_url = reset ( $re_url ); | |
568 | ||
569 | header("HTTP/1.0 301 Moved Permanently"); | |
570 | header("Location: {$re_url}{$row['id']}-{$row['alt_name']}.html"); | |
571 | die("Redirect"); | |
572 | ||
573 | } | |
574 | ||
575 | } | |
576 | ||
577 | $print_link = $config['http_home_url'] . "print:page,1," . $row['id'] . "-" . $row['alt_name'] . ".html"; | |
578 | $short_link = $config['http_home_url']; | |
579 | $row['alt_name'] = $row['id'] . "-" . $row['alt_name']; | |
580 | $link_page = $config['http_home_url'] . 'page,' . $news_page . ','; | |
581 | $news_name = $row['alt_name']; | |
582 | ||
583 | } | |
584 | ||
585 | } else { | |
586 | ||
587 | $full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html"; | |
588 | ||
589 | if ( $config['seo_control'] ) { | |
590 | ||
591 | if ($_GET['newsid'] OR strpos ( $_SERVER['REQUEST_URI'], "?" ) !== false OR ($_GET['news_page'] == 1 AND $cstart < 2 AND $view_template != "print") OR ($view_template == "print" AND $news_page > 1) ) { | |
592 | ||
593 | $re_url = explode ( "index.php", strtolower ( $_SERVER['PHP_SELF'] ) ); | |
594 | $re_url = reset ( $re_url ); | |
595 | ||
596 | header("HTTP/1.0 301 Moved Permanently"); | |
597 | header("Location: {$re_url}".date( 'Y/m/d/', $row['date'] ).$row['alt_name'].".html"); | |
598 | die("Redirect"); | |
599 | ||
600 | } | |
601 | ||
602 | } | |
603 | ||
604 | $print_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . "print:page,1," . $row['alt_name'] . ".html"; | |
605 | $short_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ); | |
606 | $link_page = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . 'page,' . $news_page . ','; | |
607 | $news_name = $row['alt_name']; | |
608 | ||
609 | } | |
610 | ||
611 | } else { | |
612 | ||
613 | $full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id']; | |
614 | $print_link = $config['http_home_url'] . "index.php?mod=print&newsid=" . $row['id']; | |
615 | $short_link = ""; | |
616 | $link_page = ""; | |
617 | $news_name = ""; | |
618 | ||
619 | } | |
620 | ||
621 | $i ++; | |
622 | ||
623 | $canonical = $full_link; | |
624 | ||
625 | $news_seiten = explode( "{PAGEBREAK}", $row['full_story'] ); | |
626 | $anzahl_seiten = count( $news_seiten ); | |
627 | ||
628 | if( $news_page <= 0 OR $news_page > $anzahl_seiten OR (isset($_GET['news_page']) AND $_GET['news_page'] === "0") ) { | |
629 | ||
630 | $news_page = 1; | |
631 | ||
632 | if ( $config['seo_control'] ) { | |
633 | $re_url = str_replace( $config['http_home_url'], "/", $full_link ); | |
634 | header("HTTP/1.0 301 Moved Permanently"); | |
635 | header("Location: {$re_url}"); | |
636 | die("Redirect"); | |
637 | } | |
638 | } | |
639 | ||
640 | if( $view_template == "print" ) { | |
641 | ||
642 | $row['full_story'] = str_replace( "{PAGEBREAK}", "", $row['full_story'] ); | |
643 | $row['full_story'] = preg_replace( "'\[page=(.*?)\](.*?)\[/page\]'si", "\\2", $row['full_story'] ); | |
644 | $tpl->set_block( "'\\[pages\\](.*?)\\[/pages\\]'si", "" ); | |
645 | $tpl->set( '{pages}', "" ); | |
646 | ||
647 | } else { | |
648 | ||
649 | $row['full_story'] = $news_seiten[$news_page - 1]; | |
650 | ||
651 | $row['full_story'] = preg_replace( '#(\A[\s]*<br[^>]*>[\s]*|<br[^>]*>[\s]*\Z)#is', '', $row['full_story'] ); // remove <br/> at end of string | |
652 | $news_seiten = ""; | |
653 | unset( $news_seiten ); | |
654 | ||
655 | if( $anzahl_seiten > 1 ) { | |
656 | ||
657 | $tpl2 = new dle_template(); | |
658 | $tpl2->dir = TEMPLATE_DIR; | |
659 | $tpl2->load_template( 'splitnewsnavigation.tpl' ); | |
660 | ||
661 | if( $news_page < $anzahl_seiten ) { | |
662 | $pages = $news_page + 1; | |
663 | ||
664 | if( $config['allow_alt_url'] ) { | |
665 | $nextpage = "<a href=\"" . $short_link . "page," . $pages . "," . $row['alt_name'] . ".html\">"; | |
666 | } else { | |
667 | $nextpage = "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&news_page=" . $pages . "\">"; | |
668 | } | |
669 | ||
670 | $tpl2->set( '[next-link]', $nextpage ); | |
671 | $tpl2->set( '[/next-link]', "</a>" ); | |
672 | ||
673 | } else { | |
674 | ||
675 | $tpl2->set_block( "'\\[next-link\\](.*?)\\[/next-link\\]'si", "<span>\\1</span>" ); | |
676 | ||
677 | } | |
678 | ||
679 | if( $news_page > 1 ) { | |
680 | $pages = $news_page - 1; | |
681 | ||
682 | if( $config['allow_alt_url'] ) { | |
683 | if ( $pages == 1 ) $prevpage = "<a href=\"" . $full_link . "\">"; | |
684 | else $prevpage = "<a href=\"" . $short_link . "page," . $pages . "," . $row['alt_name'] . ".html\">"; | |
685 | } else { | |
686 | if ( $pages == 1 ) $prevpage = "<a href=\"" . $full_link. "\">"; | |
687 | else $prevpage = "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&news_page=" . $pages . "\">"; | |
688 | } | |
689 | ||
690 | $tpl2->set( '[prev-link]', $prevpage ); | |
691 | $tpl2->set( '[/prev-link]', "</a>" ); | |
692 | ||
693 | } else { | |
694 | ||
695 | $tpl2->set_block( "'\\[prev-link\\](.*?)\\[/prev-link\\]'si", "<span>\\1</span>" ); | |
696 | ||
697 | } | |
698 | ||
699 | $listpages =""; | |
700 | ||
701 | if( $anzahl_seiten <= 10 ) { | |
702 | ||
703 | for($j = 1; $j <= $anzahl_seiten; $j ++) { | |
704 | ||
705 | if( $j != $news_page ) { | |
706 | ||
707 | if( $config['allow_alt_url'] ) { | |
708 | ||
709 | if ($j == 1) | |
710 | $listpages .= "<a href=\"" . $full_link . "\">$j</a> "; | |
711 | else | |
712 | $listpages .= "<a href=\"" . $short_link . "page," . $j . "," . $row['alt_name'] . ".html\">$j</a> "; | |
713 | ||
714 | } else { | |
715 | ||
716 | if ($j == 1) | |
717 | $listpages .= "<a href=\"{$full_link}\">$j</a> "; | |
718 | else | |
719 | $listpages .= "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&news_page=" . $j . "\">$j</a> "; | |
720 | ||
721 | } | |
722 | ||
723 | } else { | |
724 | ||
725 | $listpages .= "<span>$j</span> "; | |
726 | ||
727 | if( $config['allow_alt_url'] ) { | |
728 | ||
729 | if($j != 1) $canonical = $short_link . "page," . $j . "," . $row['alt_name'] . ".html"; | |
730 | ||
731 | } else { | |
732 | ||
733 | if($j != 1) $canonical = "$PHP_SELF?newsid=" . $row['id'] . "&news_page=" . $j; | |
734 | ||
735 | } | |
736 | } | |
737 | ||
738 | } | |
739 | ||
740 | } else { | |
741 | ||
742 | $start = 1; | |
743 | $end = 10; | |
744 | $nav_prefix = "<span class=\"nav_ext\">{$lang['nav_trennen']}</span> "; | |
745 | ||
746 | if( $news_page > 1 ) { | |
747 | ||
748 | if( $news_page > 6 ) { | |
749 | ||
750 | $start = $news_page - 4; | |
751 | $end = $start + 8; | |
752 | ||
753 | if( $end >= $anzahl_seiten-1 ) { | |
754 | $start = $anzahl_seiten - 9; | |
755 | $end = $anzahl_seiten - 1; | |
756 | } | |
757 | ||
758 | } | |
759 | ||
760 | } | |
761 | ||
762 | if( $end >= $anzahl_seiten-1 ) $nav_prefix = ""; else $nav_prefix = "<span class=\"nav_ext\">{$lang['nav_trennen']}</span> "; | |
763 | ||
764 | if( $start >= 2 ) { | |
765 | ||
766 | if( $start >= 3 ) $before_prefix = "<span class=\"nav_ext\">{$lang['nav_trennen']}</span> "; else $before_prefix = ""; | |
767 | ||
768 | $listpages .= "<a href=\"" . $full_link . "\">1</a> ".$before_prefix; | |
769 | ||
770 | } | |
771 | ||
772 | for($j = $start; $j <= $end; $j ++) { | |
773 | ||
774 | if( $j != $news_page ) { | |
775 | ||
776 | if( $config['allow_alt_url'] ) { | |
777 | ||
778 | if ($j == 1) | |
779 | $listpages .= "<a href=\"" . $full_link . "\">$j</a> "; | |
780 | else | |
781 | $listpages .= "<a href=\"" . $short_link . "page," . $j . "," . $row['alt_name'] . ".html\">$j</a> "; | |
782 | ||
783 | } else { | |
784 | ||
785 | if ($j == 1) | |
786 | $listpages .= "<a href=\"{$full_link}\">$j</a> "; | |
787 | else | |
788 | $listpages .= "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&news_page=" . $j . "\">$j</a> "; | |
789 | ||
790 | } | |
791 | ||
792 | } else { | |
793 | ||
794 | $listpages .= "<span>$j</span> "; | |
795 | } | |
796 | ||
797 | } | |
798 | ||
799 | if( $news_page != $anzahl_seiten ) { | |
800 | ||
801 | if( $config['allow_alt_url'] ) $listpages .= $nav_prefix . "<a href=\"" . $short_link . "page," . $anzahl_seiten . "," . $row['alt_name'] . ".html\">{$anzahl_seiten}</a>"; | |
802 | else $listpages .= $nav_prefix . "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&news_page=" . $anzahl_seiten . "\">{$anzahl_seiten}</a>"; | |
803 | ||
804 | } else | |
805 | $listpages .= "<span>{$anzahl_seiten}</span> "; | |
806 | ||
807 | } | |
808 | ||
809 | $tpl2->set( '{pages}', $listpages ); | |
810 | $tpl2->compile( 'content' ); | |
811 | ||
812 | $tpl->set( '{pages}', $tpl2->result['content'] ); | |
813 | unset($tpl2); | |
814 | ||
815 | if( $config['allow_alt_url'] ) { | |
816 | ||
817 | $replacepage = "<a href=\"" . $short_link . "page," . "\\1" . "," . $row['alt_name'] . ".html\">\\2</a>"; | |
818 | ||
819 | } else { | |
820 | ||
821 | $replacepage = "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&news_page=\\1\">\\2</a>"; | |
822 | } | |
823 | ||
824 | $row['full_story'] = preg_replace( "'\[page=(.*?)\](.*?)\[/page\]'si", $replacepage, $row['full_story'] ); | |
825 | $tpl->set( '[pages]', "" ); | |
826 | $tpl->set( '[/pages]', "" ); | |
827 | ||
828 | ||
829 | } else { | |
830 | ||
831 | $tpl->set( '{pages}', '' ); | |
832 | $row['full_story'] = preg_replace( "'\[page=(.*?)\](.*?)\[/page\]'si", "", $row['full_story'] ); | |
833 | $tpl->set_block( "'\\[pages\\](.*?)\\[/pages\\]'si", "" ); | |
834 | } | |
835 | } | |
836 | ||
837 | $row['title'] = stripslashes( $row['title'] ); | |
838 | $metatags['title'] = $row['title']; | |
839 | ||
840 | if( $row['keywords'] == '' AND $row['descr'] == '' AND $config['create_metatags'] ) { | |
841 | create_keywords( $row['full_story'] ); | |
842 | } else { | |
843 | $metatags['keywords'] = $row['keywords']; | |
844 | if( $row['descr'] ) $metatags['description'] = $row['descr']; else $metatags['description'] = $row['title']; | |
845 | } | |
846 | ||
847 | if ($row['metatitle']) $metatags['header_title'] = $row['metatitle']; | |
848 | ||
849 | $social_tags['site_name'] = $config['home_title']; | |
850 | $social_tags['type'] = 'article'; | |
851 | $social_tags['title'] = str_replace("&amp;", "&", htmlspecialchars( $row['title'], ENT_QUOTES, $config['charset'] ) ); | |
852 | $social_tags['url'] = $full_link; | |
853 | ||
854 | $comments_num = $row['comm_num']; | |
855 | ||
856 | $news_find = array ('{comments-num}' => number_format($row['comm_num'], 0, ',', ' '), '{views}' => number_format($row['news_read'], 0, ',', ' '), '{category}' => $my_cat, '{link-category}' => $my_cat_link, '{news-id}' => $row['id'] ); | |
857 | ||
858 | if( date( 'Ymd', $row['date'] ) == date( 'Ymd', $_TIME ) ) { | |
859 | ||
860 | $tpl->set( '{date}', $lang['time_heute'] . langdate( ", H:i", $row['date'] ) ); | |
861 | ||
862 | } elseif( date( 'Ymd', $row['date'] ) == date( 'Ymd', ($_TIME - 86400) ) ) { | |
863 | ||
864 | $tpl->set( '{date}', $lang['time_gestern'] . langdate( ", H:i", $row['date'] ) ); | |
865 | ||
866 | } else { | |
867 | ||
868 | $tpl->set( '{date}', langdate( $config['timestamp_active'], $row['date'] ) ); | |
869 | ||
870 | } | |
871 | $news_date = $row['date']; | |
872 | $tpl->copy_template = preg_replace_callback ( "#\{date=(.+?)\}#i", "formdate", $tpl->copy_template ); | |
873 | ||
874 | if ( $row['fixed'] ) { | |
875 | ||
876 | $tpl->set( '[fixed]', "" ); | |
877 | $tpl->set( '[/fixed]', "" ); | |
878 | $tpl->set_block( "'\\[not-fixed\\](.*?)\\[/not-fixed\\]'si", "" ); | |
879 | ||
880 | } else { | |
881 | ||
882 | $tpl->set( '[not-fixed]', "" ); | |
883 | $tpl->set( '[/not-fixed]', "" ); | |
884 | $tpl->set_block( "'\\[fixed\\](.*?)\\[/fixed\\]'si", "" ); | |
885 | } | |
886 | ||
887 | if ( $comments_num ) { | |
888 | ||
889 | if( $row['allow_comm'] ) { | |
890 | ||
891 | $tpl->set( '[comments]', "" ); | |
892 | $tpl->set( '[/comments]', "" ); | |
893 | ||
894 | } else $tpl->set_block( "'\\[comments\\](.*?)\\[/comments\\]'si", "" ); | |
895 | ||
896 | $tpl->set_block( "'\\[not-comments\\](.*?)\\[/not-comments\\]'si", "" ); | |
897 | ||
898 | } else { | |
899 | ||
900 | if( $row['allow_comm'] ) { | |
901 | ||
902 | $tpl->set( '[not-comments]', "" ); | |
903 | $tpl->set( '[/not-comments]', "" ); | |
904 | ||
905 | } else $tpl->set_block( "'\\[not-comments\\](.*?)\\[/not-comments\\]'si", "" ); | |
906 | ||
907 | $tpl->set_block( "'\\[comments\\](.*?)\\[/comments\\]'si", "" ); | |
908 | } | |
909 | ||
910 | if ( $row['votes'] ) { | |
911 | ||
912 | $tpl->set( '[poll]', "" ); | |
913 | $tpl->set( '[/poll]', "" ); | |
914 | $tpl->set_block( "'\\[not-poll\\](.*?)\\[/not-poll\\]'si", "" ); | |
915 | ||
916 | } else { | |
917 | ||
918 | $tpl->set( '[not-poll]', "" ); | |
919 | $tpl->set( '[/not-poll]', "" ); | |
920 | $tpl->set_block( "'\\[poll\\](.*?)\\[/poll\\]'si", "" ); | |
921 | } | |
922 | ||
923 | if( $vk_url ) { | |
924 | $tpl->set( '[vk]', "" ); | |
925 | $tpl->set( '[/vk]', "" ); | |
926 | $tpl->set( '{vk_url}', $vk_url ); | |
927 | } else { | |
928 | $tpl->set_block( "'\\[vk\\](.*?)\\[/vk\\]'si", "" ); | |
929 | $tpl->set( '{vk_url}', '' ); | |
930 | } | |
931 | if( $odnoklassniki_url ) { | |
932 | $tpl->set( '[odnoklassniki]', "" ); | |
933 | $tpl->set( '[/odnoklassniki]', "" ); | |
934 | $tpl->set( '{odnoklassniki_url}', $odnoklassniki_url ); | |
935 | } else { | |
936 | $tpl->set_block( "'\\[odnoklassniki\\](.*?)\\[/odnoklassniki\\]'si", "" ); | |
937 | $tpl->set( '{odnoklassniki_url}', '' ); | |
938 | } | |
939 | if( $facebook_url ) { | |
940 | $tpl->set( '[facebook]', "" ); | |
941 | $tpl->set( '[/facebook]', "" ); | |
942 | $tpl->set( '{facebook_url}', $facebook_url ); | |
943 | } else { | |
944 | $tpl->set_block( "'\\[facebook\\](.*?)\\[/facebook\\]'si", "" ); | |
945 | $tpl->set( '{facebook_url}', '' ); | |
946 | } | |
947 | if( $google_url ) { | |
948 | $tpl->set( '[google]', "" ); | |
949 | $tpl->set( '[/google]', "" ); | |
950 | $tpl->set( '{google_url}', $google_url ); | |
951 | } else { | |
952 | $tpl->set_block( "'\\[google\\](.*?)\\[/google\\]'si", "" ); | |
953 | $tpl->set( '{google_url}', '' ); | |
954 | } | |
955 | if( $mailru_url ) { | |
956 | $tpl->set( '[mailru]', "" ); | |
957 | $tpl->set( '[/mailru]', "" ); | |
958 | $tpl->set( '{mailru_url}', $mailru_url ); | |
959 | } else { | |
960 | $tpl->set_block( "'\\[mailru\\](.*?)\\[/mailru\\]'si", "" ); | |
961 | $tpl->set( '{mailru_url}', '' ); | |
962 | } | |
963 | if( $yandex_url ) { | |
964 | $tpl->set( '[yandex]', "" ); | |
965 | $tpl->set( '[/yandex]', "" ); | |
966 | $tpl->set( '{yandex_url}', $yandex_url ); | |
967 | } else { | |
968 | $tpl->set_block( "'\\[yandex\\](.*?)\\[/yandex\\]'si", "" ); | |
969 | $tpl->set( '{yandex_url}', '' ); | |
970 | } | |
971 | ||
972 | if( $row['editdate'] ) $_DOCUMENT_DATE = $row['editdate']; | |
973 | ||
974 | else $_DOCUMENT_DATE = $row['date']; | |
975 | ||
976 | if( $row['view_edit'] and $row['editdate'] ) { | |
977 | ||
978 | if( date( 'Ymd', $row['editdate'] ) == date( 'Ymd', $_TIME ) ) { | |
979 | ||
980 | $tpl->set( '{edit-date}', $lang['time_heute'] . langdate( ", H:i", $row['editdate'] ) ); | |
981 | ||
982 | } elseif( date( 'Ymd', $row['editdate'] ) == date( 'Ymd', ($_TIME - 86400) ) ) { | |
983 | ||
984 | $tpl->set( '{edit-date}', $lang['time_gestern'] . langdate( ", H:i", $row['editdate'] ) ); | |
985 | ||
986 | } else { | |
987 | ||
988 | $tpl->set( '{edit-date}', langdate( $config['timestamp_active'], $row['editdate'] ) ); | |
989 | ||
990 | } | |
991 | ||
992 | $tpl->set( '{editor}', $row['editor'] ); | |
993 | $tpl->set( '{edit-reason}', $row['reason'] ); | |
994 | ||
995 | if( $row['reason'] ) { | |
996 | ||
997 | $tpl->set( '[edit-reason]', "" ); | |
998 | $tpl->set( '[/edit-reason]', "" ); | |
999 | ||
1000 | } else | |
1001 | $tpl->set_block( "'\\[edit-reason\\](.*?)\\[/edit-reason\\]'si", "" ); | |
1002 | ||
1003 | $tpl->set( '[edit-date]', "" ); | |
1004 | $tpl->set( '[/edit-date]', "" ); | |
1005 | ||
1006 | } else { | |
1007 | ||
1008 | $tpl->set( '{edit-date}', "" ); | |
1009 | $tpl->set( '{editor}', "" ); | |
1010 | $tpl->set( '{edit-reason}', "" ); | |
1011 | $tpl->set_block( "'\\[edit-date\\](.*?)\\[/edit-date\\]'si", "" ); | |
1012 | $tpl->set_block( "'\\[edit-reason\\](.*?)\\[/edit-reason\\]'si", "" ); | |
1013 | } | |
1014 | ||
1015 | if( $config['allow_tags'] and $row['tags'] ) { | |
1016 | ||
1017 | $tpl->set( '[tags]', "" ); | |
1018 | $tpl->set( '[/tags]', "" ); | |
1019 | ||
1020 | $social_tags['news_keywords'] = $row['tags']; | |
1021 | ||
1022 | $tags = array (); | |
1023 | ||
1024 | $row['tags'] = explode( ",", $row['tags'] ); | |
1025 | ||
1026 | foreach ( $row['tags'] as $value ) { | |
1027 | ||
1028 | $value = trim( $value ); | |
1029 | ||
1030 | if( $config['allow_alt_url'] ) $tags[] = "<span><a href=\"" . $config['http_home_url'] . "tags/" . urlencode( $value ) . "/\">" . $value . "</a></span>"; | |
1031 | else $tags[] = "<span><a href=\"$PHP_SELF?do=tags&tag=" . urlencode( $value ) . "\">" . $value . "</a></span>"; | |
1032 | ||
1033 | } | |
1034 | ||
1035 | $tpl->set( '{tags}', implode( " ", $tags ) ); | |
1036 | ||
1037 | } else { | |
1038 | ||
1039 | $tpl->set_block( "'\\[tags\\](.*?)\\[/tags\\]'si", "" ); | |
1040 | $tpl->set( '{tags}', "" ); | |
1041 | ||
1042 | } | |
1043 | ||
1044 | $tpl->set( '', $news_find ); | |
1045 | ||
1046 | $url_cat = $category_id; | |
1047 | $category_id = $row['category']; | |
1048 | ||
1049 | if( strpos( $tpl->copy_template, "[catlist=" ) !== false ) { | |
1050 | $tpl->copy_template = preg_replace_callback ( "#\\[(catlist)=(.+?)\\](.*?)\\[/catlist\\]#is", "check_category", $tpl->copy_template ); | |
1051 | } | |
1052 | ||
1053 | if( strpos( $tpl->copy_template, "[not-catlist=" ) !== false ) { | |
1054 | $tpl->copy_template = preg_replace_callback ( "#\\[(not-catlist)=(.+?)\\](.*?)\\[/not-catlist\\]#is", "check_category", $tpl->copy_template ); | |
1055 | } | |
1056 | ||
1057 | $category_id = $url_cat; | |
1058 | ||
1059 | if( $category_id AND $cat_info[$category_id]['icon'] ) { | |
1060 | ||
1061 | $tpl->set( '{category-icon}', $cat_info[$category_id]['icon'] ); | |
1062 | ||
1063 | } else { | |
1064 | ||
1065 | $tpl->set( '{category-icon}', "{THEME}/dleimages/no_icon.gif" ); | |
1066 | ||
1067 | } | |
1068 | ||
1069 | if ( $category_id ) { | |
1070 | ||
1071 | if( $config['allow_alt_url'] ) $tpl->set( '{category-url}', $config['http_home_url'] . get_url( $category_id ) . "/" ); | |
1072 | else $tpl->set( '{category-url}', "$PHP_SELF?do=cat&category={$cat_info[$category_id]['alt_name']}" ); | |
1073 | ||
1074 | } else $tpl->set( '{category-url}', "#" ); | |
1075 | ||
1076 | if ($config['allow_search_print']) { | |
1077 | ||
1078 | $tpl->set( '[print-link]', "<a href=\"" . $print_link . "\">" ); | |
1079 | $tpl->set( '[/print-link]', "</a>" ); | |
1080 | ||
1081 | } else { | |
1082 | ||
1083 | $tpl->set( '[print-link]', "<a href=\"" . $print_link . "\" rel=\"nofollow\">" ); | |
1084 | $tpl->set( '[/print-link]', "</a>" ); | |
1085 | ||
1086 | } | |
1087 | ||
1088 | if ( $config['rating_type'] == "1" ) { | |
1089 | $tpl->set( '[rating-type-2]', "" ); | |
1090 | $tpl->set( '[/rating-type-2]', "" ); | |
1091 | $tpl->set_block( "'\\[rating-type-1\\](.*?)\\[/rating-type-1\\]'si", "" ); | |
1092 | $tpl->set_block( "'\\[rating-type-3\\](.*?)\\[/rating-type-3\\]'si", "" ); | |
1093 | } elseif ( $config['rating_type'] == "2" ) { | |
1094 | $tpl->set( '[rating-type-3]', "" ); | |
1095 | $tpl->set( '[/rating-type-3]', "" ); | |
1096 | $tpl->set_block( "'\\[rating-type-1\\](.*?)\\[/rating-type-1\\]'si", "" ); | |
1097 | $tpl->set_block( "'\\[rating-type-2\\](.*?)\\[/rating-type-2\\]'si", "" ); | |
1098 | } else { | |
1099 | $tpl->set( '[rating-type-1]', "" ); | |
1100 | $tpl->set( '[/rating-type-1]', "" ); | |
1101 | $tpl->set_block( "'\\[rating-type-3\\](.*?)\\[/rating-type-3\\]'si", "" ); | |
1102 | $tpl->set_block( "'\\[rating-type-2\\](.*?)\\[/rating-type-2\\]'si", "" ); | |
1103 | } | |
1104 | ||
1105 | if( $row['allow_rate'] ) { | |
1106 | ||
1107 | $tpl->set( '{rating}', ShowRating( $row['id'], $row['rating'], $row['vote_num'], $user_group[$member_id['user_group']]['allow_rating'] ) ); | |
1108 | $tpl->set( '{vote-num}', "<span id=\"vote-num-id-".$row['id']."\">".$row['vote_num']."</span>" ); | |
1109 | $tpl->set( '[rating]', "" ); | |
1110 | $tpl->set( '[/rating]', "" ); | |
1111 | ||
1112 | if( $user_group[$member_id['user_group']]['allow_rating'] ) { | |
1113 | ||
1114 | if ( $config['rating_type'] ) { | |
1115 | ||
1116 | $tpl->set( '[rating-plus]', "<a href=\"#\" onclick=\"doRate('plus', '{$row['id']}'); return false;\" >" ); | |
1117 | $tpl->set( '[/rating-plus]', '</a>' ); | |
1118 | ||
1119 | if ( $config['rating_type'] == "2" ) { | |
1120 | ||
1121 | $tpl->set( '[rating-minus]', "<a href=\"#\" onclick=\"doRate('minus', '{$row['id']}'); return false;\" >" ); | |
1122 | $tpl->set( '[/rating-minus]', '</a>' ); | |
1123 | ||
1124 | } else { | |
1125 | $tpl->set_block( "'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", "" ); | |
1126 | } | |
1127 | ||
1128 | } else { | |
1129 | $tpl->set_block( "'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", "" ); | |
1130 | $tpl->set_block( "'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", "" ); | |
1131 | } | |
1132 | ||
1133 | } else { | |
1134 | $tpl->set_block( "'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", "" ); | |
1135 | $tpl->set_block( "'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", "" ); | |
1136 | } | |
1137 | ||
1138 | } else { | |
1139 | ||
1140 | $tpl->set( '{rating}', "" ); | |
1141 | $tpl->set( '{vote-num}', "" ); | |
1142 | $tpl->set_block( "'\\[rating\\](.*?)\\[/rating\\]'si", "" ); | |
1143 | $tpl->set_block( "'\\[rating-plus\\](.*?)\\[/rating-plus\\]'si", "" ); | |
1144 | $tpl->set_block( "'\\[rating-minus\\](.*?)\\[/rating-minus\\]'si", "" ); | |
1145 | } | |
1146 | ||
1147 | if ( $config['allow_comments'] AND $config['allow_subscribe'] AND $is_logged AND $row['allow_comm'] AND $user_group[$member_id['user_group']]['allow_subscribe'] ) { | |
1148 | $tpl->set( '[comments-subscribe]', "<a href=\"#\" onclick=\"subscribe('{$row['id']}'); return false;\" >" ); | |
1149 | $tpl->set( '[/comments-subscribe]', '</a>' ); | |
1150 | } else { | |
1151 | $tpl->set_block( "'\\[comments-subscribe\\](.*?)\\[/comments-subscribe\\]'si", "" ); | |
1152 | } | |
1153 | ||
1154 | if( $config['allow_alt_url'] ) { | |
1155 | ||
1156 | $go_page = $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . "/"; | |
1157 | $tpl->set( '[day-news]', "<a href=\"".$config['http_home_url'] . date( 'Y/m/d/', $row['date'])."\" >" ); | |
1158 | ||
1159 | } else { | |
1160 | ||
1161 | $go_page = "$PHP_SELF?subaction=userinfo&user=" . urlencode( $row['autor'] ); | |
1162 | $tpl->set( '[day-news]', "<a href=\"$PHP_SELF?year=".date( 'Y', $row['date'])."&month=".date( 'm', $row['date'])."&day=".date( 'd', $row['date'])."\" >" ); | |
1163 | ||
1164 | } | |
1165 | ||
1166 | $tpl->set( '[/day-news]', "</a>" ); | |
1167 | $tpl->set( '[profile]', "<a href=\"" . $go_page . "\">" ); | |
1168 | $tpl->set( '[/profile]', "</a>" ); | |
1169 | ||
1170 | $tpl->set( '{login}', $row['autor'] ); | |
1171 | ||
1172 | $tpl->set( '{author}', "<a onclick=\"ShowProfile('" . urlencode( $row['autor'] ) . "', '" . $go_page . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\" href=\"" . $go_page . "\">" . $row['autor'] . "</a>" ); | |
1173 | ||
1174 | $_SESSION['referrer'] = htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, $config['charset'] );; | |
1175 | ||
1176 | $tpl->set( '[full-link]', "<a href=\"" . $full_link . "\">" ); | |
1177 | $tpl->set( '[/full-link]', "</a>" ); | |
1178 | $tpl->set( '[notify-me]', "<a href='/index.php?do=notifications&add={$row[id]}'>" ); | |
1179 | $tpl->set( '[/notify-me]', "</a>" ); | |
1180 | $tpl->set( '{full-link}', $full_link ); | |
1181 | ||
1182 | if( $row['allow_comm'] ) { | |
1183 | ||
1184 | $tpl->set( '[com-link]', "<a id=\"dle-comm-link\" href=\"" . $full_link . "#comment\">" ); | |
1185 | $tpl->set( '[/com-link]', "</a>" ); | |
1186 | ||
1187 | } else $tpl->set_block( "'\\[com-link\\](.*?)\\[/com-link\\]'si", "" ); | |
1188 | ||
1189 | if( ! $row['approve'] and ($member_id['name'] == $row['autor'] and ! $user_group[$member_id['user_group']]['allow_all_edit']) ) { | |
1190 | ||
1191 | $tpl->set( '[edit]', "<a href=\"" . $config['http_home_url'] . "index.php?do=addnews&id=" . $row['id'] . "\" >" ); | |
1192 | $tpl->set( '[/edit]', "</a>" ); | |
1193 | ||
1194 | if( $config['allow_quick_wysiwyg'] ) $allow_comments_ajax = true; | |
1195 | ||
1196 | } elseif( $is_logged and (($member_id['name'] == $row['autor'] and $user_group[$member_id['user_group']]['allow_edit']) or $user_group[$member_id['user_group']]['allow_all_edit']) ) { | |
1197 | ||
1198 | $tpl->set( '[edit]', "<a onclick=\"return dropdownmenu(this, event, MenuNewsBuild('" . $row['id'] . "', 'full'), '170px')\" href=\"#\">" ); | |
1199 | $tpl->set( '[/edit]', "</a>" ); | |
1200 | ||
1201 | if( $config['allow_quick_wysiwyg'] ) $allow_comments_ajax = true; | |
1202 | ||
1203 | } else $tpl->set_block( "'\\[edit\\](.*?)\\[/edit\\]'si", "" ); | |
1204 | ||
1205 | if( $config['related_news'] AND $view_template != "print") { | |
1206 | ||
1207 | if ( $allow_full_cache ) $related_buffer = dle_cache( "related", $row['id'].$config['skin'], true ); else $related_buffer = false; | |
1208 | ||
1209 | if( $related_buffer === false ) { | |
1210 | ||
1211 | if ( $row['related_ids'] ) { | |
1212 | ||
1213 | $id_list = array(); | |
1214 | $id_temp = explode(",", $row['related_ids']); | |
1215 | ||
1216 | foreach ( $id_temp as $value ) { | |
1217 | ||
1218 | $value = intval($value); | |
1219 | ||
1220 | if ( $value > 0 ) $id_list[] = $value; | |
1221 | ||
1222 | } | |
1223 | ||
1224 | $row['related_ids'] = implode( ',', $id_list ); | |
1225 | ||
1226 | unset($id_list); | |
1227 | unset($id_temp); | |
1228 | ||
1229 | $db->query( "SELECT id, date, short_story, xfields, title, category, alt_name FROM " . PREFIX . "_post WHERE id IN({$row['related_ids']}) AND approve=1 ORDER BY id DESC"); | |
1230 | $first_show = false; | |
1231 | ||
1232 | } else { | |
1233 | $first_show = true; | |
1234 | $related_ids = array(); | |
1235 | ||
1236 | if( strlen( $row['full_story'] ) < strlen( $row['short_story'] ) ) $body = $row['short_story']; | |
1237 | else $body = $row['full_story']; | |
1238 | ||
1239 | $body = strip_tags( stripslashes( $metatags['title'] . " " . $body ) ); | |
1240 | ||
1241 | if( dle_strlen( $body, $config['charset'] ) > 1000 ) { | |
1242 | $body = dle_substr( $body, 0, 1000, $config['charset'] ); | |
1243 | } | |
1244 | ||
1245 | $body = $db->safesql( $body ); | |
1246 | ||
1247 | $config['related_number'] = intval( $config['related_number'] ); | |
1248 | if( $config['related_number'] < 1 ) $config['related_number'] = 5; | |
1249 | ||
1250 | $allowed_cats = array(); | |
1251 | ||
1252 | foreach ($user_group as $value) { | |
1253 | if ($value['allow_cats'] != "all" AND !$value['allow_short'] ) $allowed_cats[] = $db->safesql($value['allow_cats']); | |
1254 | } | |
1255 | ||
1256 | if (count($allowed_cats)) { | |
1257 | ||
1258 | $allowed_cats = implode(",", $allowed_cats); | |
1259 | $allowed_cats = explode(",", $allowed_cats); | |
1260 | $allowed_cats = array_unique($allowed_cats); | |
1261 | sort($allowed_cats); | |
1262 | ||
1263 | if ($config['allow_multi_category']) { | |
1264 | ||
1265 | $allowed_cats = "category regexp '[[:<:]](" . implode ( '|', $allowed_cats ) . ")[[:>:]]' AND "; | |
1266 | ||
1267 | } else { | |
1268 | ||
1269 | $allowed_cats = "category IN ('" . implode ( "','", $allowed_cats ) . "') AND "; | |
1270 | ||
1271 | } | |
1272 | ||
1273 | } else $allowed_cats=""; | |
1274 | ||
1275 | $not_allowed_cats = array(); | |
1276 | ||
1277 | foreach ($user_group as $value) { | |
1278 | if ($value['not_allow_cats'] != "" AND !$value['allow_short'] ) $not_allowed_cats[] = $db->safesql($value['not_allow_cats']); | |
1279 | } | |
1280 | ||
1281 | if (count($not_allowed_cats)) { | |
1282 | ||
1283 | $not_allowed_cats = implode(",", $not_allowed_cats); | |
1284 | $not_allowed_cats = explode(",", $not_allowed_cats); | |
1285 | $not_allowed_cats = array_unique($not_allowed_cats); | |
1286 | sort($not_allowed_cats); | |
1287 | ||
1288 | if ($config['allow_multi_category']) { | |
1289 | ||
1290 | $not_allowed_cats = "category NOT REGEXP '[[:<:]](" . implode ( '|', $not_allowed_cats ) . ")[[:>:]]' AND "; | |
1291 | ||
1292 | } else { | |
1293 | ||
1294 | $not_allowed_cats = "category NOT IN ('" . implode ( "','", $not_allowed_cats ) . "') AND "; | |
1295 | ||
1296 | } | |
1297 | ||
1298 | } else $not_allowed_cats=""; | |
1299 | ||
1300 | if ($config['related_only_cats'] AND $row['category'] ) { | |
1301 | ||
1302 | $allowed_cats=""; | |
1303 | $not_allowed_cats = ""; | |
1304 | $allow_sub_cats = true; | |
1305 | $all_cats = explode(",", $row['category']); | |
1306 | $get_cats = array(); | |
1307 | ||
1308 | foreach ($all_cats as $value) { | |
1309 | ||
1310 | if ( $cat_info[$value]['show_sub'] ) { | |
1311 | ||
1312 | if ( $cat_info[$value]['show_sub'] == 1 ) $get_cats[] = get_sub_cats ( $value ); | |
1313 | else { $get_cats[] = $value; } | |
1314 | ||
1315 | } else { | |
1316 | ||
1317 | if ( $config['show_sub_cats'] ) $get_cats[] = get_sub_cats ( $value ); | |
1318 | else { $get_cats[] = $value; } | |
1319 | ||
1320 | } | |
1321 | ||
1322 | } | |
1323 | ||
1324 | $get_cats = implode("|", $get_cats); | |
1325 | $get_cats = explode("|", $get_cats); | |
1326 | ||
1327 | if ( count($get_cats) < 2 ) $allow_sub_cats = false; | |
1328 | ||
1329 | $get_cats = implode("|", $get_cats); | |
1330 | ||
1331 | if ($config['allow_multi_category']) { | |
1332 | ||
1333 | $where_category = "category regexp '[[:<:]](" . $get_cats . ")[[:>:]]' AND "; | |
1334 | ||
1335 | } else { | |
1336 | ||
1337 | if ( $allow_sub_cats ) { | |
1338 | ||
1339 | $get_cats = str_replace ( "|", "','", $get_cats ); | |
1340 | $where_category = "category IN ('" . $get_cats . "') AND "; | |
1341 | ||
1342 | } else { | |
1343 | ||
1344 | $where_category = "category = '{$get_cats}' AND "; | |
1345 | ||
1346 | } | |
1347 | ||
1348 | } | |
1349 | ||
1350 | } else $where_category = ""; | |
1351 | ||
1352 | $db->query( "SELECT id, date, short_story, xfields, title, category, alt_name FROM " . PREFIX . "_post WHERE {$where_category}{$allowed_cats}{$not_allowed_cats}MATCH (title, short_story, full_story, xfields) AGAINST ('$body') AND id != " . $row['id'] . " AND approve=1" . $where_date . " LIMIT " . $config['related_number'] ); | |
1353 | } | |
1354 | ||
1355 | $tpl2 = new dle_template(); | |
1356 | $tpl2->dir = TEMPLATE_DIR; | |
1357 | $tpl2->load_template( 'relatednews.tpl' ); | |
1358 | ||
1359 | while ( $related = $db->get_row() ) { | |
1360 | ||
1361 | if ( $first_show ) $related_ids[] = $related['id']; | |
1362 | ||
1363 | $related['date'] = strtotime( $related['date'] ); | |
1364 | ||
1365 | if( ! $related['category'] ) { | |
1366 | $my_cat = "---"; | |
1367 | $my_cat_link = "---"; | |
1368 | } else { | |
1369 | ||
1370 | $my_cat = array (); | |
1371 | $my_cat_link = array (); | |
1372 | $rel_cat_list = explode( ',', $related['category'] ); | |
1373 | ||
1374 | if( count( $rel_cat_list ) == 1 ) { | |
1375 | ||
1376 | $my_cat[] = $cat_info[$rel_cat_list[0]]['name']; | |
1377 | ||
1378 | $my_cat_link = get_categories( $rel_cat_list[0], $config['category_separator'] ); | |
1379 | ||
1380 | } else { | |
1381 | ||
1382 | foreach ( $rel_cat_list as $element ) { | |
1383 | if( $element ) { | |
1384 | $my_cat[] = $cat_info[$element]['name']; | |
1385 | if( $config['allow_alt_url'] ) $my_cat_link[] = "<a href=\"" . $config['http_home_url'] . get_url( $element ) . "/\">{$cat_info[$element]['name']}</a>"; | |
1386 | else $my_cat_link[] = "<a href=\"$PHP_SELF?do=cat&category={$cat_info[$element]['alt_name']}\">{$cat_info[$element]['name']}</a>"; | |
1387 | } | |
1388 | } | |
1389 | ||
1390 | $my_cat_link = implode( "{$config['category_separator']} ", $my_cat_link ); | |
1391 | } | |
1392 | ||
1393 | $my_cat = implode( "{$config['category_separator']} ", $my_cat ); | |
1394 | } | |
1395 | ||
1396 | $related['category'] = intval( $related['category'] ); | |
1397 | ||
1398 | if( $config['allow_alt_url'] ) { | |
1399 | ||
1400 | if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 ) { | |
1401 | ||
1402 | if( $related['category'] and $config['seo_type'] == 2 ) { | |
1403 | ||
1404 | $rel_full_link = $config['http_home_url'] . get_url( $related['category'] ) . "/" . $related['id'] . "-" . $related['alt_name'] . ".html"; | |
1405 | ||
1406 | } else { | |
1407 | ||
1408 | $rel_full_link = $config['http_home_url'] . $related['id'] . "-" . $related['alt_name'] . ".html"; | |
1409 | ||
1410 | } | |
1411 | ||
1412 | } else { | |
1413 | ||
1414 | $rel_full_link = $config['http_home_url'] . date( 'Y/m/d/', $related['date'] ) . $related['alt_name'] . ".html"; | |
1415 | } | |
1416 | ||
1417 | } else { | |
1418 | ||
1419 | $rel_full_link = $config['http_home_url'] . "index.php?newsid=" . $related['id']; | |
1420 | ||
1421 | } | |
1422 | ||
1423 | $related['title'] = strip_tags( stripslashes( $related['title'] ) ); | |
1424 | ||
1425 | $tpl2->set( '{title}', str_replace("&amp;", "&", htmlspecialchars( $related['title'], ENT_QUOTES, $config['charset'] ) ) ); | |
1426 | $tpl2->set( '{link}', $rel_full_link ); | |
1427 | $tpl2->set( '{category}', $my_cat ); | |
1428 | $tpl2->set( '{link-category}', $my_cat_link ); | |
1429 | ||
1430 | if( date( 'Ymd', $related['date'] ) == date( 'Ymd', $_TIME ) ) { | |
1431 | ||
1432 | $tpl2->set( '{date}', $lang['time_heute'] . langdate( ", H:i", $related['date'] ) ); | |
1433 | ||
1434 | } elseif( date( 'Ymd', $related['date'] ) == date( 'Ymd', ($_TIME - 86400) ) ) { | |
1435 | ||
1436 | $tpl2->set( '{date}', $lang['time_gestern'] . langdate( ", H:i", $related['date'] ) ); | |
1437 | ||
1438 | } else { | |
1439 | ||
1440 | $tpl2->set( '{date}', langdate( $config['timestamp_active'], $related['date'] ) ); | |
1441 | ||
1442 | } | |
1443 | $news_date = $related['date']; | |
1444 | $tpl2->copy_template = preg_replace_callback ( "#\{date=(.+?)\}#i", "formdate", $tpl2->copy_template ); | |
1445 | ||
1446 | $related['short_story'] = stripslashes( $related['short_story'] ); | |
1447 | ||
1448 | if (stripos ( $related['short_story'], "[hide" ) !== false ) { | |
1449 | ||
1450 | $related['short_story'] = preg_replace_callback ( "#\[hide(.*?)\](.+?)\[/hide\]#is", | |
1451 | function ($matches) use ($member_id, $user_group, $lang) { | |
1452 | ||
1453 | $matches[1] = str_replace(array("=", " "), "", $matches[1]); | |
1454 | $matches[2] = $matches[2]; | |
1455 | ||
1456 | if( $matches[1] ) { | |
1457 | ||
1458 | $groups = explode( ',', $matches[1] ); | |
1459 | ||
1460 | if( in_array( $member_id['user_group'], $groups ) OR $member_id['user_group'] == "1") { | |
1461 | return $matches[2]; | |
1462 | } else return "<div class=\"quote\">" . $lang['news_regus'] . "</div>"; | |
1463 | ||
1464 | } else { | |
1465 | ||
1466 | if( $user_group[$member_id['user_group']]['allow_hide'] ) return $matches[2]; else return "<div class=\"quote\">" . $lang['news_regus'] . "</div>"; | |
1467 | ||
1468 | } | |
1469 | ||
1470 | }, $related['short_story'] ); | |
1471 | } | |
1472 | ||
1473 | if (stripos ( $tpl2->copy_template, "{image-" ) !== false) { | |
1474 | ||
1475 | $images = array(); | |
1476 | preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $related['short_story'], $media); | |
1477 | $data=preg_replace('/(img|src)("|\'|="|=\')(.*)/i',"$3",$media[0]); | |
1478 | ||
1479 | foreach($data as $url) { | |
1480 | $info = pathinfo($url); | |
1481 | if (isset($info['extension'])) { | |
1482 | if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-minus" OR strpos($info['dirname'], 'engine/data/emoticons') !== false) continue; | |
1483 | $info['extension'] = strtolower($info['extension']); | |
1484 | if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) array_push($images, $url); | |
1485 | } | |
1486 | } | |
1487 | ||
1488 | if ( count($images) ) { | |
1489 | $i=0; | |
1490 | foreach($images as $url) { | |
1491 | $i++; | |
1492 | $tpl2->copy_template = str_replace( '{image-'.$i.'}', $url, $tpl2->copy_template ); | |
1493 | $tpl2->copy_template = str_replace( '[image-'.$i.']', "", $tpl2->copy_template ); | |
1494 | $tpl2->copy_template = str_replace( '[/image-'.$i.']', "", $tpl2->copy_template ); | |
1495 | } | |
1496 | ||
1497 | } | |
1498 | ||
1499 | $tpl2->copy_template = preg_replace( "#\[image-(.+?)\](.+?)\[/image-(.+?)\]#is", "", $tpl2->copy_template ); | |
1500 | $tpl2->copy_template = preg_replace( "#\\{image-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl2->copy_template ); | |
1501 | ||
1502 | } | |
1503 | ||
1504 | if ( preg_match( "#\\{text limit=['\"](.+?)['\"]\\}#i", $tpl2->copy_template, $matches ) ) { | |
1505 | $count= intval($matches[1]); | |
1506 | ||
1507 | $related['short_story'] = preg_replace( "#<!--TBegin(.+?)<!--TEnd-->#is", "", $related['short_story'] ); | |
1508 | $related['short_story'] = preg_replace( "#<!--MBegin(.+?)<!--MEnd-->#is", "", $related['short_story'] ); | |
1509 | $related['short_story'] = preg_replace( "#<!--dle_spoiler(.+?)<!--spoiler_text-->#is", "", $related['short_story'] ); | |
1510 | $related['short_story'] = preg_replace( "#<!--spoiler_text_end-->(.+?)<!--/dle_spoiler-->#is", "", $related['short_story'] ); | |
1511 | $related['short_story'] = preg_replace( "'\[attachment=(.*?)\]'si", "", $related['short_story'] ); | |
1512 | $related['short_story'] = preg_replace ( "#\[hide(.*?)\](.+?)\[/hide\]#is", "", $related['short_story'] ); | |
1513 | ||
1514 | $related['short_story'] = str_replace( "><", "> <", $related['short_story'] ); | |
1515 | $related['short_story'] = strip_tags( $related['short_story'], "<br>" ); | |
1516 | $related['short_story'] = trim(str_replace( "<br>", " ", str_replace( "<br />", " ", str_replace( "\n", " ", str_replace( "\r", "", $related['short_story'] ) ) ) )); | |
1517 | $related['short_story'] = preg_replace('/\s+/', ' ', $related['short_story']); | |
1518 | ||
1519 | if( $count AND dle_strlen( $related['short_story'], $config['charset'] ) > $count ) { | |
1520 | ||
1521 | $related['short_story'] = dle_substr( $related['short_story'], 0, $count, $config['charset'] ); | |
1522 | ||
1523 | if( ($temp_dmax = dle_strrpos( $related['short_story'], ' ', $config['charset'] )) ) $related['short_story'] = dle_substr( $related['short_story'], 0, $temp_dmax, $config['charset'] ); | |
1524 | ||
1525 | } | |
1526 | ||
1527 | $tpl2->set( $matches[0], $related['short_story'] ); | |
1528 | ||
1529 | } else $tpl2->set( '{text}', $related['short_story'] ); | |
1530 | ||
1531 | if ( preg_match( "#\\{title limit=['\"](.+?)['\"]\\}#i", $tpl2->copy_template, $matches ) ) { | |
1532 | $count= intval($matches[1]); | |
1533 | ||
1534 | if( $count AND dle_strlen( $related['title'], $config['charset'] ) > $count ) { | |
1535 | ||
1536 | $related['title'] = dle_substr( $related['title'], 0, $count, $config['charset'] ); | |
1537 | ||
1538 | if( ($temp_dmax = dle_strrpos( $related['title'], ' ', $config['charset'] )) ) $related['title'] = dle_substr( $related['title'], 0, $temp_dmax, $config['charset'] ); | |
1539 | ||
1540 | } | |
1541 | $tpl2->set( $matches[0], str_replace("&amp;", "&", htmlspecialchars( $related['title'], ENT_QUOTES, $config['charset'] ) ) ); | |
1542 | ||
1543 | } | |
1544 | ||
1545 | if( count($xfields) ) { | |
1546 | $xfieldsdata = xfieldsdataload( $related['xfields'] ); | |
1547 | ||
1548 | foreach ( $xfields as $value ) { | |
1549 | $preg_safe_name = preg_quote( $value[0], "'" ); | |
1550 | ||
1551 | $xfieldsdata[$value[0]] = stripslashes( $xfieldsdata[$value[0]] ); | |
1552 | ||
1553 | if( $value[20] ) { | |
1554 | ||
1555 | $value[20] = explode( ',', $value[20] ); | |
1556 | ||
1557 | if( $value[20][0] AND !in_array( $member_id['user_group'], $value[20] ) ) { | |
1558 | $xfieldsdata[$value[0]] = ""; | |
1559 | } | |
1560 | ||
1561 | } | |
1562 | ||
1563 | if ( $value[3] == "yesorno" ) { | |
1564 | ||
1565 | if( intval($xfieldsdata[$value[0]]) ) { | |
1566 | $xfgiven = true; | |
1567 | $xfieldsdata[$value[0]] = $lang['xfield_xyes']; | |
1568 | } else { | |
1569 | $xfgiven = false; | |
1570 | $xfieldsdata[$value[0]] = $lang['xfield_xno']; | |
1571 | } | |
1572 | ||
1573 | } else { | |
1574 | if($xfieldsdata[$value[0]] == "") $xfgiven = false; else $xfgiven = true; | |
1575 | } | |
1576 | ||
1577 | if( !$xfgiven ) { | |
1578 | $tpl2->copy_template = preg_replace( "'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl2->copy_template ); | |
1579 | $tpl2->copy_template = str_ireplace( "[xfnotgiven_{$value[0]}]", "", $tpl2->copy_template ); | |
1580 | $tpl2->copy_template = str_ireplace( "[/xfnotgiven_{$value[0]}]", "", $tpl2->copy_template ); | |
1581 | } else { | |
1582 | $tpl2->copy_template = preg_replace( "'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl2->copy_template ); | |
1583 | $tpl2->copy_template = str_ireplace( "[xfgiven_{$value[0]}]", "", $tpl2->copy_template ); | |
1584 | $tpl2->copy_template = str_ireplace( "[/xfgiven_{$value[0]}]", "", $tpl2->copy_template ); | |
1585 | } | |
1586 | ||
1587 | if(strpos( $tpl2->copy_template, "[ifxfvalue" ) !== false ) { | |
1588 | $tpl2->copy_template = preg_replace_callback ( "#\\[ifxfvalue(.+?)\\](.+?)\\[/ifxfvalue\\]#is", "check_xfvalue", $tpl2->copy_template ); | |
1589 | } | |
1590 | ||
1591 | if ( $value[6] AND !empty( $xfieldsdata[$value[0]] ) ) { | |
1592 | $temp_array = explode( ",", $xfieldsdata[$value[0]] ); | |
1593 | $value3 = array(); | |
1594 | ||
1595 | foreach ($temp_array as $value2) { | |
1596 | ||
1597 | $value2 = trim($value2); | |
1598 | $value2 = str_replace("'", "'", $value2); | |
1599 | ||
1600 | if( $config['allow_alt_url'] ) $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" .$value[0]."/". urlencode( $value2 ) . "/\">" . $value2 . "</a>"; | |
1601 | else $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&xfname=".$value[0]."&xf=" . urlencode( $value2 ) . "\">" . $value2 . "</a>"; | |
1602 | ||
1603 | } | |
1604 | ||
1605 | if( empty($value[21]) ) $value[21] = ", "; | |
1606 | ||
1607 | $xfieldsdata[$value[0]] = implode($value[21], $value3); | |
1608 | ||
1609 | unset($temp_array); | |
1610 | unset($value2); | |
1611 | unset($value3); | |
1612 | ||
1613 | } | |
1614 | ||
1615 | if($value[3] == "image" AND $xfieldsdata[$value[0]] ) { | |
1616 | $path_parts = @pathinfo($xfieldsdata[$value[0]]); | |
1617 | ||
1618 | if( $value[12] AND file_exists(ROOT_DIR . "/uploads/posts/" .$path_parts['dirname']."/thumbs/".$path_parts['basename']) ) { | |
1619 | $thumb_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/thumbs/".$path_parts['basename']; | |
1620 | $img_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/".$path_parts['basename']; | |
1621 | } else { | |
1622 | $img_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/".$path_parts['basename']; | |
1623 | $thumb_url = ""; | |
1624 | } | |
1625 | ||
1626 | if($thumb_url) { | |
1627 | $xfieldsdata[$value[0]] = "<a href=\"$img_url\" class=\"highslide\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"$thumb_url\" alt=\"\"></a>"; | |
1628 | } else $xfieldsdata[$value[0]] = "<img class=\"xfieldimage {$value[0]}\" src=\"{$img_url}\" alt=\"\">"; | |
1629 | } | |
1630 | ||
1631 | if($value[3] == "image") { | |
1632 | ||
1633 | if( $xfieldsdata[$value[0]] ) { | |
1634 | $tpl2->set( "[xfvalue_thumb_url_{$value[0]}]", $thumb_url); | |
1635 | $tpl2->set( "[xfvalue_image_url_{$value[0]}]", $img_url); | |
1636 | } else { | |
1637 | $tpl2->set( "[xfvalue_thumb_url_{$value[0]}]", ""); | |
1638 | $tpl2->set( "[xfvalue_image_url_{$value[0]}]", ""); | |
1639 | } | |
1640 | } | |
1641 | ||
1642 | if($value[3] == "imagegalery" AND $xfieldsdata[$value[0]] AND stripos ( $tpl2->copy_template, "[xfvalue_{$value[0]}" ) !== false ) { | |
1643 | ||
1644 | $fieldvalue_arr = explode(',', $xfieldsdata[$value[0]]); | |
1645 | $gallery_image = array(); | |
1646 | $gallery_single_image = array(); | |
1647 | $xf_image_count = 0; | |
1648 | $single_need = false; | |
1649 | ||
1650 | if(stripos ( $tpl2->copy_template, "[xfvalue_{$value[0]} image=" ) !== false) $single_need = true; | |
1651 | ||
1652 | foreach ($fieldvalue_arr as $temp_value) { | |
1653 | $xf_image_count ++; | |
1654 | ||
1655 | $temp_value = trim($temp_value); | |
1656 | ||
1657 | if($temp_value == "") continue; | |
1658 | ||
1659 | $path_parts = @pathinfo($temp_value); | |
1660 | ||
1661 | if( $value[12] AND file_exists(ROOT_DIR . "/uploads/posts/" .$path_parts['dirname']."/thumbs/".$path_parts['basename']) ) { | |
1662 | $thumb_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/thumbs/".$path_parts['basename']; | |
1663 | $img_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/".$path_parts['basename']; | |
1664 | } else { | |
1665 | $img_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/".$path_parts['basename']; | |
1666 | $thumb_url = ""; | |
1667 | } | |
1668 | ||
1669 | if($thumb_url) { | |
1670 | $gallery_image[] = "<li><a href=\"$img_url\" onclick=\"return hs.expand(this, { slideshowGroup: 'xf_{$related['id']}_{$value[0]}' })\" target=\"_blank\"><img src=\"{$thumb_url}\" alt=\"\"></a></li>"; | |
1671 | $gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<a href=\"{$img_url}\" class=\"highslide\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"{$thumb_url}\" alt=\"\"></a>"; | |
1672 | } else { | |
1673 | $gallery_image[] = "<li><img src=\"{$img_url}\" alt=\"\"></li>"; | |
1674 | $gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<img class=\"xfieldimage {$value[0]}\" src=\"{$img_url}\" alt=\"\">"; | |
1675 | } | |
1676 | ||
1677 | } | |
1678 | ||
1679 | if($single_need AND count($gallery_single_image) ) { | |
1680 | foreach($gallery_single_image as $temp_key => $temp_value) $tpl2->set( $temp_key, $temp_value); | |
1681 | } | |
1682 | ||
1683 | $xfieldsdata[$value[0]] = "<ul class=\"xfieldimagegallery {$value[0]}\">".implode($gallery_image)."</ul>"; | |
1684 | ||
1685 | } | |
1686 | ||
1687 | $tpl2->set( "[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]] ); | |
1688 | ||
1689 | if ( preg_match( "#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl2->copy_template, $matches ) ) { | |
1690 | $count= intval($matches[1]); | |
1691 | ||
1692 | $xfieldsdata[$value[0]] = str_replace( "><", "> <", $xfieldsdata[$value[0]] ); | |
1693 | $xfieldsdata[$value[0]] = strip_tags( $xfieldsdata[$value[0]], "<br>" ); | |
1694 | $xfieldsdata[$value[0]] = trim(str_replace( "<br>", " ", str_replace( "<br />", " ", str_replace( "\n", " ", str_replace( "\r", "", $xfieldsdata[$value[0]] ) ) ) )); | |
1695 | $xfieldsdata[$value[0]] = preg_replace('/\s+/', ' ', $xfieldsdata[$value[0]]); | |
1696 | ||
1697 | if( $count AND dle_strlen( $xfieldsdata[$value[0]], $config['charset'] ) > $count ) { | |
1698 | ||
1699 | $xfieldsdata[$value[0]] = dle_substr( $xfieldsdata[$value[0]], 0, $count, $config['charset'] ); | |
1700 | ||
1701 | if( ($temp_dmax = dle_strrpos( $xfieldsdata[$value[0]], ' ', $config['charset'] )) ) $xfieldsdata[$value[0]] = dle_substr( $xfieldsdata[$value[0]], 0, $temp_dmax, $config['charset'] ); | |
1702 | ||
1703 | } | |
1704 | ||
1705 | $tpl2->set( $matches[0], $xfieldsdata[$value[0]] ); | |
1706 | ||
1707 | } | |
1708 | ||
1709 | } | |
1710 | } | |
1711 | ||
1712 | $tpl2->compile( 'content' ); | |
1713 | ||
1714 | } | |
1715 | //// | |
1716 | ||
1717 | //// | |
1718 | $related_buffer = $tpl2->result['content']; | |
1719 | unset($tpl2); | |
1720 | $db->free(); | |
1721 | ||
1722 | if ( $first_show ) { | |
1723 | if ( count($related_ids) ) { | |
1724 | $related_ids = implode(",",$related_ids); | |
1725 | $db->query( "UPDATE " . PREFIX . "_post_extras SET related_ids='{$related_ids}' WHERE news_id='{$row['id']}'" ); | |
1726 | } | |
1727 | } | |
1728 | ||
1729 | if ( $allow_full_cache ) create_cache( "related", $related_buffer, $row['id'].$config['skin'], true ); | |
1730 | } | |
1731 | ||
1732 | if ( $related_buffer ) { | |
1733 | ||
1734 | $tpl->set( '[related-news]', "" ); | |
1735 | $tpl->set( '[/related-news]', "" ); | |
1736 | ||
1737 | } else $tpl->set_block( "'\\[related-news\\](.*?)\\[/related-news\\]'si", "" ); | |
1738 | ||
1739 | $tpl->set( '{related-news}', $related_buffer ); | |
1740 | ||
1741 | } | |
1742 | ||
1743 | if( $is_logged ) { | |
1744 | ||
1745 | $fav_arr = explode( ',', $member_id['favorites'] ); | |
1746 | ||
1747 | if( ! in_array( $row['id'], $fav_arr ) ) { | |
1748 | ||
1749 | $tpl->set( '{favorites}', "<a id=\"fav-id-" . $row['id'] . "\" href=\"$PHP_SELF?do=favorites&doaction=add&id=" . $row['id'] . "\"><img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/dleimages/plus_fav.gif\" onclick=\"doFavorites('" . $row['id'] . "', 'plus', 0); return false;\" title=\"" . $lang['news_addfav'] . "\" style=\"vertical-align: middle;border: none;\" alt=\"\"></a>" ); | |
1750 | $tpl->set( '[add-favorites]', "<a id=\"fav-id-" . $row['id'] . "\" onclick=\"doFavorites('" . $row['id'] . "', 'plus', 1); return false;\" href=\"$PHP_SELF?do=favorites&doaction=add&id=" . $row['id'] . "\">" ); | |
1751 | $tpl->set( '[/add-favorites]', "</a>" ); | |
1752 | $tpl->set_block( "'\\[del-favorites\\](.*?)\\[/del-favorites\\]'si", "" ); | |
1753 | } else { | |
1754 | ||
1755 | $tpl->set( '{favorites}', "<a id=\"fav-id-" . $row['id'] . "\" href=\"$PHP_SELF?do=favorites&doaction=del&id=" . $row['id'] . "\"><img src=\"" . $config['http_home_url'] . "templates/{$config['skin']}/dleimages/minus_fav.gif\" onclick=\"doFavorites('" . $row['id'] . "', 'minus', 0); return false;\" title=\"" . $lang['news_minfav'] . "\" style=\"vertical-align: middle;border: none;\" alt=\"\"></a>" ); | |
1756 | $tpl->set( '[del-favorites]', "<a id=\"fav-id-" . $row['id'] . "\" onclick=\"doFavorites('" . $row['id'] . "', 'minus', 1); return false;\" href=\"$PHP_SELF?do=favorites&doaction=del&id=" . $row['id'] . "\">" ); | |
1757 | $tpl->set( '[/del-favorites]', "</a>" ); | |
1758 | $tpl->set_block( "'\\[add-favorites\\](.*?)\\[/add-favorites\\]'si", "" ); | |
1759 | } | |
1760 | ||
1761 | } else { | |
1762 | $tpl->set( '{favorites}', "" ); | |
1763 | $tpl->set_block( "'\\[add-favorites\\](.*?)\\[/add-favorites\\]'si", "" ); | |
1764 | $tpl->set_block( "'\\[del-favorites\\](.*?)\\[/del-favorites\\]'si", "" ); | |
1765 | } | |
1766 | ||
1767 | $tpl->set( '[complaint]', "<a href=\"javascript:AddComplaint('" . $row['id'] . "', 'news')\">" ); | |
1768 | $tpl->set( '[/complaint]', "</a>" ); | |
1769 | ||
1770 | if( $row['votes'] ) $tpl->set( '{poll}', $tpl->result['poll'] ); | |
1771 | else $tpl->set( '{poll}', '' ); | |
1772 | ||
1773 | if( $config['allow_banner'] ) include_once (DLEPlugins::Check(ENGINE_DIR . '/modules/banners.php')); | |
1774 | ||
1775 | if( $config['allow_banner'] AND count( $banners ) ) { | |
1776 | ||
1777 | foreach ( $banners as $name => $value ) { | |
1778 | $tpl->copy_template = str_replace( "{banner_" . $name . "}", $value, $tpl->copy_template ); | |
1779 | ||
1780 | if ( $value ) { | |
1781 | $tpl->copy_template = str_replace ( "[banner_" . $name . "]", "", $tpl->copy_template ); | |
1782 | $tpl->copy_template = str_replace ( "[/banner_" . $name . "]", "", $tpl->copy_template ); | |
1783 | } | |
1784 | } | |
1785 | } | |
1786 | ||
1787 | $tpl->set_block( "'{banner_(.*?)}'si", "" ); | |
1788 | $tpl->set_block ( "'\\[banner_(.*?)\\](.*?)\\[/banner_(.*?)\\]'si", "" ); | |
1789 | ||
1790 | $row['short_story'] = stripslashes($row['short_story']); | |
1791 | $row['full_story'] = stripslashes($row['full_story']); | |
1792 | $row['xfields'] = stripslashes( $row['xfields'] ); | |
1793 | ||
1794 | if ($config['allow_links'] AND function_exists('replace_links') AND isset($replace_links['news']) ) { | |
1795 | $row['short_story'] = replace_links ( $row['short_story'], $replace_links['news'] ); | |
1796 | $row['full_story'] = replace_links ( $row['full_story'], $replace_links['news'] ); | |
1797 | } | |
1798 | ||
1799 | if (stripos ( $tpl->copy_template, "{image-" ) !== false) { | |
1800 | ||
1801 | $images = array(); | |
1802 | preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['short_story'].$row['xfields'], $media); | |
1803 | $data=preg_replace('/(img|src)("|\'|="|=\')(.*)/i',"$3",$media[0]); | |
1804 | ||
1805 | foreach($data as $url) { | |
1806 | $info = pathinfo($url); | |
1807 | if (isset($info['extension'])) { | |
1808 | if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-minus" OR strpos($info['dirname'], 'engine/data/emoticons') !== false) continue; | |
1809 | $info['extension'] = strtolower($info['extension']); | |
1810 | if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) array_push($images, $url); | |
1811 | } | |
1812 | } | |
1813 | ||
1814 | if ( count($images) ) { | |
1815 | $i=0; | |
1816 | foreach($images as $url) { | |
1817 | $i++; | |
1818 | $tpl->copy_template = str_replace( '{image-'.$i.'}', $url, $tpl->copy_template ); | |
1819 | $tpl->copy_template = str_replace( '[image-'.$i.']', "", $tpl->copy_template ); | |
1820 | $tpl->copy_template = str_replace( '[/image-'.$i.']', "", $tpl->copy_template ); | |
1821 | } | |
1822 | ||
1823 | } | |
1824 | ||
1825 | $tpl->copy_template = preg_replace( "#\[image-(.+?)\](.+?)\[/image-(.+?)\]#is", "", $tpl->copy_template ); | |
1826 | $tpl->copy_template = preg_replace( "#\\{image-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template ); | |
1827 | ||
1828 | } | |
1829 | ||
1830 | ||
1831 | if (stripos ( $tpl->copy_template, "{fullimage-" ) !== false) { | |
1832 | ||
1833 | $images = array(); | |
1834 | preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['full_story'], $media); | |
1835 | $data=preg_replace('/(img|src)("|\'|="|=\')(.*)/i',"$3",$media[0]); | |
1836 | ||
1837 | foreach($data as $url) { | |
1838 | $info = pathinfo($url); | |
1839 | if (isset($info['extension'])) { | |
1840 | if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-minus" OR strpos($info['dirname'], 'engine/data/emoticons') !== false) continue; | |
1841 | $info['extension'] = strtolower($info['extension']); | |
1842 | if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) array_push($images, $url); | |
1843 | } | |
1844 | } | |
1845 | ||
1846 | if ( count($images) ) { | |
1847 | $i=0; | |
1848 | foreach($images as $url) { | |
1849 | $i++; | |
1850 | $tpl->copy_template = str_replace( '{fullimage-'.$i.'}', $url, $tpl->copy_template ); | |
1851 | $tpl->copy_template = str_replace( '[fullimage-'.$i.']', "", $tpl->copy_template ); | |
1852 | $tpl->copy_template = str_replace( '[/fullimage-'.$i.']', "", $tpl->copy_template ); | |
1853 | } | |
1854 | ||
1855 | } | |
1856 | ||
1857 | $tpl->copy_template = preg_replace( "#\[fullimage-(.+?)\](.+?)\[/fullimage-(.+?)\]#is", "", $tpl->copy_template ); | |
1858 | $tpl->copy_template = preg_replace( "#\\{fullimage-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template ); | |
1859 | ||
1860 | } | |
1861 | ||
1862 | $images = array(); | |
1863 | $allcontent = $row['full_story'].$row['short_story'].$row['xfields']; | |
1864 | preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $allcontent, $media); | |
1865 | $data=preg_replace('/(img|src)("|\'|="|=\')(.*)/i',"$3",$media[0]); | |
1866 | ||
1867 | foreach($data as $url) { | |
1868 | $info = pathinfo($url); | |
1869 | if (isset($info['extension'])) { | |
1870 | if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-minus" OR strpos($info['dirname'], 'engine/data/emoticons') !== false) continue; | |
1871 | $info['extension'] = strtolower($info['extension']); | |
1872 | if (($info['extension'] == 'jpg' || $info['extension'] == 'jpeg' || $info['extension'] == 'gif' || $info['extension'] == 'png') AND !in_array($url, $images) ) array_push($images, $url); | |
1873 | } | |
1874 | } | |
1875 | ||
1876 | if ( count($images) ) $social_tags['image'] = $images[0]; | |
1877 | ||
1878 | if ( preg_match("#<!--dle_video_begin:(.+?)-->#is", $allcontent, $media) ){ | |
1879 | $media[1] = str_replace( "|", "|", $media[1] ); | |
1880 | ||
1881 | $media[1] = explode( ",", trim( $media[1] ) ); | |
1882 | $media[1] = explode( "|", $media[1][0] ); | |
1883 | ||
1884 | $social_tags['video'] = $media[1][0]; | |
1885 | ||
1886 | } | |
1887 | ||
1888 | if ( preg_match("#<!--dle_audio_begin:(.+?)-->#is", $allcontent, $media) ){ | |
1889 | $media[1] = str_replace( "|", "|", $media[1] ); | |
1890 | ||
1891 | $media[1] = explode( ",", trim( $media[1] ) ); | |
1892 | $media[1] = explode( "|", $media[1][0] ); | |
1893 | ||
1894 | $social_tags['audio'] = $media[1][0]; | |
1895 | ||
1896 | } | |
1897 | ||
1898 | $allcontent = htmlspecialchars(strip_tags( $allcontent ), ENT_COMPAT, $config['charset']); | |
1899 | ||
1900 | if(dle_strlen( $allcontent, $config['charset'] ) > 300 ) { | |
1901 | ||
1902 | $allcontent = dle_substr( $allcontent, 0, 300, $config['charset'] ); | |
1903 | ||
1904 | if( ($temp_dmax = dle_strrpos( $allcontent, ' ', $config['charset'] )) ) $allcontent = dle_substr( $allcontent, 0, $temp_dmax, $config['charset'] ); | |
1905 | ||
1906 | } | |
1907 | ||
1908 | if( $allcontent ) $social_tags['description'] = $allcontent; | |
1909 | ||
1910 | unset($allcontent); | |
1911 | ||
1912 | if ($smartphone_detected) { | |
1913 | ||
1914 | if (!$config['allow_smart_format']) { | |
1915 | ||
1916 | $row['short_story'] = strip_tags( $row['short_story'], '<p><br><a>' ); | |
1917 | $row['full_story'] = strip_tags( $row['full_story'], '<p><br><a>' ); | |
1918 | ||
1919 | } else { | |
1920 | ||
1921 | if ( !$config['allow_smart_images'] ) { | |
1922 | ||
1923 | $row['short_story'] = preg_replace( "#<!--TBegin(.+?)<!--TEnd-->#is", "", $row['short_story'] ); | |
1924 | $row['short_story'] = preg_replace( "#<!--MBegin(.+?)<!--MEnd-->#is", "", $row['short_story'] ); | |
1925 | $row['short_story'] = preg_replace( "#<img(.+?)>#is", "", $row['short_story'] ); | |
1926 | $row['full_story'] = preg_replace( "#<!--TBegin(.+?)<!--TEnd-->#is", "", $row['full_story'] ); | |
1927 | $row['full_story'] = preg_replace( "#<!--MBegin(.+?)<!--MEnd-->#is", "", $row['full_story'] ); | |
1928 | $row['full_story'] = preg_replace( "#<img(.+?)>#is", "", $row['full_story'] ); | |
1929 | ||
1930 | } | |
1931 | ||
1932 | if ( !$config['allow_smart_video'] ) { | |
1933 | ||
1934 | $row['short_story'] = preg_replace( "#<!--dle_video_begin(.+?)<!--dle_video_end-->#is", "", $row['short_story'] ); | |
1935 | $row['short_story'] = preg_replace( "#<!--dle_audio_begin(.+?)<!--dle_audio_end-->#is", "", $row['short_story'] ); | |
1936 | $row['short_story'] = preg_replace( "#<!--dle_media_begin(.+?)<!--dle_media_end-->#is", "", $row['short_story'] ); | |
1937 | $row['full_story'] = preg_replace( "#<!--dle_video_begin(.+?)<!--dle_video_end-->#is", "", $row['full_story'] ); | |
1938 | $row['full_story'] = preg_replace( "#<!--dle_audio_begin(.+?)<!--dle_audio_end-->#is", "", $row['full_story'] ); | |
1939 | $row['full_story'] = preg_replace( "#<!--dle_media_begin(.+?)<!--dle_media_end-->#is", "", $row['full_story'] ); | |
1940 | ||
1941 | } | |
1942 | ||
1943 | } | |
1944 | ||
1945 | } | |
1946 | $tpl->set( '{comments}', "<!--dlecomments-->" ); | |
1947 | $tpl->set( '{addcomments}', "<!--dleaddcomments-->" ); | |
1948 | $tpl->set( '{navigation}', "<!--dlenavigationcomments-->" ); | |
1949 | ||
1950 | if( count($xfields) ) { | |
1951 | ||
1952 | $xfieldsdata = xfieldsdataload( $row['xfields'] ); | |
1953 | ||
1954 | foreach ( $xfields as $value ) { | |
1955 | $preg_safe_name = preg_quote( $value[0], "'" ); | |
1956 | ||
1957 | if( $value[20] ) { | |
1958 | ||
1959 | $value[20] = explode( ',', $value[20] ); | |
1960 | ||
1961 | if( $value[20][0] AND !in_array( $member_id['user_group'], $value[20] ) ) { | |
1962 | $xfieldsdata[$value[0]] = ""; | |
1963 | } | |
1964 | ||
1965 | } | |
1966 | ||
1967 | if ( $value[3] == "yesorno" ) { | |
1968 | ||
1969 | if( intval($xfieldsdata[$value[0]]) ) { | |
1970 | $xfgiven = true; | |
1971 | $xfieldsdata[$value[0]] = $lang['xfield_xyes']; | |
1972 | } else { | |
1973 | $xfgiven = false; | |
1974 | $xfieldsdata[$value[0]] = $lang['xfield_xno']; | |
1975 | } | |
1976 | ||
1977 | } else { | |
1978 | ||
1979 | if($xfieldsdata[$value[0]] == "") $xfgiven = false; else $xfgiven = true; | |
1980 | ||
1981 | } | |
1982 | ||
1983 | if( !$xfgiven ) { | |
1984 | $tpl->copy_template = preg_replace( "'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template ); | |
1985 | $tpl->copy_template = str_ireplace( "[xfnotgiven_{$value[0]}]", "", $tpl->copy_template ); | |
1986 | $tpl->copy_template = str_ireplace( "[/xfnotgiven_{$value[0]}]", "", $tpl->copy_template ); | |
1987 | } else { | |
1988 | $tpl->copy_template = preg_replace( "'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template ); | |
1989 | $tpl->copy_template = str_ireplace( "[xfgiven_{$value[0]}]", "", $tpl->copy_template ); | |
1990 | $tpl->copy_template = str_ireplace( "[/xfgiven_{$value[0]}]", "", $tpl->copy_template ); | |
1991 | } | |
1992 | ||
1993 | if(strpos( $tpl->copy_template, "[ifxfvalue" ) !== false ) { | |
1994 | $tpl->copy_template = preg_replace_callback ( "#\\[ifxfvalue(.+?)\\](.+?)\\[/ifxfvalue\\]#is", "check_xfvalue", $tpl->copy_template ); | |
1995 | } | |
1996 | ||
1997 | if ( $value[6] AND !empty( $xfieldsdata[$value[0]] ) ) { | |
1998 | $temp_array = explode( ",", $xfieldsdata[$value[0]] ); | |
1999 | $value3 = array(); | |
2000 | ||
2001 | foreach ($temp_array as $value2) { | |
2002 | ||
2003 | $value2 = trim($value2); | |
2004 | $value2 = str_replace("'", "'", $value2); | |
2005 | ||
2006 | if( $config['allow_alt_url'] ) $value3[] = "<a href=\"" . $config['http_home_url'] . "xfsearch/" .$value[0]."/". urlencode( $value2 ) . "/\">" . $value2 . "</a>"; | |
2007 | else $value3[] = "<a href=\"$PHP_SELF?do=xfsearch&xfname=".$value[0]."&xf=" . urlencode( $value2 ) . "\">" . $value2 . "</a>"; | |
2008 | } | |
2009 | ||
2010 | if( empty($value[21]) ) $value[21] = ", "; | |
2011 | ||
2012 | $xfieldsdata[$value[0]] = implode($value[21], $value3); | |
2013 | ||
2014 | unset($temp_array); | |
2015 | unset($value2); | |
2016 | unset($value3); | |
2017 | ||
2018 | } | |
2019 | ||
2020 | if ($config['allow_links'] AND $value[3] == "textarea" AND function_exists('replace_links')) $xfieldsdata[$value[0]] = replace_links ( $xfieldsdata[$value[0]], $replace_links['news'] ); | |
2021 | ||
2022 | if($value[3] == "image" AND $xfieldsdata[$value[0]] ) { | |
2023 | $path_parts = @pathinfo($xfieldsdata[$value[0]]); | |
2024 | ||
2025 | if( $value[12] AND file_exists(ROOT_DIR . "/uploads/posts/" .$path_parts['dirname']."/thumbs/".$path_parts['basename']) ) { | |
2026 | $thumb_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/thumbs/".$path_parts['basename']; | |
2027 | $img_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/".$path_parts['basename']; | |
2028 | } else { | |
2029 | $img_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/".$path_parts['basename']; | |
2030 | $thumb_url = ""; | |
2031 | } | |
2032 | ||
2033 | if($thumb_url) { | |
2034 | $xfieldsdata[$value[0]] = "<a href=\"$img_url\" class=\"highslide\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"$thumb_url\" alt=\"\"></a>"; | |
2035 | } else $xfieldsdata[$value[0]] = "<img class=\"xfieldimage {$value[0]}\" src=\"{$img_url}\" alt=\"\">"; | |
2036 | } | |
2037 | ||
2038 | if($value[3] == "image") { | |
2039 | ||
2040 | if( $xfieldsdata[$value[0]] ) { | |
2041 | $tpl->set( "[xfvalue_thumb_url_{$value[0]}]", $thumb_url); | |
2042 | $tpl->set( "[xfvalue_image_url_{$value[0]}]", $img_url); | |
2043 | } else { | |
2044 | $tpl->set( "[xfvalue_thumb_url_{$value[0]}]", ""); | |
2045 | $tpl->set( "[xfvalue_image_url_{$value[0]}]", ""); | |
2046 | } | |
2047 | } | |
2048 | ||
2049 | if($value[3] == "imagegalery" AND $xfieldsdata[$value[0]] AND stripos ( $tpl->copy_template, "[xfvalue_{$value[0]}" ) !== false) { | |
2050 | ||
2051 | $fieldvalue_arr = explode(',', $xfieldsdata[$value[0]]); | |
2052 | $gallery_image = array(); | |
2053 | $gallery_single_image = array(); | |
2054 | $xf_image_count = 0; | |
2055 | $single_need = false; | |
2056 | ||
2057 | if(stripos ( $tpl->copy_template, "[xfvalue_{$value[0]} image=" ) !== false) $single_need = true; | |
2058 | ||
2059 | foreach ($fieldvalue_arr as $temp_value) { | |
2060 | $xf_image_count ++; | |
2061 | ||
2062 | $temp_value = trim($temp_value); | |
2063 | ||
2064 | if($temp_value == "") continue; | |
2065 | ||
2066 | $path_parts = @pathinfo($temp_value); | |
2067 | ||
2068 | if( $value[12] AND file_exists(ROOT_DIR . "/uploads/posts/" .$path_parts['dirname']."/thumbs/".$path_parts['basename']) ) { | |
2069 | $thumb_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/thumbs/".$path_parts['basename']; | |
2070 | $img_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/".$path_parts['basename']; | |
2071 | } else { | |
2072 | $img_url = $config['http_home_url'] . "uploads/posts/" . $path_parts['dirname']."/".$path_parts['basename']; | |
2073 | $thumb_url = ""; | |
2074 | } | |
2075 | ||
2076 | if($thumb_url) { | |
2077 | ||
2078 | $gallery_image[] = "<li><a href=\"$img_url\" onclick=\"return hs.expand(this, { slideshowGroup: 'xf_{$row['id']}_{$value[0]}' })\" target=\"_blank\"><img src=\"{$thumb_url}\" alt=\"\"></a></li>"; | |
2079 | $gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<a href=\"{$img_url}\" class=\"highslide\" target=\"_blank\"><img class=\"xfieldimage {$value[0]}\" src=\"{$thumb_url}\" alt=\"\"></a>"; | |
2080 | ||
2081 | } else { | |
2082 | $gallery_image[] = "<li><img src=\"{$img_url}\" alt=\"\"></li>"; | |
2083 | $gallery_single_image['[xfvalue_'.$value[0].' image="'.$xf_image_count.'"]'] = "<img class=\"xfieldimage {$value[0]}\" src=\"{$img_url}\" alt=\"\">"; | |
2084 | } | |
2085 | ||
2086 | } | |
2087 | ||
2088 | if($single_need AND count($gallery_single_image) ) { | |
2089 | foreach($gallery_single_image as $temp_key => $temp_value) $tpl->set( $temp_key, $temp_value); | |
2090 | } | |
2091 | ||
2092 | $xfieldsdata[$value[0]] = "<ul class=\"xfieldimagegallery {$value[0]}\">".implode($gallery_image)."</ul>"; | |
2093 | ||
2094 | } | |
2095 | ||
2096 | $tpl->set( "[xfvalue_{$value[0]}]", $xfieldsdata[$value[0]] ); | |
2097 | ||
2098 | if ( preg_match( "#\\[xfvalue_{$preg_safe_name} limit=['\"](.+?)['\"]\\]#i", $tpl->copy_template, $matches ) ) { | |
2099 | $count= intval($matches[1]); | |
2100 | ||
2101 | $xfieldsdata[$value[0]] = str_replace( "><", "> <", $xfieldsdata[$value[0]] ); | |
2102 | $xfieldsdata[$value[0]] = strip_tags( $xfieldsdata[$value[0]], "<br>" ); | |
2103 | $xfieldsdata[$value[0]] = trim(str_replace( "<br>", " ", str_replace( "<br />", " ", str_replace( "\n", " ", str_replace( "\r", "", $xfieldsdata[$value[0]] ) ) ) )); | |
2104 | $xfieldsdata[$value[0]] = preg_replace('/\s+/', ' ', $xfieldsdata[$value[0]]); | |
2105 | ||
2106 | if( $count AND dle_strlen( $xfieldsdata[$value[0]], $config['charset'] ) > $count ) { | |
2107 | ||
2108 | $xfieldsdata[$value[0]] = dle_substr( $xfieldsdata[$value[0]], 0, $count, $config['charset'] ); | |
2109 | ||
2110 | if( ($temp_dmax = dle_strrpos( $xfieldsdata[$value[0]], ' ', $config['charset'] )) ) $xfieldsdata[$value[0]] = dle_substr( $xfieldsdata[$value[0]], 0, $temp_dmax, $config['charset'] ); | |
2111 | ||
2112 | } | |
2113 | ||
2114 | $tpl->set( $matches[0], $xfieldsdata[$value[0]] ); | |
2115 | ||
2116 | } | |
2117 | } | |
2118 | } | |
2119 | ||
2120 | //$tpl->set( '{short-story}', $row['short_story'] ); | |
2121 | ||
2122 | //$tpl->set( '{full-story}', $row['full_story'] ); | |
2123 | $liens = $db->safesql($_POST['lieno']); | |
2124 | if(strlen($row['idallo']) > 0) | |
2125 | { | |
2126 | if(isset($_POST['modifiero'])) | |
2127 | { | |
2128 | if($_POST['lieno'] !="") | |
2129 | { | |
2130 | //first | |
2131 | $ext=$db->super_query ("SELECT count(*) as count FROM dev_liens WHERE postID=".$row['id']." "); | |
2132 | if ($ext['count']=="0") | |
2133 | { | |
2134 | ||
2135 | //$lienet = explode("\n", $liens); | |
2136 | ||
2137 | $db->query("INSERT INTO `dev_liens`(`postID`, `liens`) VALUES (".$row['id'].", '".$liens."')"); | |
2138 | ||
2139 | } | |
2140 | else | |
2141 | { | |
2142 | $db->query("DELETE FROM dev_liens WHERE postID=".$row['id']); | |
2143 | $db->query("INSERT INTO `dev_liens`(`postID`, `liens`) VALUES (".$row['id'].", '".$liens."')"); | |
2144 | ||
2145 | } | |
2146 | } | |
2147 | else {$db->query("DELETE FROM dev_liens WHERE postID=".$row['id']); } | |
2148 | $db->free(); | |
2149 | // | |
2150 | } | |
2151 | ||
2152 | ||
2153 | if(isset($_POST['prezi'])) | |
2154 | { | |
2155 | $db->query("UPDATE dev_prez SET prez='".$db->safesql($_POST['prezi'])."' WHERE idallo='".$row['idallo']."'"); | |
2156 | $db->free(); | |
2157 | } | |
2158 | $db->query("SELECT * FROM dev_prez WHERE idallo='".$row['idallo']."' LIMIT 1"); | |
2159 | $resulx = $db->get_row(); | |
2160 | $control = ''; | |
2161 | $control .= '<div class="theselinks"><form action="" method="post"><input type="hidden" name="postid" value="'.$row['id'].'" /><textarea name="lieno">'; | |
2162 | $addval = '<div class="postinfo">'; | |
2163 | $db->free(); | |
2164 | $linko=$db->super_query("SELECT * FROM dev_liens WHERE postID=".$row['id']); | |
2165 | $oldlink = ""; | |
2166 | $nums = 0; | |
2167 | $bigepi = 0; | |
2168 | $complete=false; | |
2169 | /*while($datax = $db->get_row()) | |
2170 | {*/ | |
2171 | if($row['saison'] != 0) | |
2172 | { | |
2173 | $links = preg_replace('/\s+/', '', $linko['liens']); | |
2174 | $links=strtolower($links); | |
2175 | for($i = 1; $i < 200; $i++) | |
2176 | { | |
2177 | if(strpos($linko['liens'], $i."::") !== false) | |
2178 | { | |
2179 | $bigepi = $i; | |
2180 | } | |
2181 | if (strpos($links, $i."final::") !== false) { | |
2182 | $complete = true; | |
2183 | } | |
2184 | } | |
2185 | } | |
2186 | $releases1 = explode("[", $linko['liens']); | |
2187 | foreach($releases1 as $rels1) | |
2188 | { | |
2189 | $releases2 = explode("]", $rels1); | |
2190 | if(isset($releases2[1])) | |
2191 | { | |
2192 | $lienets = explode(' | |
2193 | ', $releases2[1]); | |
2194 | $li1 = ""; | |
2195 | $li2 = ""; | |
2196 | $li3 = ""; | |
2197 | $li4 = ""; | |
2198 | $li5 = ""; | |
2199 | $li6 = ""; | |
2200 | $li7 = ""; | |
2201 | $li01 = ""; | |
2202 | $li02 = ""; | |
2203 | $li03 = ""; | |
2204 | $li04 = ""; | |
2205 | $li05 = ""; | |
2206 | $li06 = ""; | |
2207 | $li07 = ""; | |
2208 | foreach($lienets as $liene) | |
2209 | { | |
2210 | if(strpos($liene, "uptobox")) | |
2211 | { | |
2212 | $li01 .= "<b>".formatLiens($liene, false)."</b><br />"; | |
2213 | $li1 .= "<b>".formatLiens($liene)."</b><br />"; | |
2214 | } | |
2215 | else if(strpos($liene, "turbobit") !== false) | |
2216 | { | |
2217 | $li03 .= "<b>".formatLiens($liene, false)."</b><br />"; | |
2218 | $li3 .= "<b>".formatLiens($liene)."</b><br />"; | |
2219 | } | |
2220 | else if(strpos($liene, "uploaded") !== false || strpos($liene, "ul.to") !== false) | |
2221 | { | |
2222 | $li02 .= "<b>".formatLiens($liene, false)."</b><br />"; | |
2223 | $li2 .= "<b>".formatLiens($liene)."</b><br />"; | |
2224 | } | |
2225 | else if(strpos($liene, "nitroflare") !== false) | |
2226 | { | |
2227 | $li04 .= "<b>".formatLiens($liene, false)."</b><br />"; | |
2228 | $li4 .= "<b>".formatLiens($liene)."</b><br />"; | |
2229 | } | |
2230 | else if(strpos($liene, "1fichier") !== false) | |
2231 | { | |
2232 | $li05 .= "<b>".formatLiens($liene, false)."</b><br />"; | |
2233 | $li5 .= "<b>".formatLiens($liene)."</b><br />"; | |
2234 | } | |
2235 | else if(strpos($liene, "streaming") !== false) | |
2236 | { | |
2237 | $li07 .= "<b>".formatLiens($liene, false)."</b><br />"; | |
2238 | $li7 .= "<b>".formatLiens($liene)."</b><br />"; | |
2239 | } | |
2240 | else if(strpos($liene, "streamzt") !== false) | |
2241 | { | |
2242 | $li07 .= "<b>".formatLiens($liene, false)."</b><br />"; | |
2243 | $li7 .= "<b>".formatLiens($liene)."</b><br />"; | |
2244 | } | |
2245 | else if(strpos($liene, "rapidgator") !== false) | |
2246 | { | |
2247 | $li06 .= "<b>".formatLiens($liene, false)."</b><br />"; | |
2248 | $li6 .= "<b>".formatLiens($liene)."</b><br />"; | |
2249 | } | |
2250 | } | |
2251 | if(strlen($li1) > 0) | |
2252 | $li1 = '<br />'.getHost($li01).$li1; | |
2253 | if(strlen($li2) > 0) | |
2254 | $li2 = '<br />'.getHost($li02).$li2; | |
2255 | if(strlen($li3) > 0) | |
2256 | $li3 = '<br />'.getHost($li03).$li3; | |
2257 | if(strlen($li4) > 0) | |
2258 | $li4 = '<br />'.getHost($li04).$li4; | |
2259 | if(strlen($li5) > 0) | |
2260 | $li5 = '<br />'.getHost($li05).$li5; | |
2261 | if(strlen($li6) > 0) | |
2262 | $li6 = '<br />'.getHost($li06).$li6; | |
2263 | if(strlen($li7) > 0) | |
2264 | $li7 = '<br />'.getHost($li07).$li7; | |
2265 | ||
2266 | if(substr($releases2[0], 0, 8) == "premium:") | |
2267 | { | |
2268 | $addval .= "<font color=#ff007f><b>".substr($releases2[0], 8)."</b></font>".$li1.$li2.$li3.$li4.$li5.$li6.$li7."<br /><br />"; } | |
2269 | else | |
2270 | { | |
2271 | $addval .= "<font color=red>".$releases2[0]."</font>".$li1.$li2.$li3.$li4.$li5.$li6.$li7."<br /><br />"; | |
2272 | } | |
2273 | } | |
2274 | } | |
2275 | $control .= $linko['liens']; | |
2276 | ||
2277 | //} | |
2278 | $db->free(); | |
2279 | $control .= '</textarea><br /><input type="submit" value="Modifier" name="modifiero" /></form></div>'; | |
2280 | /* | |
2281 | Top Others By FadhelBey <3 <3 | |
2282 | */ | |
2283 | $moreover = ''; | |
2284 | if(strlen($row['idallo']) > 0) | |
2285 | { | |
2286 | $moreover .= '<div class="otherversions" style="margin-top:10px;border-top: 1px solid #e6e6e6;text-align:left;">'; | |
2287 | $cef = "ce film"; | |
2288 | if($row['saison'] != 0) | |
2289 | { | |
2290 | $cef = "cette saison"; | |
2291 | $db->query("SELECT * FROM " . PREFIX . "_post WHERE idallo='".$row['idallo']."' AND saison!=".$row['saison'] . " ORDER BY saison ASC"); | |
2292 | $blasa = 0; | |
2293 | while($datax = $db->get_row()) | |
2294 | { | |
2295 | $blasa++; | |
2296 | if($blasa == 1) | |
2297 | { | |
2298 | $moreover .= '<h3>Saisons également disponibles pour '.$cef.':</h3>'; | |
2299 | } | |
2300 | $moreover .= '<a href="/'.$datax['id'].'-'.$datax['alt_name'].'.html"><span class="otherquality">Saison <b>'.$datax['saison'].'<span style="color:#FE8903"> '.getqualite(strval($datax['qualite'])).' </span><span style="color:#03AAFE">('.getlangue(strval($datax['langue'])).')</b></span></span></a>'; | |
2301 | } | |
2302 | if($blasa > 0) { $moreover .= '<br />'; } | |
2303 | $db->free(); | |
2304 | } | |
2305 | $db->query("SELECT * FROM " . PREFIX . "_post WHERE idallo='".$row['idallo']."' AND saison=".$row['saison']." AND id!=".$row['id']); | |
2306 | $blasa = 0; | |
2307 | while($datax = $db->get_row()) | |
2308 | { | |
2309 | $blasa++; | |
2310 | if($blasa == 1) | |
2311 | { | |
2312 | //$moreover .= utf8_encode('<h3>Qualitйs йgalement disponibles pour '.$cef.':</h3>'); | |
2313 | ||
2314 | $moreover .= '<h3>Qualités également disponibles pour '.$cef.':</h3>'; | |
2315 | ||
2316 | ||
2317 | } | |
2318 | $moreover .= '<a href="/'.$datax['id'].'-'.$datax['alt_name'].'.html"><span class="otherquality"><span style="color:#FE8903"><b>'.getqualite(strval($datax['qualite'])).'</b></span><span style="color:#03AAFE"><b> ('.getlangue(strval($datax['langue'])).')</b></span></span></a>'; | |
2319 | } | |
2320 | if($blasa > 0) { $moreover .= '<br />'; } | |
2321 | $db->free(); | |
2322 | $moreover .= '</div><div class="smallsep"></div>'; | |
2323 | $addval .= '</div>'; | |
2324 | } | |
2325 | else | |
2326 | { | |
2327 | $moreover .= '<div class="otherversions" style="margin-top:10px;border-top: 1px solid #e6e6e6;text-align:left;">'; | |
2328 | ||
2329 | $db->query("SELECT * FROM " . PREFIX . "_post WHERE idallo='".$row['idallo']."' AND id!=".$row['id']); | |
2330 | $blasa = 0; | |
2331 | while($datax = $db->get_row()) | |
2332 | { | |
2333 | $blasa++; | |
2334 | if($blasa == 1) | |
2335 | { | |
2336 | $moreover .= '<h3>Qualités également disponibles pour '.$cef.':</h3>'; | |
2337 | } | |
2338 | $moreover .= '<a href="/'.$datax['id'].'-'.$datax['alt_name'].'.html"><span class="otherquality">'.getqualite(strval($datax['qualite'])).' ('.getlangue(strval($datax['langue'])).')</span></a>'; | |
2339 | } | |
2340 | if($blasa > 0) { $moreover .= '<br />'; } | |
2341 | $db->free(); | |
2342 | $moreover .= '</div><div class="smallsep"></div>'; | |
2343 | $addval .= '</div>'; | |
2344 | ||
2345 | } | |
2346 | $serieinfo = ""; | |
2347 | if($row['saison'] != 0) | |
2348 | { | |
2349 | $serieinfo = "<br /><br />Episode ".$bigepi." | Saison ".$row['saison']; //hothayfa | |
2350 | if ($complete==true) | |
2351 | { | |
2352 | $serieinfoo = "<br /><br />Saison ".$row['saison']." Complete"; | |
2353 | } | |
2354 | else {$serieinfoo=$serieinfo;} | |
2355 | } | |
2356 | if( $is_logged and (($member_id['name'] == $row['autor'] and $user_group[$member_id['user_group']]['allow_edit']) or $user_group[$member_id['user_group']]['allow_all_edit']) ) | |
2357 | { | |
2358 | $control .= '<div class="modifino" onclick="$(\'.theselinks\').fadeToggle();">Modifier les liens</div>'; | |
2359 | $control .= ''; | |
2360 | } | |
2361 | else | |
2362 | { | |
2363 | $control = ''; | |
2364 | } | |
2365 | $prezidx = ""; | |
2366 | if($user_group[$member_id['user_group']]['moderation']) | |
2367 | { | |
2368 | $prezidx = "<br /><b>ID Unique de la presentation: ".$row['idallo']."</b>"; | |
2369 | } | |
2370 | if(strpos($row['full_story'], "Article genere par l") !== false) | |
2371 | { | |
2372 | $findddal = "<div style=\"font-family: \'Ubuntu Condensed\',\'Segoe UI\',Verdana,Helvetica,sans-serif;font-size: 24px;letter-spacing: 0.05em;color: #ff4d00;font-weight: bold;text-align: center;margin: 25px;\">".$row['title']."</div><div style=\"font-size: 18px;margin: 10px auto;color:red;font-weight:bold;text-align:center;\"> Qualité ".getqualite($row['qualite']).' | '.getLangue($row['langue']).$serieinfo.'</div>'.fadhelbbcode($resulx['prez']); | |
2373 | ||
2374 | $db->query("UPDATE " . PREFIX . "_post SET short_story='".$db->safesql($findddal)."', full_story='laissez ce champs vide' WHERE id=".$row['id']); | |
2375 | echo "<script>window.location.reload();</script>"; | |
2376 | } | |
2377 | // $tpl->set( '{full-story}', "<div id=\"news-id-" . $row['id'] . "\" style=\"display:inline;text-align:center;\"><center>" . $addval. $control .$prezidx."</center></div>"); | |
2378 | ||
2379 | ||
2380 | if(strpos($row['full_story'], "NEW") !== false) | |
2381 | { | |
2382 | $qualang = "<div style=\"font-family: \'Ubuntu Condensed\',\'Segoe UI\',Verdana,Helvetica,sans-serif;font-size: 24px;letter-spacing: 0.05em;color: #ff4d00;font-weight: bold;text-align: center;margin: 25px;\">".$row['title']."</div><div style=\"font-size: 18px;margin: 10px auto;color:red;font-weight:bold;text-align:center;\"> Qualité ".getqualite($row['qualite']).' | '.getLangue($row['langue']).$serieinfoo.'</div>' | |
2383 | .'<div style="text-align:center;">'; | |
2384 | ||
2385 | $tpl->set( '{short-story}', $moreover.$qualang.$row['short_story'].'</div>' ); | |
2386 | ||
2387 | } | |
2388 | else | |
2389 | { | |
2390 | $tpl->set( '{short-story}', $moreover.$row['short_story']); | |
2391 | ||
2392 | } | |
2393 | $tpl->set( '{full-story}', "<div id=\"news-id-" . $row['id'] . "\" style=\"display:inline;text-align:center;\"><center>" . $addval. $control .$prezidx."</center></div>"); | |
2394 | } | |
2395 | else | |
2396 | { | |
2397 | $tpl->set( '{short-story}', $row['short_story'] ); | |
2398 | $tpl->set( '{full-story}', "<div id=\"news-id-" . $row['id'] . "\" style=\"display:inline;\">" . $row['full_story'] . "</div>"); | |
2399 | } | |
2400 | // | |
2401 | ||
2402 | if ( preg_match( "#\\{full-story limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches ) ) { | |
2403 | $count= intval($matches[1]); | |
2404 | ||
2405 | $row['full_story'] = preg_replace( "#<!--dle_spoiler(.+?)<!--spoiler_text-->#is", "", $row['full_story'] ); | |
2406 | $row['full_story'] = preg_replace( "#<!--spoiler_text_end-->(.+?)<!--/dle_spoiler-->#is", "", $row['full_story'] ); | |
2407 | $row['full_story'] = preg_replace( "'\[attachment=(.*?)\]'si", "", $row['full_story'] ); | |
2408 | $row['full_story'] = preg_replace ( "#\[hide(.*?)\](.+?)\[/hide\]#is", "", $row['full_story'] ); | |
2409 | ||
2410 | $row['full_story'] = str_replace( "><", "> <", $row['full_story'] ); | |
2411 | $row['full_story'] = strip_tags( $row['full_story'], "<br>" ); | |
2412 | $row['full_story'] = trim(str_replace( "<br>", " ", str_replace( "<br />", " ", str_replace( "\n", " ", str_replace( "\r", "", $row['full_story'] ) ) ) )); | |
2413 | $row['full_story'] = preg_replace('/\s+/', ' ', $row['full_story']); | |
2414 | ||
2415 | if( $count AND dle_strlen( $row['full_story'], $config['charset'] ) > $count ) { | |
2416 | ||
2417 | $row['full_story'] = dle_substr( $row['full_story'], 0, $count, $config['charset'] ); | |
2418 | ||
2419 | if( ($temp_dmax = dle_strrpos( $row['full_story'], ' ', $config['charset'] )) ) $row['full_story'] = dle_substr( $row['full_story'], 0, $temp_dmax, $config['charset'] ); | |
2420 | ||
2421 | } | |
2422 | ||
2423 | $tpl->set( $matches[0], $row['full_story'] ); | |
2424 | ||
2425 | } | |
2426 | ||
2427 | $tpl->set( '{title}', str_replace("&amp;", "&", htmlspecialchars( $row['title'], ENT_QUOTES, $config['charset'] ) ) ); | |
2428 | ||
2429 | if ( preg_match( "#\\{title limit=['\"](.+?)['\"]\\}#i", $tpl->copy_template, $matches ) ) { | |
2430 | $count= intval($matches[1]); | |
2431 | $row['title'] = strip_tags( $row['title'] ); | |
2432 | ||
2433 | if( $count AND dle_strlen( $row['title'], $config['charset'] ) > $count ) { | |
2434 | ||
2435 | $row['title'] = dle_substr( $row['title'], 0, $count, $config['charset'] ); | |
2436 | ||
2437 | if( ($temp_dmax = dle_strrpos( $row['title'], ' ', $config['charset'] )) ) $row['title'] = dle_substr( $row['title'], 0, $temp_dmax, $config['charset'] ); | |
2438 | ||
2439 | } | |
2440 | $tpl->set( $matches[0], str_replace("&amp;", "&", htmlspecialchars( $row['title'], ENT_QUOTES, $config['charset'] ) ) ); | |
2441 | ||
2442 | } | |
2443 | ||
2444 | $xfieldsdata = $row['xfields']; | |
2445 | $category_id = $row['category']; | |
2446 | ||
2447 | $tpl->compile( 'content' ); | |
2448 | ||
2449 | if (stripos ( $tpl->result['content'], "[hide" ) !== false ) { | |
2450 | ||
2451 | $tpl->result['content'] = preg_replace_callback ( "#\[hide(.*?)\](.+?)\[/hide\]#is", | |
2452 | function ($matches) use ($member_id, $user_group, $lang) { | |
2453 | ||
2454 | $matches[1] = str_replace(array("=", " "), "", $matches[1]); | |
2455 | $matches[2] = $matches[2]; | |
2456 | ||
2457 | if( $matches[1] ) { | |
2458 | ||
2459 | $groups = explode( ',', $matches[1] ); | |
2460 | ||
2461 | if( in_array( $member_id['user_group'], $groups ) OR $member_id['user_group'] == "1") { | |
2462 | return $matches[2]; | |
2463 | } else return "<div class=\"quote\">" . $lang['news_regus'] . "</div>"; | |
2464 | ||
2465 | } else { | |
2466 | ||
2467 | if( $user_group[$member_id['user_group']]['allow_hide'] ) return $matches[2]; else return "<div class=\"quote\">" . $lang['news_regus'] . "</div>"; | |
2468 | ||
2469 | } | |
2470 | ||
2471 | }, $tpl->result['content'] ); | |
2472 | } | |
2473 | ||
2474 | if ( $config['allow_banner'] AND count($banner_in_news) AND !$view_template ){ | |
2475 | ||
2476 | foreach ( $banner_in_news as $name) { | |
2477 | $tpl->result['content'] = str_replace( "{banner_" . $name . "}", $banners[$name], $tpl->result['content'] ); | |
2478 | ||
2479 | if( $banners[$name] ) { | |
2480 | $tpl->result['content'] = str_replace ( "[banner_" . $name . "]", "", $tpl->result['content'] ); | |
2481 | $tpl->result['content'] = str_replace ( "[/banner_" . $name . "]", "", $tpl->result['content'] ); | |
2482 | } | |
2483 | } | |
2484 | ||
2485 | $tpl->result['content'] = preg_replace( "'\\[banner_(.*?)\\](.*?)\\[/banner_(.*?)\\]'si", '', $tpl->result['content'] ); | |
2486 | ||
2487 | } | |
2488 | ||
2489 | $news_id = $row['id']; | |
2490 | $allow_comments = $row['allow_comm']; | |
2491 | ||
2492 | $allow_add = true; | |
2493 | ||
2494 | if ( $config['max_comments_days'] ) { | |
2495 | ||
2496 | if ($row['date'] < ($_TIME - ($config['max_comments_days'] * 3600 * 24)) ) $allow_add = false; | |
2497 | ||
2498 | } | |
2499 | ||
2500 | if( $view_template ) $allow_comments = false; | |
2501 | ||
2502 | } | |
2503 | ||
2504 | $tpl->clear(); | |
2505 | ||
2506 | if( $config['files_allow'] AND $news_found) if( strpos( $tpl->result['content'], "[attachment=" ) !== false ) { | |
2507 | $tpl->result['content'] = show_attach( $tpl->result['content'], $news_id ); | |
2508 | } | |
2509 | ||
2510 | if( !$news_found AND !$perm AND $row['need_pass'] ) { | |
2511 | ||
2512 | $form_n_pass = <<<HTML | |
2513 | <form method="post" action=""> | |
2514 | {$lang['enter_n_pass_1']} | |
2515 | <br>{status}<br> | |
2516 | {$lang['enter_n_pass_2']} <input type="password" name="news_password" style="width:200px"> | |
2517 | <br><br> | |
2518 | <button type="submit" class="bbcodes">{$lang['enter_n_pass_3']}</button> | |
2519 | </form> | |
2520 | HTML; | |
2521 | ||
2522 | if( trim($_POST['news_password']) ) { | |
2523 | $form_n_pass = str_replace("{status}", "<br>".$lang['enter_n_pass_4']."<br>", $form_n_pass); | |
2524 | } else $form_n_pass = str_replace("{status}","", $form_n_pass); | |
2525 | ||
2526 | @header( "HTTP/1.1 403 Forbidden" ); | |
2527 | msgbox( $lang['enter_n_pass'], $form_n_pass ); | |
2528 | ||
2529 | } elseif( !$news_found AND !$perm ) { | |
2530 | ||
2531 | @header( "HTTP/1.1 403 Forbidden" ); | |
2532 | msgbox( $lang['all_err_1'], "<b>{$user_group[$member_id['user_group']]['group_name']}</b> " . $lang['news_err_28'] ); | |
2533 | ||
2534 | } elseif( !$news_found ) { | |
2535 | ||
2536 | @header( "HTTP/1.1 404 Not Found" ); | |
2537 | ||
2538 | if( $config['own_404'] AND file_exists(ROOT_DIR . '/404.html') ) { | |
2539 | @header("Content-type: text/html; charset=".$config['charset']); | |
2540 | echo file_get_contents( ROOT_DIR . '/404.html' ); | |
2541 | die(); | |
2542 | ||
2543 | } else msgbox( $lang['all_err_1'], $lang['news_err_12'] ); | |
2544 | ||
2545 | } | |
2546 | ||
2547 | unset( $row ); | |
2548 | ||
2549 | if( $allow_comments AND $news_found) { | |
2550 | ||
2551 | if( $comments_num > 0 ) { | |
2552 | ||
2553 | include_once (DLEPlugins::Check(ENGINE_DIR . '/classes/comments.class.php')); | |
2554 | $comments = new DLE_Comments( $db, $comments_num, intval($config['comm_nummers']) ); | |
2555 | ||
2556 | if( $config['comm_msort'] == "" OR $config['comm_msort'] == "ASC" ) $comm_msort = "ASC"; else $comm_msort = "DESC"; | |
2557 | ||
2558 | if( $config['tree_comments'] ) $comm_msort = "ASC"; | |
2559 | ||
2560 | if( $config['allow_cmod'] ) $where_approve = " AND " . PREFIX . "_comments.approve=1"; | |
2561 | else $where_approve = ""; | |
2562 | ||
2563 | $comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, " . PREFIX . "_comments.rating, " . PREFIX . "_comments.vote_num, " . PREFIX . "_comments.parent, name, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, lastdate, reg_date, signature, foto, fullname, land, xfields FROM " . PREFIX . "_comments LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '$news_id'" . $where_approve . " ORDER BY " . PREFIX . "_comments.id " . $comm_msort; | |
2564 | ||
2565 | if ( $allow_full_cache AND $config['allow_comments_cache'] ) $allow_full_cache = $news_id; else $allow_full_cache = false; | |
2566 | ||
2567 | $comments->build_comments('comments.tpl', 'news', $allow_full_cache, $full_link ); | |
2568 | ||
2569 | unset ($tpl->result['comments']); | |
2570 | ||
2571 | if( isset($_GET['news_page']) AND $_GET['news_page'] ) $user_query = "newsid=" . $newsid . "&news_page=" . intval( $_GET['news_page'] ); else $user_query = "newsid=" . $newsid; | |
2572 | ||
2573 | $comments->build_navigation('navigation.tpl', $link_page . "{page}," . $news_name . ".html#comment", $user_query, $full_link); | |
2574 | ||
2575 | unset ($comments); | |
2576 | unset ($tpl->result['commentsnavigation']); | |
2577 | ||
2578 | } | |
2579 | ||
2580 | if ($is_logged AND $config['comments_restricted'] AND (($_TIME - $member_id['reg_date']) < ($config['comments_restricted'] * 86400)) ) { | |
2581 | ||
2582 | $lang['news_info_6'] = str_replace( '{days}', intval($config['comments_restricted']), $lang['news_info_8'] ); | |
2583 | $allow_add = false; | |
2584 | ||
2585 | } | |
2586 | ||
2587 | if (!isset($member_id['restricted'])) $member_id['restricted'] = false; | |
2588 | ||
2589 | if( $member_id['restricted'] AND $member_id['restricted_days'] AND $member_id['restricted_date'] < $_TIME ) { | |
2590 | ||
2591 | $member_id['restricted'] = 0; | |
2592 | $db->query( "UPDATE LOW_PRIORITY " . USERPREFIX . "_users SET restricted='0', restricted_days='0', restricted_date='' WHERE user_id='{$member_id['user_id']}'" ); | |
2593 | ||
2594 | } | |
2595 | ||
2596 | if( $user_group[$member_id['user_group']]['allow_addc'] AND $config['allow_comments'] AND $allow_add AND ($member_id['restricted'] != 2 AND $member_id['restricted'] != 3) ) { | |
2597 | ||
2598 | if( !$comments_num ) { | |
2599 | if( strpos ( $tpl->result['content'], "<!--dlecomments-->" ) !== false ) { | |
2600 | ||
2601 | $tpl->result['content'] = str_replace ( "<!--dlecomments-->", "\n<div id=\"dle-ajax-comments\"></div>\n", $tpl->result['content'] ); | |
2602 | ||
2603 | } else $tpl->result['content'] .= "\n<div id=\"dle-ajax-comments\"></div>\n"; | |
2604 | } | |
2605 | ||
2606 | $tpl->load_template( 'addcomments.tpl' ); | |
2607 | ||
2608 | if ($config['allow_subscribe'] AND $is_logged AND $user_group[$member_id['user_group']]['allow_subscribe']) $allow_subscribe = true; else $allow_subscribe = false; | |
2609 | ||
2610 | if( strpos( $tpl->copy_template, "[catlist=" ) !== false ) { | |
2611 | $tpl->copy_template = preg_replace_callback ( "#\\[(catlist)=(.+?)\\](.*?)\\[/catlist\\]#is", "check_category", $tpl->copy_template ); | |
2612 | } | |
2613 | ||
2614 | if( strpos( $tpl->copy_template, "[not-catlist=" ) !== false ) { | |
2615 | $tpl->copy_template = preg_replace_callback ( "#\\[(not-catlist)=(.+?)\\](.*?)\\[/not-catlist\\]#is", "check_category", $tpl->copy_template ); | |
2616 | } | |
2617 | ||
2618 | $text=''; | |
2619 | ||
2620 | if( $config['allow_comments_wysiwyg'] > 0 ) { | |
2621 | ||
2622 | $p_name = urlencode($member_id['name']); | |
2623 | $p_id = 0; | |
2624 | include_once (DLEPlugins::Check(ENGINE_DIR . '/editor/comments.php')); | |
2625 | $bb_code = ""; | |
2626 | $allow_comments_ajax = true; | |
2627 | ||
2628 | } else { | |
2629 | ||
2630 | include_once (DLEPlugins::Check(ENGINE_DIR . '/modules/bbcode.php')); | |
2631 | ||
2632 | } | |
2633 | ||
2634 | if ( $is_logged AND $user_group[$member_id['user_group']]['disable_comments_captcha'] AND $member_id['comm_num'] >= $user_group[$member_id['user_group']]['disable_comments_captcha'] ) { | |
2635 | ||
2636 | $user_group[$member_id['user_group']]['comments_question'] = false; | |
2637 | $user_group[$member_id['user_group']]['captcha'] = false; | |
2638 | ||
2639 | } | |
2640 | ||
2641 | if( $user_group[$member_id['user_group']]['comments_question'] ) { | |
2642 | ||
2643 | $tpl->set( '[question]', "" ); | |
2644 | $tpl->set( '[/question]', "" ); | |
2645 | ||
2646 | $question = $db->super_query("SELECT id, question FROM " . PREFIX . "_question ORDER BY RAND() LIMIT 1"); | |
2647 | $tpl->set( '{question}', "<span id=\"dle-question\">".htmlspecialchars( stripslashes( $question['question'] ), ENT_QUOTES, $config['charset'] )."</span>" ); | |
2648 | ||
2649 | $_SESSION['question'] = $question['id']; | |
2650 | ||
2651 | } else { | |
2652 | ||
2653 | $tpl->set_block( "'\\[question\\](.*?)\\[/question\\]'si", "" ); | |
2654 | $tpl->set( '{question}', "" ); | |
2655 | ||
2656 | } | |
2657 | ||
2658 | if( $user_group[$member_id['user_group']]['captcha'] ) { | |
2659 | ||
2660 | if ( $config['allow_recaptcha'] ) { | |
2661 | ||
2662 | $tpl->set( '[recaptcha]', "" ); | |
2663 | $tpl->set( '[/recaptcha]', "" ); | |
2664 | ||
2665 | $tpl->set( '{recaptcha}', "<div class=\"g-recaptcha\" data-sitekey=\"{$config['recaptcha_public_key']}\" data-theme=\"{$config['recaptcha_theme']}\"></div>" ); | |
2666 | ||
2667 | $tpl->set_block( "'\\[sec_code\\](.*?)\\[/sec_code\\]'si", "" ); | |
2668 | $tpl->set( '{reg_code}', "" ); | |
2669 | ||
2670 | } else { | |
2671 | ||
2672 | $tpl->set( '[sec_code]', "" ); | |
2673 | $tpl->set( '[/sec_code]', "" ); | |
2674 | $path = parse_url( $config['http_home_url'] ); | |
2675 | $tpl->set( '{sec_code}', "<a onclick=\"reload(); return false;\" title=\"{$lang['reload_code']}\" href=\"#\"><span id=\"dle-captcha\"><img src=\"" . $path['path'] . "engine/modules/antibot/antibot.php\" alt=\"{$lang['reload_code']}\" width=\"160\" height=\"80\"></span></a>" ); | |
2676 | $tpl->set_block( "'\\[recaptcha\\](.*?)\\[/recaptcha\\]'si", "" ); | |
2677 | $tpl->set( '{recaptcha}', "" ); | |
2678 | } | |
2679 | ||
2680 | } else { | |
2681 | $tpl->set( '{sec_code}', "" ); | |
2682 | $tpl->set( '{recaptcha}', "" ); | |
2683 | $tpl->set_block( "'\\[recaptcha\\](.*?)\\[/recaptcha\\]'si", "" ); | |
2684 | $tpl->set_block( "'\\[sec_code\\](.*?)\\[/sec_code\\]'si", "" ); | |
2685 | } | |
2686 | ||
2687 | if( $config['allow_comments_wysiwyg'] > 0 ) { | |
2688 | ||
2689 | $tpl->set( '{editor}', $wysiwyg ); | |
2690 | ||
2691 | } else { | |
2692 | $tpl->set( '{editor}', $bb_code ); | |
2693 | ||
2694 | } | |
2695 | ||
2696 | $tpl->set( '{title}', $lang['news_addcom'] ); | |
2697 | ||
2698 | if( $vk_url ) { | |
2699 | $tpl->set( '[vk]', "" ); | |
2700 | $tpl->set( '[/vk]', "" ); | |
2701 | $tpl->set( '{vk_url}', $vk_url ); | |
2702 | } else { | |
2703 | $tpl->set_block( "'\\[vk\\](.*?)\\[/vk\\]'si", "" ); | |
2704 | $tpl->set( '{vk_url}', '' ); | |
2705 | } | |
2706 | if( $odnoklassniki_url ) { | |
2707 | $tpl->set( '[odnoklassniki]', "" ); | |
2708 | $tpl->set( '[/odnoklassniki]', "" ); | |
2709 | $tpl->set( '{odnoklassniki_url}', $odnoklassniki_url ); | |
2710 | } else { | |
2711 | $tpl->set_block( "'\\[odnoklassniki\\](.*?)\\[/odnoklassniki\\]'si", "" ); | |
2712 | $tpl->set( '{odnoklassniki_url}', '' ); | |
2713 | } | |
2714 | if( $facebook_url ) { | |
2715 | $tpl->set( '[facebook]', "" ); | |
2716 | $tpl->set( '[/facebook]', "" ); | |
2717 | $tpl->set( '{facebook_url}', $facebook_url ); | |
2718 | } else { | |
2719 | $tpl->set_block( "'\\[facebook\\](.*?)\\[/facebook\\]'si", "" ); | |
2720 | $tpl->set( '{facebook_url}', '' ); | |
2721 | } | |
2722 | if( $google_url ) { | |
2723 | $tpl->set( '[google]', "" ); | |
2724 | $tpl->set( '[/google]', "" ); | |
2725 | $tpl->set( '{google_url}', $google_url ); | |
2726 | } else { | |
2727 | $tpl->set_block( "'\\[google\\](.*?)\\[/google\\]'si", "" ); | |
2728 | $tpl->set( '{google_url}', '' ); | |
2729 | } | |
2730 | if( $mailru_url ) { | |
2731 | $tpl->set( '[mailru]', "" ); | |
2732 | $tpl->set( '[/mailru]', "" ); | |
2733 | $tpl->set( '{mailru_url}', $mailru_url ); | |
2734 | } else { | |
2735 | $tpl->set_block( "'\\[mailru\\](.*?)\\[/mailru\\]'si", "" ); | |
2736 | $tpl->set( '{mailru_url}', '' ); | |
2737 | } | |
2738 | if( $yandex_url ) { | |
2739 | $tpl->set( '[yandex]', "" ); | |
2740 | $tpl->set( '[/yandex]', "" ); | |
2741 | $tpl->set( '{yandex_url}', $yandex_url ); | |
2742 | } else { | |
2743 | $tpl->set_block( "'\\[yandex\\](.*?)\\[/yandex\\]'si", "" ); | |
2744 | $tpl->set( '{yandex_url}', '' ); | |
2745 | } | |
2746 | ||
2747 | if ( $allow_subscribe ) { | |
2748 | $tpl->set( '[comments-subscribe]', "<a href=\"#\" onclick=\"subscribe('{$news_id}'); return false;\" >" ); | |
2749 | $tpl->set( '[/comments-subscribe]', '</a>' ); | |
2750 | } else { | |
2751 | $tpl->set_block( "'\\[comments-subscribe\\](.*?)\\[/comments-subscribe\\]'si", "" ); | |
2752 | } | |
2753 | ||
2754 | if( ! $is_logged ) { | |
2755 | $tpl->set( '[not-logged]', '' ); | |
2756 | $tpl->set( '[/not-logged]', '' ); | |
2757 | } else $tpl->set_block( "'\\[not-logged\\](.*?)\\[/not-logged\\]'si", "" ); | |
2758 | ||
2759 | if( $is_logged ) $hidden = "<input type=\"hidden\" name=\"name\" id=\"name\" value=\"{$member_id['name']}\"><input type=\"hidden\" name=\"mail\" id=\"mail\" value=\"\">"; | |
2760 | else $hidden = ""; | |
2761 | ||
2762 | $tpl->copy_template = "<form method=\"post\" name=\"dle-comments-form\" id=\"dle-comments-form\" >" . $tpl->copy_template . " | |
2763 | <input type=\"hidden\" name=\"subaction\" value=\"addcomment\">{$hidden} | |
2764 | <input type=\"hidden\" name=\"post_id\" id=\"post_id\" value=\"{$news_id}\"><input type=\"hidden\" name=\"user_hash\" value=\"{$dle_login_hash}\"></form>"; | |
2765 | ||
2766 | $onload_scripts[] = <<<HTML | |
2767 | $('#dle-comments-form').submit(function() { | |
2768 | doAddComments(); | |
2769 | return false; | |
2770 | }); | |
2771 | HTML; | |
2772 | ||
2773 | ||
2774 | if ( $user_group[$member_id['user_group']]['captcha'] AND $config['allow_recaptcha'] ) { | |
2775 | ||
2776 | $tpl->copy_template .= <<<HTML | |
2777 | <script src='https://www.google.com/recaptcha/api.js?hl={$lang['wysiwyg_language']}' async defer></script> | |
2778 | HTML; | |
2779 | ||
2780 | } | |
2781 | ||
2782 | $tpl->compile( 'addcomments' ); | |
2783 | $tpl->clear(); | |
2784 | ||
2785 | if ( strpos ( $tpl->result['content'], "<!--dleaddcomments-->" ) !== false ) { | |
2786 | ||
2787 | $tpl->result['content'] = str_replace ( "<!--dleaddcomments-->", $tpl->result['addcomments'], $tpl->result['content'] ); | |
2788 | ||
2789 | } else { | |
2790 | ||
2791 | $tpl->result['content'] .= $tpl->result['addcomments']; | |
2792 | ||
2793 | } | |
2794 | ||
2795 | unset ($tpl->result['addcomments']); | |
2796 | ||
2797 | } elseif( $member_id['restricted'] ) { | |
2798 | ||
2799 | $tpl->load_template( 'info.tpl' ); | |
2800 | ||
2801 | if( $member_id['restricted_days'] ) { | |
2802 | ||
2803 | $lang['news_info_2'] = str_replace('{date}', langdate( "j F Y H:i", $member_id['restricted_date'] ), $lang['news_info_2'] ); | |
2804 | ||
2805 | $tpl->set( '{error}', $lang['news_info_2'] ); | |
2806 | $tpl->set( '{date}', langdate( "j F Y H:i", $member_id['restricted_date'] ) ); | |
2807 | ||
2808 | } else $tpl->set( '{error}', $lang['news_info_3'] ); | |
2809 | ||
2810 | $tpl->set( '{title}', $lang['all_info'] ); | |
2811 | $tpl->compile( 'comments_not_allowed' ); | |
2812 | $tpl->clear(); | |
2813 | ||
2814 | if ( strpos ( $tpl->result['content'], "<!--dleaddcomments-->" ) !== false ) { | |
2815 | ||
2816 | $tpl->result['content'] = str_replace ( "<!--dleaddcomments-->", $tpl->result['comments_not_allowed'], $tpl->result['content'] ); | |
2817 | ||
2818 | } else { | |
2819 | ||
2820 | $tpl->result['content'] .= $tpl->result['comments_not_allowed']; | |
2821 | ||
2822 | } | |
2823 | ||
2824 | unset ($tpl->result['comments_not_allowed']); | |
2825 | ||
2826 | } elseif( !$allow_add ) { | |
2827 | ||
2828 | $tpl->load_template( 'info.tpl' ); | |
2829 | $tpl->set( '{error}', $lang['news_info_6'] ); | |
2830 | $tpl->set( '{days}', $config['max_comments_days'] ); | |
2831 | $tpl->set( '{title}', $lang['all_info'] ); | |
2832 | $tpl->compile( 'comments_not_allowed' ); | |
2833 | $tpl->clear(); | |
2834 | ||
2835 | if ( strpos ( $tpl->result['content'], "<!--dleaddcomments-->" ) !== false ) { | |
2836 | ||
2837 | $tpl->result['content'] = str_replace ( "<!--dleaddcomments-->", $tpl->result['comments_not_allowed'], $tpl->result['content'] ); | |
2838 | ||
2839 | } else { | |
2840 | ||
2841 | $tpl->result['content'] .= $tpl->result['comments_not_allowed']; | |
2842 | ||
2843 | } | |
2844 | ||
2845 | unset ($tpl->result['comments_not_allowed']); | |
2846 | ||
2847 | } elseif( $config['allow_comments'] ) { | |
2848 | ||
2849 | $lang['news_info_1'] = str_replace('{group}', $user_group[$member_id['user_group']]['group_name'], $lang['news_info_1'] ); | |
2850 | ||
2851 | $tpl->load_template( 'info.tpl' ); | |
2852 | $tpl->set( '{error}', $lang['news_info_1'] ); | |
2853 | $tpl->set( '{group}', $user_group[$member_id['user_group']]['group_name'] ); | |
2854 | $tpl->set( '{title}', $lang['all_info'] ); | |
2855 | $tpl->compile( 'comments_not_allowed' ); | |
2856 | $tpl->clear(); | |
2857 | ||
2858 | if ( strpos ( $tpl->result['content'], "<!--dleaddcomments-->" ) !== false ) { | |
2859 | ||
2860 | $tpl->result['content'] = str_replace ( "<!--dleaddcomments-->", $tpl->result['comments_not_allowed'], $tpl->result['content'] ); | |
2861 | ||
2862 | } else { | |
2863 | ||
2864 | $tpl->result['content'] .= $tpl->result['comments_not_allowed']; | |
2865 | ||
2866 | } | |
2867 | ||
2868 | unset ($tpl->result['comments_not_allowed']); | |
2869 | ||
2870 | } | |
2871 | } | |
2872 | ?> |