| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/com_media.tar |
access.xml 0000604 00000001150 15245570546 0006535 0 ustar 00 <?xml version="1.0" encoding="utf-8" ?>
<access component="com_media">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.options" title="JACTION_OPTIONS" description="JACTION_OPTIONS_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
</section>
</access>
config.xml 0000604 00000006477 15245570546 0006562 0 ustar 00 <?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="component"
label="COM_MEDIA_FIELDSET_OPTIONS_LABEL">
<field
name="upload_extensions"
type="text"
label="COM_MEDIA_FIELD_LEGAL_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_LEGAL_EXTENSIONS_DESC"
size="50"
default="bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,BMP,CSV,DOC,GIF,ICO,JPG,JPEG,ODG,ODP,ODS,ODT,PDF,PNG,PPT,TXT,XCF,XLS"
/>
<field
name="upload_maxsize"
type="number"
label="COM_MEDIA_FIELD_MAXIMUM_SIZE_LABEL"
description="COM_MEDIA_FIELD_MAXIMUM_SIZE_DESC"
validate="number"
min="0"
size="50"
default="10"
/>
<field
name="spacer1"
type="spacer"
label="COM_MEDIA_FOLDERS_PATH_LABEL"
class="text"
/>
<field
name="file_path"
type="text"
label="COM_MEDIA_FIELD_PATH_FILE_FOLDER_LABEL"
description="COM_MEDIA_FIELD_PATH_FILE_FOLDER_DESC"
size="50"
default="images"
validate="filePath"
exclude="administrator|api|bin|cache|cli|components|includes|language|layouts|libraries|media|modules|plugins|templates|tmp"
/>
<field
name="image_path"
type="text"
label="COM_MEDIA_FIELD_PATH_IMAGE_FOLDER_LABEL"
description="COM_MEDIA_FIELD_PATH_IMAGE_FOLDER_DESC"
size="50"
default="images"
validate="filePath"
exclude="administrator|api|bin|cache|cli|components|includes|language|layouts|libraries|modules|plugins|templates|tmp"
/>
<field
name="restrict_uploads"
type="radio"
label="COM_MEDIA_FIELD_RESTRICT_UPLOADS_LABEL"
description="COM_MEDIA_FIELD_RESTRICT_UPLOADS_DESC"
class="btn-group btn-group-yesno"
default="1"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="check_mime"
type="radio"
label="COM_MEDIA_FIELD_CHECK_MIME_LABEL"
description="COM_MEDIA_FIELD_CHECK_MIME_DESC"
class="btn-group btn-group-yesno"
default="1"
showon="restrict_uploads:1"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="image_extensions"
type="text"
label="COM_MEDIA_FIELD_LEGAL_IMAGE_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_LEGAL_IMAGE_EXTENSIONS_DESC"
size="50"
default="bmp,gif,jpg,png"
showon="restrict_uploads:1"
/>
<field
name="ignore_extensions"
type="text"
label="COM_MEDIA_FIELD_IGNORED_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_IGNORED_EXTENSIONS_DESC"
size="50"
/>
<field
name="upload_mime"
type="text"
label="COM_MEDIA_FIELD_LEGAL_MIME_TYPES_LABEL"
description="COM_MEDIA_FIELD_LEGAL_MIME_TYPES_DESC"
size="50"
default="image/jpeg,image/gif,image/png,image/bmp,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip"
showon="restrict_uploads:1"
/>
<field
name="upload_mime_illegal"
type="text"
label="COM_MEDIA_FIELD_ILLEGAL_MIME_TYPES_LABEL"
description="COM_MEDIA_FIELD_ILLEGAL_MIME_TYPES_DESC"
size="50"
default="text/html"
showon="restrict_uploads:1"
/>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
filter="rules"
validate="rules"
component="com_media"
section="component"
/>
</fieldset>
</config>
models/manager.php 0000604 00000011020 15245570546 0010155 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Media Component Manager Model
*
* @since 1.5
*/
class MediaModelManager extends JModelLegacy
{
/**
* Method to get model state variables
*
* @param string $property Optional parameter name
* @param mixed $default Optional default value
*
* @return object The property where specified, the state object where omitted
*
* @since 1.5
*/
public function getState($property = null, $default = null)
{
static $set;
if (!$set)
{
$input = JFactory::getApplication()->input;
$folder = $input->get('folder', '', 'path');
$this->setState('folder', $folder);
$fieldid = $input->get('fieldid', '');
$this->setState('field.id', $fieldid);
$parent = str_replace("\\", '/', dirname($folder));
$parent = ($parent == '.') ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property, $default);
}
/**
* Get a select field with a list of available folders
*
* @param string $base The image directory to display
*
* @return html
*
* @since 1.5
*/
public function getFolderList($base = null)
{
// Get some paths from the request
if (empty($base))
{
$base = COM_MEDIA_BASE;
}
// Corrections for windows paths
$base = str_replace(DIRECTORY_SEPARATOR, '/', $base);
$com_media_base_uni = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE);
// Get the list of folders
jimport('joomla.filesystem.folder');
$folders = JFolder::folders($base, '.', true, true);
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_MEDIA_INSERT_IMAGE'));
// Build the array of select options for the folder list
$options[] = JHtml::_('select.option', '', '/');
foreach ($folders as $folder)
{
$folder = str_replace($com_media_base_uni, '', str_replace(DIRECTORY_SEPARATOR, '/', $folder));
$value = substr($folder, 1);
$text = str_replace(DIRECTORY_SEPARATOR, '/', $folder);
$options[] = JHtml::_('select.option', $value, $text);
}
// Sort the folder list array
if (is_array($options))
{
sort($options);
}
// Get asset and author id (use integer filter)
$input = JFactory::getApplication()->input;
$asset = $input->get('asset', 0, 'integer');
// For new items the asset is a string. JAccess always checks type first
// so both string and integer are supported.
if ($asset == 0)
{
$asset = htmlspecialchars(json_encode(trim($input->get('asset', 0, 'cmd'))), ENT_COMPAT, 'UTF-8');
}
$author = $input->get('author', 0, 'integer');
// Create the dropdown folder select list
$attribs = 'size="1" onchange="ImageManager.setFolder(this.options[this.selectedIndex].value, ' . $asset . ', ' . $author . ')" ';
$list = JHtml::_('select.genericlist', $options, 'folderlist', $attribs, 'value', 'text', $base);
return $list;
}
/**
* Get the folder tree
*
* @param mixed $base Base folder | null for using base media folder
*
* @return array
*
* @since 1.5
*/
public function getFolderTree($base = null)
{
// Get some paths from the request
if (empty($base))
{
$base = COM_MEDIA_BASE;
}
$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE . '/');
// Get the list of folders
jimport('joomla.filesystem.folder');
$folders = JFolder::folders($base, '.', true, true);
$tree = array();
foreach ($folders as $folder)
{
$folder = str_replace(DIRECTORY_SEPARATOR, '/', $folder);
$name = substr($folder, strrpos($folder, '/') + 1);
$relative = str_replace($mediaBase, '', $folder);
$absolute = $folder;
$path = explode('/', $relative);
$node = (object) array('name' => $name, 'relative' => $relative, 'absolute' => $absolute);
$tmp = &$tree;
for ($i = 0, $n = count($path); $i < $n; $i++)
{
if (!isset($tmp['children']))
{
$tmp['children'] = array();
}
if ($i == $n - 1)
{
// We need to place the node
$tmp['children'][$relative] = array('data' => $node, 'children' => array());
break;
}
if (array_key_exists($key = implode('/', array_slice($path, 0, $i + 1)), $tmp['children']))
{
$tmp = &$tmp['children'][$key];
}
}
}
$tree['data'] = (object) array('name' => JText::_('COM_MEDIA_MEDIA'), 'relative' => '', 'absolute' => $base);
return $tree;
}
}
models/list.php 0000604 00000012701 15245570546 0007525 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
/**
* Media Component List Model
*
* @since 1.5
*/
class MediaModelList extends JModelLegacy
{
/**
* Method to get model state variables
*
* @param string $property Optional parameter name
* @param mixed $default Optional default value
*
* @return object The property where specified, the state object where omitted
*
* @since 1.5
*/
public function getState($property = null, $default = null)
{
static $set;
if (!$set)
{
$input = JFactory::getApplication()->input;
$folder = $input->get('folder', '', 'path');
$this->setState('folder', $folder);
$parent = str_replace("\\", '/', dirname($folder));
$parent = ($parent == '.') ? null : $parent;
$this->setState('parent', $parent);
$set = true;
}
return parent::getState($property, $default);
}
/**
* Get the images on the current folder
*
* @return array
*
* @since 1.5
*/
public function getImages()
{
$list = $this->getList();
return $list['images'];
}
/**
* Get the folders on the current folder
*
* @return array
*
* @since 1.5
*/
public function getFolders()
{
$list = $this->getList();
return $list['folders'];
}
/**
* Get the documents on the current folder
*
* @return array
*
* @since 1.5
*/
public function getDocuments()
{
$list = $this->getList();
return $list['docs'];
}
/**
* Build imagelist
*
* @return array
*
* @since 1.5
*/
public function getList()
{
static $list;
// Only process the list once per request
if (is_array($list))
{
return $list;
}
// Get current path from request
$current = (string) $this->getState('folder');
$basePath = COM_MEDIA_BASE . ((strlen($current) > 0) ? '/' . $current : '');
$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE . '/');
// Reset base path
if (strpos(realpath($basePath), JPath::clean(realpath(COM_MEDIA_BASE))) !== 0)
{
$basePath = COM_MEDIA_BASE;
}
$images = array ();
$folders = array ();
$docs = array ();
$videos = array ();
$fileList = false;
$folderList = false;
if (file_exists($basePath))
{
// Get the list of files and folders from the given folder
$fileList = JFolder::files($basePath);
$folderList = JFolder::folders($basePath);
}
// Iterate over the files if they exist
if ($fileList !== false)
{
$tmpBaseObject = new JObject;
foreach ($fileList as $file)
{
if (is_file($basePath . '/' . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html')
{
$tmp = clone $tmpBaseObject;
$tmp->name = $file;
$tmp->title = $file;
$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/', JPath::clean($basePath . '/' . $file));
$tmp->path_relative = str_replace($mediaBase, '', $tmp->path);
$tmp->size = filesize($tmp->path);
$ext = strtolower(JFile::getExt($file));
switch ($ext)
{
// Image
case 'jpg':
case 'png':
case 'gif':
case 'xcf':
case 'odg':
case 'bmp':
case 'jpeg':
case 'ico':
$info = @getimagesize($tmp->path);
$tmp->width = @$info[0];
$tmp->height = @$info[1];
$tmp->type = @$info[2];
$tmp->mime = @$info['mime'];
if (($info[0] > 60) || ($info[1] > 60))
{
$dimensions = MediaHelper::imageResize($info[0], $info[1], 60);
$tmp->width_60 = $dimensions[0];
$tmp->height_60 = $dimensions[1];
}
else
{
$tmp->width_60 = $tmp->width;
$tmp->height_60 = $tmp->height;
}
if (($info[0] > 16) || ($info[1] > 16))
{
$dimensions = MediaHelper::imageResize($info[0], $info[1], 16);
$tmp->width_16 = $dimensions[0];
$tmp->height_16 = $dimensions[1];
}
else
{
$tmp->width_16 = $tmp->width;
$tmp->height_16 = $tmp->height;
}
$images[] = $tmp;
break;
// Video
case 'mp4':
$tmp->icon_32 = 'media/mime-icon-32/' . $ext . '.png';
$tmp->icon_16 = 'media/mime-icon-16/' . $ext . '.png';
$videos[] = $tmp;
break;
// Non-image document
default:
$tmp->icon_32 = 'media/mime-icon-32/' . $ext . '.png';
$tmp->icon_16 = 'media/mime-icon-16/' . $ext . '.png';
$docs[] = $tmp;
break;
}
}
}
}
// Iterate over the folders if they exist
if ($folderList !== false)
{
$tmpBaseObject = new JObject;
foreach ($folderList as $folder)
{
$tmp = clone $tmpBaseObject;
$tmp->name = basename($folder);
$tmp->path = str_replace(DIRECTORY_SEPARATOR, '/', JPath::clean($basePath . '/' . $folder));
$tmp->path_relative = str_replace($mediaBase, '', $tmp->path);
$count = MediaHelper::countFiles($tmp->path);
$tmp->files = $count[0];
$tmp->folders = $count[1];
$folders[] = $tmp;
}
}
$list = array('folders' => $folders, 'docs' => $docs, 'images' => $images, 'videos' => $videos);
return $list;
}
/**
* Get the videos on the current folder
*
* @return array
*
* @since 3.5
*/
public function getVideos()
{
$list = $this->getList();
return $list['videos'];
}
}
layouts/toolbar/uploadmedia.php 0000604 00000000772 15245570546 0012722 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$title = JText::_('JTOOLBAR_UPLOAD');
?>
<button data-toggle="collapse" data-target="#collapseUpload" class="btn btn-small btn-success">
<span class="icon-plus icon-white" title="<?php echo $title; ?>"></span> <?php echo $title; ?>
</button>
layouts/toolbar/newfolder.php 0000604 00000000761 15245570546 0012421 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$title = JText::_('COM_MEDIA_CREATE_NEW_FOLDER');
?>
<button data-toggle="collapse" data-target="#collapseFolder" class="btn btn-small">
<span class="icon-folder" title="<?php echo $title; ?>"></span> <?php echo $title; ?>
</button>
layouts/toolbar/deletemedia.php 0000604 00000001634 15245570546 0012676 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$title = JText::_('JTOOLBAR_DELETE');
JText::script('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
?>
<script type="text/javascript">
(function($){
// if any media is selected then only allow to submit otherwise show message
deleteMedia = function(){
if ( $('#folderframe').contents().find('input:checked[name="rm[]"]').length == 0){
alert(Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'));
return false;
}
MediaManager.submit('folder.delete');
};
})(jQuery);
</script>
<button onclick="deleteMedia()" class="btn btn-small">
<span class="icon-remove" title="<?php echo $title; ?>"></span> <?php echo $title; ?>
</button>
media.xml 0000604 00000002346 15245570546 0006363 0 ustar 00 <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<name>com_media</name>
<author>Joomla! Project</author>
<creationDate>April 2006</creationDate>
<copyright>(C) 2006 Open Source Matters, Inc.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>COM_MEDIA_XML_DESCRIPTION</description>
<files folder="site">
<filename>controller.php</filename>
<filename>media.php</filename>
<folder>helpers</folder>
</files>
<languages folder="site">
<language tag="en-GB">language/en-GB.com_media.ini</language>
</languages>
<administration>
<files folder="admin">
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>media.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>layouts</folder>
<folder>models</folder>
<folder>views</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_media.ini</language>
<language tag="en-GB">language/en-GB.com_media.sys.ini</language>
</languages>
</administration>
</extension>
media.php 0000604 00000001160 15245570546 0006343 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_media
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Load the com_media language files, default to the admin file and fall back to site if one isn't found
$lang = JFactory::getLanguage();
$lang->load('com_media', JPATH_ADMINISTRATOR, null, false, true)
|| $lang->load('com_media', JPATH_SITE, null, false, true);
// Hand processing over to the admin base file
require_once JPATH_COMPONENT_ADMINISTRATOR . '/media.php';
helpers/media.php 0000604 00000011733 15245570546 0010014 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Object\CMSObject;
/**
* Media helper class.
*
* @since 1.6
* @deprecated 4.0 Use JHelperMedia instead
*/
abstract class MediaHelper
{
/**
* Checks if the file is an image
*
* @param string $fileName The filename
*
* @return boolean
*
* @since 1.5
* @deprecated 4.0 Use JHelperMedia::isImage instead
*/
public static function isImage($fileName)
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::isImage() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->isImage($fileName);
}
/**
* Gets the file extension for the purpose of using an icon.
*
* @param string $fileName The filename
*
* @return string File extension
*
* @since 1.5
* @deprecated 4.0 Use JHelperMedia::getTypeIcon instead
*/
public static function getTypeIcon($fileName)
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::getTypeIcon() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->getTypeIcon($fileName);
}
/**
* Checks if the file can be uploaded
*
* @param array $file File information
* @param string $error An error message to be returned
*
* @return boolean
*
* @since 1.5
* @deprecated 4.0 Use JHelperMedia::canUpload instead
*/
public static function canUpload($file, $error = '')
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::canUpload() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->canUpload($file, 'com_media');
}
/**
* Method to parse a file size
*
* @param integer $size The file size in bytes
*
* @return string The converted file size
*
* @since 1.6
* @deprecated 4.0 Use JHtml::_('number.bytes') instead
*/
public static function parseSize($size)
{
try
{
JLog::add(
sprintf("%s() is deprecated. Use JHtml::_('number.bytes') instead.", __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
return JHtml::_('number.bytes', $size);
}
/**
* Calculate the size of a resized image
*
* @param integer $width Image width
* @param integer $height Image height
* @param integer $target Target size
*
* @return array The new width and height
*
* @since 3.2
* @deprecated 4.0 Use JHelperMedia::imageResize instead
*/
public static function imageResize($width, $height, $target)
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::imageResize() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->imageResize($width, $height, $target);
}
/**
* Counts the files and directories in a directory that are not php or html files.
*
* @param string $dir Directory name
*
* @return array The number of files and directories in the given directory
*
* @since 1.5
* @deprecated 4.0 Use JHelperMedia::countFiles instead
*/
public static function countFiles($dir)
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::countFiles() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->countFiles($dir);
}
/**
* Generates the URL to the object in the action logs component
*
* @param string $contentType The content type
* @param integer $id The integer id
* @param CMSObject $mediaObject The media object being uploaded
*
* @return string The link for the action log
*
* @since 3.9.27
*/
public static function getContentTypeLink($contentType, $id, CMSObject $mediaObject)
{
if ($contentType === 'com_media.file')
{
return '';
}
$link = 'index.php?option=com_media&view=media';
$uploadedPath = substr($mediaObject->get('filepath'), strlen(COM_MEDIA_BASE) + 1);
// Now remove the filename
$uploadedBasePath = substr_replace(
$uploadedPath,
'',
(strlen(DIRECTORY_SEPARATOR . $mediaObject->get('name')) * -1)
);
if (!empty($uploadedBasePath))
{
$link = $link . '&folder=' . $uploadedBasePath;
}
return $link;
}
}
controller.php 0000604 00000004160 15245570546 0007452 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Media Manager Component Controller
*
* @since 1.5
*/
class MediaController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
*
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
JPluginHelper::importPlugin('content');
$vType = JFactory::getDocument()->getType();
$vName = $this->input->get('view', 'media');
switch ($vName)
{
case 'images':
$vLayout = $this->input->get('layout', 'default', 'string');
$mName = 'manager';
break;
case 'imagesList':
$mName = 'list';
$vLayout = $this->input->get('layout', 'default', 'string');
break;
case 'mediaList':
$app = JFactory::getApplication();
$mName = 'list';
$vLayout = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
break;
case 'media':
default:
$vName = 'media';
$vLayout = $this->input->get('layout', 'default', 'string');
$mName = 'manager';
break;
}
// Get/Create the view
$view = $this->getView($vName, $vType, '', array('base_path' => JPATH_COMPONENT_ADMINISTRATOR));
// Get/Create the model
if ($model = $this->getModel($mName))
{
// Push the model into the view (as default)
$view->setModel($model, true);
}
// Set the layout
$view->setLayout($vLayout);
// Display the view
$view->display();
return $this;
}
/**
* Validate FTP credentials
*
* @return void
*
* @since 1.5
*/
public function ftpValidate()
{
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
}
}
controllers/file.json.php 0000604 00000015547 15245570546 0011537 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
/**
* File Media Controller
*
* @since 1.6
*/
class MediaControllerFile extends JControllerLegacy
{
/**
* Upload a file
*
* @return void
*
* @since 1.5
*/
public function upload()
{
$params = JComponentHelper::getParams('com_media');
// Check for request forgeries
if (!JSession::checkToken('request'))
{
$response = array(
'status' => '0',
'message' => JText::_('JINVALID_TOKEN'),
'error' => JText::_('JINVALID_TOKEN')
);
echo json_encode($response);
return;
}
// Get the user
$user = JFactory::getUser();
JLog::addLogger(array('text_file' => 'upload.error.php'), JLog::ALL, array('upload'));
// Get some data from the request
$file = $this->input->files->get('Filedata', '', 'array');
$folder = $this->input->get('folder', '', 'path');
// Instantiate the media helper
$mediaHelper = new JHelperMedia;
if ($_SERVER['CONTENT_LENGTH'] > ($params->get('upload_maxsize', 0) * 1024 * 1024)
|| $_SERVER['CONTENT_LENGTH'] > $mediaHelper->toBytes(ini_get('upload_max_filesize'))
|| $_SERVER['CONTENT_LENGTH'] > $mediaHelper->toBytes(ini_get('post_max_size'))
|| $_SERVER['CONTENT_LENGTH'] > $mediaHelper->toBytes(ini_get('memory_limit')))
{
$response = array(
'status' => '0',
'message' => JText::_('COM_MEDIA_ERROR_WARNFILETOOLARGE'),
'error' => JText::_('COM_MEDIA_ERROR_WARNFILETOOLARGE')
);
echo json_encode($response);
return;
}
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
if (isset($file['name']))
{
// Make the filename safe
$file['name'] = JFile::makeSafe($file['name']);
// We need a URL safe name
$fileparts = pathinfo(COM_MEDIA_BASE . '/' . $folder . '/' . $file['name']);
// Transform filename to punycode
$fileparts['filename'] = JStringPunycode::toPunycode($fileparts['filename']);
$tempExt = !empty($fileparts['extension']) ? strtolower($fileparts['extension']) : '';
// Transform filename to punycode, then neglect other than non-alphanumeric characters & underscores. Also transform extension to lowercase
$safeFileName = preg_replace(array("/[\\s]/", '/[^a-zA-Z0-9_\-]/'), array('_', ''), $fileparts['filename']) . '.' . $tempExt;
// Create filepath with safe-filename
$files['final'] = $fileparts['dirname'] . DIRECTORY_SEPARATOR . $safeFileName;
$file['name'] = $safeFileName;
$filepath = JPath::clean($files['final']);
if (!$mediaHelper->canUpload($file, 'com_media')
|| strpos(realpath($fileparts['dirname']), JPath::clean(realpath(COM_MEDIA_BASE))) !== 0)
{
try
{
JLog::add('Invalid: ' . $filepath, JLog::INFO, 'upload');
}
catch (RuntimeException $exception)
{
// Informational log only
}
$response = array(
'status' => '0',
'message' => JText::_('COM_MEDIA_ERROR_UNABLE_TO_UPLOAD_FILE'),
'error' => JText::_('COM_MEDIA_ERROR_UNABLE_TO_UPLOAD_FILE')
);
echo json_encode($response);
return;
}
// Trigger the onContentBeforeSave event.
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
$object_file = new JObject($file);
$object_file->filepath = $filepath;
$result = $dispatcher->trigger('onContentBeforeSave', array('com_media.file', &$object_file, true));
if (in_array(false, $result, true))
{
// There are some errors in the plugins
try
{
JLog::add(
'Errors before save: ' . $object_file->filepath . ' : ' . implode(', ', $object_file->getErrors()),
JLog::INFO,
'upload'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$response = array(
'status' => '0',
'message' => JText::plural('COM_MEDIA_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('<br />', $errors)),
'error' => JText::plural('COM_MEDIA_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('<br />', $errors))
);
echo json_encode($response);
return;
}
if (JFile::exists($object_file->filepath))
{
// File exists
try
{
JLog::add('File exists: ' . $object_file->filepath . ' by user_id ' . $user->id, JLog::INFO, 'upload');
}
catch (RuntimeException $exception)
{
// Informational log only
}
$response = array(
'status' => '0',
'message' => JText::_('COM_MEDIA_ERROR_FILE_EXISTS'),
'error' => JText::_('COM_MEDIA_ERROR_FILE_EXISTS'),
'location' => str_replace(JPATH_ROOT, '', $filepath)
);
echo json_encode($response);
return;
}
elseif (!$user->authorise('core.create', 'com_media'))
{
// File does not exist and user is not authorised to create
try
{
JLog::add('Create not permitted: ' . $object_file->filepath . ' by user_id ' . $user->id, JLog::INFO, 'upload');
}
catch (RuntimeException $exception)
{
// Informational log only
}
$response = array(
'status' => '0',
'error' => JText::_('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED'),
'message' => JText::_('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED')
);
echo json_encode($response);
return;
}
if (!JFile::upload($object_file->tmp_name, $object_file->filepath))
{
// Error in upload
try
{
JLog::add('Error on upload: ' . $object_file->filepath, JLog::INFO, 'upload');
}
catch (RuntimeException $exception)
{
// Informational log only
}
$response = array(
'status' => '0',
'message' => JText::_('COM_MEDIA_ERROR_UNABLE_TO_UPLOAD_FILE'),
'error' => JText::_('COM_MEDIA_ERROR_UNABLE_TO_UPLOAD_FILE')
);
echo json_encode($response);
return;
}
else
{
// Trigger the onContentAfterSave event.
$dispatcher->trigger('onContentAfterSave', array('com_media.file', &$object_file, true));
try
{
JLog::add($folder, JLog::INFO, 'upload');
}
catch (RuntimeException $exception)
{
// Informational log only
}
$returnUrl = str_replace(JPATH_ROOT, '', $object_file->filepath);
$response = array(
'status' => '1',
'message' => JText::sprintf('COM_MEDIA_UPLOAD_COMPLETE', $returnUrl),
'error' => JText::sprintf('COM_MEDIA_UPLOAD_COMPLETE', $returnUrl),
'location' => str_replace('\\', '/', $returnUrl)
);
echo json_encode($response);
return;
}
}
else
{
$response = array(
'status' => '0',
'error' => JText::_('COM_MEDIA_ERROR_BAD_REQUEST'),
'message' => JText::_('COM_MEDIA_ERROR_BAD_REQUEST')
);
echo json_encode($response);
return;
}
}
}
controllers/file.php 0000604 00000024420 15245570546 0010555 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
/**
* Media File Controller
*
* @since 1.5
*/
class MediaControllerFile extends JControllerLegacy
{
/**
* The folder we are uploading into
*
* @var string
*/
protected $folder = '';
/**
* Upload one or more files
*
* @return boolean
*
* @since 1.5
*/
public function upload()
{
// Check for request forgeries
$this->checkToken('request');
$params = JComponentHelper::getParams('com_media');
// Get some data from the request
$files = $this->input->files->get('Filedata', array(), 'array');
$return = JFactory::getSession()->get('com_media.return_url');
$this->folder = $this->input->get('folder', '', 'path');
// Instantiate the media helper
$mediaHelper = new JHelperMedia;
// Don't redirect to an external URL.
if (!JUri::isInternal($return))
{
$return = '';
}
// Set the redirect
if ($return)
{
$this->setRedirect($return . '&folder=' . $this->folder);
}
else
{
$this->setRedirect('index.php?option=com_media&folder=' . $this->folder);
}
// First check against unfiltered input.
if (!$this->input->files->get('Filedata', null, 'RAW'))
{
// Total length of post back data in bytes.
$contentLength = $this->input->server->get('CONTENT_LENGTH', 0, 'INT');
// Maximum allowed size of post back data in MB.
$postMaxSize = $mediaHelper->toBytes(ini_get('post_max_size'));
// Maximum allowed size of script execution in MB.
$memoryLimit = $mediaHelper->toBytes(ini_get('memory_limit'));
// Check for the total size of post back data.
if (($postMaxSize > 0 && $contentLength > $postMaxSize)
|| ($memoryLimit != -1 && $contentLength > $memoryLimit))
{
// Files are too large.
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_WARNUPLOADTOOLARGE'));
return false;
}
// No files were provided.
$this->setMessage(JText::_('COM_MEDIA_ERROR_UPLOAD_INPUT'), 'warning');
return false;
}
if (!$files)
{
// Files were provided but are unsafe to upload.
$this->setMessage(JText::_('COM_MEDIA_ERROR_WARNFILENOTSAFE'), 'error');
return false;
}
// Authorize the user
if (!$this->authoriseUser('create'))
{
return false;
}
$uploadMaxSize = $params->get('upload_maxsize', 0) * 1024 * 1024;
$uploadMaxFileSize = $mediaHelper->toBytes(ini_get('upload_max_filesize'));
// Perform basic checks on file info before attempting anything
foreach ($files as &$file)
{
// Make the filename safe
$file['name'] = JFile::makeSafe($file['name']);
// We need a url safe name
$fileparts = pathinfo(COM_MEDIA_BASE . '/' . $this->folder . '/' . $file['name']);
if (strpos(realpath($fileparts['dirname']), JPath::clean(realpath(COM_MEDIA_BASE))) !== 0)
{
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_WARNINVALID_FOLDER'));
return false;
}
// Transform filename to punycode, check extension and transform it to lowercase
$fileparts['filename'] = JStringPunycode::toPunycode($fileparts['filename']);
$tempExt = !empty($fileparts['extension']) ? strtolower($fileparts['extension']) : '';
// Neglect other than non-alphanumeric characters, hyphens & underscores.
$safeFileName = preg_replace(array("/[\\s]/", '/[^a-zA-Z0-9_\-]/'), array('_', ''), $fileparts['filename']) . '.' . $tempExt;
$file['name'] = $safeFileName;
$file['filepath'] = JPath::clean(implode(DIRECTORY_SEPARATOR, array(COM_MEDIA_BASE, $this->folder, $file['name'])));
if (($file['error'] == 1)
|| ($uploadMaxSize > 0 && $file['size'] > $uploadMaxSize)
|| ($uploadMaxFileSize > 0 && $file['size'] > $uploadMaxFileSize))
{
// File size exceed either 'upload_max_filesize' or 'upload_maxsize'.
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_WARNFILETOOLARGE'));
return false;
}
if (JFile::exists($file['filepath']))
{
// A file with this name already exists
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_FILE_EXISTS'));
return false;
}
if (!isset($file['name']))
{
// No filename (after the name was cleaned by JFile::makeSafe)
$this->setRedirect('index.php', JText::_('COM_MEDIA_INVALID_REQUEST'), 'error');
return false;
}
}
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
foreach ($files as &$file)
{
// The request is valid
$err = null;
if (!MediaHelper::canUpload($file, $err))
{
// The file can't be uploaded
return false;
}
// Trigger the onContentBeforeSave event.
$object_file = new JObject($file);
$result = $dispatcher->trigger('onContentBeforeSave', array('com_media.file', &$object_file, true));
if (in_array(false, $result, true))
{
// There are some errors in the plugins
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
return false;
}
if (!JFile::upload($object_file->tmp_name, $object_file->filepath))
{
// Error in upload
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_UNABLE_TO_UPLOAD_FILE'));
return false;
}
// Trigger the onContentAfterSave event.
$dispatcher->trigger('onContentAfterSave', array('com_media.file', &$object_file, true));
$this->setMessage(JText::sprintf('COM_MEDIA_UPLOAD_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
return true;
}
/**
* Check that the user is authorized to perform this action
*
* @param string $action - the action to be performed (create or delete)
*
* @return boolean
*
* @since 1.6
*/
protected function authoriseUser($action)
{
if (!JFactory::getUser()->authorise('core.' . strtolower($action), 'com_media'))
{
// User is not authorised
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_' . strtoupper($action) . '_NOT_PERMITTED'));
return false;
}
return true;
}
/**
* Deletes paths from the current path
*
* @return boolean
*
* @since 1.5
*/
public function delete()
{
$this->checkToken('request');
$user = JFactory::getUser();
// Get some data from the request
$tmpl = $this->input->get('tmpl');
$paths = $this->input->get('rm', array(), 'array');
$folder = $this->input->get('folder', '', 'path');
$redirect = 'index.php?option=com_media&folder=' . $folder;
if ($tmpl == 'component')
{
// We are inside the iframe
$redirect .= '&view=mediaList&tmpl=component';
}
$this->setRedirect($redirect);
// Just return if there's nothing to do
if (empty($paths))
{
$this->setMessage(JText::_('JERROR_NO_ITEMS_SELECTED'), 'error');
return true;
}
if (!$user->authorise('core.delete', 'com_media'))
{
// User is not authorised to delete
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'));
return false;
}
// Need this to enqueue messages.
$app = JFactory::getApplication();
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
$ret = true;
$safePaths = array_intersect($paths, array_map(array('JFile', 'makeSafe'), $paths));
foreach ($safePaths as $key => $path)
{
$fullPath = implode(DIRECTORY_SEPARATOR, array(COM_MEDIA_BASE, $folder, $path));
if (strpos(realpath($fullPath), JPath::clean(realpath(COM_MEDIA_BASE))) !== 0)
{
unset($safePaths[$key]);
}
}
$unsafePaths = array_diff($paths, $safePaths);
foreach ($unsafePaths as $path)
{
$path = JPath::clean(implode(DIRECTORY_SEPARATOR, array($folder, $path)));
$path = htmlspecialchars($path, ENT_COMPAT, 'UTF-8');
$app->enqueueMessage(JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FILE_WARNFILENAME', $path), 'error');
}
foreach ($safePaths as $path)
{
$fullPath = JPath::clean(implode(DIRECTORY_SEPARATOR, array(COM_MEDIA_BASE, $folder, $path)));
$object_file = new JObject(array('filepath' => $fullPath));
if (is_file($object_file->filepath))
{
// Trigger the onContentBeforeDelete event.
$result = $dispatcher->trigger('onContentBeforeDelete', array('com_media.file', &$object_file));
if (in_array(false, $result, true))
{
// There are some errors in the plugins
$errors = $object_file->getErrors();
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors), implode('<br />', $errors)));
continue;
}
$ret &= JFile::delete($object_file->filepath);
// Trigger the onContentAfterDelete event.
$dispatcher->trigger('onContentAfterDelete', array('com_media.file', &$object_file));
$app->enqueueMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
elseif (is_dir($object_file->filepath))
{
$contents = JFolder::files($object_file->filepath, '.', true, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html'));
if (!empty($contents))
{
// This makes no sense...
$folderPath = substr($object_file->filepath, strlen(COM_MEDIA_BASE));
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FOLDER_NOT_EMPTY', $folderPath));
continue;
}
// Trigger the onContentBeforeDelete event.
$result = $dispatcher->trigger('onContentBeforeDelete', array('com_media.folder', &$object_file));
if (in_array(false, $result, true))
{
// There are some errors in the plugins
$errors = $object_file->getErrors();
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors), implode('<br />', $errors)));
continue;
}
$ret &= !JFolder::delete($object_file->filepath);
// Trigger the onContentAfterDelete event.
$dispatcher->trigger('onContentAfterDelete', array('com_media.folder', &$object_file));
$app->enqueueMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
}
return $ret;
}
}
controllers/folder.php 0000604 00000016232 15245570546 0011113 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
/**
* Folder Media Controller
*
* @since 1.5
*/
class MediaControllerFolder extends JControllerLegacy
{
/**
* Deletes paths from the current path
*
* @return boolean
*
* @since 1.5
*/
public function delete()
{
$this->checkToken('request');
$user = JFactory::getUser();
// Get some data from the request
$tmpl = $this->input->get('tmpl');
$paths = $this->input->get('rm', array(), 'array');
$folder = $this->input->get('folder', '', 'path');
$redirect = 'index.php?option=com_media&folder=' . $folder;
if ($tmpl == 'component')
{
// We are inside the iframe
$redirect .= '&view=mediaList&tmpl=component';
}
$this->setRedirect($redirect);
// Just return if there's nothing to do
if (empty($paths))
{
$this->setMessage(JText::_('JERROR_NO_ITEMS_SELECTED'), 'error');
return true;
}
if (!$user->authorise('core.delete', 'com_media'))
{
// User is not authorised to delete
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'));
return false;
}
// Need this to enqueue messages.
$app = JFactory::getApplication();
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
$ret = true;
$safePaths = array_intersect($paths, array_map(array('JFile', 'makeSafe'), $paths));
$unsafePaths = array_diff($paths, $safePaths);
foreach ($unsafePaths as $path)
{
$path = JPath::clean(implode(DIRECTORY_SEPARATOR, array($folder, $path)));
$path = htmlspecialchars($path, ENT_COMPAT, 'UTF-8');
$app->enqueueMessage(JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FILE_WARNFILENAME', $path), 'error');
}
foreach ($safePaths as $path)
{
$fullPath = JPath::clean(implode(DIRECTORY_SEPARATOR, array(COM_MEDIA_BASE, $folder, $path)));
if (strpos(realpath($fullPath), JPath::clean(realpath(COM_MEDIA_BASE))) !== 0)
{
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_WARNINVALID_FOLDER'));
continue;
}
$object_file = new JObject(array('filepath' => $fullPath));
if (is_file($object_file->filepath))
{
// Trigger the onContentBeforeDelete event.
$result = $dispatcher->trigger('onContentBeforeDelete', array('com_media.file', &$object_file));
if (in_array(false, $result, true))
{
// There are some errors in the plugins
$errors = $object_file->getErrors();
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors), implode('<br />', $errors)));
continue;
}
$ret &= JFile::delete($object_file->filepath);
// Trigger the onContentAfterDelete event.
$dispatcher->trigger('onContentAfterDelete', array('com_media.file', &$object_file));
$app->enqueueMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
elseif (is_dir($object_file->filepath))
{
$contents = JFolder::files($object_file->filepath, '.', true, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html'));
if (!empty($contents))
{
// This makes no sense...
$folderPath = substr($object_file->filepath, strlen(COM_MEDIA_BASE));
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FOLDER_NOT_EMPTY', $folderPath));
continue;
}
// Trigger the onContentBeforeDelete event.
$result = $dispatcher->trigger('onContentBeforeDelete', array('com_media.folder', &$object_file));
if (in_array(false, $result, true))
{
// There are some errors in the plugins
$errors = $object_file->getErrors();
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors), implode('<br />', $errors)));
continue;
}
$ret &= !JFolder::delete($object_file->filepath);
// Trigger the onContentAfterDelete event.
$dispatcher->trigger('onContentAfterDelete', array('com_media.folder', &$object_file));
$app->enqueueMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
}
return $ret;
}
/**
* Create a folder
*
* @return boolean
*
* @since 1.5
*/
public function create()
{
// Check for request forgeries
$this->checkToken();
$user = JFactory::getUser();
$folder = $this->input->get('foldername', '');
$folderCheck = (string) $this->input->get('foldername', null, 'raw');
$parent = $this->input->get('folderbase', '', 'path');
$this->setRedirect('index.php?option=com_media&folder=' . $parent . '&tmpl=' . $this->input->get('tmpl', 'index'));
if (strlen($folder) > 0)
{
if (!$user->authorise('core.create', 'com_media'))
{
// User is not authorised to create
JError::raiseWarning(403, JText::_('COM_MEDIA_ERROR_CREATE_NOT_PERMITTED'));
return false;
}
// Set FTP credentials, if given
JClientHelper::setCredentialsFromRequest('ftp');
$this->input->set('folder', $parent);
if (($folderCheck !== null) && ($folder !== $folderCheck))
{
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('COM_MEDIA_ERROR_UNABLE_TO_CREATE_FOLDER_WARNDIRNAME'), 'warning');
return false;
}
$path = JPath::clean(COM_MEDIA_BASE . '/' . $parent . '/' . $folder);
if (strpos(realpath(COM_MEDIA_BASE . '/' . $parent), JPath::clean(realpath(COM_MEDIA_BASE))) !== 0)
{
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('COM_MEDIA_ERROR_WARNINVALID_FOLDER'), 'error');
return false;
}
if (!is_dir($path) && !is_file($path))
{
// Trigger the onContentBeforeSave event.
$object_file = new JObject(array('filepath' => $path));
JPluginHelper::importPlugin('content');
$dispatcher = JEventDispatcher::getInstance();
$result = $dispatcher->trigger('onContentBeforeSave', array('com_media.folder', &$object_file, true));
if (in_array(false, $result, true))
{
// There are some errors in the plugins
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_SAVE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
return false;
}
if (JFolder::create($object_file->filepath))
{
$data = "<html>\n<body bgcolor=\"#FFFFFF\">\n</body>\n</html>";
JFile::write($object_file->filepath . '/index.html', $data);
// Trigger the onContentAfterSave event.
$dispatcher->trigger('onContentAfterSave', array('com_media.folder', &$object_file, true));
$this->setMessage(JText::sprintf('COM_MEDIA_CREATE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
}
}
$this->input->set('folder', ($parent) ? $parent . '/' . $folder : $folder);
}
else
{
// File name is of zero length (null).
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_UNABLE_TO_CREATE_FOLDER_WARNDIRNAME'));
return false;
}
return true;
}
}
views/imageslist/view.html.php 0000604 00000003173 15245570546 0012505 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Media component
*
* @since 1.0
*/
class MediaViewImagesList extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.0
*/
public function display($tpl = null)
{
// Do not allow cache
JFactory::getApplication()->allowCache(false);
$images = $this->get('images');
$folders = $this->get('folders');
$state = $this->get('state');
$this->baseURL = COM_MEDIA_BASEURL;
$this->images = &$images;
$this->folders = &$folders;
$this->state = &$state;
parent::display($tpl);
}
/**
* Set the active folder
*
* @param integer $index Folder position
*
* @return void
*
* @since 1.0
*/
public function setFolder($index = 0)
{
if (isset($this->folders[$index]))
{
$this->_tmp_folder = &$this->folders[$index];
}
else
{
$this->_tmp_folder = new JObject;
}
}
/**
* Set the active image
*
* @param integer $index Image position
*
* @return void
*
* @since 1.0
*/
public function setImage($index = 0)
{
if (isset($this->images[$index]))
{
$this->_tmp_img = &$this->images[$index];
}
else
{
$this->_tmp_img = new JObject;
}
}
}
views/imageslist/tmpl/default_folder.php 0000604 00000001531 15245570546 0014517 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$input = JFactory::getApplication()->input;
?>
<li class="imgOutline thumbnail height-80 width-80 center">
<a href="index.php?option=com_media&view=imagesList&tmpl=component&folder=<?php echo rawurlencode($this->_tmp_folder->path_relative); ?>&asset=<?php echo $input->getCmd('asset'); ?>&author=<?php echo $input->getCmd('author'); ?>" target="imageframe">
<div class="height-50">
<span class="icon-folder-2"></span>
</div>
<div class="small">
<?php echo JHtml::_('string.truncate', $this->escape($this->_tmp_folder->name), 10, false); ?>
</div>
</a>
</li>
views/imageslist/tmpl/default.php 0000604 00000003060 15245570546 0013163 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$lang = JFactory::getLanguage();
JHtml::_('stylesheet', 'media/popup-imagelist.css', array('version' => 'auto', 'relative' => true));
if ($lang->isRtl())
{
JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array('version' => 'auto', 'relative' => true));
}
JFactory::getDocument()->addScriptDeclaration('var ImageManager = window.parent.ImageManager;');
if ($lang->isRtl())
{
JFactory::getDocument()->addStyleDeclaration(
'
@media (max-width: 767px) {
li.imgOutline.thumbnail.height-80.width-80.center {
float: right;
}
}
'
);
}
else
{
JFactory::getDocument()->addStyleDeclaration(
'
@media (max-width: 767px) {
li.imgOutline.thumbnail.height-80.width-80.center {
float: left;
}
}
'
);
}
?>
<?php if (count($this->images) > 0 || count($this->folders) > 0) : ?>
<ul class="manager thumbnails thumbnails-media">
<?php for ($i = 0, $n = count($this->folders); $i < $n; $i++) :
$this->setFolder($i);
echo $this->loadTemplate('folder');
endfor; ?>
<?php for ($i = 0, $n = count($this->images); $i < $n; $i++) :
$this->setImage($i);
echo $this->loadTemplate('image');
endfor; ?>
</ul>
<?php else : ?>
<div id="media-noimages">
<div class="alert alert-info"><?php echo JText::_('COM_MEDIA_NO_IMAGES_FOUND'); ?></div>
</div>
<?php endif; ?>
views/imageslist/tmpl/default_image.php 0000604 00000002467 15245570546 0014337 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_img, &$params, 0));
?>
<li class="imgOutline thumbnail height-80 width-80 center">
<a class="img-preview" href="javascript:ImageManager.populateFields('<?php echo $this->escape($this->_tmp_img->path_relative); ?>')" title="<?php echo $this->escape($this->_tmp_img->name); ?>" >
<div class="height-50">
<?php echo JHtml::_('image', $this->baseURL . '/' . $this->escape($this->_tmp_img->path_relative), JText::sprintf('COM_MEDIA_IMAGE_TITLE', $this->escape($this->_tmp_img->title), JHtml::_('number.bytes', $this->_tmp_img->size)), array('width' => $this->_tmp_img->width_60, 'height' => $this->_tmp_img->height_60)); ?>
</div>
<div class="small">
<?php echo JHtml::_('string.truncate', $this->escape($this->_tmp_img->name), 10, false); ?>
</div>
</a>
</li>
<?php
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_img, &$params, 0));
views/images/view.html.php 0000604 00000002245 15245570546 0011610 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Media component
*
* @since 1.0
*/
class MediaViewImages extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.0
*/
public function display($tpl = null)
{
$config = JComponentHelper::getParams('com_media');
/*
* Display form for FTP credentials?
* Don't set them here, as there are other functions called before this one if there is any file write operation
*/
$ftp = !JClientHelper::hasCredentials('ftp');
$this->session = JFactory::getSession();
$this->config = $config;
$this->state = $this->get('state');
$this->folderList = $this->get('folderList');
$this->require_ftp = $ftp;
parent::display($tpl);
}
}
views/images/tmpl/default.php 0000604 00000020152 15245570546 0012270 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$user = JFactory::getUser();
$input = JFactory::getApplication()->input;
$params = JComponentHelper::getParams('com_media');
$lang = JFactory::getLanguage();
$onClick = '';
$fieldInput = $this->state->get('field.id');
$isMoo = $input->getInt('ismoo', 1);
$author = $input->getCmd('author');
$asset = $input->getCmd('asset');
JHtml::_('formbehavior.chosen', 'select');
// Load tooltip instance without HTML support because we have a HTML tag in the tip
JHtml::_('bootstrap.tooltip', '.noHtmlTip', array('html' => false));
// Include jQuery
JHtml::_('behavior.core');
JHtml::_('jquery.framework');
JHtml::_('script', 'media/popup-imagemanager.min.js', array('version' => 'auto', 'relative' => true));
JHtml::_('stylesheet', 'media/popup-imagemanager.css', array('version' => 'auto', 'relative' => true));
if ($lang->isRtl())
{
JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array('version' => 'auto', 'relative' => true));
}
JFactory::getDocument()->addScriptOptions(
'mediamanager', array(
'base' => $params->get('image_path', 'images') . '/',
'asset' => $asset,
'author' => $author
)
);
/**
* Mootools compatibility
*
* There is an extra option passed in the URL for the iframe &ismoo=0 for the bootstrap fields.
* By default the value will be 1 or defaults to mootools behaviour
*
* This should be removed when mootools won't be shipped by Joomla.
*/
if (!empty($fieldInput)) // Media Form Field
{
if ($isMoo)
{
$onClick = "window.parent.jInsertFieldValue(document.getElementById('f_url').value, '" . $fieldInput . "');window.parent.jModalClose();window.parent.jQuery('.modal.in').modal('hide');";
}
}
else // XTD Image plugin
{
$onClick = 'ImageManager.onok();window.parent.jModalClose();';
}
?>
<div class="container-popup">
<form action="index.php?option=com_media&asset=<?php echo $asset; ?>&author=<?php echo $author; ?>" class="form-horizontal" id="imageForm" method="post" enctype="multipart/form-data">
<div id="messages" style="display: none;">
<span id="message"></span><?php echo JHtml::_('image', 'media/dots.gif', '...', array('width' => 22, 'height' => 12), true); ?>
</div>
<div class="well">
<div class="row-fluid">
<div class="span8 control-group">
<div class="control-label">
<label for="folder"><?php echo JText::_('COM_MEDIA_DIRECTORY'); ?></label>
</div>
<div class="controls">
<?php echo $this->folderList; ?>
<button class="btn" type="button" id="upbutton" title="<?php echo JText::_('COM_MEDIA_DIRECTORY_UP'); ?>"><?php echo JText::_('COM_MEDIA_UP'); ?></button>
</div>
</div>
<div class="span4 control-group">
<div class="pull-right">
<button class="btn btn-success button-save-selected" type="button" <?php if (!empty($onClick)) :
// This is for Mootools compatibility ?>onclick="<?php echo $onClick; ?>"<?php endif; ?> data-dismiss="modal"><?php echo JText::_('COM_MEDIA_INSERT'); ?></button>
<button class="btn button-cancel" type="button" onclick="window.parent.jQuery('.modal.in').modal('hide');<?php if (!empty($onClick)) :
// This is for Mootools compatibility ?>parent.jModalClose();<?php endif ?>" data-dismiss="modal"><?php echo JText::_('JCANCEL'); ?></button>
</div>
</div>
</div>
</div>
<iframe id="imageframe" name="imageframe" src="index.php?option=com_media&view=imagesList&tmpl=component&folder=<?php echo rawurlencode($this->state->folder); ?>&asset=<?php echo $asset; ?>&author=<?php echo $author; ?>"></iframe>
<div class="well">
<div class="row-fluid">
<div class="span12 control-group">
<div class="control-label">
<label for="f_url"><?php echo JText::_('COM_MEDIA_IMAGE_URL'); ?></label>
</div>
<div class="controls">
<input type="text" id="f_url" value="" />
</div>
</div>
</div>
</div>
<?php if (!$this->state->get('field.id')) : ?>
<div class="well">
<div class="row-fluid">
<div class="span6 control-group">
<div class="control-label">
<label title="<?php echo JText::_('COM_MEDIA_ALIGN_DESC'); ?>" class="noHtmlTip" for="f_align"><?php echo JText::_('COM_MEDIA_ALIGN'); ?></label>
</div>
<div class="controls">
<select size="1" id="f_align">
<option value="" selected="selected"><?php echo JText::_('COM_MEDIA_NOT_SET'); ?></option>
<option value="left"><?php echo JText::_('JGLOBAL_LEFT'); ?></option>
<option value="center"><?php echo JText::_('JGLOBAL_CENTER'); ?></option>
<option value="right"><?php echo JText::_('JGLOBAL_RIGHT'); ?></option>
</select>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<div class="control-label">
<label for="f_alt"><?php echo JText::_('COM_MEDIA_IMAGE_DESCRIPTION'); ?></label>
</div>
<div class="controls">
<input type="text" id="f_alt" value="" />
</div>
</div>
<div class="span6 control-group">
<div class="control-label">
<label for="f_title"><?php echo JText::_('COM_MEDIA_TITLE'); ?></label>
</div>
<div class="controls">
<input type="text" id="f_title" value="" />
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6 control-group">
<div class="control-label">
<label for="f_caption"><?php echo JText::_('COM_MEDIA_CAPTION'); ?></label>
</div>
<div class="controls">
<input type="text" id="f_caption" value="" />
</div>
</div>
<div class="span6 control-group">
<div class="control-label">
<label title="<?php echo JText::_('COM_MEDIA_CAPTION_CLASS_DESC'); ?>" class="noHtmlTip" for="f_caption_class"><?php echo JText::_('COM_MEDIA_CAPTION_CLASS_LABEL'); ?></label>
</div>
<div class="controls">
<input type="text" list="d_caption_class" id="f_caption_class" value="" />
<datalist id="d_caption_class">
<option value="text-left">
<option value="text-center">
<option value="text-right">
</datalist>
</div>
</div>
</div>
<input type="hidden" id="dirPath" name="dirPath" />
<input type="hidden" id="f_file" name="f_file" />
<input type="hidden" id="tmpl" name="component" />
</div>
<?php endif; ?>
</form>
<?php if ($user->authorise('core.create', 'com_media')) : ?>
<form action="<?php echo JUri::base(); ?>index.php?option=com_media&task=file.upload&tmpl=component&<?php echo $this->session->getName() . '=' . $this->session->getId(); ?>&<?php echo JSession::getFormToken(); ?>=1&asset=<?php echo $asset; ?>&author=<?php echo $author; ?>&view=images" id="uploadForm" class="form-horizontal" name="uploadForm" method="post" enctype="multipart/form-data">
<div id="uploadform" class="well">
<fieldset id="upload-noflash" class="actions">
<div class="control-group">
<div class="control-label">
<label for="upload-file" class="control-label"><?php echo JText::_('COM_MEDIA_UPLOAD_FILE'); ?></label>
</div>
<div class="controls">
<input required type="file" id="upload-file" name="Filedata[]" multiple /><button class="btn btn-primary" id="upload-submit"><span class="icon-upload icon-white"></span> <?php echo JText::_('COM_MEDIA_START_UPLOAD'); ?></button>
<p class="help-block">
<?php $cMax = (int) $this->config->get('upload_maxsize'); ?>
<?php $maxSize = JUtility::getMaxUploadSize($cMax . 'MB'); ?>
<?php echo JText::sprintf('JGLOBAL_MAXIMUM_UPLOAD_SIZE_LIMIT', JHtml::_('number.bytes', $maxSize)); ?>
</p>
</div>
</div>
</fieldset>
<?php JFactory::getSession()->set('com_media.return_url', 'index.php?option=com_media&view=images&tmpl=component&fieldid=' . $input->getCmd('fieldid', '') . '&e_name=' . $input->getCmd('e_name') . '&asset=' . $asset . '&author=' . $author); ?>
</div>
</form>
<?php endif; ?>
</div>
views/media/tmpl/default_navigation.php 0000604 00000001607 15245570546 0014325 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$app = JFactory::getApplication();
$style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
?>
<div class="media btn-group ventral-space">
<a href="#" id="thumbs" onclick="MediaManager.setViewType('thumbs')" class="btn <?php echo ($style == 'thumbs') ? 'active' : ''; ?>">
<span class="icon-grid-view-2"></span> <?php echo JText::_('COM_MEDIA_THUMBNAIL_VIEW'); ?></a>
<a href="#" id="details" onclick="MediaManager.setViewType('details')" class="btn <?php echo ($style == 'details') ? 'active' : ''; ?>">
<span class="icon-list-view"></span> <?php echo JText::_('COM_MEDIA_DETAIL_VIEW'); ?></a>
</div>
views/media/tmpl/default_folders.php 0000604 00000002061 15245570546 0013617 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Set up the sanitised target for the ul
$ulTarget = str_replace('/', '-', $this->folders['data']->relative);
?>
<ul class="nav nav-list" id="collapseFolder-<?php echo $ulTarget; ?>">
<?php if (isset($this->folders['children'])) :
foreach ($this->folders['children'] as $folder) :
// Get a sanitised name for the target
$target = str_replace('/', '-', $folder['data']->relative); ?>
<li id="<?php echo $target; ?>" class="folder">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($folder['data']->relative); ?>" target="folderframe" class="folder-url" >
<span class="icon-folder"></span>
<?php echo $this->escape($folder['data']->name); ?>
</a>
<?php echo $this->getFolderLevel($folder); ?>
</li>
<?php endforeach;
endif; ?>
</ul>
views/media/tmpl/default.php 0000604 00000015163 15245570546 0012110 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$user = JFactory::getUser();
$input = JFactory::getApplication()->input;
$lang = JFactory::getLanguage();
$style = JFactory::getApplication()->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
if (DIRECTORY_SEPARATOR == '\\')
{
$base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE);
}
else
{
$base = COM_MEDIA_BASE;
}
JFactory::getDocument()->addScriptDeclaration(
"
var basepath = '" . $base . "';
var viewstyle = '" . $style . "';
"
);
JHtml::_('behavior.keepalive');
JHtml::_('bootstrap.framework');
JHtml::_('script', 'media/mediamanager.min.js', array('version' => 'auto', 'relative' => true));
JHtml::_('script', 'media/mediaelement-and-player.js', array('version' => 'auto', 'relative' => true));
JHtml::_('stylesheet', 'media/mediaelementplayer.css', array('version' => 'auto', 'relative' => true));
JHtml::_('stylesheet', 'system/mootree.css', array('version' => 'auto', 'relative' => true));
if ($lang->isRtl())
{
JHtml::_('stylesheet', 'system/mootree_rtl.css', array('version' => 'auto', 'relative' => true));
}
?>
<div class="row-fluid">
<!-- Begin Sidebar -->
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
<div class="j-toggle-sidebar-header">
<h3><?php echo JText::_('COM_MEDIA_FOLDERS'); ?> </h3>
</div>
<div id="treeview" class="sidebar">
<div id="media-tree_tree" class="tree-holder">
<?php echo $this->loadTemplate('folders'); ?>
</div>
</div>
</div>
<!-- End Sidebar -->
<!-- Begin Content -->
<div id="j-main-container" class="span10">
<?php echo $this->loadTemplate('navigation'); ?>
<?php if (($user->authorise('core.create', 'com_media')) and $this->require_ftp) : ?>
<form action="index.php?option=com_media&task=ftpValidate" name="ftpForm" id="ftpForm" method="post">
<fieldset title="<?php echo JText::_('COM_MEDIA_DESCFTPTITLE'); ?>">
<legend><?php echo JText::_('COM_MEDIA_DESCFTPTITLE'); ?></legend>
<?php echo JText::_('COM_MEDIA_DESCFTP'); ?>
<label for="username"><?php echo JText::_('JGLOBAL_USERNAME'); ?></label>
<input type="text" id="username" name="username" size="70" value="" />
<label for="password"><?php echo JText::_('JGLOBAL_PASSWORD'); ?></label>
<input type="password" id="password" name="password" size="70" value="" />
</fieldset>
</form>
<?php endif; ?>
<form action="index.php?option=com_media" name="adminForm" id="mediamanager-form" method="post" enctype="multipart/form-data" >
<input type="hidden" name="task" value="" />
<input type="hidden" name="cb1" id="cb1" value="0" />
<input class="update-folder" type="hidden" name="folder" id="folder" value="<?php echo $this->escape($this->state->folder); ?>" />
</form>
<?php if ($user->authorise('core.create', 'com_media')) : ?>
<!-- File Upload Form -->
<div id="collapseUpload" class="collapse">
<form action="<?php echo JUri::base(); ?>index.php?option=com_media&task=file.upload&tmpl=component&<?php echo $this->session->getName() . '=' . $this->session->getId(); ?>&<?php echo JSession::getFormToken(); ?>=1&format=html" id="uploadForm" class="form-inline" name="uploadForm" method="post" enctype="multipart/form-data">
<div id="uploadform" class="uploadform">
<fieldset id="upload-noflash" class="actions">
<label for="upload-file" class="control-label"><?php echo JText::_('COM_MEDIA_UPLOAD_FILE'); ?></label>
<input required type="file" id="upload-file" name="Filedata[]" multiple /> <button class="btn btn-primary" id="upload-submit"><span class="icon-upload icon-white"></span> <?php echo JText::_('COM_MEDIA_START_UPLOAD'); ?></button>
<p class="help-block">
<?php $cMax = (int) $this->config->get('upload_maxsize'); ?>
<?php $maxSize = JUtility::getMaxUploadSize($cMax . 'MB'); ?>
<?php echo JText::sprintf('JGLOBAL_MAXIMUM_UPLOAD_SIZE_LIMIT', JHtml::_('number.bytes', $maxSize)); ?>
</p>
</fieldset>
<input class="update-folder" type="hidden" name="folder" id="folder" value="<?php echo $this->escape($this->state->folder); ?>" />
<?php JFactory::getSession()->set('com_media.return_url', 'index.php?option=com_media'); ?>
</div>
</form>
</div>
<div id="collapseFolder" class="collapse">
<form action="index.php?option=com_media&task=folder.create&tmpl=<?php echo $input->getCmd('tmpl', 'index'); ?>" name="folderForm" id="folderForm" class="form-inline" method="post">
<div class="path">
<input type="text" id="folderpath" readonly="readonly" class="update-folder" />
<input required type="text" id="foldername" name="foldername" />
<input class="update-folder" type="hidden" name="folderbase" id="folderbase" value="<?php echo $this->escape($this->state->folder); ?>" />
<button type="submit" class="btn"><span class="icon-folder-open"></span> <?php echo JText::_('COM_MEDIA_CREATE_FOLDER'); ?></button>
</div>
<?php echo JHtml::_('form.token'); ?>
</form>
</div>
<?php endif; ?>
<form action="index.php?option=com_media&task=folder.create&tmpl=<?php echo $input->getCmd('tmpl', 'index'); ?>" name="folderForm" id="folderForm" method="post">
<div id="folderview">
<div class="view">
<iframe class="thumbnail" src="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo $this->escape($this->state->folder); ?>" id="folderframe" name="folderframe" width="100%" height="500px" marginwidth="0" marginheight="0" scrolling="auto"></iframe>
</div>
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
</div>
<?php // Pre render all the bootstrap modals on the parent window
echo JHtml::_(
'bootstrap.renderModal',
'imagePreview',
array(
'title' => JText::_('COM_MEDIA_PREVIEW'),
'footer' => '<button type="button" class="btn" data-dismiss="modal">'
. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
),
'<div id="image" style="text-align:center;"><img id="imagePreviewSrc" src="../media/jui/img/alpha.png" alt="preview" style="max-width:100%; max-height:300px;"/></div>'
);
echo JHtml::_(
'bootstrap.renderModal',
'videoPreview',
array(
'title' => JText::_('COM_MEDIA_PREVIEW'),
'footer' => '<button type="button" class="btn" data-dismiss="modal">'
. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
),
'<div id="videoPlayer" style="z-index: -100;"><video id="mejsPlayer" style="height: 250px;"/></div>'
);
?>
<!-- End Content -->
</div>
views/media/tmpl/default.xml 0000604 00000000310 15245570546 0012105 0 ustar 00 <?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_MEDIA_MEDIA_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_MEDIA_MEDIA_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
views/media/view.html.php 0000604 00000006753 15245570546 0011432 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Media component
*
* @since 1.0
*/
class MediaViewMedia extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.0
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$config = JComponentHelper::getParams('com_media');
if (!$app->isClient('administrator'))
{
return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');
}
/*
* Display form for FTP credentials?
* Don't set them here, as there are other functions called before this one if there is any file write operation
*/
$ftp = !JClientHelper::hasCredentials('ftp');
$session = JFactory::getSession();
$state = $this->get('state');
$this->session = $session;
$this->config = &$config;
$this->state = &$state;
$this->require_ftp = $ftp;
$this->folders_id = ' id="media-tree"';
$this->folders = $this->get('folderTree');
$this->sidebar = JHtmlSidebar::render();
// Set the toolbar
$this->addToolbar();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
// Get the toolbar object instance
$bar = JToolbar::getInstance('toolbar');
$user = JFactory::getUser();
// Set the titlebar text
JToolbarHelper::title(JText::_('COM_MEDIA'), 'images mediamanager');
// Add an upload button
if ($user->authorise('core.create', 'com_media'))
{
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('toolbar.uploadmedia');
$bar->appendButton('Custom', $layout->render(array()), 'upload');
JToolbarHelper::divider();
}
// Add a create folder button
if ($user->authorise('core.create', 'com_media'))
{
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('toolbar.newfolder');
$bar->appendButton('Custom', $layout->render(array()), 'create');
JToolbarHelper::divider();
}
// Add a delete button
if ($user->authorise('core.delete', 'com_media'))
{
// Instantiate a new JLayoutFile instance and render the layout
$layout = new JLayoutFile('toolbar.deletemedia');
$bar->appendButton('Custom', $layout->render(array()), 'delete');
JToolbarHelper::divider();
}
// Add a preferences button
if ($user->authorise('core.admin', 'com_media') || $user->authorise('core.options', 'com_media'))
{
JToolbarHelper::preferences('com_media');
JToolbarHelper::divider();
}
JToolbarHelper::help('JHELP_CONTENT_MEDIA_MANAGER');
}
/**
* Display a folder level
*
* @param array $folder Array with folder data
*
* @return string
*
* @since 1.0
*/
protected function getFolderLevel($folder)
{
$this->folders_id = null;
$txt = null;
if (isset($folder['children']) && count($folder['children']))
{
$tmp = $this->folders;
$this->folders = $folder;
$txt = $this->loadTemplate('folders');
$this->folders = $tmp;
}
return $txt;
}
}
views/medialist/tmpl/details_videos.php 0000604 00000004377 15245570546 0014363 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JHtml::_('bootstrap.tooltip');
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
JFactory::getDocument()->addScriptDeclaration("
jQuery(document).ready(function($){
window.parent.jQuery('#videoPreview').on('hidden', function () {
window.parent.jQuery('#mejsPlayer')[0].player.pause();
});
});
");
?>
<?php foreach ($this->videos as $i => $video) : ?>
<?php $dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$video, &$params, 0)); ?>
<tr>
<?php if ($this->canDelete) : ?>
<td>
<?php echo JHtml::_('grid.id', $i, $this->escape($video->name), false, 'rm', 'cb-video'); ?>
</td>
<?php endif; ?>
<td>
<a class="video-preview" href="<?php echo COM_MEDIA_BASEURL, '/', rawurlencode($video->name); ?>" title="<?php echo $this->escape($video->title); ?>">
<?php echo JHtml::_('image', $video->icon_16, $this->escape($video->title), null, true); ?>
</a>
</td>
<td class="description">
<a class="video-preview" href="<?php echo COM_MEDIA_BASEURL, '/', rawurlencode($video->name); ?>" title="<?php echo $this->escape($video->name); ?>">
<?php echo $this->escape($video->name); ?>
</a>
</td>
<td class="dimensions">
<?php // Can we figure out the dimensions of the video? ?>
</td>
<td class="filesize">
<?php echo JHtml::_('number.bytes', $video->size); ?>
</td>
<?php if ($this->canDelete) : ?>
<td>
<a class="delete-item" target="_top" href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($video->name); ?>" rel="<?php echo $this->escape($video->name); ?>">
<span class="icon-remove hasTooltip" title="<?php echo JHtml::tooltipText('JACTION_DELETE'); ?>"></span>
</a>
</td>
<?php endif; ?>
</tr>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$video, &$params, 0)); ?>
<?php endforeach; ?>
views/medialist/tmpl/details_video.php 0000604 00000004446 15245570546 0014175 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JHtml::_('bootstrap.tooltip');
$user = JFactory::getUser();
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_video, &$params, 0));
JFactory::getDocument()->addScriptDeclaration("
jQuery(document).ready(function($){
window.parent.jQuery('#videoPreview').on('hidden', function () {
window.parent.jQuery('#mejsPlayer')[0].player.pause();
});
});
");
?>
<tr>
<td>
<a class="video-preview" href="<?php echo COM_MEDIA_BASEURL . '/' . rawurlencode($this->_tmp_video->name); ?>" title="<?php echo $this->escape($this->_tmp_video->title); ?>"><?php JHtml::_('image', $this->_tmp_video->icon_16, $this->escape($this->_tmp_video->title), null, true); ?></a>
</td>
<td class="description">
<a class="video-preview" href="<?php echo COM_MEDIA_BASEURL . '/' . rawurlencode($this->_tmp_video->name); ?>" title="<?php echo $this->escape($this->_tmp_video->name); ?>">
<?php echo JHtml::_('string.truncate', $this->escape($this->_tmp_video->name), 10, false); ?>
</a>
</td>
<td class="dimensions">
<?php // Can we figure out the dimensions of the video? ?>
</td>
<td class="filesize">
<?php echo JHtml::_('number.bytes', $this->_tmp_video->size); ?>
</td>
<?php if ($user->authorise('core.delete', 'com_media')):?>
<td>
<a class="delete-item" target="_top" href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($this->_tmp_video->name); ?>" rel="<?php echo $this->escape($this->_tmp_video->name); ?>"><span class="icon-remove hasTooltip" title="<?php echo JHtml::_('tooltipText', 'JACTION_DELETE');?>"></span></a>
<input type="checkbox" name="rm[]" value="<?php echo $this->escape($this->_tmp_video->name); ?>" />
</td>
<?php endif;?>
</tr>
<?php
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_video, &$params, 0));
views/medialist/tmpl/thumbs_videos.php 0000604 00000003656 15245570546 0014237 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
JFactory::getDocument()->addScriptDeclaration("
jQuery(document).ready(function($){
window.parent.jQuery('#videoPreview').on('hidden', function () {
window.parent.jQuery('#mejsPlayer')[0].player.pause();
});
});
");
?>
<?php foreach ($this->videos as $i => $video) : ?>
<?php $dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$video, &$params, 0)); ?>
<li class="imgOutline thumbnail height-80 width-80 center">
<?php if ($this->canDelete) : ?>
<a class="close delete-item" target="_top" href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($video->name); ?>" rel="<?php echo $this->escape($video->name); ?>" title="<?php echo JText::_('JACTION_DELETE'); ?>">×</a>
<div class="pull-left">
<?php echo JHtml::_('grid.id', $i, $this->escape($video->name), false, 'rm', 'cb-video'); ?>
</div>
<div class="clearfix"></div>
<?php endif; ?>
<div class="height-50">
<?php echo JHtml::_('image', $video->icon_32, $this->escape($video->title), null, true); ?>
</div>
<div class="small">
<a class="video-preview" href="<?php echo COM_MEDIA_BASEURL, '/', rawurlencode($video->path_relative); ?>" title="<?php echo $this->escape($video->name); ?>">
<?php echo JHtml::_('string.truncate', $this->escape($video->name), 10, false); ?>
</a>
</div>
</li>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$video, &$params, 0)); ?>
<?php endforeach; ?>
views/medialist/tmpl/thumbs_folders.php 0000604 00000003146 15245570546 0014376 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php foreach ($this->folders as $i => $folder) : ?>
<li class="imgOutline thumbnail height-80 width-80 center">
<?php if ($this->canDelete) : ?>
<a class="close delete-item" target="_top" href="index.php?option=com_media&task=folder.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($folder->name); ?>" rel="<?php echo $this->escape($folder->name); ?> :: <?php echo $this->escape($folder->files) + $this->escape($folder->folders); ?>" title="<?php echo JText::_('JACTION_DELETE'); ?>">×</a>
<div class="pull-left">
<?php echo JHtml::_('grid.id', $i, $this->escape($folder->name), false, 'rm', 'cb-folder'); ?>
</div>
<div class="clearfix"></div>
<?php endif; ?>
<div class="height-50">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($folder->path_relative); ?>" target="folderframe">
<span class="icon-folder-2"></span>
</a>
</div>
<div class="small">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($folder->path_relative); ?>" target="folderframe">
<?php echo JHtml::_('string.truncate', $this->escape($folder->name), 10, false); ?>
</a>
</div>
</li>
<?php endforeach; ?>
views/medialist/tmpl/details_up.php 0000604 00000001745 15245570546 0013512 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$user = JFactory::getUser();
?>
<?php if ($this->state->folder != '') : ?>
<tr>
<?php if ($this->canDelete) : ?>
<td> </td>
<?php endif; ?>
<td class="imgTotal">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($this->state->parent); ?>" target="folderframe">
<span class="icon-arrow-up"></span></a>
</td>
<td class="description">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($this->state->parent); ?>" target="folderframe">..</a>
</td>
<td> </td>
<td> </td>
<?php if ($user->authorise('core.delete', 'com_media')) : ?>
<td> </td>
<?php endif; ?>
</tr>
<?php endif; ?>
views/medialist/tmpl/thumbs_up.php 0000604 00000001643 15245570546 0013364 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php if ($this->state->folder != '') : ?>
<li class="imgOutline thumbnail height-80 width-80 center">
<div class="imgTotal">
<div class="imgBorder">
<a class="btn" href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($this->state->parent); ?>" target="folderframe">
<span class="icon-arrow-up"></span></a>
</div>
</div>
<div class="controls">
<span> </span>
</div>
<div class="imginfoBorder">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($this->state->parent); ?>" target="folderframe">..</a>
</div>
</li>
<?php endif; ?>
views/medialist/tmpl/details_folders.php 0000604 00000003066 15245570546 0014522 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('bootstrap.tooltip');
?>
<?php foreach ($this->folders as $i => $folder) : ?>
<?php $link = 'index.php?option=com_media&view=mediaList&tmpl=component&folder=' . rawurlencode($folder->path_relative); ?>
<tr>
<?php if ($this->canDelete) : ?>
<td>
<?php echo JHtml::_('grid.id', $i, $this->escape($folder->name), false, 'rm', 'cb-folder'); ?>
</td>
<?php endif; ?>
<td class="imgTotal">
<a href="<?php echo $link; ?>" target="folderframe"><span class="icon-folder-2"></span></a>
</td>
<td class="description">
<a href="<?php echo $link; ?>" target="folderframe"><?php echo $this->escape($folder->name); ?></a>
</td>
<td> </td>
<td> </td>
<?php if ($this->canDelete) : ?>
<td>
<a class="delete-item" target="_top" href="index.php?option=com_media&task=folder.delete&tmpl=index&folder=<?php echo rawurlencode($this->state->folder); ?>&<?php echo JSession::getFormToken(); ?>=1&rm[]=<?php echo $this->escape($folder->name); ?>" rel="<?php echo $this->escape($folder->name); ?> :: <?php echo $this->escape($folder->files) + $this->escape($folder->folders); ?>">
<span class="icon-remove hasTooltip" title="<?php echo JHtml::tooltipText('JACTION_DELETE'); ?>"></span>
</a>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
views/medialist/tmpl/details_img.php 0000604 00000004465 15245570546 0013644 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JHtml::_('bootstrap.tooltip');
$user = JFactory::getUser();
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_img, &$params, 0));
?>
<tr>
<td>
<a class="img-preview" href="<?php echo COM_MEDIA_BASEURL . '/' . str_replace('%2F', '/', rawurlencode($this->_tmp_img->path_relative)); ?>" title="<?php echo $this->escape($this->_tmp_img->name); ?>"><?php echo JHtml::_('image', COM_MEDIA_BASEURL . '/' . $this->escape($this->_tmp_img->path_relative), JText::sprintf('COM_MEDIA_IMAGE_TITLE', $this->_tmp_img->title, JHtml::_('number.bytes', $this->_tmp_img->size)), array('width' => $this->_tmp_img->width_16, 'height' => $this->_tmp_img->height_16)); ?></a>
</td>
<td class="description">
<a href="<?php echo COM_MEDIA_BASEURL . '/' . str_replace('%2F', '/', rawurlencode($this->_tmp_img->path_relative)); ?>" title="<?php echo $this->escape($this->_tmp_img->name); ?>" class="preview"><?php echo $this->escape($this->_tmp_img->title); ?></a>
</td>
<td class="dimensions">
<?php echo JText::sprintf('COM_MEDIA_IMAGE_DIMENSIONS', $this->_tmp_img->width, $this->_tmp_img->height); ?>
</td>
<td class="filesize">
<?php echo JHtml::_('number.bytes', $this->_tmp_img->size); ?>
</td>
<?php if ($user->authorise('core.delete', 'com_media')):?>
<td>
<a class="delete-item" target="_top" href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($this->_tmp_img->name); ?>" rel="<?php echo $this->escape($this->_tmp_img->name); ?>"><span class="icon-remove hasTooltip" title="<?php echo JHtml::_('tooltipText', 'JACTION_DELETE');?>"></span></a>
<input type="checkbox" name="rm[]" value="<?php echo $this->escape($this->_tmp_img->name); ?>" />
</td>
<?php endif;?>
</tr>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_img, &$params, 0));
views/medialist/tmpl/details_doc.php 0000604 00000003725 15245570546 0013633 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JHtml::_('bootstrap.tooltip');
$user = JFactory::getUser();
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_doc, &$params, 0));
?>
<tr>
<td>
<a title="<?php echo $this->escape($this->_tmp_doc->name); ?>">
<?php echo JHtml::_('image', $this->_tmp_doc->icon_16, $this->escape($this->_tmp_doc->title), null, true, true) ? JHtml::_('image', $this->_tmp_doc->icon_16, $this->_tmp_doc->title, array('width' => 16, 'height' => 16), true) : JHtml::_('image', 'media/con_info.png', $this->escape($this->_tmp_doc->title), array('width' => 16, 'height' => 16), true);?> </a>
</td>
<td class="description" title="<?php echo $this->escape($this->_tmp_doc->name); ?>">
<?php echo $this->escape($this->_tmp_doc->title); ?>
</td>
<td> 
</td>
<td class="filesize">
<?php echo JHtml::_('number.bytes', $this->_tmp_doc->size); ?>
</td>
<?php if ($user->authorise('core.delete', 'com_media')):?>
<td>
<a class="delete-item" target="_top" href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($this->_tmp_doc->name); ?>" rel="<?php echo $this->escape($this->_tmp_doc->name); ?>"><span class="icon-remove hasTooltip" title="<?php echo JHtml::_('tooltipText', 'JACTION_DELETE');?>"></span></a>
<input type="checkbox" name="rm[]" value="<?php echo $this->escape($this->_tmp_doc->name); ?>" />
</td>
<?php endif;?>
</tr>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_doc, &$params, 0));
views/medialist/tmpl/details_imgs.php 0000604 00000004534 15245570546 0014024 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JHtml::_('bootstrap.tooltip');
$user = JFactory::getUser();
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
?>
<?php foreach ($this->images as $i => $image) : ?>
<?php $dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$image, &$params, 0)); ?>
<tr>
<?php if ($this->canDelete) : ?>
<td>
<?php echo JHtml::_('grid.id', $i, $this->escape($image->name), false, 'rm', 'cb-image'); ?>
</td>
<?php endif; ?>
<td>
<a class="img-preview" href="<?php echo COM_MEDIA_BASEURL . '/' . str_replace('%2F', '/', rawurlencode($image->path_relative)); ?>" title="<?php echo $this->escape($image->name); ?>">
<?php echo JHtml::_('image', COM_MEDIA_BASEURL . '/' . $this->escape($image->path_relative), JText::sprintf('COM_MEDIA_IMAGE_TITLE', $this->escape($image->title), JHtml::_('number.bytes', $image->size)), array('width' => $image->width_16, 'height' => $image->height_16)); ?>
</a>
</td>
<td class="description">
<a href="<?php echo COM_MEDIA_BASEURL . '/' . str_replace('%2F', '/', rawurlencode($image->path_relative)); ?>" title="<?php echo $this->escape($image->name); ?>" class="preview">
<?php echo $this->escape($image->title); ?>
</a>
</td>
<td class="dimensions">
<?php echo JText::sprintf('COM_MEDIA_IMAGE_DIMENSIONS', $image->width, $image->height); ?>
</td>
<td class="filesize">
<?php echo JHtml::_('number.bytes', $image->size); ?>
</td>
<?php if ($this->canDelete) : ?>
<td>
<a class="delete-item" target="_top" href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($image->name); ?>" rel="<?php echo $this->escape($image->name); ?>">
<span class="icon-remove hasTooltip" title="<?php echo JHtml::tooltipText('JACTION_DELETE'); ?>"></span>
</a>
</td>
<?php endif; ?>
</tr>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$image, &$params, 0)); ?>
<?php endforeach; ?>
views/medialist/tmpl/details_folder.php 0000604 00000003041 15245570546 0014330 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$user = JFactory::getUser();
JHtml::_('bootstrap.tooltip');
?>
<tr>
<td class="imgTotal">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($this->_tmp_folder->path_relative); ?>" target="folderframe">
<span class="icon-folder-2"></span></a>
</td>
<td class="description">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($this->_tmp_folder->path_relative); ?>" target="folderframe"><?php echo $this->escape($this->_tmp_folder->name); ?></a>
</td>
<td> 
</td>
<td> 
</td>
<?php if ($user->authorise('core.delete', 'com_media')):?>
<td>
<a class="delete-item" target="_top" href="index.php?option=com_media&task=folder.delete&tmpl=index&folder=<?php echo rawurlencode($this->state->folder); ?>&<?php echo JSession::getFormToken(); ?>=1&rm[]=<?php echo $this->_tmp_folder->name; ?>" rel="<?php echo $this->_tmp_folder->name; ?>' :: <?php echo $this->_tmp_folder->files + $this->_tmp_folder->folders; ?>"><span class="icon-remove hasTooltip" title="<?php echo JHtml::_('tooltipText', 'JACTION_DELETE');?>"></span></a>
<input type="checkbox" name="rm[]" value="<?php echo $this->_tmp_folder->name; ?>" />
</td>
<?php endif;?>
</tr>
views/medialist/tmpl/default.php 0000604 00000000406 15245570546 0012776 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
views/medialist/tmpl/thumbs_imgs.php 0000604 00000004056 15245570546 0013700 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
?>
<?php foreach ($this->images as $i => $img) : ?>
<?php $dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$img, &$params, 0)); ?>
<li class="imgOutline thumbnail height-80 width-80 center">
<?php if ($this->canDelete) : ?>
<a class="close delete-item" target="_top"
href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($img->name); ?>"
rel="<?php echo $this->escape($img->name); ?>" title="<?php echo JText::_('JACTION_DELETE'); ?>">×</a>
<div class="pull-left">
<?php echo JHtml::_('grid.id', $i, $this->escape($img->name), false, 'rm', 'cb-image'); ?>
</div>
<div class="clearfix"></div>
<?php endif; ?>
<div class="height-50">
<a class="img-preview" href="<?php echo COM_MEDIA_BASEURL . '/' . str_replace('%2F', '/', rawurlencode($img->path_relative)); ?>" title="<?php echo $this->escape($img->name); ?>" >
<?php echo JHtml::_('image', COM_MEDIA_BASEURL . '/' . $this->escape($img->path_relative), JText::sprintf('COM_MEDIA_IMAGE_TITLE', $this->escape($img->title), JHtml::_('number.bytes', $img->size)), array('width' => $img->width_60, 'height' => $img->height_60)); ?>
</a>
</div>
<div class="small">
<a href="<?php echo COM_MEDIA_BASEURL, '/', rawurlencode($img->path_relative); ?>" title="<?php echo $this->escape($img->name); ?>" class="preview">
<?php echo JHtml::_('string.truncate', $this->escape($img->name), 10, false); ?>
</a>
</div>
</li>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$img, &$params, 0)); ?>
<?php endforeach; ?>
views/medialist/tmpl/details_docs.php 0000604 00000003727 15245570546 0014020 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
JHtml::_('bootstrap.tooltip');
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
?>
<?php foreach ($this->documents as $i => $doc) : ?>
<?php $dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$doc, &$params, 0)); ?>
<tr>
<?php if ($this->canDelete) : ?>
<td>
<?php echo JHtml::_('grid.id', $i, $this->escape($doc->name), false, 'rm', 'cb-document'); ?>
</td>
<?php endif; ?>
<td>
<a title="<?php echo $this->escape($doc->name); ?>">
<?php echo JHtml::_('image', $doc->icon_16, $this->escape($doc->title), null, true, true) ? JHtml::_('image', $doc->icon_16, $this->escape($doc->title), array('width' => 16, 'height' => 16), true) : JHtml::_('image', 'media/con_info.png', $this->escape($doc->title), array('width' => 16, 'height' => 16), true); ?>
</a>
</td>
<td class="description" title="<?php echo $this->escape($doc->name); ?>">
<?php echo $this->escape($doc->title); ?>
</td>
<td> </td>
<td class="filesize">
<?php echo JHtml::_('number.bytes', $doc->size); ?>
</td>
<?php if ($this->canDelete) : ?>
<td>
<a class="delete-item" target="_top" href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($doc->name); ?>" rel="<?php echo $this->escape($doc->name); ?>">
<span class="icon-remove hasTooltip" title="<?php echo JHtml::tooltipText('JACTION_DELETE'); ?>"></span>
</a>
</td>
<?php endif; ?>
</tr>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$doc, &$params, 0)); ?>
<?php endforeach; ?>
views/medialist/tmpl/details.php 0000604 00000007302 15245570546 0013001 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$params = JComponentHelper::getParams('com_media');
$path = 'file_path';
JHtml::_('jquery.framework');
JHtml::_('behavior.core');
$doc = JFactory::getDocument();
// Need to override this core function because we use a different form id
$doc->addScriptDeclaration(
"
Joomla.isChecked = function( isitchecked, form ) {
if ( typeof form === 'undefined' ) {
form = document.getElementById( 'mediamanager-form' );
}
form.boxchecked.value += isitchecked ? 1 : -1;
// If we don't have a checkall-toggle, done.
if ( !form.elements[ 'checkall-toggle' ] ) return;
// Toggle main toggle checkbox depending on checkbox selection
var c = true,
i, e, n;
for ( i = 0, n = form.elements.length; i < n; i++ ) {
e = form.elements[ i ];
if ( e.type == 'checkbox' && e.name != 'checkall-toggle' && !e.checked ) {
c = false;
break;
}
}
form.elements[ 'checkall-toggle' ].checked = c;
};
"
);
$doc->addScriptDeclaration(
"
jQuery(document).ready(function($){
window.parent.document.updateUploader();
$('.img-preview, .preview').each(function(index, value) {
$(this).on('click', function(e) {
window.parent.jQuery('#imagePreviewSrc').attr('src', $(this).attr('href'));
window.parent.jQuery('#imagePreview').modal('show');
return false;
});
});
$('.video-preview').each(function(index, value) {
$(this).unbind('click');
$(this).on('click', function(e) {
e.preventDefault();
window.parent.jQuery('#videoPreview').modal('show');
var elementInitialised = window.parent.jQuery('#mejsPlayer').attr('src');
if (!elementInitialised)
{
window.parent.jQuery('#mejsPlayer').attr('src', $(this).attr('href'));
window.parent.jQuery('#mejsPlayer').mediaelementplayer();
}
window.parent.jQuery('#mejsPlayer')[0].player.media.setSrc($(this).attr('href'));
return false;
});
});
});
"
);
?>
<form target="_parent" action="index.php?option=com_media&tmpl=index&folder=<?php echo rawurlencode($this->state->folder); ?>" method="post" id="mediamanager-form" name="mediamanager-form">
<div class="muted">
<p>
<span class="icon-folder"></span>
<?php
echo $params->get($path, 'images'),
($this->escape($this->state->folder) != '') ? '/' . $this->escape($this->state->folder) : '';
?>
</p>
</div>
<div class="manager">
<table class="table table-striped table-condensed">
<thead>
<tr>
<?php if ($this->canDelete) : ?>
<th width="1%">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<?php endif; ?>
<th width="1%"><?php echo JText::_('JGLOBAL_PREVIEW'); ?></th>
<th><?php echo JText::_('COM_MEDIA_NAME'); ?></th>
<th width="15%"><?php echo JText::_('COM_MEDIA_PIXEL_DIMENSIONS'); ?></th>
<th width="8%"><?php echo JText::_('COM_MEDIA_FILESIZE'); ?></th>
<?php if ($this->canDelete) : ?>
<th width="8%">
<?php echo JText::_('JACTION_DELETE'); ?>
</th>
<?php endif; ?>
</tr>
</thead>
<tbody>
<?php
echo $this->loadTemplate('up'),
$this->loadTemplate('folders'),
$this->loadTemplate('docs'),
$this->loadTemplate('videos'),
$this->loadTemplate('imgs');
?>
</tbody>
</table>
</div>
<input type="hidden" name="task" value="list" />
<input type="hidden" name="username" value="" />
<input type="hidden" name="password" value="" />
<input type="hidden" name="boxchecked" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
views/medialist/tmpl/thumbs.php 0000604 00000006333 15245570546 0012661 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$params = JComponentHelper::getParams('com_media');
$path = 'file_path';
JHtml::_('jquery.framework');
JHtml::_('behavior.core');
$doc = JFactory::getDocument();
// Need to override this core function because we use a different form id
$doc->addScriptDeclaration(
"
Joomla.isChecked = function( isitchecked, form ) {
if ( typeof form === 'undefined' ) {
form = document.getElementById( 'mediamanager-form' );
}
form.boxchecked.value += isitchecked ? 1 : -1;
// If we don't have a checkall-toggle, done.
if ( !form.elements[ 'checkall-toggle' ] ) return;
// Toggle main toggle checkbox depending on checkbox selection
var c = true,
i, e, n;
for ( i = 0, n = form.elements.length; i < n; i++ ) {
e = form.elements[ i ];
if ( e.type == 'checkbox' && e.name != 'checkall-toggle' && !e.checked ) {
c = false;
break;
}
}
form.elements[ 'checkall-toggle' ].checked = c;
};
"
);
$doc->addScriptDeclaration(
"
jQuery(document).ready(function($){
window.parent.document.updateUploader();
$('.img-preview, .preview').each(function(index, value) {
$(this).on('click', function(e) {
window.parent.jQuery('#imagePreviewSrc').attr('src', $(this).attr('href'));
window.parent.jQuery('#imagePreview').modal('show');
return false;
});
});
$('.video-preview').each(function(index, value) {
$(this).unbind('click');
$(this).on('click', function(e) {
e.preventDefault();
window.parent.jQuery('#videoPreview').modal('show');
var elementInitialised = window.parent.jQuery('#mejsPlayer').attr('src');
if (!elementInitialised)
{
window.parent.jQuery('#mejsPlayer').attr('src', $(this).attr('href'));
window.parent.jQuery('#mejsPlayer').mediaelementplayer();
}
window.parent.jQuery('#mejsPlayer')[0].player.media.setSrc($(this).attr('href'));
return false;
});
});
});
"
);
?>
<form target="_parent" action="index.php?option=com_media&tmpl=index&folder=<?php echo rawurlencode($this->state->folder); ?>" method="post" id="mediamanager-form" name="mediamanager-form">
<div class="muted breadcrumbs">
<p>
<span class="icon-folder"></span>
<?php
echo $params->get($path, 'images'),
($this->escape($this->state->folder) != '') ? '/' . $this->escape($this->state->folder) : '';
?>
</p>
</div>
<div>
<label class="checkbox btn">
<?php echo JHtml::_('grid.checkall'); ?>
<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>
</label>
</div>
<ul class="manager thumbnails thumbnails-media">
<?php
echo $this->loadTemplate('up'),
$this->loadTemplate('folders'),
$this->loadTemplate('docs'),
$this->loadTemplate('videos'),
$this->loadTemplate('imgs');
?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="username" value="" />
<input type="hidden" name="password" value="" />
<input type="hidden" name="boxchecked" value="" />
<?php echo JHtml::_('form.token'); ?>
</ul>
</form>
views/medialist/tmpl/thumbs_docs.php 0000604 00000003542 15245570546 0013670 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
?>
<?php foreach ($this->documents as $i => $doc) : ?>
<?php $dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$doc, &$params, 0)); ?>
<li class="imgOutline thumbnail height-80 width-80 center">
<?php if ($this->canDelete) : ?>
<a class="close delete-item" target="_top" href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($doc->name); ?>" rel="<?php echo $this->escape($doc->name); ?>" title="<?php echo JText::_('JACTION_DELETE'); ?>">×</a>
<div class="pull-left">
<?php echo JHtml::_('grid.id', $i, $this->escape($doc->name), false, 'rm', 'cb-document'); ?>
</div>
<div class="clearfix"></div>
<?php endif; ?>
<div class="height-50">
<a style="display: block; width: 100%; height: 100%" title="<?php echo $this->escape($doc->name); ?>" >
<?php echo JHtml::_('image', $doc->icon_32, $this->escape($doc->name), null, true, true) ? JHtml::_('image', $doc->icon_32, $this->escape($doc->title), null, true) : JHtml::_('image', 'media/con_info.png', $this->escape($doc->name), null, true); ?>
</a>
</div>
<div class="small" title="<?php echo $this->escape($doc->name); ?>" >
<?php echo JHtml::_('string.truncate', $this->escape($doc->name), 10, false); ?>
</div>
</li>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$doc, &$params, 0)); ?>
<?php endforeach; ?>
views/medialist/view.html.php 0000604 00000003122 15245570546 0012311 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Media component
*
* @since 1.0
*/
class MediaViewMediaList extends JViewLegacy
{
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.0
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
if (!$app->isClient('administrator'))
{
return $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'warning');
}
// Do not allow cache
$app->allowCache(false);
$this->images = $this->get('images');
$this->documents = $this->get('documents');
$this->folders = $this->get('folders');
$this->videos = $this->get('videos');
$this->state = $this->get('state');
// Check for invalid folder name
if (empty($this->state->folder))
{
$dirname = JFactory::getApplication()->input->getPath('folder', '');
if (!empty($dirname))
{
$dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8');
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname));
}
}
$user = JFactory::getUser();
$this->canDelete = $user->authorise('core.delete', 'com_media');
parent::display($tpl);
}
}
medialist/thumbs_folders.php 0000604 00000003142 15245571342 0012254 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php foreach ($this->folders as $i => $folder) : ?>
<li class="imgOutline thumbnail height-80 width-80 center">
<?php if ($this->canDelete):?>
<a class="close delete-item" target="_top" href="index.php?option=com_media&task=folder.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($folder->name); ?>" rel="<?php echo $this->escape($folder->name); ?> :: <?php echo $this->escape($folder->files) + $this->escape($folder->folders); ?>" title="<?php echo JText::_('JACTION_DELETE');?>">×</a>
<div class="pull-left">
<?php echo JHtml::_('grid.id', $i, $this->escape($folder->name), false, 'rm', 'cb-folder'); ?>
</div>
<div class="clearfix"></div>
<?php endif;?>
<div class="height-50">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($folder->path_relative); ?>" target="folderframe">
<span class="icon-folder-2"></span>
</a>
</div>
<div class="small">
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo rawurlencode($folder->path_relative); ?>" target="folderframe">
<?php echo JHtml::_('string.truncate', $this->escape($folder->name), 10, false); ?>
</a>
</div>
</li>
<?php endforeach; ?>
medialist/thumbs_imgs.php 0000604 00000004010 15245571342 0011550 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
?>
<?php foreach ($this->images as $i => $img) : ?>
<?php $dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$img, &$params, 0)); ?>
<li class="imgOutline thumbnail center">
<?php if ($this->canDelete):?>
<div class="imgDelete">
<a class="close delete-item" target="_top"
href="index.php?option=com_media&task=file.delete&tmpl=index&<?php echo JSession::getFormToken(); ?>=1&folder=<?php echo rawurlencode($this->state->folder); ?>&rm[]=<?php echo $this->escape($img->name); ?>"
rel="<?php echo $this->escape($img->name); ?>" title="<?php echo JText::_('JACTION_DELETE'); ?>"><span class="icon-delete"> </span></a>
</div>
<?php endif; ?>
<div class="imgThumb imgInput">
<?php if ($this->canDelete):?>
<?php echo JHtml::_('grid.id', $i, $this->escape($img->name), false, 'rm', 'cb-image'); ?>
<?php endif; ?>
<label for="cb-image<?php echo $i ?>">
<?php echo JHtml::_('image', COM_MEDIA_BASEURL . '/' . $this->escape($img->path_relative), JText::sprintf('COM_MEDIA_IMAGE_TITLE', $this->escape($img->title), JHtml::_('number.bytes', $img->size)), array('width' => $img->width_60, 'height' => $img->height_60)); ?>
</label>
</div>
<div class="imgPreview nowrap small">
<a href="<?php echo COM_MEDIA_BASEURL . '/' . str_replace('%2F', '/', rawurlencode($img->path_relative)); ?>" title="<?php echo $this->escape($img->name); ?>" class="preview truncate">
<span class="icon-search" aria-hidden="true"></span><?php echo $this->escape($img->name); ?>
</a>
</div>
</li>
<?php $dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$img, &$params, 0)); ?>
<?php endforeach; ?>
imageslist/default_folder.php 0000604 00000001527 15245571342 0012406 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$input = JFactory::getApplication()->input;
?>
<li class="imgOutline thumbnail height-80 width-80 center">
<a href="index.php?option=com_media&view=imagesList&tmpl=component&folder=<?php echo rawurlencode($this->_tmp_folder->path_relative); ?>&asset=<?php echo $input->getCmd('asset');?>&author=<?php echo $input->getCmd('author');?>" target="imageframe">
<div class="imgFolder">
<span class="icon-folder-2"></span>
</div>
<div class="small">
<?php echo JHtml::_('string.truncate', $this->escape($this->_tmp_folder->name), 10, false); ?>
</div>
</a>
</li>
imageslist/default_image.php 0000604 00000002553 15245571342 0012215 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\Registry\Registry;
$params = new Registry;
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_img, &$params, 0));
?>
<li class="imgOutline thumbnail height-80 width-80 center">
<a class="img-preview" href="javascript:ImageManager.populateFields('<?php echo $this->escape($this->_tmp_img->path_relative); ?>')" title="<?php echo $this->escape($this->_tmp_img->name); ?>" >
<div class="imgThumb">
<div class="imgThumbInside">
<?php echo JHtml::_('image', $this->baseURL . '/' . $this->escape($this->_tmp_img->path_relative), JText::sprintf('COM_MEDIA_IMAGE_TITLE', $this->escape($this->_tmp_img->title), JHtml::_('number.bytes', $this->_tmp_img->size)), array('width' => $this->_tmp_img->width_60, 'height' => $this->_tmp_img->height_60)); ?>
</div>
</div>
<div class="imgDetails small">
<?php echo JHtml::_('string.truncate', $this->escape($this->_tmp_img->name), 10, false); ?>
</div>
</a>
</li>
<?php
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_img, &$params, 0));