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