Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-2151

Attachment counter

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 3.0.0
    • 3.0.x
    • Other
    • None
    • PHP Environment:
      Database:

      The counter for the number of downloads need 2 language string, and is compared in attachments.html and functions.php:

      {_file.L_DOWNLOADED_VIEWED} {_file.L_DOWNLOAD_COUNT}

      			$l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang['DOWNLOAD_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang['DOWNLOAD_COUNT'], $attachment['download_count']) : sprintf($user->lang['DOWNLOAD_COUNTS'], $attachment['download_count']));
       
      			$block_array += array(
      				'U_DOWNLOAD_LINK'		=> $download_link,
      				'L_DOWNLOADED_VIEWED'	=> $l_downloaded_viewed,
      				'L_DOWNLOAD_COUNT'		=> $l_download_count
      			);

      $l_downloaded_viewed is $user->lang['VIEWED'] or $user->lang['DOWNLOADED'].
      The problem is, in some language, the order of this is different. But, you cannot change the order, the translation isn't correct.

      Solution:
      Change the language items, to 2 items, possible patch (Note this is only for functions.php, the new correct language items and attachment.html should be modified as well)

      Index: includes/functions.php
      ===================================================================
      RCS file: /cvsroot/phpbb/phpBB2/includes/functions.php,v
      retrieving revision 1.538
      diff -u -r1.538 functions.php
      --- includes/functions.php	24 Feb 2007 12:29:33 -0000	1.538
      +++ includes/functions.php	27 Mar 2007 19:34:24 -0000
      @@ -2649,7 +2649,7 @@
       			{
       				// Images
       				case ATTACHMENT_CATEGORY_IMAGE:
      -					$l_downloaded_viewed = $user->lang['VIEWED'];
      +					$l_downloaded_viewed = 'VIEWD_COUNT';
       
       					$block_array += array(
       						'S_IMAGE'		=> true,
      @@ -2660,7 +2660,7 @@
       
       				// Images, but display Thumbnail
       				case ATTACHMENT_CATEGORY_THUMB:
      -					$l_downloaded_viewed = $user->lang['VIEWED'];
      +					$l_downloaded_viewed = 'VIEWD_COUNT';
       					$thumbnail_link = append_sid("{$phpbb_root_path}download.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1&f=' . (int) $forum_id);
       
       					$block_array += array(
      @@ -2671,7 +2671,7 @@
       
       				// Windows Media Streams
       				case ATTACHMENT_CATEGORY_WM:
      -					$l_downloaded_viewed = $user->lang['VIEWED'];
      +					$l_downloaded_viewed = 'VIEWD_COUNT';
       
       					// Giving the filename directly because within the wm object all variables are in local context making it impossible
       					// to validate against a valid session (all params can differ)
      @@ -2690,7 +2690,7 @@
       				// Real Media Streams
       				case ATTACHMENT_CATEGORY_RM:
       				case ATTACHMENT_CATEGORY_QUICKTIME:
      -					$l_downloaded_viewed = $user->lang['VIEWED'];
      +					$l_downloaded_viewed = 'VIEWD_COUNT';
       
       					$block_array += array(
       						'S_RM_FILE'			=> ($display_cat == ATTACHMENT_CATEGORY_RM) ? true : false,
      @@ -2707,7 +2707,7 @@
       				case ATTACHMENT_CATEGORY_FLASH:
       					list($width, $height) = getimagesize($filename);
       
      -					$l_downloaded_viewed = $user->lang['VIEWED'];
      +					$l_downloaded_viewed = 'VIEWD_COUNT';
       
       					$block_array += array(
       						'S_FLASH_FILE'	=> true,
      @@ -2720,7 +2720,7 @@
       				break;
       
       				default:
      -					$l_downloaded_viewed = $user->lang['DOWNLOADED'];
      +					$l_downloaded_viewed = 'DOWNLOAD_COUNT';
       
       					$block_array += array(
       						'S_FILE'		=> true,
      @@ -2728,11 +2728,10 @@
       				break;
       			}
       
      -			$l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang['DOWNLOAD_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang['DOWNLOAD_COUNT'], $attachment['download_count']) : sprintf($user->lang['DOWNLOAD_COUNTS'], $attachment['download_count']));
      +			$l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang['DOWNLOAD_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang[$l_download_viewd], $attachment['download_count']) : sprintf($user->lang[$l_download_viewd . 's'], $attachment['download_count']));
       
       			$block_array += array(
       				'U_DOWNLOAD_LINK'		=> $download_link,
      -				'L_DOWNLOADED_VIEWED'	=> $l_downloaded_viewed,
       				'L_DOWNLOAD_COUNT'		=> $l_download_count
       			);
       		}

      I modify the sprintf function so it uses the correct language variable.

            Acyd Burn Meik Sievertsen [X] (Inactive)
            Paul Paul Sohier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: