Skip to content

Commit

Permalink
finalising upload_data_file
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Hromada authored and Daniel Hromada committed Oct 10, 2011
1 parent 84c1a47 commit 41b53a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
40 changes: 18 additions & 22 deletions wwwroot/inc/eventz/display.inc
Expand Up @@ -150,28 +150,28 @@ else {


// XXX into function
if (($node['template_id']!='2019721') && (isset($_SESSION['user_id']))){
if (isset($_SESSION['user_id'])){
//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->query($q);
$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->query($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 ($template_id=='data') {
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;
$linkname = FILE_DIR."/".$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;
Expand Down Expand Up @@ -203,16 +203,12 @@ if ($template_id=='download' OR $template_id=='download.jpg') {
readfile("$filename");
exit();
}
else { echo "you don't have permissions for downloading this data"; die(); }
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
Expand Down
2 changes: 0 additions & 2 deletions wwwroot/nodes.php
Expand Up @@ -35,7 +35,6 @@

switch(true) {
case preg_match('/id\/([0-9]+)(?:\/([a-zA-Z0-9]+)\/?)?/',$_SERVER['PATH_INFO'],$match):
// print_r($match);
$_GET['node_id']=$match[1];
if (!empty($match[2])) {
$_GET['template_id']=$match[2];
Expand All @@ -52,7 +51,6 @@
break;

case preg_match('/k\/([a-z0-9]{1,7})(?:\/([a-z0-9]+))?/',$_SERVER['PATH_INFO'],$match):
echo "picic";
$_GET['node_id']=base_convert($match[1], 36, 10);
if (!empty($match[2])) {
$_GET['template_id']=$match[2];
Expand Down

0 comments on commit 41b53a9

Please sign in to comment.