query ("UPDATE biblio SET download_biblio = download_biblio + 1, timestamp = NOW()
WHERE biblio_id = ".$b_id);
//
if (isset($_POST['ajaxsec_user'])) {
$ajaxsec_user = $_POST['ajaxsec_user'];
}
if (isset($_POST['ajaxsec_passwd'])) {
$ajaxsec_passwd = $_POST['ajaxsec_passwd'];
}
if (($ajaxsec_user == $sysconf['ajaxsec_user']) AND ($ajaxsec_passwd == $sysconf['ajaxsec_passwd'])) {
if ($sysconf['ajaxsec_ip_enabled'] == '1') {
$server_addr = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : gethostbyname($_SERVER['SERVER_NAME']));
if ($server_addr == $sysconf['ajaxsec_ip_allowed']) {
die();
}
}
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
$attachment_q = $dbs->query('SELECT att.*, f.* FROM biblio_attachment AS att
LEFT JOIN files AS f ON att.file_id=f.file_id WHERE att.biblio_id='.$id.' AND att.access_type=\'public\' LIMIT 20');
if ($attachment_q->num_rows < 1) {
echo ''.__('No Attachment').'';
} else {
echo '
';
while ($attachment_d = $attachment_q->fetch_assoc()) {
// 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') {
if ($sysconf['pdf']['viewer'] == 'zviewer') {
echo '- ';
} elseif ($sysconf['pdf']['viewer'] == 'pdfjs') {
echo '
- ';
}
echo '
'.$attachment_d['file_desc'].'
';
if (trim($attachment_d['file_url']) != '') { echo ''; }
echo ' ';
} else if (preg_match('@(video|audio)/.+@i', $attachment_d['mime_type'])) {
echo '- ';
echo '
'.$attachment_d['file_desc'].'
';
if (trim($attachment_d['file_url']) != '') { echo ''; }
echo ' ';
} else if ($attachment_d['mime_type'] == 'text/uri-list') {
echo '- '.$attachment_d['file_title'].'
'.$attachment_d['file_desc'].'
';
} else if (preg_match('@(image)/.+@i', $attachment_d['mime_type'])) {
#echo '- '.$attachment_d['file_title'].'';
$file_loc = REPOBS.'/'.$attachment_d['file_dir'].'/'.$attachment_d['file_name'];
$imgsize = GetImageSize($file_loc);
$imgwidth = $imgsize[0] + 16;
if ($imgwidth > 600) {
$imgwidth = 600;
}
$imgheight = $imgsize[1] + 16;
if ($imgheight > 400) {
$imgheight = 400;
}
#echo '
- '.$attachment_d['file_title'].'';
echo '
- ';
if (trim($attachment_d['file_url']) != '') { echo ' [Other Resource Link]'; }
echo '
'.$attachment_d['file_desc'].'
';
} else {
echo '- '.$attachment_d['file_title'].'';
if (trim($attachment_d['file_url']) != '') { echo ' [Other Resource Link]'; }
echo '
'.$attachment_d['file_desc'].'
';
}
}
echo '
';
}
}
}