WebsiteBaker 2.13.9 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
<?phpglobal $database;if (!isset($group)) return true; //No group=nn parm given..$returnvalue = '<table>';$query_files = $database->query ( 'SELECT * from '.TABLE_PREFIX.'mod_download_gallery_files where `active`=1 AND `group_id` = '.$group );if ($query_files) { while($file = $query_files->fetchRow()) { $url = WB_URL . '/modules/download_gallery/dlc.php?file=' .$file['file_id']; $returnvalue .= '<tr>'; $returnvalue .= ' <td><a href="'.$url.'" target="_blank">'.$file['title'].'</a></td>'; $returnvalue .= ' <td>'.gmdate(DATE_FORMAT, $file['modified_when']+TIMEZONE).'</td>'; $returnvalue .= ' <td>'.gmdate(TIME_FORMAT, $file['modified_when']+TIMEZONE).'</td>'; $returnvalue .= ' <td>'.$file['dlcount'].'</td>'; $returnvalue .= '</tr>'; }}$returnvalue .= '</table>';return $returnvalue;?>
Works like a charm
$returnvalue .= '<tr>'; $returnvalue .= ' <td colspan="4">'.$file['description'].'</td>'; $returnvalue .= '</tr>';
if (!isset($group)) return true; //No group=nn parm given..
if (!isset($file_id)) return true; //No file_id=nn parm given..
$query_files = $database->query ( 'SELECT * from '.TABLE_PREFIX.'mod_download_gallery_files where `active`=1 AND `group_id` = '.$group );
$query_files = $database->query ( 'SELECT * from '.TABLE_PREFIX.'mod_download_gallery_files where `file_id` = $file_id ' );
Very nice one indeed.Maybe giving a new parameter to show only a unique Download (by download ID) at wish instead of a whole group?May be interesting for example in a kind of "Blog-Entry" where you want to put a unique download at the end of the Text (or somewhere else).Regards,Stefek
Seems a bit overkill to use a script for that.
<?php if(!isset($_GET['file']) OR !is_numeric($_GET['file'])) { //echo "get file "; header('Location: ../index.php');} else { $file = (int) $_GET['file'];}if(!isset($_GET['id']) OR !is_numeric($_GET['id'])) { //echo "get id "; header('Location: ../index.php');} else { $prove = (int) $_GET['id'];}
If you know the file-id, it is just a fixed link you can add with your editor.
<?phpglobal $database;$ret_val = "";$download_url = WB_URL . '/modules/download_gallery/dlc.php?file=';if (!isset($group) && !isset($item))$ret_val = "you must specify a group or a item ID from your download gallery";elseif(isset($item)){ // UNIQUE DOWNLOAD ITEM $query_unique_file = $database->query(sprintf("SELECT * from `%s` WHERE `file_id` = '%d'", TABLE_PREFIX."mod_download_gallery_files", $item)); if ($query_unique_file) { while($file = $query_unique_file->fetchRow()) { $ret_val .= '<div class="unique_download">' .'<a href="'.$download_url.$file['file_id'].'&id='.$file['modified_when'].'" target="_blank">' .$file['title'] .'</a><small> DL:'.$file['dlcount'].'</small>' .'<div>'.$file['description'].'</div></div>'; } } }elseif(isset($group)){ // GROUP $query_files = $database->query(sprintf("SELECT * from `%s` WHERE `active`=1 AND `group_id` = '%d'", TABLE_PREFIX."mod_download_gallery_files", $group)); $ret_val = '<table border="1">'; if ($query_files) { while($file = $query_files->fetchRow()) { $ret_val .= '<tr>' .' <td><a href="'.$download_url.$file['file_id'].'&id='.$file['modified_when'].'" target="_blank">'.$file['title'].'</a></td>' .' <td>'.gmdate(DATE_FORMAT, $file['modified_when']+TIMEZONE).'</td>' .' <td>'.gmdate(TIME_FORMAT, $file['modified_when']+TIMEZONE).'</td>' .' <td>'.$file['dlcount'].'</td>' .'</tr>'; } } $ret_val .= '</table><br>';}return $ret_val;
Just a try...Code: (tested a little bit) [Select]<?phpglobal $database;if (!isset($group)) return true; //No group=nn parm given..$returnvalue = '<table>';$query_files = $database->query ( 'SELECT * from '.TABLE_PREFIX.'mod_download_gallery_files where `active`=1 AND `group_id` = '.$group );if ($query_files) { while($file = $query_files->fetchRow()) { $url = WB_URL . '/modules/download_gallery/dlc.php?file=' .$file['file_id']; $returnvalue .= '<tr>'; $returnvalue .= ' <td><a href="'.$url.'" target="_blank">'.$file['title'].'</a></td>'; $returnvalue .= ' <td>'.gmdate(DATE_FORMAT, $file['modified_when']+TIMEZONE).'</td>'; $returnvalue .= ' <td>'.gmdate(TIME_FORMAT, $file['modified_when']+TIMEZONE).'</td>'; $returnvalue .= ' <td>'.$file['dlcount'].'</td>'; $returnvalue .= '</tr>'; }}$returnvalue .= '</table>';return $returnvalue;?>Name it "download", call with [[download?group=nn]][edit]Added the `active`=1 in the query to show only active records[/edit]
<?phpglobal $database;if (!isset($group)) return true; //No group=nn parm given..$returnvalue = '<table>';$query_files = $database->query ( 'SELECT * from '.TABLE_PREFIX.'mod_download_gallery_files where `active`=1 AND `group_id` = '.$group );if ($query_files) { while($file = $query_files->fetchRow()) { $url = WB_URL . '/modules/download_gallery/dlc.php?file=' .$file['file_id']; $returnvalue .= '<tr>'; $returnvalue .= ' <td><a href="'.$url.'" target="_blank">'.$file['title'].'</a></td>'; $returnvalue .= ' <td>'.gmdate(DATE_FORMAT, $file['modified_when']+TIMEZONE).'</td>'; $returnvalue .= ' <td>'.gmdate(TIME_FORMAT, $file['modified_when']+TIMEZONE).'</td>'; $returnvalue .= ' <td>'.$file['dlcount'].'</td>'; $returnvalue .= '</tr>'; }}$returnvalue .= '</table>';return $returnvalue;?>