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