Exemplo n.º 1
0
	protected function generate() {
		require_once KPATH_SITE.'/lib/kunena.link.class.php';
		if (!isset($this->_shorttype)) {
			$this->_shorttype = $this->isImage($this->filetype) ? 'image' : $this->filetype;
			$this->_shortname = KunenaForumMessageAttachmentHelper::shortenFileName($this->filename);

			$config = KunenaFactory::getConfig();
			$this->_imagelink = null;
			$template = KunenaFactory::getTemplate();
			switch (strtolower ( $this->_shorttype )) {
				case 'image' :
					// Check for thumbnail and if available, use for display
					if (file_exists ( JPATH_ROOT . '/' . $this->folder . '/thumb/' . $this->filename )) {
						$thumb = $this->folder . '/thumb/' . $this->filename;
						$imgsize = '';
					} else {
						$thumb = $this->folder . '/' . $this->filename;
						$imgsize = 'width="' . $config->thumbwidth . 'px" height="' . $config->thumbheight . 'px"';
					}

					$img = '<img title="' . $this->escape ( $this->filename ) . '" ' . $imgsize . ' src="' . JURI::ROOT () . $thumb . '" alt="' . $this->escape ( $this->filename ) . '" />';
					$this->_thumblink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $img, $this->escape ( $this->filename ), ($config->lightbox)? 'lightbox[thumb' . intval ( $this->mesid ). ']':'' );
					$img = '<img title="' . $this->escape ( $this->filename ) . '" src="' . JURI::ROOT () . $this->escape ( $this->folder ) . '/' . $this->escape ( $this->filename ) . '" alt="' . $this->escape ( $this->filename ) . '" />';
					$this->_imagelink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $img, $this->escape ( $this->filename ), ($config->lightbox)?'lightbox[imagelink' . intval ( $this->mesid ) .']':'' );
					$this->_textLink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $this->escape ( $this->_shortname ), $this->escape ( $this->filename ), ($config->lightbox)?'lightbox[simple' . $this->mesid . ']' . ' nofollow':' nofollow' ) . ' (' . number_format ( intval ( $this->size ) / 1024, 0, '', ',' ) . 'KB)';
					break;
				default :
					// Filetype without thumbnail or icon support - use default file icon
					$img = '<img src="' . $template->getImagePath('icons/attach_generic.png') . '" alt="' . JText::_ ( 'COM_KUNENA_ATTACH' ) . '" />';
					$this->_thumblink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $img, $this->escape ( $this->filename ), 'nofollow' );
					$this->_textLink = CKunenaLink::GetAttachmentLink ( $this->escape ( $this->folder ), $this->escape ( $this->filename ), $this->escape ( $this->_shortname ), $this->escape ( $this->filename ), 'nofollow' ) . ' (' . number_format ( intval ( $this->size ) / 1024, 0, '', ',' ) . 'KB)';
			}
			$this->_disabled = false;
			if (! KunenaUserHelper::getMyself()->exists()) {
				if ($this->_shorttype == 'image' && ! $config->showimgforguest) {
					$this->_disabled = true;
					$this->_textLink = JText::_ ( 'COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG' );
				}
				if ($this->_shorttype != 'image' && ! $config->showfileforguest) {
					$this->_disabled = true;
					$this->_textLink = JText::_ ( 'COM_KUNENA_SHOWIMGFORGUEST_HIDEFILE' );
				}
				if ($this->_disabled) {
					$this->_thumblink = '<img src="' . $template->getImagePath('icons/attach_generic.png') . '" alt="' . JText::_ ( 'COM_KUNENA_ATTACH' ) . '" />';
					$this->_imagelink = null;
					$this->size = 0;
				}
			}
		}
	}
Exemplo n.º 2
0
				<tbody>
				<?php 
