2 // output buffering forcing (mx)
3 if (!empty($_POST['FORCE_OB']) && $_POST['FORCE_OB'] == 'true') ob_start();
5 //header("Location: http://kyberia.sk");
6 // just a little joke:-))) darkaural
7 //header("Location: http://kenny.in-the-hell.org/albums/album22/HPIM1443.sized.jpg");
8 //header("Location: http://zoznamka.azet.sk/inzeraty.phtml?&kat=8");
9 //header("Location: http://web.archive.org/web/20020925021139/http://kyberia.sk");
10 //echo "este posledna pauza :)";
12 //die("tak este nie ;o)<br>uplatky posielajte postovou poukazkou ;-p<br>prajem pekny den<br>stab<br>");
13 //echo "je to uz uplne v pici. vsetky data su stratene, prajem pekny den :)";
16 // echo "<center>prvy april presiel ale ja nechcem byt koderom azetu takze ring volny</center>";
17 //echo "ehm, roztiekla sa databaza, zachovajte paniku, snad sme o hodinku spat ;)<br>br";
18 //echo "<title>establishing artificial environment</title><br><br><center>healing database inconsistency.comeback today</center>";
19 //echo '<body bgcolor=black><center><img src="http://kyberia.sk/images/under-construction.gif"><br><font color=silver>je mi luto, ale nachvilku to musim sundat ;). s pozdravom brrrrr </font></center></body>';
20 //echo '<body bgcolor=black><center><img src="http://kyberia.sk/images/construction.jpg"><br><font color=silver>je mi luto, ale nachvilku to musim sundat ;). s pozdravom br </font></center></body>';
22 //if ($_GET['node_id'] != 2334 && $_SESSION['user_id'] != '2334' && $_SESSION['user_id'] != 2095638 && $_SESSION['user_id'] != 2088 && $_GET['node_id'] != 1478235) {
23 //echo "<body><center><img src='/images/stuff/kyberia-stickerIV.jpg' /><br /><br />";
24 //echo "<b><h3>snazime sa nieco spravit s rychlostou, stay tuned.</h3></b><br />";
25 //echo "PS: my sme to odpojili z vonka</center></body>";
28 //starting timer for benchmarking purposes
29 $timer_start=Time()+
SubStr(MicroTime(),0,8);
31 //setting PHPSESSID cookie and starting user session
35 if ($_SESSION['debugging']) {
37 error_reporting(E_ALL
);
38 echo "GET VARIABLES::<br/>";
40 echo "POST VARIABLES::<br/>";
42 echo "<b>SESSION VARIABLES::</b><br/>";
46 //requiring main config file with path/database etc. constants
47 require('../config/config.inc');
48 require(INCLUDE_DIR
.'senate.inc');
50 preg_match("/id\/(.*)\//",$_SERVER['HTTP_REFERER'],$ref_match);
51 $referer_id=$ref_match[1];
53 //connecting to database and creating universal $db object
54 require(INCLUDE_DIR
.'log.inc');
55 require(INCLUDE_DIR
.'ubik.inc');
56 require(INCLUDE_DIR
.'nodes.inc');
57 require(INCLUDE_DIR
.'error_messages.inc');
58 require(INCLUDE_DIR
.'database.inc');
60 $db=new CLASS_DATABASE();
62 if (!empty($_GET['template_id'])) {
63 $template_id=$_GET['template_id'];
65 else $template_id=false;
67 //initializing node methods
68 if (!empty($_GET['node_name'])) {
69 //omfg what's this! jail , jail, penalty of death!
70 // reopened by [CENSORED], keep this in secret, then you can benefit from it..
71 if(strpos($_GET['node_name'],'0')===0) {
72 $numbah=$_GET['node_name'];
73 $db->query("set character_set_connection=latin2");
74 $set=$db->query("select * from tz.gts where full_number='$numbah'");
76 echo $set->getString('full_name')."<br>";
77 echo $set->getString('full_street')."<br>";
78 echo $set->getString('city')."<br>";
79 echo $set->getString('psc')."<br>";
80 echo $set->getString('company')."<br>";
85 else $node = nodes
::redirByName($_GET['node_name']);
87 $node = nodes
::redirByName($_GET['node_name']);
89 elseif (!empty($_GET['node_id'])) {
90 $node = nodes
::getNodeById($_GET['node_id'],$_SESSION['user_id']);
93 //loading smarty template engine and setting main parameters
94 require(SMARTY_DIR
.'Smarty.class.php');
97 $smarty->template_dir
= TEMPLATE_DIR
.TEMPLATE_SET
;
98 //echo TEMPLATE_DIR.TEMPLATE_SET;
99 //echo $smarty->template_dir;
100 $smarty->compile_dir
= SYSTEM_ROOT
."data/templates_c/".TEMPLATE_SET
;
101 $smarty->config_dir
= SMARTY_DIR
.'configs/';
102 $smarty->cache_dir
= SMARTY_DIR
.'cache/';
103 $smarty->plugins_dir
= SMARTY_PLUGIN_DIR
;
104 if ($_SESSION['debugging']) $smarty->debugging
=true;
106 //initializing variables
107 if (empty($_POST['event'])) $event=false;
108 else $event=$_POST['event'];
111 if ($_SESSION['debugging']) {
112 echo "<pre><b>NODE::";
117 if ($node['node_creator']==$_SESSION['user_id']) $node['node_permission']='owner';
119 if ($_SESSION['cube_vector']) {
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";
128 //if not existent node show our own 404
130 $nodes= nodes
::getNodesByName($_GET['node_name']);
132 $smarty->assign('nodes',$nodes);
133 $content=$smarty->display("404.tpl");
136 elseif ($_SESSION['user_id']) {
137 $smarty->assign('node_name',$_GET['node_name']);
138 $content=$smarty->display("modules/addnode.tpl");
142 //modifying node glass pearl
143 if (is_array($children_types[$node['node_type']])) $smarty->assign('children_types',$children_types[$node['node_type']]);
144 $smarty->assign('types',$types);
147 //$node['node_type']=$types[$node['node_type']];
148 $node['node_content']=StripSlashes($node['node_content']);
149 $node['node_name']=StripSlashes($node['node_name']);
151 //checking permissions
152 function _checkPermissions()
154 global $permissions, $node;
156 require(SYSTEM_ROOT
.'inc/permissions.inc');
157 $permissions=permissions
::checkPermissions($node);
158 $permissions['h']=permissions
::isHierarch($node);
162 if ($template_id=='rss')
164 $_feedType = "RSS0.91";
165 if (!is_numeric($_SESSION['user_id']))
167 if (!isset($_SERVER['PHP_AUTH_USER'])) {
168 header('WWW-Authenticate: Basic realm="Kyberia"');
169 header('HTTP/1.0 401 Unauthorized');
170 echo 'Cancel button';
175 require_once(EVENT_DIR
.'/login.inc');
176 $_POST['login'] = $_SERVER['PHP_AUTH_USER'];
177 $_POST['password'] = $_SERVER['PHP_AUTH_PW'];
178 $_POST['login_type'] = "name";
181 echo "Zle meno/heslo.";
190 if ($_GET['node_id']==='24' && $permissions['r'])
192 require_once(INCLUDE_DIR
.'/feedcreator.class.php');
194 $rss =& new UniversalFeedCreator();
195 $rss->title
= "Kyberia mail";
196 $rss->description
= "";
197 $rss->link
= "https://kyberia.sk/id/24";
199 $query = "select date_format(mail.mail_timestamp,\"%e.%c. %k:%i:%s\") as cas,
200 userfrom.user_action as locationfrom_action,
201 userfrom.user_action_id as locationfrom_action_id,
202 userto.user_action as locationto_action,
203 userto.user_action_id as locationto_action_id,
204 userto.login as mail_to_name, userfrom.login as mail_from_name,
205 mail.* from mail left join users as userfrom on
206 mail_from=userfrom.user_id left join users as userto on mail_to=userto.user_id
207 where mail_user='$_SESSION[user_id]' and mail_to='$_SESSION[user_id]' order by mail_id desc limit 0,10";
209 $set = $db->query($query);
211 while($set->next()) {
212 $m = $set->getRecord();
213 if ($m['mail_to'] != $_SESSION['user_id'])
215 $item =& new FeedItem();
216 $item->title
= $m['mail_from_name'];
217 $item->link
= "https://kyberia.sk/id/24";
218 $item->description
= $m['mail_text'];
219 $rss->addItem($item);
223 elseif ($_GET['node_id']=='19' && $permissions['r'])
225 require_once(INCLUDE_DIR
.'/feedcreator.class.php');
227 $rss =& new UniversalFeedCreator();
228 $rss->title
= "Kyberia bookmarks";
229 $rss->link
= "http://kyberia.sk/id/19";
231 require_once(SMARTY_PLUGIN_DIR
.'/function.get_bookmarks.php');
232 smarty_function_get_bookmarks(array(), $smarty);
233 $_items = $smarty->get_template_vars('get_bookmarks');
234 foreach ($_items as $_item)
236 if (is_array($_item['children']))
237 foreach ($_item['children'] as $_b)
239 $item =& new FeedItem();
240 $item->title
= $_b['node_name'];
241 $item->link
= "http://kyberia.sk/id/".$_b['node_id']."/rss";
242 $rss->addItem($item);
247 elseif ($permissions['r'])
249 require_once(INCLUDE_DIR
.'/feedcreator.class.php');
251 $rss =& new UniversalFeedCreator();
252 $rss->title
= $node['node_name'];
253 $rss->description
= "";
254 $rss->link
= "http://kyberia.sk/id/".$node['node_id'];
257 if ($_GET['node_id']=='15')
259 require_once(SMARTY_PLUGIN_DIR
.'/function.get_k.php');
260 smarty_function_get_k(array(), $smarty);
261 $_items = $smarty->get_template_vars('get_k');
265 require_once(SMARTY_PLUGIN_DIR
.'/function.get_children.php');
266 smarty_function_get_children(
267 array('orderby' => 'desc', 'orderby_type' => 'time'), $smarty);
268 $_items = $smarty->get_template_vars('get_children');
271 foreach ($_items as $_item)
273 $item =& new FeedItem();
274 $item->title
= $_item['node_name'];
275 $item->link
= "http://kyberia.sk/id/".$_item['node_id'];
276 $item->description
= $_item['node_content'];
277 $rss->addItem($item);
281 if ($permissions['r']) $rss->showFeed($_feedType);
290 if (($permissions['r']) ||
($event != 'register')) {
292 //performing node_events (based on update/insert/delete db queries)
294 require(SYSTEM_ROOT
.'inc/eventz.inc');
297 elseif ($transaction) {
298 require(SYSTEM_ROOT
.'inc/transaction.inc');
300 //end of performing node events
306 if ($permissions['r']) {
308 //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
309 if ($_SESSION['user_id']) {
310 $q="insert delayed into levenshtein set user_id='".$_SESSION['user_id']."',node_id='".$node['node_id']."'";
315 if ($node['template_id']!='2019721'){
317 log
::log('enter',$node['node_id'],'ok',$node['node_user_subchild_count']);
318 if (!empty($_SESSION['user_id']) && is_numeric($node['node_id'])) {
319 $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']."'";
321 $result=$db->update($q);
324 $q="insert into node_access set user_id='".$_SESSION['user_id']."',node_id='".$node['node_id']."',last_visit=NOW()";
327 }//end of if node os css
332 // DO NOT MESS WITH THIS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
333 //creating neural network
334 $db->update("update nodes set node_views=node_views+1 where node_id='".$node['node_id']."'");
335 if (is_numeric($referer_id)) {
336 $q="update neurons set synapse=synapse+1 where dst='".$node['node_id']."' and src='$referer_id'";
337 $result=$db->update($q);
339 $q="insert into neurons set synapse_creator='".$_SESSION['user_id']."',dst='".$node['node_id']."',src='$referer_id',synapse=1";
345 elseif (!$permissions['r'] && $_GET['magic_word']) {
346 $magic_word_big=$_GET['magic_word'];
348 if ( preg_match("/(\d+)-(.+)/",$_GET['magic_word'],$mu)) {
350 $magic_word=addslashes($mu['2']);
351 $q="select login from users where user_id='$magic_uid' and magic_word='$magic_word'";
353 if ($set->getNumRows()) {
354 $permissions['r']=true;
364 log
::log('enter',$node['node_id'],'failed');
369 //assigning user data to smarty if user logged in
370 if ($user_id=$_SESSION['user_id']) {
371 $smarty->assign('_POST',$_POST);
372 $smarty->assign('bookmarks',$_SESSION['bookmarks']);
373 $smarty->assign('ignore',$_SESSION['ignore']);
374 $smarty->assign('bookstyl',$_SESSION['bookstyl']);
375 $smarty->assign('fook',$_SESSION['fook']);
376 $smarty->assign('user_id',$_SESSION['user_id']);
377 if (!empty($_SESSION['cube_vector'])) $smarty->assign('cube_vector',$_SESSION['cube_vector']);
378 $smarty->assign('friends',$_SESSION['friends']); //req by freezy, done by darkaural
379 $smarty->assign('user_quota',$_SESSION['user_quota']);
380 $newmailset=$db->query("select user_mail,user_mail_name,user_k,k_wallet from users where user_id='$user_id'");
382 $new_mail=$newmailset->getString('user_mail');
383 $newmailset2 = $db->query("select users.user_mail_id,mailsender.login
384 from users left join users as mailsender on users.user_mail_id = mailsender.user_id where users.user_id = '$user_id'");
385 $newmailset2->next();
386 $smarty->assign('new_mail',$new_mail);
387 $smarty->assign('new_mail_name',$newmailset->getString('user_mail_name'));
388 $smarty->assign('new_mail_name2',$newmailset2->getString('login'));
389 $user_k=$newmailset->getString('user_k');
390 $smarty->assign('user_k',$user_k);
391 $k_wallet=$newmailset->getString('k_wallet');
392 $smarty->assign('k_wallet',$k_wallet);
393 $user_id=$_SESSION['user_id'];
396 if ($node['node_name']=='mail') {
398 //clear new mail message
399 if ($new_mail) $db->query("update users set user_mail=0 where user_id='$user_id'");
401 //set messages as delivered to recipient
402 $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'");
403 while($set->next()) {
404 $db->query("update mail set mail_read='yes' where mail_id='".$set->getString('mail_duplicate_id')."'");
405 $db->query("update mail set mail_read='yes' where mail_id='".$set->getString('mail_id')."'");
407 $new_messages[$set->getString('mail_id')]=true;
410 if (count($new_messages)) {
411 $db->query("update mail set mail_read='yes' where mail_user='$user_id' and mail_user=mail_to and mail_read='no'");
412 $smarty->assign('new_messages',$new_messages);
421 if ($node['node_system_access']=='crypto') {
422 $smarty->assign('crypto_pass',$_SESSION['crypto'][$node['node_id']]);
426 //$error .= "ocakavajte planovany vypadok okolo 6 hodiny <br>
427 //s pozdravom br .)";
428 //$error .= "dnes od 22:00 zurka v subclube! ucast povinna!";
430 $smarty->assign('error',$error);
431 $smarty->assign('permissions',$permissions);
432 $smarty->assign('current_vector',$node['node_vector']);
433 if ($permissions['r']) $smarty->assign('node',$node);
436 $smarty->assign('node',$node);
437 //new templates by Dark matter
438 $smarty->template_dir
=OWN_TEMPLATE_DIR
;
440 $smarty->display('1549864.tpl');
441 $smarty->display('1549885.tpl');
442 $smarty->display('630526.tpl');
445 //redirect to mainpage
446 // looks like poeple totaly hate this redirect!
447 // header("Location: /id/1");
451 if ($node['template_id']!='2019721'){
452 //setting user location
453 $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']."'";
454 $db->executequery($q);
457 $whole_time=SubStr((Time()+
SubStr(MicroTime(),0,8)-$timer_start),0,7);
458 $smarty->assign('whole_time',$whole_time);
461 if ($template_id=='download' OR $template_id=='download.jpg') {
462 if ($permissions['r']) {
463 $linkname = SYSTEM_ROOT
."/files/".$node['node_id'];
464 $filename= readlink($linkname);
465 $suffix=preg_replace("/(.*?)\.(.*?)/i","$2",$filename);
467 $ext = substr( $filename,-3 );
468 if( $filename == "" ) {
469 echo "ERROR: Empty file to download. ";
471 } elseif ( ! file_exists( $filename ) ) {
474 switch( strtolower($ext) ){
475 case "pdf": $ctype="application/pdf"; break;
476 case "exe": $ctype="application/octet-stream"; break;
477 case "zip": $ctype="application/zip"; break;
478 case "doc": $ctype="application/msword"; break;
479 case "xls": $ctype="application/vnd.ms-excel"; break;
480 case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
481 case "gif": $ctype="image/gif"; break;
482 case "png": $ctype="image/png"; break;
483 case "jpg": $ctype="image/jpg"; break;
484 default: $ctype="application/force-download";
486 $file=str_replace(" ","_",$node['node_name']).".$ext";
487 header("Pragma: public");
488 header("Expires: 0");
489 header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
490 header("Content-Type: $ctype");
491 $user_agent = strtolower ($_SERVER["HTTP_USER_AGENT"]);
492 if ((is_integer (strpos($user_agent, "msie"))) && (is_integer
493 (strpos($user_agent, "win")))) {
494 header( "Content-Disposition: filename=$file;" );
496 header( "Content-Disposition: attachment;
499 header("Content-Transfer-Encoding: binary");
500 header("Content-Length: ".filesize($filename));
501 readfile("$filename");
504 else { echo "you don't have permissions for downloading this data"; die(); }
507 if ($node['template_id']=='2019721'){
508 Header("Cache-control: max-age=3600");
510 Header("Cache-control: no-cache");
511 Header("Expires:".gmdate("D, d M Y H:i:s")." GMT");
512 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
516 //for cases like search & preview
517 $smarty->assign('post_vars',$_POST);
518 if (!empty($_POST['template_event'])) {
519 $smarty->assign('template_event',$_POST['template_event']);
523 //setting listing parameters
524 $children_count=$node['node_children_count'];
525 $descendant_count=$node['node_descendant_count'];
527 if (is_numeric($_POST['listing_amount'])) $listing_amount=$_POST['listing_amount'];
528 elseif (!empty($_SESSION['listing_amount'])) $listing_amount=$_SESSION['listing_amount'];
529 else $listing_amount=DEFAULT_LISTING_AMOUNT
;
530 $smarty->assign('listing_amount',$listing_amount);
532 if ($_POST['listing_order']) $listing_order=$_POST['listing_order'];
533 elseif (!empty($_SESSION['listing_order'])) $listing_order=$_SESSION['listing_order'];
534 else $listing_order=DEFAULT_LISTING_ORDER
;
535 $smarty->assign('listing_order',$listing_order);
537 if (is_numeric($_POST['get_children_offset'])) $offset=$_POST['get_children_offset'];
541 //movement forward and backward
542 // if ($listing_order=='asc' && !$offset) $offset=$descendant_count-$listing_amount;
544 if ($_POST['get_children_move']=='<') {
545 $offset=$offset-$listing_amount;
546 if ($offset<0) $offset=0;
548 elseif ($_POST['get_children_move']=='>') {
549 $offset=$offset+
$listing_amount;
551 elseif ($_POST['get_children_move']=='>>') {
552 $offset=$descendant_count-$listing_amount;
555 elseif ($_POST['get_children_move']=='<<') {
558 if ($offset<0) $offset=0;
559 $_POST['offset']=$offset;
560 $smarty->assign('offset',$offset);
563 if ($node['external_link']=='header://svg' && !is_numeric($template_id)) {
564 header("Content-Type: image/svg+xml");
568 elseif ($_SESSION['header_id']==true) {
569 $smarty->assign('header_id',$_SESSION['header_id']);
570 $smarty->template_dir
=OWN_TEMPLATE_DIR
;
571 $content=$smarty->fetch($_SESSION['header_id'].".tpl");
572 $smarty->template_dir
= TEMPLATE_DIR
.TEMPLATE_SET
;
573 //not registered user
574 if ($_SESSION['header_id']==2091520) {
581 $smarty->template_dir
=OWN_TEMPLATE_DIR
;
583 if (is_numeric($template_id)) {
584 $content.=$smarty->fetch($template_id.".tpl");
588 $template_id=$node['template_id'];
589 $content.=$smarty->fetch($node['template_id'].".tpl");
592 if ($template_id=='2019721'){
593 $content=$smarty->fetch($template_id.".tpl");
596 $time=SubStr((Time()+
SubStr(MicroTime(),0,8)-$timer_start),0,7);
598 // echo "<center>page generation took: $time second</center>";
602 // output buffering forcing (mx)
603 if (!empty($_POST['FORCE_OB']) && $_POST['FORCE_OB'] == 'true') ob_end_flush();
This page took 0.847255 seconds and 4 git commands to generate.