Wicher's phpBB2 Mods Forum Index Wicher's phpBB2 Mods
On this board you will find all phpBB2 mods that i have created over the years. Most mods are on this board installed. Before asking for support, be sure to have your board updated to the latest phpBB2 version.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Simple db_update generatorSimple db_update generator   Advanced db_update generatorAdvanced db_update generator 
 This board is protected by Phpbbantispam 

Adjusted ViewAttachment

 
Board Alert Board Message
There are in this topic 8 posts to view if you are logged in.

You can log in or register via the login / registerlink here or in the header.
Back to top  Login here and be redirected to this TopicLogin here and be redirected to this Topic RegisterRegister
Reply to topic    Wicher's phpBB2 Mods Forum Index -> Wicher's phpBB Mods Was this Topic Helpful?  
Points for this topic: 0
Topic gradiation: 
View previous topic :: View next topic  
Author Adjusted ViewAttachment
Wicher
Site Admin


Joined: 16 Dec 2005
Posts: 1144
User's local time:
2024 Mar 28 - 8:05 PM
Country IP         : Netherlands
Country of choice: Netherlands


Was This Post Helpful?

 
Users postingpoints:
58
Posts points:
0
Post gradiation:
PostPosted: Wed Dec 21, 2005 6:42 pm    Post subject: Reply with quote

I changed some code in the viewattachment mod so it now displayes no longer only the links to the attachments but shows the images that are attached.
This only works oke with images that are attached, not with zips or txt or whatever.
The attachments can be show user by user by clicking on the users name.

For the rest: USE AT OWN RISK AND MAKE BACKUPS!!!!
(with thanks to thoul for pointing me in some right directions without knowing where is was for.)


You can view an example at: http://www.wichersmods.nl/attachments.php
When your there, click on a username at the right of the image to see the attachments from that user only.

Before u can use this u willl have to install also:
http://www.phpbbhacks.com/download/4863


Also download the attachment at the bottom of this posting, extract the zip in your images folder.


