diff --git a/lib/contents/error.inc.php b/lib/contents/error.inc.php new file mode 100755 index 00000000..ce77760e --- /dev/null +++ b/lib/contents/error.inc.php @@ -0,0 +1,50 @@ +You have no authorization to download this file.'; + } else { + $errnum = FALSE; + } +} else { + $errnum = FALSE; +} + +#die('disini>'); + + +if ((!$errnum) AND (!is_null($errmsg))) { + echo $errmsg; +} else { + header("location:index.php"); +} + diff --git a/lib/contents/fstream-pdf.inc.php b/lib/contents/fstream-pdf.inc.php index 63821f28..4ecfddaa 100755 --- a/lib/contents/fstream-pdf.inc.php +++ b/lib/contents/fstream-pdf.inc.php @@ -1,6 +1,6 @@ num_rows > 0) { $file_loc = REPOBS.str_ireplace('/', DS, $file_d['file_dir']).DS.$file_d['file_name']; if (file_exists($file_loc)) { - if ($file_d['access_limit']) { if (utility::isMemberLogin()) { $allowed_mem_types = @unserialize($file_d['access_limit']); if (!in_array($_SESSION['m_member_type_id'], $allowed_mem_types)) { - header("location:index.php"); + header("location:index.php?p=error&errnum=601"); continue; } } else { - header("location:index.php"); + $referto = SWB.'index.php?p=member&destination=index.php?p=fstream-pdf&fid='.$fileID.'&bid='.$biblioID; + header("location:$referto"); continue; } } - header("Content-Description: File Transfer"); header('Content-Disposition: attachment; filename="'.basename($file_loc).'"'); header('Content-Type: '.$file_d['mime_type']); readfile($file_loc); - exit(); + exit(); } else { die('
File Not Found!
'); } -} else { +} else { die('
File Not Found!
'); } -exit(); +exit(); diff --git a/lib/contents/fstream.inc.php b/lib/contents/fstream.inc.php index bf52ba8e..760d751b 100755 --- a/lib/contents/fstream.inc.php +++ b/lib/contents/fstream.inc.php @@ -40,7 +40,7 @@ $file_d = $file_q->fetch_assoc(); if ($file_q->num_rows > 0) { - $file_loc_url = SWB.'/index.php?p=fstream-pdf&fid='.$fileID.'&bid='.$biblioID; + $file_loc_url = SWB.'index.php?p=fstream-pdf&fid='.$fileID.'&bid='.$biblioID; $file_loc = REPOBS.( $file_d['file_dir']?$file_d['file_dir'].'/':'' ).$file_d['file_name']; if (file_exists($file_loc)) { // check access limit @@ -50,11 +50,12 @@ if (!in_array($_SESSION['m_member_type_id'], $allowed_mem_types)) { # Access to file restricted # Member logged in but doesnt have privilege to download - header("location:index.php"); + header("location:index.php?p=error&errnum=601"); exit(); } } else { - header("location:index.php"); + $referto = SWB.'index.php?p=member&destination=index.php?p=fstream&fid='.$fileID.'&bid='.$biblioID; + header("location:$referto"); exit(); } } diff --git a/lib/contents/member.inc.php b/lib/contents/member.inc.php index e85f7cce..264b71f1 100755 --- a/lib/contents/member.inc.php +++ b/lib/contents/member.inc.php @@ -45,6 +45,18 @@ define('PASSWD_NOT_MATCH', -2); define('CANT_UPDATE_PASSWD', -3); +if (isset($_GET['destination'])) { + $destination = $_GET['destination']; + if (isset($_GET['fid'])) { + $destination .= '&fid='.$_GET['fid']; + } + if (isset($_GET['bid'])) { + $destination .= '&bid='.$_GET['bid']; + } +} else { + $destination = FALSE; +} + // if member is logged out if (isset($_GET['logout']) && $_GET['logout'] == '1') { // write log @@ -98,7 +110,11 @@ if ($logon->valid($dbs)) { // write log utility::writeLogs($dbs, 'member', $username, 'Login', 'Login success for member '.$username.' from address '.$_SERVER['REMOTE_ADDR']); - header('Location: index.php?p=member'); + if ($destination) { + header("location:$destination"); + } else { + header('Location: index.php?p=member'); + } exit(); } else { $_member_sql = sprintf('SELECT member_name FROM member @@ -233,7 +249,7 @@ function procChangePasswordNew($str_user, $str_curr_pass, $str_new_pass, $str_co
-
+
diff --git a/lib/detail.inc.php b/lib/detail.inc.php index 7a073fcd..1d80cb41 100755 --- a/lib/detail.inc.php +++ b/lib/detail.inc.php @@ -126,18 +126,6 @@ public function getAttachments() { return false; } foreach ($this->record_detail['attachments'] as $attachment_d) { - // check member type privileges - if ($attachment_d['access_limit']) { - if (utility::isMemberLogin()) { - $allowed_mem_types = @unserialize($attachment_d['access_limit']); - if (!in_array($_SESSION['m_member_type_id'], $allowed_mem_types)) { - continue; - } - } else { - continue; - } - } - #if (preg_match('@(video|audio|image)/.+@i', $attachment_d['mime_type'])) { if ($attachment_d['mime_type'] == 'application/pdf') { $_output .= '
  • '.$attachment_d['file_title'].''; $_output .= '
    '.$attachment_d['file_desc'].'
    ';