$k = $i = 0;
if ($this->pagination->total > 0) {
    foreach ($this->attachments_instance as $attachment) {
        ?>
				<tr <?php 
        echo 'class = "row' . $k . '"';
        ?>
>
					<td><?php 
        echo JHtml::_('grid.id', $i, intval($attachment->attachment->id));
        ?>
</td>
					<td><?php 
        echo $attachment->attachment->getThumbnailLink() . ' ' . KunenaForumMessageAttachmentHelper::shortenFileName($attachment->attachment->filename, 10, 15);
        ?>
</td>
					<td><?php 
        echo $this->escape($attachment->attachment->filetype);
        ?>
</td>
					<td><?php 
        echo number_format(intval($attachment->attachment->size) / 1024, 0, '', ',') . ' KB';
        ?>
</td>
					<td><?php 
        echo isset($attachment->width) && isset($attachment->height) ? $attachment->width . ' x ' . $attachment->height : '';
        ?>
</td>
					<td><?php 
						<td class="kcol-mid"><?php 
        if ($item->authorise('delete')) {
            echo JHtml::_('grid.id', $i, intval($item->id));
        }
        ?>
</td>

						<td align="center" class="kcol-mid"><img src="<?php 
        echo $item->filetype != '' ? JUri::root(true) . '/media/kunena/icons/image.png' : JUri::root(true) . '/media/kunena/icons/file.png';
        ?>
" alt="" title="" /></td>



						<td class="kcol-mid"><?php 
        echo KunenaForumMessageAttachmentHelper::shortenFileName($item->filename, 5, 5);
        ?>
</td>



						<td class="kcol-mid"><?php 
        echo number_format(intval($item->size) / 1024, 0, '', ',') . ' ' . JText::_('COM_KUNENA_USER_ATTACHMENT_FILE_WEIGHT');
        ?>
</td>



						<td class="kcol-mid"><?php 
        echo $this->getTopicLink($message->getTopic(), $message);
        ?>
Exemplo n.º 4
0
					</tr>
				</tfoot>
		<?php
			$k = 0;
			$i = 0;
			$n = count($this->items);
			foreach($this->items as $id=>$attachment) {
				$instance = KunenaForumMessageAttachmentHelper::get($attachment->id);
				$message = $instance->getMessage();
				$path = JPATH_ROOT.'/'.$attachment->folder.'/'.$attachment->filename;
				if ( $instance->isImage($attachment->filetype) && is_file($path)) list($width, $height) =	getimagesize( $path );
		?>
			<tr <?php echo 'class = "row' . $k . '"';?>>
				<td class="right"><?php echo $i + $this->navigation->limitstart + 1; ?></td>
				<td><?php echo JHTML::_('grid.id', $i, intval($attachment->id)) ?></td>
				<td class="left" width="70%"><?php echo $instance->getThumbnailLink() . ' ' . KunenaForumMessageAttachmentHelper::shortenFileName($attachment->filename, 10, 15) ?></td>
				<td class="center"><?php echo intval($attachment->id); ?></td>
				<td class="center"><?php echo $attachment->filetype; ?></td>
				<td class="center"><?php echo number_format ( intval ( $attachment->size ) / 1024, 0, '', ',' ) . ' KB'; ?></td>
				<td class="center"><?php echo isset($width) && isset($height) ? $width . ' x ' . $height  : '' ?></td>
				<td class="center"><?php echo $message->name; ?></td>
				<td class="center"><?php echo $message->subject; ?></td>
			</tr>
				<?php
				$i++;
				$k = 1 - $k;
				}
				?>
		</table>

		<input type="hidden" name="option" value="com_kunena" />
					$i=0;
					$y=1;
					foreach ($this->items as $item) :
						$message = $item->getMessage();
						$evenodd = $i % 2;

						if ($evenodd == 0)	$usrl_class="row1";
						else $usrl_class="row2";
					?>

					<tr class="k<?php echo $usrl_class ;?>">
						<td class="kcol-first"><?php echo $y; ?></td>
						<td class="kcol-mid"><?php if ($item->authorise('delete')) echo JHtml::_('grid.id', $i, intval($item->id)) ?></td>
						<td align="center" class="kcol-mid"><img src="<?php echo $item->filetype != '' ? JUri::root(true).'/media/kunena/icons/image.png' : JUri::root(true).'/media/kunena/icons/file.png'; ?>" alt="" title="" /></td>

						<td class="kcol-mid"><?php echo KunenaForumMessageAttachmentHelper::shortenFileName($item->filename, 5, 5); ?></td>

						<td class="kcol-mid"><?php echo number_format ( intval ( $item->size ) / 1024, 0, '', ',' ) . ' '.JText::_('COM_KUNENA_USER_ATTACHMENT_FILE_WEIGHT'); ?></td>

						<td class="kcol-mid"><?php echo $this->getTopicLink($message->getTopic(), $message); ?></td>

						<td align="center" class="kcol-mid"><?php echo $item->getThumbnailLink() ; ?></td>

						<td align="center" class="kcol-mid">
							<?php if ($item->authorise('delete')) : ?>
							<a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i; ?>','delfile')">
								<img src="<?php echo $this->ktemplate->getImagePath('icons/publish_x.png') ?>" alt="" title="" />
							</a>
							<?php endif ?>
						</td>