ATTACHMENTS.PHP:
Code:
  1. <?php
  2. /***************************************************************************
  3.  *                        attachments.php
  4.  *                            -------------------
  5.  *   begin                : Friday, Aug 23, 2002
  6.  *   copyright            : (C) 2002 Meik Sievertsen
  7.  *   email                : acyd.burn@gmx.de
  8.  *
  9.  *   $Id: attachments.php,v 1.0.2 2003/08/31 meik Exp $
  10.  *
  11.  *   This version of attachments.php is heavely adjusted for my own needs.
  12.  *   Use at own risk.
  13.  *   
  14.  ***************************************************************************/
  15. /***************************************************************************
  16.  *
  17.  *   This program is free software; you can redistribute it and/or modify
  18.  *   it under the terms of the GNU General Public License as published by
  19.  *   the Free Software Foundation; either version 2 of the License, or
  20.  *   (at your option) any later version.
  21.  *
  22.  ***************************************************************************/
  23. define('IN_PHPBB', true);
  24. $phpbb_root_path = './';
  25. include($phpbb_root_path . 'extension.inc');
  26. include($phpbb_root_path . 'common.'.$phpEx);
  27. //
  28. // Start session management
  29. //
  30. $userdata = session_pagestart($user_ip, PAGE_INDEX);
  31. init_userprefs($userdata);
  32. //
  33. // End session management
  34. //
  35. if( !$userdata['session_logged_in'] || !isset($userdata))
  36. {
  37. redirect("login.$phpEx?redirect=attachments.$phpEx");
  38. }
  39. $attachment_mod_installed = ( defined('ATTACH_CONFIG_TABLE') ) ? TRUE : FALSE;
  40. if (!$attachment_mod_installed)
  41. {
  42.    message_die(GENERAL_MESSAGE, "The Attachment Mod have to be installed in order to see the Attachment List.");
  43. }
  44. $sql = 'SELECT config_value
  45.    FROM ' . ATTACH_CONFIG_TABLE . "
  46.    WHERE config_name = 'attach_version'";
  47. if (!($result = $db->sql_query($sql)))
  48. {
  49.    message_die(GENERAL_ERROR, "Unable to query config table.", '', __LINE__, __FILE__, $sql);
  50. }
  51. if (!($row = $db->sql_fetchrow($result)))
  52. {
  53.    message_die(GENERAL_MESSAGE, 'Wrong Attachment Version detected.<br />Please update your Attachment Mod (V' . ATTACH_VERSION . ') to at least Version 3.0.0.');
  54. }
  55. $attachment_version = $row['config_value'];
  56. $real_filename = 'real_filename';
  57. $attach_table = ATTACHMENTS_TABLE;
  58. $attach_desc_table = ATTACHMENTS_DESC_TABLE;
  59. $sql = 'SELECT config_value
  60.    FROM ' . CONFIG_TABLE . "
  61.    WHERE config_name = 'default_lang'";
  62. if (!($result = $db->sql_query($sql)))
  63. {
  64.    message_die(GENERAL_ERROR, "Unable to query config table.", '', __LINE__, __FILE__, $sql);
  65. }
  66. $default_lang = $db->sql_fetchrow($result);
  67. $default_lang = $default_lang['config_value'];
  68. $language = $board_config['default_lang'];
  69. if( !file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.'.$phpEx) )
  70. {
  71.    $language = $default_lang;
  72. }
  73. include($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.' . $phpEx);
  74. //
  75. // Start user modifiable variables
  76. //
  77. //
  78. // Define the default forum by forum-id OR by Forum Name
  79. // If both are set, the forum id is used
  80. // To display the Attachments of all Forums, please set the display_all variable to true
  81. //
  82. $default_forum_id = '';
  83. $default_forum_name = '';
  84. // Set this to FALSE or fill the above values for a specific forum to be displayed
  85. $display_all_forums = TRUE;
  86. //
  87. // File extensions to show
  88. // If not present here, viewattachments will show an empty tablecell
  89. $image_files = array(
  90.            'bmp',
  91.            'jpg',
  92.            'png',
  93.            'tga',
  94.            'gif',
  95.            'peg');
  96. $flash_files = array(
  97.            'swf');
  98. $zip_files = array(
  99.            'tar',
  100.            'ace',
  101.            'zip',
  102.            'rar',
  103.            '.gz');
  104. $doc_files = array(
  105.            'doc',
  106.            'xls',
  107.            'dot',
  108.            'pdf',
  109.            '.ps',
  110.            '.ai',
  111.            'pps',
  112.            'ppt');
  113. $txt_files = array(
  114.            'txt',
  115.            'cpp',
  116.            'diz',
  117.            'inf',
  118.            'hpp');
  119. $video_files = array(
  120.            'avi',
  121.            'mpg',
  122.            '.rm',
  123.            'wma',
  124.            'wmv');
  125. $sound_files = array(
  126.            'mp3',
  127.            'wav',
  128.            'mid');
  129. //
  130. // Define the default Sort.
  131. // Valid values are: filename, comment, filesize, downloads, post_time
  132. //
  133. $default_sort_method = 'filename';
  134. //
  135. // Default Sort Order: ASC or DESC
  136. //
  137. $default_sort_order = 'ASC';
  138. //
  139. // End user modifiable variables
  140. //
  141. //
  142. // Determine the variables we need for sorting and such
  143. //
  144. $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
  145. if(isset($HTTP_POST_VARS['order']))
  146. {
  147.    $sort_order = ($HTTP_POST_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
  148. }
  149. else if(isset($HTTP_GET_VARS['order']))
  150. {
  151.    $sort_order = ($HTTP_GET_VARS['order'] == 'ASC') ? 'ASC' : 'DESC';
  152. }
  153. else
  154. {
  155.    $sort_order = $default_sort_order;
  156. }
  157. if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
  158. {
  159.    $mode = (isset($HTTP_POST_VARS['mode'])) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];
  160. }
  161. else
  162. {
  163.    $mode = $default_sort_method;
  164. }
  165. // Sort and Mode Select
  166. $mode_types_text = array($lang['Sort_Filename'], $lang['Sort_Comment'], $lang['Sort_Size'], $lang['Sort_Downloads'], $lang['Sort_Posttime']);
  167. $mode_types = array('filename', 'comment', 'filesize', 'downloads', 'post_time');
  168. $select_sort_mode = '<select name="mode">';
  169. for($i = 0; $i < count($mode_types_text); $i++)
  170. {
  171.    $selected = ( $mode == $mode_types[$i] ) ? ' selected="selected"' : '';
  172.    $select_sort_mode .= '<option value="' . $mode_types[$i] . '"' . $selected . '>' . $mode_types_text[$i] . '</option>';
  173. }
  174. $select_sort_mode .= '</select>';
  175. $select_sort_order = '<select name="order">';
  176. if($sort_order == 'ASC')
  177. {
  178.    $select_sort_order .= '<option value="ASC" selected="selected">' . $lang['Sort_Ascending'] . '</option><option value="DESC">' . $lang['Sort_Descending'] . '</option>';
  179. }
  180. else
  181. {
  182.    $select_sort_order .= '<option value="ASC">' . $lang['Sort_Ascending'] . '</option><option value="DESC" selected="selected">' . $lang['Sort_Descending'] . '</option>';
  183. }
  184. $select_sort_order .= '</select>';
  185. switch ($mode)
  186. {
  187.    case 'filename':
  188.       $order_by = '' . $real_filename . ' ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['posts_per_page'];
  189.       break;
  190.    case 'comment':
  191.       $order_by = 'comment ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['posts_per_page'];
  192.       break;
  193.    case 'filesize':
  194.       $order_by = 'filesize ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['posts_per_page'];
  195.       break;
  196.    case 'downloads':
  197.       $order_by = 'download_count ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['posts_per_page'];
  198.       break;
  199.    case 'post_time':
  200.       $order_by = 'filetime ' . $sort_order . ' LIMIT ' . $start . ', ' . $board_config['posts_per_page'];
  201.       break;
  202.    default:
  203.       message_die(GENERAL_MESSAGE, "Please have a look at the attachments.php file and define valid sort order default values.");
  204.       break;
  205. }
  206. // Forum Select
  207. if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]))
  208. {
  209.    $forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? $HTTP_POST_VARS[POST_FORUM_URL] : $HTTP_GET_VARS[POST_FORUM_URL];
  210.   if ($forum_id == -1)
  211.   {
  212.     $forum_id = '*';
  213.     $display_all_forums = true;
  214.   }
  215. }
  216. else
  217. {
  218.    $default_forum_id = intval($default_forum_id);
  219.    if ($default_forum_id)
  220.    {
  221.       $forum_id = intval($default_forum_id);
  222.    }
  223.    else if ($default_forum_name != '')
  224.    {
  225.       $sql = "SELECT forum_id
  226.       FROM " . FORUMS_TABLE . "
  227.       WHERE forum_name='" . $default_forum_name . "'";
  228.    
  229.       if ( !($result = $db->sql_query($sql) ))
  230.       {
  231.          message_die(GENERAL_MESSAGE, "Please specify a valid Forum Name.'" . $default_forum_name . "' could not be found.");
  232.       }
  233.       $row = $db->sql_fetchrow($result);
  234.       $forum_id = $row['forum_id'];
  235.    }
  236.    else if (!$display_all_forums)
  237.    {
  238.       message_die(GENERAL_MESSAGE, "Please have a look at the attachments.php file and define valid forum default values.");
  239.    }
  240.    if ($forum_id)
  241.    {
  242.       $sql = "SELECT forum_id
  243.       FROM " . FORUMS_TABLE . "
  244.       WHERE forum_id = $forum_id
  245.       LIMIT 1";
  246.       if ( !($result = $db->sql_query($sql) ))
  247.       {
  248.          message_die(GENERAL_ERROR, "Couldn't query forums table.", '', __LINE__, __FILE__, $sql);
  249.       }
  250.       if ($db->sql_numrows($result) == 0)
  251.       {
  252.          message_die(GENERAL_MESSAGE, "The default forum id/name does not exist, please check your default values.");
  253.       }
  254.    }
  255. }
  256. //
  257. // Search forum - first delete those the user have not access to and then those the user have no permission to download to.
  258. //
  259. $sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id 
  260.    FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
  261.    WHERE f.cat_id = c.cat_id
  262.    ORDER BY c.cat_id, f.forum_order";
  263. if ( !($result = $db->sql_query($sql)) )
  264. {
  265.    message_die(GENERAL_ERROR, 'Could not obtain forum_name/forum_id', '', __LINE__, __FILE__, $sql);
  266. }
  267. $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
  268. $is_download_auth_ary = auth(AUTH_DOWNLOAD, AUTH_LIST_ALL, $userdata);
  269. $forum_ids = array();
  270. $select_forums = '';
  271. while( $row = $db->sql_fetchrow($result) )
  272. {
  273.    if ( ( $is_auth_ary[$row['forum_id']]['auth_read'] ) && ( $is_download_auth_ary[$row['forum_id']]['auth_download'] ) )
  274.    {
  275.       $selected = ( $forum_id == $row['forum_id'] ) ? ' selected="selected"' : '';
  276.       $select_forums .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $row['forum_name'] . '</option>';
  277.       $forum_ids[] = $row['forum_id'];
  278.    }
  279. }
  280. if ( $select_forums != '' )
  281. {
  282.    $select_forums = '<select name="' . POST_FORUM_URL . '"><option value="-1">' . $lang['All_available'] . '</option>' . $select_forums . '</select>';
  283. }
  284. else
  285. {
  286.    message_die(GENERAL_MESSAGE, "You are not authorized to view Attachments at all.");
  287. }
  288. $forum_id = intval($forum_id);
  289. $page_title = $lang['Statistics'];
  290. include($phpbb_root_path . 'includes/page_header.'.$phpEx);
  291. $template->set_filenames(array(
  292.    'body' => 'attachments.tpl')
  293. );
  294. $sql = '';
  295. $user = ( isset($_REQUEST['gebruiker']) ) ? htmlspecialchars(strip_tags(trim($_REQUEST['gebruiker']))) : '';
  296. if ($user != '')
  297. {
  298.    if (!$forum_id && $display_all_forums)
  299.    {
  300.       $sql = "SELECT a.*, t.topic_title, d.*, u.*
  301.          FROM " . $attach_table . " a, " . $attach_desc_table . " d, "  . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
  302.          WHERE (a.post_id = p.post_id)
  303.          AND (p.forum_id IN (" . implode(', ', $forum_ids) . "))
  304.          AND (p.topic_id = t.topic_id)
  305.          AND (a.attach_id = d.attach_id)
  306.          AND (a.user_id_1 = u.user_id)
  307.             AND (u.username = '" . $user . "')
  308.          ORDER BY $order_by";
  309.    }
  310.    else if (($is_auth_ary[$forum_id]['auth_read']) && ($is_download_auth_ary[$forum_id]['auth_download']))
  311.    {
  312.       $sql = "SELECT a.*, t.topic_title, d.*, u.*
  313.          FROM " . $attach_table . " a, " . $attach_desc_table . " d, "  . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
  314.          WHERE (a.post_id = p.post_id)
  315.          AND (p.forum_id = " . $forum_id . ")
  316.          AND (p.topic_id = t.topic_id)
  317.          AND (a.attach_id = d.attach_id)
  318.          AND (a.user_id_1 = u.user_id)
  319.             AND (u.username = '" . $user . "')
  320.          ORDER BY $order_by";
  321.    }
  322. $backtobegin = '<a href="attachments.php">' . $lang['BackToAll'] . '</a>';
  323. $useronly = $lang['Attachmentsfrom'] . $user;
  324. }
  325. else
  326. {
  327.    if (!$forum_id && $display_all_forums)
  328.    {
  329.       $sql = "SELECT a.*, t.topic_title, d.*, u.*
  330.          FROM " . $attach_table . " a, " . $attach_desc_table . " d, "  . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
  331.          WHERE (a.post_id = p.post_id)
  332.          AND (p.forum_id IN (" . implode(', ', $forum_ids) . "))
  333.          AND (p.topic_id = t.topic_id)
  334.          AND (a.attach_id = d.attach_id)
  335.          AND (a.user_id_1 = u.user_id)
  336.          ORDER BY $order_by";
  337.    }
  338.    else if (($is_auth_ary[$forum_id]['auth_read']) && ($is_download_auth_ary[$forum_id]['auth_download']))
  339.    {
  340.       $sql = "SELECT a.*, t.topic_title, d.*, u.*
  341.          FROM " . $attach_table . " a, " . $attach_desc_table . " d, "  . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
  342.          WHERE (a.post_id = p.post_id)
  343.          AND (p.forum_id = " . $forum_id . ")
  344.          AND (p.topic_id = t.topic_id)
  345.          AND (a.attach_id = d.attach_id)
  346.          AND (a.user_id_1 = u.user_id)
  347.          ORDER BY $order_by";
  348.    }
  349. $backtobegin = '';
  350. $useronly = $lang['AllAttachments'];
  351. }
  352. $tussen = '»';
  353. $nodesc = $lang['no_desc'];
  354. $template->set_filenames(array(
  355.    'body' => 'attachments.tpl')
  356. );
  357. $template->assign_vars(array(
  358.    'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'],
  359.    'L_ORDER' => $lang['Order'],
  360.    'L_SORT' => $lang['Sort'],
  361.    'L_SUBMIT' => $lang['Submit'],
  362.    'L_FORUM' => $lang['Forum'],
  363.    'L_ATTACHMENTS' => $lang['Attachments'],
  364.    'L_FILENAME' => $lang['File_name'],
  365.    'L_FILECOMMENT' => $lang['File_comment'],
  366.    'L_SIZE' => $lang['Size_in_kb'],
  367.    'L_DOWNLOADS' => $lang['Downloads'],
  368.    'L_POST_TIME' => $lang['Post_time'],
  369.    'L_POSTED_IN_TOPIC' => $lang['Posted_in_topic'],
  370.    
  371.    'S_MODE_SELECT' => $select_sort_mode,
  372.    'S_ORDER_SELECT' => $select_sort_order,
  373.    'S_FORUM_SELECT' => $select_forums,
  374.    'USERONLY' => $useronly,
  375.    'BYUSER' => $lang['From'],
  376.    'IMG_NUM' => $lang['number'],
  377.    'SEEN' => $lang['seen'],
  378.    'POSTED_IN' => $lang['posted_in'],
  379.    'DESC_IMG' => $lang['desc_img'],
  380.    'CLICKTOENLARGE' => $lang['click_to_enlarge'],
  381.    'IMG_' => $lang['img_'],
  382.    'TUSSEN' => $tussen,
  383.    'ONLYUSERATTACH' => $lang['only_user_attach'],
  384.    'FILE_NAME' => $lang['file_name'],
  385.    'FILE_NAME' => $lang['file_name'],
  386.    'S_MODE_ACTION' => append_sid("attachments.$phpEx"))
  387. );
  388.    
  389. if ($sql != '')
  390. {
  391.    if (!($result = $db->sql_query($sql)))
  392.    {
  393.       message_die(GENERAL_ERROR, 'Couldn\'t query attachments', '', __LINE__, __FILE__, $sql);
  394.    }
  395.    
  396.    $attachments = $db->sql_fetchrowset($result);
  397.    $num_attachments = $db->sql_numrows($result);
  398. }
  399. else
  400. {
  401.    $attachments = array();
  402.    $num_attachments = 0;
  403. }
  404. for ($i = 0; $i < $num_attachments; $i++)
  405. {
  406.    $class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
  407.   $filename = $attachments[$i][$real_filename];
  408.   $file_ext = substr($filename, (strlen($filename) - 3), strlen($filename));
  409.   $file_ext = strtolower($file_ext);
  410.    $post_title = $attachments[$i]['topic_title'];
  411.    $post_title_2 = '';
  412.    
  413.    if (strlen($post_title) > 32)
  414.    {
  415.       $post_title_2 = substr($post_title, 0, 30) . '...';
  416.    }
  417.    $view_topic = append_sid('viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . $attachments[$i]['post_id'] . '#' . $attachments[$i]['post_id']);
  418.    if ($post_title_2 != '')
  419.    {
  420.       $post_title = '<a href="' . $view_topic . '" class="gen" title="' . $post_title . '" target="_blank">' . $post_title_2 . '</a>';
  421.    }
  422.    else
  423.    {
  424.       $post_title = '<a href="' . $view_topic . '" class="gen" target="_blank">' . $post_title . '</a>';
  425.    }
  426.    $comment = htmlspecialchars($attachments[$i]['comment']);
  427.    $comment_2 = '';
  428.    if (strlen($comment) > 298)
  429.    {
  430.       $comment_2 = substr($comment, 0, 300) . '...';
  431.    }
  432.    if ($comment_2 != '')
  433.    {
  434.       $comment_field = '<span title="' . $comment . '">' . $comment_2 . '</span>';
  435.    }
  436.    else
  437.    {
  438.       $comment_field = $comment;
  439.    }
  440.    if (strlen($comment) < 1)
  441.    {
  442.       $comment_field = $nodesc;
  443.    }
  444.    
  445. //   $filename = $attachments[$i][$real_filename];
  446.    $filename_2 = '';
  447.    
  448.    if (strlen($filename) > 25)
  449.    {
  450. $filename = strrev($filename);
  451.       $filename_2 = substr($filename, 0, 23) . '...';
  452. $filename_2 = strrev($filename_2);
  453. $filename = strrev($filename);
  454.    }
  455.    else
  456.    {
  457.    $filename_2 = $filename;
  458.    }
  459. $view_attachment = 'files/' . ($attachments[$i]['physical_filename']);
  460. if ( in_array($file_ext, $image_files) )
  461. {
  462.    if ($filename_2 != '')
  463.    {
  464.       $filename_link = '<a href="' . $view_attachment . '" class="gen" title="' . $filename . '" target="_blank"><img src="size.php?pic=' . $view_attachment . '"></a>';
  465.       }
  466.    else
  467.    {
  468.          $filename_link = '<a href="' . $view_attachment . '" class="gen" target="_blank"><img src="size.php?pic=' . $view_attachment . '"></a>';
  469.    }
  470. }
  471. else
  472. {
  473.    if ( in_array($file_ext, $flash_files) )
  474.    {
  475.          if ($filename_2 != '')
  476.          {
  477.          $filename_link = '<a href="' . $view_attachment . '" class="gen" title="' . $filename . '" target="_blank"><img src="images/flash.gif"></a>';
  478.          }
  479.          else
  480.          {
  481.                $filename_link = '<a href="' . $view_attachment . '" class="gen" target="_blank"><img src="images/flash.gif"></a>';
  482.          }
  483.    }
  484.    elseif ( in_array($file_ext, $zip_files) )
  485.    {
  486.          if ($filename_2 != '')
  487.          {
  488.          $filename_link = '<a href="' . $view_attachment . '" class="gen" title="' . $filename . '" target="_blank"><img src="images/zip.gif"></a>';
  489.          }
  490.          else
  491.          {
  492.                $filename_link = '<a href="' . $view_attachment . '" class="gen" target="_blank"><img src="images/zip.gif"></a>';
  493.          }
  494.    }
  495.    elseif ( in_array($file_ext, $txt_files) )
  496.    {
  497.          if ($filename_2 != '')
  498.          {
  499.          $filename_link = '<a href="' . $view_attachment . '" class="gen" title="' . $filename . '" target="_blank"><img src="images/txt.gif"></a>';
  500.          }
  501.          else
  502.          {
  503.                $filename_link = '<a href="' . $view_attachment . '" class="gen" target="_blank"><img src="images/txt.gif"></a>';
  504.          }
  505.    }
  506.    elseif ( in_array($file_ext, $doc_files) )
  507.    {
  508.          if ($filename_2 != '')
  509.          {
  510.          $filename_link = '<a href="' . $view_attachment . '" class="gen" title="' . $filename . '" target="_blank"><img src="images/doc.gif"></a>';
  511.          }
  512.          else
  513.          {
  514.                $filename_link = '<a href="' . $view_attachment . '" class="gen" target="_blank"><img src="images/doc.gif"></a>';
  515.          }
  516.    }
  517.    elseif ( in_array($file_ext, $video_files) )
  518.    {
  519.          if ($filename_2 != '')
  520.          {
  521.          $filename_link = '<a href="' . $view_attachment . '" class="gen" title="' . $filename . '" target="_blank"><img src="images/mpg.gif"></a>';
  522.          }
  523.          else
  524.          {
  525.                $filename_link = '<a href="' . $view_attachment . '" class="gen" target="_blank"><img src="images/mpg.gif"></a>';
  526.          }
  527.    }
  528.    elseif ( in_array($file_ext, $sound_files) )
  529.    {
  530.          if ($filename_2 != '')
  531.          {
  532.          $filename_link = '<a href="' . $view_attachment . '" class="gen" title="' . $filename . '" target="_blank"><img src="images/mp3.gif"></a>';
  533.          }
  534.          else
  535.          {
  536.                $filename_link = '<a href="' . $view_attachment . '" class="gen" target="_blank"><img src="images/mp3.gif"></a>';
  537.          }
  538.    }
  539. }
  540. $userfinds = '<a href="attachments.php?gebruiker=' . $attachments[$i]['username'] . '">' . $attachments[$i]['username'] . '</a>';
  541.    $template->assign_block_vars('attachrow', array(
  542.       'ROW_NUMBER' => $i + ( $HTTP_GET_VARS['start'] + 1 ),
  543.       'ROW_CLASS' => $class,
  544.       'FILENAME' => $filename,
  545.      'FILENAME_2' => $filename_2,
  546.       'COMMENT' => $comment_field,
  547.       'SIZE' => round(($attachments[$i]['filesize'] / 1024), 2),
  548.       'DOWNLOAD_COUNT' => $attachments[$i]['download_count'],
  549.       'POST_TIME' => create_date($board_config['default_dateformat'], $attachments[$i]['filetime'], $board_config['board_timezone']),
  550.       'POST_TITLE' => $post_title,
  551.       'VIEW_ATTACHMENT' => $filename_link,
  552.       'BACKTOBEGIN' => $backtobegin,
  553.       'BY_USER' => $userfinds)
  554.    );
  555. }
  556. $sql = '';
  557. if ($user != '')
  558. {
  559.    if (!$forum_id && $display_all_forums)
  560.    {
  561.       $sql = "SELECT count(*) AS total
  562.          FROM " . $attach_table . " a, " . USERS_TABLE . " u
  563.          WHERE (a.user_id_1 = u.user_id)
  564.             AND (u.username = '" . $user . "')";
  565.    }
  566.    else if ( ( $is_auth_ary[$forum_id]['auth_read'] ) && ( $is_download_auth_ary[$forum_id]['auth_download'] ) && ($num_attachments > 0) )
  567.    {
  568.       $sql = "SELECT count(*) AS total
  569.          FROM " . $attach_table . " a, " . USERS_TABLE . " u
  570.          WHERE (a.user_id_1 = u.user_id)
  571.             AND (u.username = '" . $user . "')";
  572.    }
  573.    if ($sql != '')
  574.    {
  575.       if (!($result = $db->sql_query($sql)))
  576.       {
  577.          message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
  578.       }
  579.       if ( $total = $db->sql_fetchrow($result) )
  580.       {
  581.          $total = $total['total'];
  582.          $total = $total-2;
  583.          $pagination = generate_pagination("{$phpbb_root_path}attachments.$phpEx?mode=$mode&amp;gebruiker=" . $user . "&amp;order=$sort_order&amp;" . POST_FORUM_URL . "=$forum_id", $total, $board_config['posts_per_page'], $start). '&nbsp;';
  584.       }
  585.       $template->assign_vars(array(
  586.          'PAGINATION' => $pagination,
  587.          'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['posts_per_page'] ) + 1 ), ceil( $total / $board_config['posts_per_page'] )),
  588.          'USER_ID' => 'User ID',
  589.          'L_GOTO_PAGE' => $lang['Goto_page'])
  590.       );
  591.    }
  592. }
  593. else
  594. {
  595.    if (!$forum_id && $display_all_forums)
  596.    {
  597.       $sql = "SELECT count(*) AS total
  598.          FROM " . $attach_table . " a, " . POSTS_TABLE . " p
  599.          WHERE (a.post_id = p.post_id) AND (p.forum_id IN (" . implode(', ', $forum_ids) . "))";
  600.    }
  601.    else if ( ( $is_auth_ary[$forum_id]['auth_read'] ) && ( $is_download_auth_ary[$forum_id]['auth_download'] ) && ($num_attachments > 0) )
  602.    {
  603.       $sql = "SELECT count(*) AS total
  604.          FROM " . $attach_table . " a, " . POSTS_TABLE . " p
  605.          WHERE (a.post_id = p.post_id) AND (p.forum_id = " . $forum_id . ")";
  606.    }
  607.    if ($sql != '')
  608.    {
  609.       if (!($result = $db->sql_query($sql)))
  610.       {
  611.          message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
  612.       }
  613.       if ( $total = $db->sql_fetchrow($result) )
  614.       {
  615.          $total = $total['total'];
  616.          $total = $total-2;
  617.          $pagination = generate_pagination("{$phpbb_root_path}attachments.$phpEx?mode=$mode&amp;order=$sort_order&amp;" . POST_FORUM_URL . "=$forum_id", $total, $board_config['posts_per_page'], $start). '&nbsp;';
  618.       }
  619.       $template->assign_vars(array(
  620.          'PAGINATION' => $pagination,
  621.          'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['posts_per_page'] ) + 1 ), ceil( $total / $board_config['posts_per_page'] )),
  622.          'USER_ID' => 'User ID',
  623.          'L_GOTO_PAGE' => $lang['Goto_page'])
  624.       );
  625.    }
  626. }
  627. $template->pparse('body');
  628. include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
  629. ?>


ATTACHMENTS.TPL:
Code:
  1. <table width="100%" cellspacing="0" cellpadding="0" border="0">
  2.   <tr>
  3.    <td><span class="nav">{PAGE_NUMBER}</span></td>
  4.    <td align="right"><span class="nav">{PAGINATION}</span></td>
  5.   </tr>
  6. </table>
  7. <form method="post" action="{S_MODE_ACTION}">
  8.   <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
  9.    <tr>
  10.      <td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> {TUSSEN} {USERONLY}</span></td>
  11.    </tr>
  12.    <tr>
  13.      <td align="right" nowrap="nowrap"><span class="genmed">{L_SELECT_SORT_METHOD}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp;{L_FORUM}&nbsp;{S_FORUM_SELECT}&nbsp;&nbsp;
  14.       <input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
  15.       </span></td>
  16.    </tr>
  17.   </table>
  18.   {ERROR_BOX}
  19.    
  20.   {USERONLY}
  21.    
  22.   <table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
  23.    <tr>
  24.      <th width="610" class="thTop" nowrap="nowrap">{IMG_}</th>
  25.      <th class="thCornerR" nowrap="nowrap">{L_POSTED_IN_TOPIC}</th>
  26.    </tr>
  27.    <!-- BEGIN attachrow -->
  28.    <tr>
  29.    <td class="row" align="center"><span class="gen">{attachrow.VIEW_ATTACHMENT}</span></td>
  30.    <td valign="top" class="row4" align="left" valign="middle"><span class="gen">
  31.    <br><br>{IMG_NUM} <b>{attachrow.ROW_NUMBER}</b>
  32.    <br />{FILE_NAME} <b>{attachrow.FILENAME_2}</b>
  33.    <br />{BYUSER}: <b>{attachrow.BY_USER}</b>
  34.    <br />{ONLYUSERATTACH}
  35.    <br />{SEEN} <b>{attachrow.DOWNLOAD_COUNT}</b>
  36.    <br />{POSTED_IN} <b>{attachrow.POST_TITLE}</b>
  37.    <br /><br />{DESC_IMG} <b>{attachrow.COMMENT}</b>
  38.    <br /><br />{CLICKTOENLARGE}
  39.    <br /><br />{attachrow.BACKTOBEGIN}</span></td>
  40.    </tr>
  41.    <!-- END attachrow -->
  42.    <tr>
  43.      <td class="catbottom" colspan="8" height="28">&nbsp;</td>
  44.    </tr>
  45.   </table>
  46. <table width="100%" cellspacing="0" cellpadding="0" border="0">
  47.   <tr>
  48.    <td><span class="nav">{PAGE_NUMBER}</span></td>
  49.    <td align="right"><span class="nav">{PAGINATION}</span></td>
  50.   </tr>
  51. </table>
  52.   <table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
  53.    <tr>
  54.      <td align="right" nowrap="nowrap"><span class="genmed">{L_SELECT_SORT_METHOD}:&nbsp;{S_MODE_SELECT}&nbsp;&nbsp;{L_ORDER}&nbsp;{S_ORDER_SELECT}&nbsp;&nbsp;{L_FORUM}&nbsp;{S_FORUM_SELECT}&nbsp;&nbsp;
  55.       <input type="submit" name="submit" value="{L_SUBMIT}" class="liteoption" />
  56.       </span></td>
  57.    </tr>
  58.    <tr>
  59.      <td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> {TUSSEN} {USERONLY}</span></td>
  60.    </tr>
  61.   </table>
  62. </form>


LANGMAIN.PHP INSERTS:
If English:
Code:
  1. // View_Attachments_with_image
  2. $lang['number'] = 'Number:';
  3. $lang['seen'] = 'Seen:';
  4. $lang['posted_in'] = 'Posted in:';
  5. $lang['desc_img'] = 'Description:';
  6. $lang['click_to_enlarge'] = 'Click the image to see it at original size.';
  7. $lang['img_'] = 'Image';
  8. $lang['only_user_attach'] = '(Click to see only this users attachments)';
  9. $lang['AllAttachments'] = 'All Attachments';
  10. $lang['Attachmentsfrom'] = 'Attachments from ';
  11. $lang['BackToAll'] = 'To all Attachments';
  12. $lang['file_name'] = 'Filename';
  13. $lang['no_desc'] = 'No description availible';


If Dutch
Code:
  1. // View_Attachments_with_image
  2. $lang['number'] = 'Nummer:';
  3. $lang['seen'] = 'Maal bekeken:';
  4. $lang['posted_in'] = 'Gepost in:';
  5. $lang['desc_img'] = 'Beschrijving:';
  6. $lang['click_to_enlarge'] = 'Klik op de afbeelding om de afbeelding op de <br />originele grootte te bekijken.';
  7. $lang['img_'] = 'Afbeelding';
  8. $lang['only_user_attach'] = '(klik om de vondsten van deze gebruiker te bekijken)';
  9. $lang['AllAttachments'] = 'Alle Vondsten';
  10. $lang['Attachmentsfrom'] = 'Vondsten van ';
  11. $lang['BackToAll'] = 'Naar alle vondsten.';
  12. $lang['file_name'] = 'Bestandsnaam: ';
  13. $lang['no_desc'] = 'Geen beschrijving aanwezig';

_________________

Wicher's phpBB2 Mods | Wicher's phpBB3 Mods | Statistics Mod 4.x.x


Last edited by Wicher on Mon Feb 19, 2007 12:28 pm; edited 5 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Post new topic    Reply to topic    Wicher's phpBB2 Mods Forum Index -> Wicher's phpBB Mods
Author Adjusted ViewAttachment Replies
Display posts from previous:   
Post new topic   Reply to topic    Wicher's phpBB2 Mods Forum Index -> Wicher's phpBB Mods All times are GMT

Was this Topic Helpful?  
Points for this topic: 0
Topic gradiation: 
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

This board is protected by Phpbbantispam
Powered by phpBB © 2001, 2005 phpBB Group

Googlepage: GooglePullerPage
IP Country Flag 2.9.4 © 2005, 2007 - 3Di (aka 3D)