-if ($node['template_id']!='2019721'){
-//setting user location
-$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']."'";
-$db->executequery($q);
-}
-
-$whole_time=SubStr((Time()+SubStr(MicroTime(),0,8)-$timer_start),0,7);
-$smarty->assign('whole_time',$whole_time);
-
-
-if ($template_id=='download' OR $template_id=='download.jpg') {
- if ($permissions['r']) {
- $linkname = SYSTEM_ROOT."/files/".$node['node_id'];
- $filename= readlink($linkname);
- $suffix=preg_replace("/(.*?)\.(.*?)/i","$2",$filename);
-
- $ext = substr( $filename,-3 );
- if( $filename == "" ) {
- echo "ERROR: Empty file to download. ";
- exit;
- } elseif ( ! file_exists( $filename ) ) {
- exit;
- };
- switch( strtolower($ext) ){
- case "pdf": $ctype="application/pdf"; break;
- case "exe": $ctype="application/octet-stream"; break;
- case "zip": $ctype="application/zip"; break;
- case "doc": $ctype="application/msword"; break;
- case "xls": $ctype="application/vnd.ms-excel"; break;
- case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
- case "gif": $ctype="image/gif"; break;
- case "png": $ctype="image/png"; break;
- case "jpg": $ctype="image/jpg"; break;
- default: $ctype="application/force-download";
- }
- $file=str_replace(" ","_",$node['node_name']).".$ext";
- header("Pragma: public");
- header("Expires: 0");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Content-Type: $ctype");
- $user_agent = strtolower ($_SERVER["HTTP_USER_AGENT"]);
- if ((is_integer (strpos($user_agent, "msie"))) && (is_integer
- (strpos($user_agent, "win")))) {
- header( "Content-Disposition: filename=$file;" );
- } else {
- header( "Content-Disposition: attachment;
- filename=$file;" );
- }
- header("Content-Transfer-Encoding: binary");
- header("Content-Length: ".filesize($filename));
- readfile("$filename");
- exit();
- }
- else { echo "you don't have permissions for downloading this data"; die(); }
-}
-
-if ($node['template_id']=='2019721'){
-Header("Cache-control: max-age=3600");
-}else{
-Header("Cache-control: no-cache");
-Header("Expires:".gmdate("D, d M Y H:i:s")." GMT");
-header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
-}
-
-
-//for cases like search & preview
- $smarty->assign('post_vars',$_POST);
-if (!empty($_POST['template_event'])) {
- $smarty->assign('template_event',$_POST['template_event']);
-
-}
-
-//setting listing parameters
- $children_count=$node['node_children_count'];
- $descendant_count=$node['node_descendant_count'];
-
- if (is_numeric($_POST['listing_amount'])) $listing_amount=$_POST['listing_amount'];
- elseif (!empty($_SESSION['listing_amount'])) $listing_amount=$_SESSION['listing_amount'];
- else $listing_amount=DEFAULT_LISTING_AMOUNT;
- $smarty->assign('listing_amount',$listing_amount);
-
- if ($_POST['listing_order']) $listing_order=$_POST['listing_order'];
- elseif (!empty($_SESSION['listing_order'])) $listing_order=$_SESSION['listing_order'];
- else $listing_order=DEFAULT_LISTING_ORDER;
- $smarty->assign('listing_order',$listing_order);
-
- if (is_numeric($_POST['get_children_offset'])) $offset=$_POST['get_children_offset'];
- else $offset=0;
-
-
- //movement forward and backward
-// if ($listing_order=='asc' && !$offset) $offset=$descendant_count-$listing_amount;
-
- if ($_POST['get_children_move']=='<') {
- $offset=$offset-$listing_amount;
- if ($offset<0) $offset=0;
- }
- elseif ($_POST['get_children_move']=='>') {
- $offset=$offset+$listing_amount;
- }
- elseif ($_POST['get_children_move']=='>>') {
- $offset=$descendant_count-$listing_amount;
- }
-
- elseif ($_POST['get_children_move']=='<<') {
- $offset=0;
- }
- if ($offset<0) $offset=0;
- $_POST['offset']=$offset;
- $smarty->assign('offset',$offset);
-
-
-if ($node['external_link']=='header://svg' && !is_numeric($template_id)) {
- header("Content-Type: image/svg+xml");
-}
-
-//show own header
-elseif ($_SESSION['header_id']==true) {
- $smarty->assign('header_id',$_SESSION['header_id']);
- $smarty->template_dir=OWN_TEMPLATE_DIR;
- $content=$smarty->fetch($_SESSION['header_id'].".tpl");
- $smarty->template_dir = TEMPLATE_DIR.TEMPLATE_SET;
- //not registered user
- if ($_SESSION['header_id']==2091520) {
- echo $content;
- session_destroy();
- die();