root/ip/trunk/includes/attach_mod/displaying.php

125157
295
295
296
	$image = 'templates/subSilver/images/icon_mini_message.gif';
296
	$image = 'templates/subSilver/images/icon_mini_message.gif';
297
297
298
	if ( (intval($attach_config['disable_mod'])) || (!( ($is_auth['auth_download']) && ($is_auth['auth_view']))) )
298
	if ((intval($attach_config['disable_mod'])) || (!(($is_auth['auth_download']) && ($is_auth['auth_view']))))
299
	{
299
	{
300
		return ('');
300
		return ('');
301
	}
301
	}
...
...
319
	{
319
	{
320
		$switch_attachment = $forum_row['topic_attachment'];
320
		$switch_attachment = $forum_row['topic_attachment'];
321
	}
321
	}
322
	if ( !empty($article) && ($switch_attachment == '') )
322
	if (!empty($article) && ($switch_attachment == ''))
323
	{
323
	{
324
		$switch_attachment = $article['topic_attachment'];
324
		$switch_attachment = $article['topic_attachment'];
325
	}
325
	}
326
326
327
	if ( sizeof($article) == 0 )
327
	if (sizeof($article) == 0)
328
	{
328
	{
329
		if ( (intval($switch_attachment) == 0) || intval($attach_config['disable_mod']) || (!($is_auth['auth_download'] && $is_auth['auth_view'])) )
329
		if ((intval($switch_attachment) == 0) || intval($attach_config['disable_mod']) || (!($is_auth['auth_download'] && $is_auth['auth_view'])))
330
		{
330
		{
331
			return;
331
			return;
332
		}
332
		}
...
...
334
334
335
	$post_id_array = array();
335
	$post_id_array = array();
336
336
337
	if ( sizeof($article) == 0 )
337
	if (sizeof($article) == 0)
338
	{
338
	{
339
		for ($i = 0; $i < $total_posts; $i++)
339
		for ($i = 0; $i < $total_posts; $i++)
340
		{
340
		{
...
...
810
		}
810
		}
811
811
812
		$filesize = $attachments['_' . $post_id][$i]['filesize'];
812
		$filesize = $attachments['_' . $post_id][$i]['filesize'];
813
		$size_lang = ($filesize >= 1048576) ? $lang['MB'] : ( ($filesize >= 1024) ? $lang['KB'] : $lang['Bytes'] );
813
		$size_lang = ($filesize >= 1048576) ? $lang['MB'] : (($filesize >= 1024) ? $lang['KB'] : $lang['Bytes']);
814
814
815
		if ($filesize >= 1048576)
815
		if ($filesize >= 1048576)
816
		{
816
		{
...
...
931
				}
931
				}
932
				$max_image_width = intval($config['liw_max_width']);
932
				$max_image_width = intval($config['liw_max_width']);
933
933
934
				$server_protocol = ( $config['cookie_secure'] ) ? 'https://' : 'http://';
934
				$server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
935
				$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($config['server_name']));
935
				$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($config['server_name']));
936
				$server_port = ( $config['server_port'] <> 80 ) ? ':' . trim($config['server_port']) : '';
936
				$server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) : '';
937
				$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($config['script_path']));
937
				$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($config['script_path']));
938
				$script_name = ( $script_name == '' ) ? $script_name : '/' . $script_name;
938
				$script_name = ($script_name == '') ? $script_name : '/' . $script_name;
939
939
940
				if (($max_image_width != 0) && ($config['liw_attach_enabled'] == 1) && !isset($username_from))
940
				if (($max_image_width != 0) && ($config['liw_attach_enabled'] == 1) && !isset($username_from))
941
				{
941
				{
...
...
945
					}
945
					}
946
					list($image_width, $image_height) = liw_get_dimensions($server_protocol . $server_name . $server_port . $script_name . '/' . $img_source, $post_id);
946
					list($image_width, $image_height) = liw_get_dimensions($server_protocol . $server_name . $server_port . $script_name . '/' . $img_source, $post_id);
947
947
948
					if ($image_width && ($image_width > $max_image_width) || empty($image_width) || empty($image_height) )
948
					if ($image_width && ($image_width > $max_image_width) || empty($image_width) || empty($image_height))
949
					{
949
					{
950
						$img_code = generate_liw_img_popup($img_source, $image_width, $image_height, $max_image_width);
950
						$img_code = generate_liw_img_popup($img_source, $image_width, $image_height, $max_image_width);
951
					}
951
					}
...
...
1077
1077
1078
			if ($link)
1078
			if ($link)
1079
			{
1079
			{
1080
				$target_blank = 'target="_blank"'; //( (intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT) ) ? 'target="_blank"' : '';
1080
				$target_blank = 'target="_blank"'; //((intval($display_categories[$attachments['_' . $post_id][$i]['extension']]) == IMAGE_CAT)) ? 'target="_blank"' : '';
1081
1081
1082
				// display attachment
1082
				// display attachment
1083
				$download_count_link = (($attachments['_' . $post_id][$i]['download_count'] > '0') && ($userdata['user_level'] == ADMIN)) ? ('<a href="'
. append_sid(IP_ROOT_PATH . 'attachments.' . PHP_EXT . '?attach_id=' . $attachments['_' . $post_id][$i]['attach_id']) . '">' .
sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']) . '</a>') : sprintf($lang['Download_number'], $attachments['_' .
$post_id][$i]['download_count']);
1083
				$download_count_link = (($attachments['_' . $post_id][$i]['download_count'] > '0') && ($userdata['user_level'] == ADMIN)) ? ('<a href="'
. append_sid(IP_ROOT_PATH . 'attachments.' . PHP_EXT . '?attach_id=' . $attachments['_' . $post_id][$i]['attach_id']) . '">' .
sprintf($lang['Download_number'], $attachments['_' . $post_id][$i]['download_count']) . '</a>') : sprintf($lang['Download_number'], $attachments['_' .
$post_id][$i]['download_count']);