51ff3226 |
1 | <?php |
2 | // output buffering forcing (mx) |
3 | if (!empty($_POST['FORCE_OB']) && $_POST['FORCE_OB'] == 'true') ob_start(); |
4 | |
51ff3226 |
5 | //header("Location: http://web.archive.org/web/20020925021139/http://kyberia.sk"); |
51ff3226 |
6 | //echo "je to uz uplne v pici. vsetky data su stratene, prajem pekny den :)"; |
7 | //exit; |
ab8ec5e5 |
8 | |
51ff3226 |
9 | //starting timer for benchmarking purposes |
10 | $timer_start=Time()+SubStr(MicroTime(),0,8); |
11 | |
12 | //setting PHPSESSID cookie and starting user session |
13 | session_start(); |
14 | |
45a1b870 |
15 | error_reporting(1); |
cb4300b2 |
16 | //$_SESSION['debugging']=1; |
45a1b870 |
17 | //exit; |
18 | |
51ff3226 |
19 | |
20 | if ($_SESSION['debugging']) { |
21 | |
22 | error_reporting(E_ALL); |
23 | echo "GET VARIABLES::<br/>"; |
24 | print_r($_GET); |
25 | echo "POST VARIABLES::<br/>"; |
26 | print_r($_POST); |
27 | echo "<b>SESSION VARIABLES::</b><br/>"; |
28 | print_r($_SESSION); |
29 | } |
30 | |
31 | //requiring main config file with path/database etc. constants |
ab8ec5e5 |
32 | require('config/config.inc'); |
1757f060 |
33 | require(INCLUDE_DIR.'senate.inc'); |
51ff3226 |
34 | |
2bcd35a6 |
35 | if (isset($_SERVER['HTTP_REFERER'])) { |
36 | preg_match("/id\/([0-9]*)\//",$_SERVER['HTTP_REFERER'],$ref_match); |
37 | $referer_id=$ref_match[1]; |
38 | } |
51ff3226 |
39 | |
40 | //connecting to database and creating universal $db object |
1757f060 |
41 | require(INCLUDE_DIR.'log.inc'); |
42 | require(INCLUDE_DIR.'ubik.inc'); |
43 | require(INCLUDE_DIR.'nodes.inc'); |
44 | require(INCLUDE_DIR.'error_messages.inc'); |
45 | require(INCLUDE_DIR.'database.inc'); |
51ff3226 |
46 | |
e23557a6 |
47 | $db = new CLASS_DATABASE(); |
51ff3226 |
48 | |
49 | if (!empty($_GET['template_id'])) { |
50 | $template_id=$_GET['template_id']; |
51 | } |
52 | else $template_id=false; |
53 | |
54 | //initializing node methods |
55 | if (!empty($_GET['node_name'])) { |
51ff3226 |
56 | $node = nodes::redirByName($_GET['node_name']); |
57 | } |
58 | elseif (!empty($_GET['node_id'])) { |
1f1c51a0 |
59 | $node = nodes::getNodeById($_GET['node_id'],(isset($_SESSION['user_id']))?$_SESSION['user_id']:''); |
51ff3226 |
60 | } |
61 | |
065440d5 |
62 | //XXX Paths are wrong (!) |
51ff3226 |
63 | //loading smarty template engine and setting main parameters |
64 | require(SMARTY_DIR.'Smarty.class.php'); |
65 | $smarty = new Smarty; |
66 | |
065440d5 |
67 | //$smarty->php_handling = SMARTY_PHP_REMOVE; //XXX |
39244cfc |
68 | $smarty->template_dir = TEMPLATE_DIR; |
51ff3226 |
69 | //echo TEMPLATE_DIR.TEMPLATE_SET; |
70 | //echo $smarty->template_dir; |
39244cfc |
71 | $smarty->compile_dir = SYSTEM_DATA."templates_c/"; |
175043f4 |
72 | $smarty->config_dir = SMARTY_DIR.'configs/'; //XXX neexistuje |
51ff3226 |
73 | $smarty->cache_dir = SMARTY_DIR.'cache/'; |
74 | $smarty->plugins_dir = SMARTY_PLUGIN_DIR ; |
75 | if ($_SESSION['debugging']) $smarty->debugging=true; |
76 | |
9850bdc4 |
77 | // initializing variables |
78 | // preg_replace prevents LFI |
51ff3226 |
79 | if (empty($_POST['event'])) $event=false; |
9850bdc4 |
80 | else $event= preg_replace( "![^a-zA-Z0-9_]+!", "", $_POST['event']); |
51ff3226 |
81 | |
82 | |
83 | if ($_SESSION['debugging']) { |
84 | echo "<pre><b>NODE::"; |
85 | print_r($node); |
86 | echo "</pre>"; |
87 | } |
88 | |
12425f11 |
89 | if ((isset($_SESSION['user_id']) && ($node['node_creator']==$_SESSION['user_id']))) { |
006bd683 |
90 | $node['node_permission']='owner'; |
91 | } |
51ff3226 |
92 | |
006bd683 |
93 | if (isset($_SESSION['cube_vector']) && ($_SESSION['cube_vector'])) { |
51ff3226 |
94 | if (strpos($node['node_vector'],$_SESSION['cube_vector'])===false) { |
95 | echo "node::".$node['node_vector']; |
96 | echo "cube_Vector::".$_SESSION['cube_vector']; |
97 | echo "you are out of allowed cwbe. access forbidden"; |
98 | die(); |
99 | } |
100 | } |
101 | |
102 | //if not existent node show our own 404 |
103 | if (empty($node)) { |
104 | $nodes= nodes::getNodesByName($_GET['node_name']); |
105 | if ($nodes) { |
106 | $smarty->assign('nodes',$nodes); |
107 | $content=$smarty->display("404.tpl"); |
108 | die(); |
109 | } |
110 | elseif ($_SESSION['user_id']) { |
111 | $smarty->assign('node_name',$_GET['node_name']); |
112 | $content=$smarty->display("modules/addnode.tpl"); |
113 | } |
114 | } |
115 | |
006bd683 |
116 | //modifying node glass pearl //XXX WTF |
117 | if (is_array($children_types[$node['node_type']])) { |
118 | $smarty->assign('children_types',$children_types[$node['node_type']]); |
119 | } |
51ff3226 |
120 | $smarty->assign('types',$types); |
121 | |
122 | |
123 | //$node['node_type']=$types[$node['node_type']]; |
006bd683 |
124 | $node['node_content']= StripSlashes($node['node_content']); |
125 | $node['node_name']= StripSlashes($node['node_name']); |
51ff3226 |
126 | |
127 | //checking permissions |
128 | function _checkPermissions() |
129 | { |
130 | global $permissions, $node; |
131 | |
e909f81b |
132 | require(INCLUDE_DIR.'permissions.inc'); |
51ff3226 |
133 | $permissions=permissions::checkPermissions($node); |
134 | $permissions['h']=permissions::isHierarch($node); |
135 | } |
136 | |
137 | // mail rss |
138 | if ($template_id=='rss') |
139 | { |
140 | $_feedType = "RSS0.91"; |
141 | if (!is_numeric($_SESSION['user_id'])) |
142 | { |
143 | if (!isset($_SERVER['PHP_AUTH_USER'])) { |
144 | header('WWW-Authenticate: Basic realm="Kyberia"'); |
145 | header('HTTP/1.0 401 Unauthorized'); |
146 | echo 'Cancel button'; |
147 | exit; |
148 | } |
149 | else |
150 | { |
151 | require_once(EVENT_DIR.'/login.inc'); |
152 | $_POST['login'] = $_SERVER['PHP_AUTH_USER']; |
153 | $_POST['password'] = $_SERVER['PHP_AUTH_PW']; |
154 | $_POST['login_type'] = "name"; |
155 | if (!login()) |
156 | { |
157 | echo "Zle meno/heslo."; |
158 | exit(); |
159 | } |
160 | } |
161 | } |
162 | |
163 | _checkPermissions(); |
164 | |
165 | // Mail |
166 | if ($_GET['node_id']==='24' && $permissions['r']) |
167 | { |
168 | require_once(INCLUDE_DIR.'/feedcreator.class.php'); |
169 | |
82765da6 |
170 | $rss = new UniversalFeedCreator(); |
51ff3226 |
171 | $rss->title = "Kyberia mail"; |
172 | $rss->description = ""; |
b6e35197 |
173 | $rss->link = "https://". SYSTEM_URL . "/id/24"; |
51ff3226 |
174 | |
175 | $query = "select date_format(mail.mail_timestamp,\"%e.%c. %k:%i:%s\") as cas, |
176 | userfrom.user_action as locationfrom_action, |
177 | userfrom.user_action_id as locationfrom_action_id, |
178 | userto.user_action as locationto_action, |
179 | userto.user_action_id as locationto_action_id, |
180 | userto.login as mail_to_name, userfrom.login as mail_from_name, |
181 | mail.* from mail left join users as userfrom on |
182 | mail_from=userfrom.user_id left join users as userto on mail_to=userto.user_id |
183 | where mail_user='$_SESSION[user_id]' and mail_to='$_SESSION[user_id]' order by mail_id desc limit 0,10"; |
184 | |
185 | $set = $db->query($query); |
186 | |
187 | while($set->next()) { |
188 | $m = $set->getRecord(); |
189 | if ($m['mail_to'] != $_SESSION['user_id']) |
190 | continue; |
82765da6 |
191 | $item = new FeedItem(); |
51ff3226 |
192 | $item->title = $m['mail_from_name']; |
b6e35197 |
193 | $item->link = "https://".SYSTEM_URL."/id/24"; |
51ff3226 |
194 | $item->description = $m['mail_text']; |
195 | $rss->addItem($item); |
196 | } |
197 | } |
198 | // bookmarks |
199 | elseif ($_GET['node_id']=='19' && $permissions['r']) |
200 | { |
201 | require_once(INCLUDE_DIR.'/feedcreator.class.php'); |
202 | |
82765da6 |
203 | $rss = new UniversalFeedCreator(); |
51ff3226 |
204 | $rss->title = "Kyberia bookmarks"; |
b6e35197 |
205 | $rss->link = "http://".SYSTEM_URL."/id/19"; |
51ff3226 |
206 | |
207 | require_once(SMARTY_PLUGIN_DIR.'/function.get_bookmarks.php'); |
208 | smarty_function_get_bookmarks(array(), $smarty); |
209 | $_items = $smarty->get_template_vars('get_bookmarks'); |
210 | foreach ($_items as $_item) |
211 | { |
212 | if (is_array($_item['children'])) |
213 | foreach ($_item['children'] as $_b) |
214 | { |
82765da6 |
215 | $item = new FeedItem(); |
51ff3226 |
216 | $item->title = $_b['node_name']; |
b6e35197 |
217 | $item->link = "http://".SYSTEM_URL."/id/".$_b['node_id']."/rss"; |
51ff3226 |
218 | $rss->addItem($item); |
219 | } |
220 | } |
221 | $_feedType = 'OPML'; |
222 | } |
223 | elseif ($permissions['r']) |
224 | { |
225 | require_once(INCLUDE_DIR.'/feedcreator.class.php'); |
226 | |
82765da6 |
227 | $rss = new UniversalFeedCreator(); |
51ff3226 |
228 | $rss->title = $node['node_name']; |
229 | $rss->description = ""; |
b6e35197 |
230 | $rss->link = "http://".SYSTEM_URL."/id/".$node['node_id']; |
51ff3226 |
231 | |
232 | // K list |
233 | if ($_GET['node_id']=='15') |
234 | { |
235 | require_once(SMARTY_PLUGIN_DIR.'/function.get_k.php'); |
236 | smarty_function_get_k(array(), $smarty); |
237 | $_items = $smarty->get_template_vars('get_k'); |
238 | } |
239 | else |
240 | { |
241 | require_once(SMARTY_PLUGIN_DIR.'/function.get_children.php'); |
242 | smarty_function_get_children( |
243 | array('orderby' => 'desc', 'orderby_type' => 'time'), $smarty); |
244 | $_items = $smarty->get_template_vars('get_children'); |
245 | } |
246 | |
247 | foreach ($_items as $_item) |
248 | { |
82765da6 |
249 | $item = new FeedItem(); |
51ff3226 |
250 | $item->title = $_item['node_name']; |
b6e35197 |
251 | $item->link = "http://".SYSTEM_URL."/id/".$_item['node_id']; |
51ff3226 |
252 | $item->description = $_item['node_content']; |
253 | $rss->addItem($item); |
254 | } |
255 | } |
256 | |
257 | if ($permissions['r']) $rss->showFeed($_feedType); |
258 | exit(); |
259 | } |
260 | |
261 | _checkPermissions(); |
262 | |
263 | //entering the node |
264 | |
265 | //sventest |
266 | if (($permissions['r']) || ($event != 'register')) { |
267 | |
268 | //performing node_events (based on update/insert/delete db queries) |
269 | if ($event) { |
e909f81b |
270 | require(INCLUDE_DIR.'eventz.inc'); |
51ff3226 |
271 | } |
272 | |
273 | elseif ($transaction) { |
e909f81b |
274 | require(INCLUDE_DIR.'transaction.inc'); |
51ff3226 |
275 | } |
276 | //end of performing node events |
277 | |
278 | //sventest |
279 | } |
280 | |
281 | |
282 | if ($permissions['r']) { |
283 | |
284 | //these 4 lines are not the source of kyberia lagging problems. leave them. started on the 10.4. data gained will be used for scientific purposes |
d9464c68 |
285 | if ((isset($_SESSION['user_id'])) && ($_SESSION['user_id'])) { |
51ff3226 |
286 | $q="insert delayed into levenshtein set user_id='".$_SESSION['user_id']."',node_id='".$node['node_id']."'"; |
287 | $db->update($q); |
288 | } |
289 | |
290 | //if node is css |
291 | if ($node['template_id']!='2019721'){ |
292 | |
fd15ea3a |
293 | logger::log('enter',$node['node_id'],'ok',$node['node_user_subchild_count']); |
51ff3226 |
294 | if (!empty($_SESSION['user_id']) && is_numeric($node['node_id'])) { |
295 | $q="update node_access set visits=visits+1,node_user_subchild_count='0',last_visit=NOW() where node_id='".$node['node_id']."' and user_id='".$_SESSION['user_id']."'"; |
296 | // echo $q; |
297 | $result=$db->update($q); |
298 | |
299 | if (!$result) { |
300 | $q="insert into node_access set user_id='".$_SESSION['user_id']."',node_id='".$node['node_id']."',last_visit=NOW()"; |
301 | $db->query($q); |
302 | } |
303 | }//end of if node os css |
304 | } |
305 | |
306 | |
307 | } |
308 | // DO NOT MESS WITH THIS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
309 | //creating neural network |
310 | $db->update("update nodes set node_views=node_views+1 where node_id='".$node['node_id']."'"); |
202718bc |
311 | if (isset($referer_id) && is_numeric($referer_id)) { |
51ff3226 |
312 | $q="update neurons set synapse=synapse+1 where dst='".$node['node_id']."' and src='$referer_id'"; |
313 | $result=$db->update($q); |
314 | if (!$result) { |
315 | $q="insert into neurons set synapse_creator='".$_SESSION['user_id']."',dst='".$node['node_id']."',src='$referer_id',synapse=1"; |
316 | $db->query($q); |
317 | } |
318 | } |
319 | |
320 | |
321 | elseif (!$permissions['r'] && $_GET['magic_word']) { |
322 | $magic_word_big=$_GET['magic_word']; |
323 | |
324 | if ( preg_match("/(\d+)-(.+)/",$_GET['magic_word'],$mu)) { |
325 | $magic_uid=$mu['1']; |
326 | $magic_word=addslashes($mu['2']); |
327 | $q="select login from users where user_id='$magic_uid' and magic_word='$magic_word'"; |
328 | $set=$db->query($q); |
329 | if ($set->getNumRows()) { |
330 | $permissions['r']=true; |
331 | } |
332 | } |
333 | } |
334 | |
335 | |
336 | |
337 | |
338 | |
339 | else { |
fd15ea3a |
340 | logger::log('enter',$node['node_id'],'failed'); |
51ff3226 |
341 | } |
342 | |
343 | |
344 | |
345 | //assigning user data to smarty if user logged in |
58a9d5d7 |
346 | if (isset($_SESSION['user_id'])&&($user_id=$_SESSION['user_id'])) { |
51ff3226 |
347 | $smarty->assign('_POST',$_POST); |
348 | $smarty->assign('bookmarks',$_SESSION['bookmarks']); |
349 | $smarty->assign('ignore',$_SESSION['ignore']); |
350 | $smarty->assign('bookstyl',$_SESSION['bookstyl']); |
351 | $smarty->assign('fook',$_SESSION['fook']); |
352 | $smarty->assign('user_id',$_SESSION['user_id']); |
9a7d7230 |
353 | if (!empty($_SESSION['cube_vector'])) |
354 | $smarty->assign('cube_vector',$_SESSION['cube_vector']); |
51ff3226 |
355 | $smarty->assign('friends',$_SESSION['friends']); //req by freezy, done by darkaural |
356 | $smarty->assign('user_quota',$_SESSION['user_quota']); |
9a7d7230 |
357 | |
358 | $newmail_q = sprintf('select u.user_mail_id |
359 | , u.user_k |
360 | , u.k_wallet |
361 | , u.user_mail |
362 | , ms.user_id as mail_sender_id |
363 | , ms.login as mail_sender |
364 | from users u |
365 | left join users ms on ms.user_id = u.user_mail_id |
366 | where u.user_id = %d', |
367 | $user_id); |
368 | $newmailset = $db->query($newmail_q); |
369 | |
175043f4 |
370 | //$newmailset=$db->query("select user_mail,user_mail_name,user_k,k_wallet from users where user_id='$user_id'"); |
9a7d7230 |
371 | |
51ff3226 |
372 | $newmailset->next(); |
373 | $new_mail=$newmailset->getString('user_mail'); |
374 | $newmailset2 = $db->query("select users.user_mail_id,mailsender.login |
375 | from users left join users as mailsender on users.user_mail_id = mailsender.user_id where users.user_id = '$user_id'"); |
376 | $newmailset2->next(); |
377 | $smarty->assign('new_mail',$new_mail); |
9a7d7230 |
378 | $smarty->assign('new_mail_name',$newmailset->getString('mail_sender')); |
51ff3226 |
379 | $smarty->assign('new_mail_name2',$newmailset2->getString('login')); |
380 | $user_k=$newmailset->getString('user_k'); |
381 | $smarty->assign('user_k',$user_k); |
382 | $k_wallet=$newmailset->getString('k_wallet'); |
383 | $smarty->assign('k_wallet',$k_wallet); |
384 | $user_id=$_SESSION['user_id']; |
385 | |
386 | //mail node |
387 | if ($node['node_name']=='mail') { |
388 | |
389 | //clear new mail message |
390 | if ($new_mail) $db->query("update users set user_mail=0 where user_id='$user_id'"); |
391 | |
392 | //set messages as delivered to recipient |
393 | $set=$db->query("select mail_id,mail_duplicate_id from mail where mail_user='$user_id' and mail_to='$user_id' and mail_read='no'"); |
394 | while($set->next()) { |
395 | $db->query("update mail set mail_read='yes' where mail_id='".$set->getString('mail_duplicate_id')."'"); |
396 | $db->query("update mail set mail_read='yes' where mail_id='".$set->getString('mail_id')."'"); |
397 | |
398 | $new_messages[$set->getString('mail_id')]=true; |
399 | } |
400 | /* |
401 | if (count($new_messages)) { |
402 | $db->query("update mail set mail_read='yes' where mail_user='$user_id' and mail_user=mail_to and mail_read='no'"); |
403 | $smarty->assign('new_messages',$new_messages); |
404 | |
405 | } |
406 | */ |
407 | } |
408 | } |
409 | |
410 | |
411 | |
412 | if ($node['node_system_access']=='crypto') { |
413 | $smarty->assign('crypto_pass',$_SESSION['crypto'][$node['node_id']]); |
414 | } |
415 | |
51ff3226 |
416 | $smarty->assign('error',$error); |
417 | $smarty->assign('permissions',$permissions); |
418 | $smarty->assign('current_vector',$node['node_vector']); |
419 | if ($permissions['r']) $smarty->assign('node',$node); |
420 | else { |
421 | |
422 | $smarty->assign('node',$node); |
423 | //new templates by Dark matter |
424 | $smarty->template_dir=OWN_TEMPLATE_DIR; |
425 | |
426 | $smarty->display('1549864.tpl'); |
427 | $smarty->display('1549885.tpl'); |
428 | $smarty->display('630526.tpl'); |
429 | die(); |
430 | |
431 | //redirect to mainpage |
432 | // looks like poeple totaly hate this redirect! |
433 | // header("Location: /id/1"); |
434 | } |
435 | |
436 | |
58a9d5d7 |
437 | if (($node['template_id']!='2019721') && (isset($_SESSION['user_id']))){ |
51ff3226 |
438 | //setting user location |
439 | $q="update users set last_action=NOW(),user_location_vector='".$node['node_vector']."',user_action='".addslashes($node['node_name'])."',user_action_id='".$node['node_id']."' where user_id='".$_SESSION['user_id']."'"; |
440 | $db->executequery($q); |
441 | } |
442 | |
443 | $whole_time=SubStr((Time()+SubStr(MicroTime(),0,8)-$timer_start),0,7); |
444 | $smarty->assign('whole_time',$whole_time); |
445 | |
446 | |
447 | if ($template_id=='download' OR $template_id=='download.jpg') { |
448 | if ($permissions['r']) { |
449 | $linkname = SYSTEM_ROOT."/files/".$node['node_id']; |
450 | $filename= readlink($linkname); |
451 | $suffix=preg_replace("/(.*?)\.(.*?)/i","$2",$filename); |
452 | |
453 | $ext = substr( $filename,-3 ); |
454 | if( $filename == "" ) { |
455 | echo "ERROR: Empty file to download. "; |
456 | exit; |
457 | } elseif ( ! file_exists( $filename ) ) { |
458 | exit; |
459 | }; |
460 | switch( strtolower($ext) ){ |
461 | case "pdf": $ctype="application/pdf"; break; |
462 | case "exe": $ctype="application/octet-stream"; break; |
463 | case "zip": $ctype="application/zip"; break; |
464 | case "doc": $ctype="application/msword"; break; |
465 | case "xls": $ctype="application/vnd.ms-excel"; break; |
466 | case "ppt": $ctype="application/vnd.ms-powerpoint"; break; |
467 | case "gif": $ctype="image/gif"; break; |
468 | case "png": $ctype="image/png"; break; |
469 | case "jpg": $ctype="image/jpg"; break; |
470 | default: $ctype="application/force-download"; |
471 | } |
472 | $file=str_replace(" ","_",$node['node_name']).".$ext"; |
473 | header("Pragma: public"); |
474 | header("Expires: 0"); |
475 | header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); |
476 | header("Content-Type: $ctype"); |
477 | $user_agent = strtolower ($_SERVER["HTTP_USER_AGENT"]); |
478 | if ((is_integer (strpos($user_agent, "msie"))) && (is_integer |
479 | (strpos($user_agent, "win")))) { |
480 | header( "Content-Disposition: filename=$file;" ); |
481 | } else { |
482 | header( "Content-Disposition: attachment; |
483 | filename=$file;" ); |
484 | } |
485 | header("Content-Transfer-Encoding: binary"); |
486 | header("Content-Length: ".filesize($filename)); |
487 | readfile("$filename"); |
488 | exit(); |
489 | } |
490 | else { echo "you don't have permissions for downloading this data"; die(); } |
491 | } |
492 | |
493 | if ($node['template_id']=='2019721'){ |
494 | Header("Cache-control: max-age=3600"); |
495 | }else{ |
496 | Header("Cache-control: no-cache"); |
497 | Header("Expires:".gmdate("D, d M Y H:i:s")." GMT"); |
498 | header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
499 | } |
500 | |
501 | |
502 | //for cases like search & preview |
503 | $smarty->assign('post_vars',$_POST); |
504 | if (!empty($_POST['template_event'])) { |
505 | $smarty->assign('template_event',$_POST['template_event']); |
506 | |
507 | } |
508 | |
509 | //setting listing parameters |
510 | $children_count=$node['node_children_count']; |
511 | $descendant_count=$node['node_descendant_count']; |
512 | |
202718bc |
513 | if (isset($_POST['listing_amount']) && is_numeric($_POST['listing_amount'])) { |
514 | $listing_amount=mysql_real_escape_string($_POST['listing_amount']); |
515 | }elseif (!empty($_SESSION['listing_amount'])) $listing_amount=$_SESSION['listing_amount']; |
51ff3226 |
516 | else $listing_amount=DEFAULT_LISTING_AMOUNT; |
517 | $smarty->assign('listing_amount',$listing_amount); |
518 | |
202718bc |
519 | if (isset($_POST['listing_order']) && $_POST['listing_order']) { |
520 | $listing_order=mysql_real_escape_string($_POST['listing_order']); |
521 | } elseif (!empty($_SESSION['listing_order'])) $listing_order=$_SESSION['listing_order']; |
51ff3226 |
522 | else $listing_order=DEFAULT_LISTING_ORDER; |
523 | $smarty->assign('listing_order',$listing_order); |
524 | |
202718bc |
525 | if (isset ($_POST['get_children_offset']) && is_numeric($_POST['get_children_offset'])) { |
526 | $offset=$_POST['get_children_offset']; |
527 | } else { $offset=0; } |
51ff3226 |
528 | |
529 | |
530 | //movement forward and backward |
531 | // if ($listing_order=='asc' && !$offset) $offset=$descendant_count-$listing_amount; |
532 | |
533 | if ($_POST['get_children_move']=='<') { |
534 | $offset=$offset-$listing_amount; |
535 | if ($offset<0) $offset=0; |
536 | } |
537 | elseif ($_POST['get_children_move']=='>') { |
538 | $offset=$offset+$listing_amount; |
539 | } |
540 | elseif ($_POST['get_children_move']=='>>') { |
541 | $offset=$descendant_count-$listing_amount; |
542 | } |
543 | |
544 | elseif ($_POST['get_children_move']=='<<') { |
545 | $offset=0; |
546 | } |
547 | if ($offset<0) $offset=0; |
548 | $_POST['offset']=$offset; |
549 | $smarty->assign('offset',$offset); |
550 | |
551 | |
552 | if ($node['external_link']=='header://svg' && !is_numeric($template_id)) { |
553 | header("Content-Type: image/svg+xml"); |
554 | } |
555 | |
556 | //show own header |
58a9d5d7 |
557 | elseif (isset($_SESSION['header_id']) && ($_SESSION['header_id']==true)) { |
51ff3226 |
558 | $smarty->assign('header_id',$_SESSION['header_id']); |
559 | $smarty->template_dir=OWN_TEMPLATE_DIR; |
560 | $content=$smarty->fetch($_SESSION['header_id'].".tpl"); |
561 | $smarty->template_dir = TEMPLATE_DIR.TEMPLATE_SET; |
562 | //not registered user |
563 | if ($_SESSION['header_id']==2091520) { |
564 | echo $content; |
565 | session_destroy(); |
566 | die(); |
567 | } |
568 | } |
569 | |
570 | $smarty->template_dir=OWN_TEMPLATE_DIR; |
571 | |
572 | if (is_numeric($template_id)) { |
573 | $content.=$smarty->fetch($template_id.".tpl"); |
574 | } |
575 | |
576 | else { |
577 | $template_id=$node['template_id']; |
578 | $content.=$smarty->fetch($node['template_id'].".tpl"); |
579 | } |
580 | |
581 | if ($template_id=='2019721'){ |
582 | $content=$smarty->fetch($template_id.".tpl"); |
583 | echo $content; |
584 | }else{ |
585 | $time=SubStr((Time()+SubStr(MicroTime(),0,8)-$timer_start),0,7); |
586 | echo $content; |
587 | // echo "<center>page generation took: $time second</center>"; |
588 | } |
589 | //end of displaying |
590 | |
591 | // output buffering forcing (mx) |
592 | if (!empty($_POST['FORCE_OB']) && $_POST['FORCE_OB'] == 'true') ob_end_flush(); |
593 | |
594 | ?> |