You've already forked joomla_test
first commit
This commit is contained in:
9
administrator/components/com_media/access.xml
Normal file
9
administrator/components/com_media/access.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?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.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>
|
121
administrator/components/com_media/config.xml
Normal file
121
administrator/components/com_media/config.xml
Normal file
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<config>
|
||||
<fieldset name="component">
|
||||
<field
|
||||
name="upload_extensions"
|
||||
type="text"
|
||||
size="50"
|
||||
default="bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,BMP,CSV,DOC,GIF,ICO,JPG,JPEG,ODG,ODP,ODS,ODT,PDF,PNG,PPT,SWF,TXT,XCF,XLS"
|
||||
label="COM_MEDIA_FIELD_LEGAL_EXTENSIONS_LABEL"
|
||||
description="COM_MEDIA_FIELD_LEGAL_EXTENSIONS_DESC" />
|
||||
|
||||
<field
|
||||
name="upload_maxsize"
|
||||
type="text"
|
||||
size="50"
|
||||
default="10"
|
||||
label="COM_MEDIA_FIELD_MAXIMUM_SIZE_LABEL"
|
||||
description="COM_MEDIA_FIELD_MAXIMUM_SIZE_DESC" />
|
||||
|
||||
<field name="spacer1" type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field name="spacer2" type="spacer" class="text"
|
||||
label="COM_MEDIA_FOLDERS_PATH_LABEL"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="file_path"
|
||||
type="text"
|
||||
size="50"
|
||||
default="images"
|
||||
label="COM_MEDIA_FIELD_PATH_FILE_FOLDER_LABEL"
|
||||
description="COM_MEDIA_FIELD_PATH_FILE_FOLDER_DESC" />
|
||||
|
||||
<field
|
||||
name="image_path"
|
||||
type="text"
|
||||
size="50"
|
||||
default="images"
|
||||
label="COM_MEDIA_FIELD_PATH_IMAGE_FOLDER_LABEL"
|
||||
description="COM_MEDIA_FIELD_PATH_IMAGE_FOLDER_DESC" />
|
||||
|
||||
<field name="spacer3" type="spacer"
|
||||
hr="true"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="restrict_uploads"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="COM_MEDIA_FIELD_RESTRICT_UPLOADS_LABEL"
|
||||
description="COM_MEDIA_FIELD_RESTRICT_UPLOADS_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="check_mime"
|
||||
type="radio"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
label="COM_MEDIA_FIELD_CHECK_MIME_LABEL"
|
||||
description="COM_MEDIA_FIELD_CHECK_MIME_DESC">
|
||||
<option
|
||||
value="0">JNO</option>
|
||||
<option
|
||||
value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="image_extensions"
|
||||
type="text"
|
||||
size="50"
|
||||
default="bmp,gif,jpg,png"
|
||||
label="COM_MEDIA_FIELD_LEGAL_IMAGE_EXTENSIONS_LABEL"
|
||||
description="COM_MEDIA_FIELD_LEGAL_IMAGE_EXTENSIONS_DESC" />
|
||||
|
||||
<field
|
||||
name="ignore_extensions"
|
||||
type="text"
|
||||
size="50"
|
||||
label="COM_MEDIA_FIELD_IGNORED_EXTENSIONS_LABEL"
|
||||
description="COM_MEDIA_FIELD_IGNORED_EXTENSIONS_DESC" />
|
||||
|
||||
<field
|
||||
name="upload_mime"
|
||||
type="text"
|
||||
size="50"
|
||||
default="image/jpeg,image/gif,image/png,image/bmp,application/x-shockwave-flash,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip"
|
||||
label="COM_MEDIA_FIELD_LEGAL_MIME_TYPES_LABEL"
|
||||
description="COM_MEDIA_FIELD_LEGAL_MIME_TYPES_DESC" />
|
||||
|
||||
<field
|
||||
name="upload_mime_illegal"
|
||||
type="text"
|
||||
size="50"
|
||||
default="text/html"
|
||||
label="COM_MEDIA_FIELD_ILLEGAL_MIME_TYPES_LABEL"
|
||||
description="COM_MEDIA_FIELD_ILLEGAL_MIME_TYPES_DESC" />
|
||||
</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>
|
91
administrator/components/com_media/controller.php
Normal file
91
administrator/components/com_media/controller.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Media Manager Component Controller
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.5
|
||||
*/
|
||||
class MediaController extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean If true, the view output will be cached
|
||||
* @param array 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');
|
||||
$vName = $this->input->get('view', 'media');
|
||||
switch ($vName)
|
||||
{
|
||||
case 'images':
|
||||
$vLayout = $this->input->get('layout', 'default');
|
||||
$mName = 'manager';
|
||||
|
||||
break;
|
||||
|
||||
case 'imagesList':
|
||||
$mName = 'list';
|
||||
$vLayout = $this->input->get('layout', 'default');
|
||||
|
||||
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');
|
||||
$mName = 'manager';
|
||||
break;
|
||||
}
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$vType = $document->getType();
|
||||
|
||||
// Get/Create the view
|
||||
$view = $this->getView($vName, $vType);
|
||||
$view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.'/views/'.strtolower($vName).'/tmpl');
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
public function ftpValidate()
|
||||
{
|
||||
// Set FTP credentials, if given
|
||||
JClientHelper::setCredentialsFromRequest('ftp');
|
||||
}
|
||||
}
|
182
administrator/components/com_media/controllers/file.json.php
Normal file
182
administrator/components/com_media/controllers/file.json.php
Normal file
@ -0,0 +1,182 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.6
|
||||
*/
|
||||
class MediaControllerFile extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Upload a file
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
function upload()
|
||||
{
|
||||
$params = JComponentHelper::getParams('com_media');
|
||||
|
||||
// Check for request forgeries
|
||||
if (!JSession::checkToken('request'))
|
||||
{
|
||||
$response = array(
|
||||
'status' => '0',
|
||||
'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');
|
||||
|
||||
if (
|
||||
$_SERVER['CONTENT_LENGTH'] > ($params->get('upload_maxsize', 0) * 1024 * 1024) ||
|
||||
$_SERVER['CONTENT_LENGTH'] > (int) (ini_get('upload_max_filesize')) * 1024 * 1024 ||
|
||||
$_SERVER['CONTENT_LENGTH'] > (int) (ini_get('post_max_size')) * 1024 * 1024 ||
|
||||
$_SERVER['CONTENT_LENGTH'] > (int) (ini_get('memory_limit')) * 1024 * 1024
|
||||
)
|
||||
{
|
||||
$response = array(
|
||||
'status' => '0',
|
||||
'error' => JText::_('COM_MEDIA_ERROR_WARNFILETOOLARGE')
|
||||
);
|
||||
echo json_encode($response);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set FTP credentials, if given
|
||||
JClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
// Make the filename safe
|
||||
$file['name'] = JFile::makeSafe($file['name']);
|
||||
|
||||
if (isset($file['name']))
|
||||
{
|
||||
// The request is valid
|
||||
$err = null;
|
||||
|
||||
$filepath = JPath::clean(COM_MEDIA_BASE . '/' . $folder . '/' . strtolower($file['name']));
|
||||
|
||||
if (!MediaHelper::canUpload($file, $err))
|
||||
{
|
||||
JLog::add('Invalid: ' . $filepath . ': ' . $err, JLog::INFO, 'upload');
|
||||
|
||||
$response = array(
|
||||
'status' => '0',
|
||||
'error' => JText::_($err)
|
||||
);
|
||||
|
||||
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
|
||||
JLog::add('Errors before save: ' . $object_file->filepath . ' : ' . implode(', ', $object_file->getErrors()), JLog::INFO, 'upload');
|
||||
|
||||
$response = array(
|
||||
'status' => '0',
|
||||
'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
|
||||
JLog::add('File exists: ' . $object_file->filepath . ' by user_id ' . $user->id, JLog::INFO, 'upload');
|
||||
|
||||
$response = array(
|
||||
'status' => '0',
|
||||
'error' => JText::_('COM_MEDIA_ERROR_FILE_EXISTS')
|
||||
);
|
||||
|
||||
echo json_encode($response);
|
||||
return;
|
||||
}
|
||||
elseif (!$user->authorise('core.create', 'com_media'))
|
||||
{
|
||||
// File does not exist and user is not authorised to create
|
||||
JLog::add('Create not permitted: ' . $object_file->filepath . ' by user_id ' . $user->id, JLog::INFO, 'upload');
|
||||
|
||||
$response = array(
|
||||
'status' => '0',
|
||||
'error' => 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
|
||||
JLog::add('Error on upload: ' . $object_file->filepath, JLog::INFO, 'upload');
|
||||
|
||||
$response = array(
|
||||
'status' => '0',
|
||||
'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));
|
||||
JLog::add($folder, JLog::INFO, 'upload');
|
||||
|
||||
$response = array(
|
||||
'status' => '1',
|
||||
'error' => JText::sprintf('COM_MEDIA_UPLOAD_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE)))
|
||||
);
|
||||
|
||||
echo json_encode($response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$response = array(
|
||||
'status' => '0',
|
||||
'error' => JText::_('COM_MEDIA_ERROR_BAD_REQUEST')
|
||||
);
|
||||
|
||||
echo json_encode($response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
278
administrator/components/com_media/controllers/file.php
Normal file
278
administrator/components/com_media/controllers/file.php
Normal file
@ -0,0 +1,278 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @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
|
||||
JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN'));
|
||||
$params = JComponentHelper::getParams('com_media');
|
||||
|
||||
// Get some data from the request
|
||||
$files = $this->input->files->get('Filedata', '', 'array');
|
||||
$return = $this->input->post->get('return-url', null, 'base64');
|
||||
$this->folder = $this->input->get('folder', '', 'path');
|
||||
|
||||
// Set the redirect
|
||||
if ($return)
|
||||
{
|
||||
$this->setRedirect(base64_decode($return) . '&folder=' . $this->folder);
|
||||
}
|
||||
|
||||
// Authorize the user
|
||||
if (!$this->authoriseUser('create'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
$_SERVER['CONTENT_LENGTH'] > ($params->get('upload_maxsize', 0) * 1024 * 1024) ||
|
||||
$_SERVER['CONTENT_LENGTH'] > (int) (ini_get('upload_max_filesize')) * 1024 * 1024 ||
|
||||
$_SERVER['CONTENT_LENGTH'] > (int) (ini_get('post_max_size')) * 1024 * 1024 ||
|
||||
(($_SERVER['CONTENT_LENGTH'] > (int) (ini_get('memory_limit')) * 1024 * 1024) && ((int) (ini_get('memory_limit')) != -1))
|
||||
)
|
||||
{
|
||||
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_WARNFILETOOLARGE'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Perform basic checks on file info before attempting anything
|
||||
foreach ($files as &$file)
|
||||
{
|
||||
$file['name'] = JFile::makeSafe($file['name']);
|
||||
$file['filepath'] = JPath::clean(implode(DIRECTORY_SEPARATOR, array(COM_MEDIA_BASE, $this->folder, $file['name'])));
|
||||
|
||||
if ($file['error'] == 1)
|
||||
{
|
||||
JError::raiseWarning(100, JText::_('COM_MEDIA_ERROR_WARNFILETOOLARGE'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($file['size'] > ($params->get('upload_maxsize', 0) * 1024 * 1024))
|
||||
{
|
||||
JError::raiseNotice(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 upload
|
||||
JError::raiseNotice(100, JText::_($err));
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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 peformed (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()
|
||||
{
|
||||
JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
// 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);
|
||||
|
||||
// Nothing to delete
|
||||
if (empty($paths))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Authorize the user
|
||||
if (!$this->authoriseUser('delete'))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set FTP credentials, if given
|
||||
JClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
JPluginHelper::importPlugin('content');
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
|
||||
$ret = true;
|
||||
|
||||
foreach ($paths as $path)
|
||||
{
|
||||
if ($path !== JFile::makeSafe($path))
|
||||
{
|
||||
// filename is not safe
|
||||
$filename = htmlspecialchars($path, ENT_COMPAT, 'UTF-8');
|
||||
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FILE_WARNFILENAME', substr($filename, strlen(COM_MEDIA_BASE))));
|
||||
continue;
|
||||
}
|
||||
|
||||
$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
|
||||
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
|
||||
continue;
|
||||
}
|
||||
|
||||
$ret &= JFile::delete($object_file->filepath);
|
||||
|
||||
// Trigger the onContentAfterDelete event.
|
||||
$dispatcher->trigger('onContentAfterDelete', array('com_media.file', &$object_file));
|
||||
$this->setMessage(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))
|
||||
{
|
||||
// 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
|
||||
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
|
||||
continue;
|
||||
}
|
||||
|
||||
$ret &= JFolder::delete($object_file->filepath);
|
||||
|
||||
// Trigger the onContentAfterDelete event.
|
||||
$dispatcher->trigger('onContentAfterDelete', array('com_media.folder', &$object_file));
|
||||
$this->setMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
|
||||
}
|
||||
else
|
||||
{
|
||||
// This makes no sense...
|
||||
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FOLDER_NOT_EMPTY', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
210
administrator/components/com_media/controllers/folder.php
Normal file
210
administrator/components/com_media/controllers/folder.php
Normal file
@ -0,0 +1,210 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.5
|
||||
*/
|
||||
class MediaControllerFolder extends JControllerLegacy
|
||||
{
|
||||
/**
|
||||
* Deletes paths from the current path
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
// Set FTP credentials, if given
|
||||
JClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
$ret = true;
|
||||
|
||||
JPluginHelper::importPlugin('content');
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
|
||||
if (count($paths))
|
||||
{
|
||||
foreach ($paths as $path)
|
||||
{
|
||||
if ($path !== JFile::makeSafe($path))
|
||||
{
|
||||
$dirname = htmlspecialchars($path, ENT_COMPAT, 'UTF-8');
|
||||
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FOLDER_WARNDIRNAME', substr($dirname, strlen(COM_MEDIA_BASE))));
|
||||
continue;
|
||||
}
|
||||
|
||||
$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
|
||||
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
|
||||
continue;
|
||||
}
|
||||
|
||||
$ret &= JFile::delete($object_file->filepath);
|
||||
|
||||
// Trigger the onContentAfterDelete event.
|
||||
$dispatcher->trigger('onContentAfterDelete', array('com_media.file', &$object_file));
|
||||
$this->setMessage(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))
|
||||
{
|
||||
// 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
|
||||
JError::raiseWarning(100, JText::plural('COM_MEDIA_ERROR_BEFORE_DELETE', count($errors = $object_file->getErrors()), implode('<br />', $errors)));
|
||||
continue;
|
||||
}
|
||||
|
||||
$ret &= !JFolder::delete($object_file->filepath);
|
||||
|
||||
// Trigger the onContentAfterDelete event.
|
||||
$dispatcher->trigger('onContentAfterDelete', array('com_media.folder', &$object_file));
|
||||
$this->setMessage(JText::sprintf('COM_MEDIA_DELETE_COMPLETE', substr($object_file->filepath, strlen(COM_MEDIA_BASE))));
|
||||
}
|
||||
else
|
||||
{
|
||||
//This makes no sense...
|
||||
JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_DELETE_FOLDER_NOT_EMPTY', 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
|
||||
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
|
||||
|
||||
$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 delete
|
||||
JError::raiseWarning(403, JText::_('JLIB_APPLICATION_ERROR_CREATE_NOT_PERMITTED'));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set FTP credentials, if given
|
||||
JClientHelper::setCredentialsFromRequest('ftp');
|
||||
|
||||
$this->input->set('folder', $parent);
|
||||
|
||||
if (($folderCheck !== null) && ($folder !== $folderCheck))
|
||||
{
|
||||
$this->setMessage(JText::_('COM_MEDIA_ERROR_UNABLE_TO_CREATE_FOLDER_WARNDIRNAME'));
|
||||
return false;
|
||||
}
|
||||
|
||||
$path = JPath::clean(COM_MEDIA_BASE . '/' . $parent . '/' . $folder);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
administrator/components/com_media/helpers/index.html
Normal file
1
administrator/components/com_media/helpers/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
212
administrator/components/com_media/helpers/media.php
Normal file
212
administrator/components/com_media/helpers/media.php
Normal file
@ -0,0 +1,212 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class MediaHelper
|
||||
{
|
||||
/**
|
||||
* Checks if the file is an image
|
||||
* @param string The filename
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isImage($fileName)
|
||||
{
|
||||
static $imageTypes = 'xcf|odg|gif|jpg|png|bmp';
|
||||
return preg_match("/\.(?:$imageTypes)$/i", $fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the file is an image
|
||||
* @param string The filename
|
||||
* @return boolean
|
||||
*/
|
||||
public static function getTypeIcon($fileName)
|
||||
{
|
||||
// Get file extension
|
||||
return strtolower(substr($fileName, strrpos($fileName, '.') + 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the file can be uploaded
|
||||
*
|
||||
* @param array File information
|
||||
* @param string An error message to be returned
|
||||
* @return boolean
|
||||
*/
|
||||
public static function canUpload($file, &$err)
|
||||
{
|
||||
$params = JComponentHelper::getParams('com_media');
|
||||
|
||||
if (empty($file['name']))
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_UPLOAD_INPUT';
|
||||
return false;
|
||||
}
|
||||
|
||||
jimport('joomla.filesystem.file');
|
||||
if ($file['name'] !== JFile::makesafe($file['name']))
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_WARNFILENAME';
|
||||
return false;
|
||||
}
|
||||
|
||||
$format = strtolower(JFile::getExt($file['name']));
|
||||
|
||||
$allowable = explode(',', $params->get('upload_extensions'));
|
||||
$ignored = explode(',', $params->get('ignore_extensions'));
|
||||
if ($format == '' || $format == false || (!in_array($format, $allowable) && !in_array($format, $ignored)))
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_WARNFILETYPE';
|
||||
return false;
|
||||
}
|
||||
|
||||
$maxSize = (int) ($params->get('upload_maxsize', 0) * 1024 * 1024);
|
||||
if ($maxSize > 0 && (int) $file['size'] > $maxSize)
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_WARNFILETOOLARGE';
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$imginfo = null;
|
||||
if ($params->get('restrict_uploads', 1))
|
||||
{
|
||||
$images = explode(',', $params->get('image_extensions'));
|
||||
if (in_array($format, $images)) { // if its an image run it through getimagesize
|
||||
// if tmp_name is empty, then the file was bigger than the PHP limit
|
||||
if (!empty($file['tmp_name']))
|
||||
{
|
||||
if (($imginfo = getimagesize($file['tmp_name'])) === false)
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_WARNINVALID_IMG';
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$err = 'COM_MEDIA_ERROR_WARNFILETOOLARGE';
|
||||
return false;
|
||||
}
|
||||
} elseif (!in_array($format, $ignored))
|
||||
{
|
||||
// if its not an image...and we're not ignoring it
|
||||
$allowed_mime = explode(',', $params->get('upload_mime'));
|
||||
$illegal_mime = explode(',', $params->get('upload_mime_illegal'));
|
||||
if (function_exists('finfo_open') && $params->get('check_mime', 1))
|
||||
{
|
||||
// We have fileinfo
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
$type = finfo_file($finfo, $file['tmp_name']);
|
||||
if (strlen($type) && !in_array($type, $allowed_mime) && in_array($type, $illegal_mime))
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_WARNINVALID_MIME';
|
||||
return false;
|
||||
}
|
||||
finfo_close($finfo);
|
||||
} elseif (function_exists('mime_content_type') && $params->get('check_mime', 1))
|
||||
{
|
||||
// we have mime magic
|
||||
$type = mime_content_type($file['tmp_name']);
|
||||
if (strlen($type) && !in_array($type, $allowed_mime) && in_array($type, $illegal_mime))
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_WARNINVALID_MIME';
|
||||
return false;
|
||||
}
|
||||
} elseif (!$user->authorise('core.manage'))
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_WARNNOTADMIN';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$xss_check = file_get_contents($file['tmp_name'], false, null, -1, 256);
|
||||
$html_tags = array('abbr', 'acronym', 'address', 'applet', 'area', 'audioscope', 'base', 'basefont', 'bdo', 'bgsound', 'big', 'blackface', 'blink', 'blockquote', 'body', 'bq', 'br', 'button', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'comment', 'custom', 'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'fn', 'font', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'html', 'iframe', 'ilayer', 'img', 'input', 'ins', 'isindex', 'keygen', 'kbd', 'label', 'layer', 'legend', 'li', 'limittext', 'link', 'listing', 'map', 'marquee', 'menu', 'meta', 'multicol', 'nobr', 'noembed', 'noframes', 'noscript', 'nosmartquotes', 'object', 'ol', 'optgroup', 'option', 'param', 'plaintext', 'pre', 'rt', 'ruby', 's', 'samp', 'script', 'select', 'server', 'shadow', 'sidebar', 'small', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'tt', 'ul', 'var', 'wbr', 'xml', 'xmp', '!DOCTYPE', '!--');
|
||||
|
||||
foreach ($html_tags as $tag)
|
||||
{
|
||||
// A tag is '<tagname ', so we need to add < and a space or '<tagname>'
|
||||
if (stristr($xss_check, '<'.$tag.' ') || stristr($xss_check, '<'.$tag.'>'))
|
||||
{
|
||||
$err = 'COM_MEDIA_ERROR_WARNIEXSS';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 JHtmlNumber::bytes() instead
|
||||
*/
|
||||
public static function parseSize($size)
|
||||
{
|
||||
JLog::add('MediaHelper::parseSize() is deprecated. Use JHtmlNumber::bytes() instead.', JLog::WARNING, 'deprecated');
|
||||
return JHtml::_('number.bytes', $size);
|
||||
}
|
||||
|
||||
public static function imageResize($width, $height, $target)
|
||||
{
|
||||
//takes the larger size of the width and height and applies the
|
||||
//formula accordingly...this is so this script will work
|
||||
//dynamically with any size image
|
||||
if ($width > $height)
|
||||
{
|
||||
$percentage = ($target / $width);
|
||||
}
|
||||
else
|
||||
{
|
||||
$percentage = ($target / $height);
|
||||
}
|
||||
|
||||
//gets the new value and applies the percentage, then rounds the value
|
||||
$width = round($width * $percentage);
|
||||
$height = round($height * $percentage);
|
||||
|
||||
return array($width, $height);
|
||||
}
|
||||
|
||||
public static function countFiles($dir)
|
||||
{
|
||||
$total_file = 0;
|
||||
$total_dir = 0;
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$d = dir($dir);
|
||||
|
||||
while (false !== ($entry = $d->read()))
|
||||
{
|
||||
if (substr($entry, 0, 1) != '.' && is_file($dir . DIRECTORY_SEPARATOR . $entry) && strpos($entry, '.html') === false && strpos($entry, '.php') === false)
|
||||
{
|
||||
$total_file++;
|
||||
}
|
||||
if (substr($entry, 0, 1) != '.' && is_dir($dir . DIRECTORY_SEPARATOR . $entry))
|
||||
{
|
||||
$total_dir++;
|
||||
}
|
||||
}
|
||||
|
||||
$d->close();
|
||||
}
|
||||
|
||||
return array ($total_file, $total_dir);
|
||||
}
|
||||
|
||||
}
|
1
administrator/components/com_media/index.html
Normal file
1
administrator/components/com_media/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
48
administrator/components/com_media/media.php
Normal file
48
administrator/components/com_media/media.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$input = JFactory::getApplication()->input;
|
||||
$user = JFactory::getUser();
|
||||
$asset = $input->get('asset');
|
||||
$author = $input->get('author');
|
||||
|
||||
// Access check.
|
||||
if (!$user->authorise('core.manage', 'com_media')
|
||||
&& (!$asset or (
|
||||
!$user->authorise('core.edit', $asset)
|
||||
&& !$user->authorise('core.create', $asset)
|
||||
&& count($user->getAuthorisedCategories($asset, 'core.create')) == 0)
|
||||
&& !($user->id == $author && $user->authorise('core.edit.own', $asset))))
|
||||
{
|
||||
return JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
}
|
||||
|
||||
$params = JComponentHelper::getParams('com_media');
|
||||
|
||||
// Load the helper class
|
||||
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/media.php';
|
||||
|
||||
// Set the path definitions
|
||||
$popup_upload = $input->get('pop_up', null);
|
||||
$path = 'file_path';
|
||||
|
||||
$view = $input->get('view');
|
||||
if (substr(strtolower($view), 0, 6) == 'images' || $popup_upload == 1)
|
||||
{
|
||||
$path = 'image_path';
|
||||
}
|
||||
|
||||
define('COM_MEDIA_BASE', JPATH_ROOT . '/' . $params->get($path, 'images'));
|
||||
define('COM_MEDIA_BASEURL', JUri::root() . $params->get($path, 'images'));
|
||||
|
||||
$controller = JControllerLegacy::getInstance('Media', array('base_path' => JPATH_COMPONENT_ADMINISTRATOR));
|
||||
$controller->execute($input->get('task'));
|
||||
$controller->redirect();
|
39
administrator/components/com_media/media.xml
Normal file
39
administrator/components/com_media/media.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?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) 2005 - 2013 Open Source Matters. All rights reserved. </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>index.html</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>index.html</filename>
|
||||
<filename>media.php</filename>
|
||||
<folder>controllers</folder>
|
||||
<folder>helpers</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>
|
||||
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
1
administrator/components/com_media/models/index.html
Normal file
1
administrator/components/com_media/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
202
administrator/components/com_media/models/list.php
Normal file
202
administrator/components/com_media/models/list.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.5
|
||||
*/
|
||||
class MediaModelList extends JModelLegacy
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public function getImages()
|
||||
{
|
||||
$list = $this->getList();
|
||||
|
||||
return $list['images'];
|
||||
}
|
||||
|
||||
public function getFolders()
|
||||
{
|
||||
$list = $this->getList();
|
||||
|
||||
return $list['folders'];
|
||||
}
|
||||
|
||||
public function getDocuments()
|
||||
{
|
||||
$list = $this->getList();
|
||||
|
||||
return $list['docs'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Build imagelist
|
||||
*
|
||||
* @param string $listFolder The image directory to display
|
||||
* @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 = $this->getState('folder');
|
||||
|
||||
// If undefined, set to empty
|
||||
if ($current == 'undefined')
|
||||
{
|
||||
$current = '';
|
||||
}
|
||||
|
||||
if (strlen($current) > 0)
|
||||
{
|
||||
$basePath = COM_MEDIA_BASE.'/'.$current;
|
||||
}
|
||||
else
|
||||
{
|
||||
$basePath = COM_MEDIA_BASE;
|
||||
}
|
||||
|
||||
$mediaBase = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE.'/');
|
||||
|
||||
$images = array ();
|
||||
$folders = array ();
|
||||
$docs = 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)
|
||||
{
|
||||
foreach ($fileList as $file)
|
||||
{
|
||||
if (is_file($basePath.'/'.$file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html')
|
||||
{
|
||||
$tmp = new JObject;
|
||||
$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;
|
||||
|
||||
// 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)
|
||||
{
|
||||
foreach ($folderList as $folder)
|
||||
{
|
||||
$tmp = new JObject;
|
||||
$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);
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
146
administrator/components/com_media/models/manager.php
Normal file
146
administrator/components/com_media/models/manager.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Media Component Manager Model
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.5
|
||||
*/
|
||||
class MediaModelManager extends JModelLegacy
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Image Manager Popup
|
||||
*
|
||||
* @param string $listFolder The image directory to display
|
||||
* @since 1.5
|
||||
*/
|
||||
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');
|
||||
$author = $input->get('author', 0, 'integer');
|
||||
|
||||
// Create the drop-down folder select list
|
||||
$list = JHtml::_('select.genericlist', $options, 'folderlist', 'class="inputbox" size="1" onchange="ImageManager.setFolder(this.options[this.selectedIndex].value, '.$asset.', '.$author.')" ', 'value', 'text', $base);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
130
administrator/components/com_media/views/images/tmpl/default.php
Normal file
130
administrator/components/com_media/views/images/tmpl/default.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$input = JFactory::getApplication()->input;
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
var image_base_path = '<?php $params = JComponentHelper::getParams('com_media');
|
||||
echo $params->get('image_path', 'images'); ?>/';
|
||||
</script>
|
||||
<form action="index.php?option=com_media&asset=<?php echo $input->getCmd('asset');?>&author=<?php echo $input->getCmd('author'); ?>" class="form-vertical" 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">
|
||||
<div class="span9 control-group">
|
||||
<div class="control-label">
|
||||
<label class="control-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="pull-right">
|
||||
<button class="btn btn-primary" type="button" onclick="<?php if ($this->state->get('field.id')):?>window.parent.jInsertFieldValue(document.id('f_url').value,'<?php echo $this->state->get('field.id');?>');<?php else:?>ImageManager.onok();<?php endif;?>window.parent.SqueezeBox.close();"><?php echo JText::_('COM_MEDIA_INSERT') ?></button>
|
||||
<button class="btn" type="button" onclick="window.parent.SqueezeBox.close();"><?php echo JText::_('JCANCEL') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<iframe id="imageframe" name="imageframe" src="index.php?option=com_media&view=imagesList&tmpl=component&folder=<?php echo $this->state->folder?>&asset=<?php echo $input->getCmd('asset');?>&author=<?php echo $input->getCmd('author');?>"></iframe>
|
||||
|
||||
<div class="well">
|
||||
<div class="row">
|
||||
<div class="span6 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>
|
||||
<?php if (!$this->state->get('field.id')):?>
|
||||
<div class="span6 control-group">
|
||||
<div class="control-label">
|
||||
<label 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="right"><?php echo JText::_('JGLOBAL_RIGHT') ?></option>
|
||||
</select>
|
||||
<p class="help-block"><?php echo JText::_('COM_MEDIA_ALIGN_DESC');?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php if (!$this->state->get('field.id')):?>
|
||||
<div class="row">
|
||||
<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">
|
||||
<div class="span12 control-group">
|
||||
<div class="control-label">
|
||||
<label for="f_caption"><?php echo JText::_('COM_MEDIA_CAPTION') ?></label>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<select size="1" id="f_caption" >
|
||||
<option value="" selected="selected" ><?php echo JText::_('JNO') ?></option>
|
||||
<option value="1"><?php echo JText::_('JYES') ?></option>
|
||||
</select>
|
||||
<p class="help-block"><?php echo JText::_('COM_MEDIA_CAPTION_DESC');?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
<input type="hidden" id="dirPath" name="dirPath" />
|
||||
<input type="hidden" id="f_file" name="f_file" />
|
||||
<input type="hidden" id="tmpl" name="component" />
|
||||
|
||||
</div>
|
||||
</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 $input->getCmd('asset');?>&author=<?php echo $input->getCmd('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 type="file" id="upload-file" name="Filedata[]" multiple /><button class="btn btn-primary" id="upload-submit"><i class="icon-upload icon-white"></i> <?php echo JText::_('COM_MEDIA_START_UPLOAD'); ?></button>
|
||||
<p class="help-block"><?php echo $this->config->get('upload_maxsize') == '0' ? JText::_('COM_MEDIA_UPLOAD_FILES_NOLIMIT') : JText::sprintf('COM_MEDIA_UPLOAD_FILES', $this->config->get('upload_maxsize')); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<input type="hidden" name="return-url" value="<?php echo base64_encode('index.php?option=com_media&view=images&tmpl=component&fieldid=' . $input->getCmd('fieldid', '') . '&e_name=' . $input->getCmd('e_name') . '&asset=' . $input->getCmd('asset') . '&author=' . $input->getCmd('author')); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* HTML View class for the Media component
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.0
|
||||
*/
|
||||
class MediaViewImages extends JViewLegacy
|
||||
{
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$config = JComponentHelper::getParams('com_media');
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
JHtml::_('behavior.framework', true);
|
||||
JHtml::_('script', 'media/popup-imagemanager.js', true, true);
|
||||
JHtml::_('stylesheet', 'media/popup-imagemanager.css', array(), true);
|
||||
|
||||
if ($lang->isRTL())
|
||||
{
|
||||
JHtml::_('stylesheet', 'media/popup-imagemanager_rtl.css', array(), true);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<?php if (count($this->images) > 0 || count($this->folders) > 0) { ?>
|
||||
<ul class="manager thumbnails">
|
||||
<?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 } ?>
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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 $this->_tmp_folder->path_relative; ?>&asset=<?php echo $input->getCmd('asset');?>&author=<?php echo $input->getCmd('author');?>" target="imageframe">
|
||||
<div class="height-50">
|
||||
<i class="icon-folder-2"></i>
|
||||
</div>
|
||||
<div class="small">
|
||||
<?php echo JHtml::_('string.truncate', $this->_tmp_folder->name, 10, false); ?>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$params = new JRegistry;
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_img, &$params));
|
||||
?>
|
||||
<li class="imgOutline thumbnail height-80 width-80 center">
|
||||
<a class="img-preview" href="javascript:ImageManager.populateFields('<?php echo $this->_tmp_img->path_relative; ?>')" title="<?php echo $this->_tmp_img->name; ?>" >
|
||||
<div class="height-50">
|
||||
<?php echo JHtml::_('image', $this->baseURL . '/' . $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_60, 'height' => $this->_tmp_img->height_60)); ?>
|
||||
</div>
|
||||
<div class="small">
|
||||
<?php echo JHtml::_('string.truncate', $this->_tmp_img->name, 10, false); ?>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_img, &$params));
|
||||
?>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* HTML View class for the Media component
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.0
|
||||
*/
|
||||
class MediaViewImagesList extends JViewLegacy
|
||||
{
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Do not allow cache
|
||||
JResponse::allowCache(false);
|
||||
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true);
|
||||
if ($lang->isRTL()) {
|
||||
JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true);
|
||||
}
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
$document->addScriptDeclaration("var ImageManager = window.parent.ImageManager;");
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
function setFolder($index = 0)
|
||||
{
|
||||
if (isset($this->folders[$index]))
|
||||
{
|
||||
$this->_tmp_folder = &$this->folders[$index];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tmp_folder = new JObject;
|
||||
}
|
||||
}
|
||||
|
||||
function setImage($index = 0)
|
||||
{
|
||||
if (isset($this->images[$index]))
|
||||
{
|
||||
$this->_tmp_img = &$this->images[$index];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tmp_img = new JObject;
|
||||
}
|
||||
}
|
||||
}
|
1
administrator/components/com_media/views/index.html
Normal file
1
administrator/components/com_media/views/index.html
Normal file
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$input = JFactory::getApplication()->input;
|
||||
?>
|
||||
<div class="row-fluid">
|
||||
<!-- Begin Sidebar -->
|
||||
<div class="span2">
|
||||
<div id="treeview">
|
||||
<div id="media-tree_tree" class="sidebar-nav">
|
||||
<?php echo $this->loadTemplate('folders'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.overall-progress,
|
||||
.current-progress {
|
||||
width: 150px;
|
||||
}
|
||||
</style>
|
||||
<!-- End Sidebar -->
|
||||
<!-- Begin Content -->
|
||||
<div 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" class="inputbox" size="70" value="" />
|
||||
|
||||
<label for="password"><?php echo JText::_('JGLOBAL_PASSWORD'); ?></label>
|
||||
<input type="password" id="password" name="password" class="inputbox" 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->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">
|
||||
<fieldset id="upload-noflash" class="actions">
|
||||
<label for="upload-file" class="control-label"><?php echo JText::_('COM_MEDIA_UPLOAD_FILE'); ?></label>
|
||||
<input type="file" id="upload-file" name="Filedata[]" multiple /> <button class="btn btn-primary" id="upload-submit"><i class="icon-upload icon-white"></i> <?php echo JText::_('COM_MEDIA_START_UPLOAD'); ?></button>
|
||||
<p class="help-block"><?php echo $this->config->get('upload_maxsize') == '0' ? JText::_('COM_MEDIA_UPLOAD_FILES_NOLIMIT') : JText::sprintf('COM_MEDIA_UPLOAD_FILES', $this->config->get('upload_maxsize')); ?></p>
|
||||
</fieldset>
|
||||
<input class="update-folder" type="hidden" name="folder" id="folder" value="<?php echo $this->state->folder; ?>" />
|
||||
<input type="hidden" name="return-url" value="<?php echo base64_encode('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 class="inputbox" type="text" id="folderpath" readonly="readonly" />
|
||||
<input class="inputbox" type="text" id="foldername" name="foldername" />
|
||||
<input class="update-folder" type="hidden" name="folderbase" id="folderbase" value="<?php echo $this->state->folder; ?>" />
|
||||
<button type="submit" class="btn"><i class="icon-folder-open"></i> <?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->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>
|
||||
<!-- End Content -->
|
||||
</div>
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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 collapse in" 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; ?>">
|
||||
<i class="icon-folder-2 pull-left" data-toggle="collapse" data-target="#collapseFolder-<?php echo $target; ?>"></i>
|
||||
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo $folder['data']->relative; ?>" target="folderframe">
|
||||
<?php echo $folder['data']->name; ?>
|
||||
</a>
|
||||
<?php echo $this->getFolderLevel($folder); ?>
|
||||
</li>
|
||||
<?php endforeach;
|
||||
endif; ?>
|
||||
</ul>
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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">
|
||||
<a href="#" id="thumbs" onclick="MediaManager.setViewType('thumbs')" class="btn <?php echo ($style == "thumbs") ? 'active' : '';?>">
|
||||
<i class="icon-grid-view-2"></i> <?php echo JText::_('COM_MEDIA_THUMBNAIL_VIEW'); ?></a>
|
||||
<a href="#" id="details" onclick="MediaManager.setViewType('details')" class="btn <?php echo ($style == "details") ? 'active' : '';?>">
|
||||
<i class="icon-list-view"></i> <?php echo JText::_('COM_MEDIA_DETAIL_VIEW'); ?></a>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
159
administrator/components/com_media/views/media/view.html.php
Normal file
159
administrator/components/com_media/views/media/view.html.php
Normal file
@ -0,0 +1,159 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* HTML View class for the Media component
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.0
|
||||
*/
|
||||
class MediaViewMedia extends JViewLegacy
|
||||
{
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$config = JComponentHelper::getParams('com_media');
|
||||
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
$style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
|
||||
|
||||
$document = JFactory::getDocument();
|
||||
|
||||
JHtml::_('behavior.framework', true);
|
||||
|
||||
JHtml::_('script', 'media/mediamanager.js', true, true);
|
||||
/*
|
||||
JHtml::_('stylesheet', 'media/mediamanager.css', array(), true);
|
||||
if ($lang->isRTL()) :
|
||||
JHtml::_('stylesheet', 'media/mediamanager_rtl.css', array(), true);
|
||||
endif;
|
||||
*/
|
||||
JHtml::_('behavior.modal');
|
||||
$document->addScriptDeclaration("
|
||||
window.addEvent('domready', function()
|
||||
{
|
||||
document.preview = SqueezeBox;
|
||||
});");
|
||||
|
||||
// JHtml::_('script', 'system/mootree.js', true, true, false, false);
|
||||
JHtml::_('stylesheet', 'system/mootree.css', array(), true);
|
||||
if ($lang->isRTL()) :
|
||||
JHtml::_('stylesheet', 'media/mootree_rtl.css', array(), true);
|
||||
endif;
|
||||
|
||||
if (DIRECTORY_SEPARATOR == '\\')
|
||||
{
|
||||
$base = str_replace(DIRECTORY_SEPARATOR, "\\\\", COM_MEDIA_BASE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$base = COM_MEDIA_BASE;
|
||||
}
|
||||
|
||||
$js = "
|
||||
var basepath = '".$base."';
|
||||
var viewstyle = '".$style."';
|
||||
";
|
||||
$document->addScriptDeclaration($js);
|
||||
|
||||
/*
|
||||
* 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');
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolbar();
|
||||
|
||||
parent::display($tpl);
|
||||
echo JHtml::_('behavior.keepalive');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the page title and toolbar.
|
||||
*
|
||||
* @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'), 'mediamanager.png');
|
||||
|
||||
// Add a upload button
|
||||
if ($user->authorise('core.create', 'com_media'))
|
||||
{
|
||||
$title = JText::_('JTOOLBAR_UPLOAD');
|
||||
$dhtml = "<button data-toggle=\"collapse\" data-target=\"#collapseUpload\" class=\"btn btn-small btn-success\">
|
||||
<i class=\"icon-plus icon-white\" title=\"$title\"></i>
|
||||
$title</button>";
|
||||
$bar->appendButton('Custom', $dhtml, 'upload');
|
||||
JToolbarHelper::divider();
|
||||
}
|
||||
|
||||
// Add a create folder button
|
||||
if ($user->authorise('core.create', 'com_media'))
|
||||
{
|
||||
$title = JText::_('COM_MEDIA_CREATE_NEW_FOLDER');
|
||||
$dhtml = "<button data-toggle=\"collapse\" data-target=\"#collapseFolder\" class=\"btn btn-small\">
|
||||
<i class=\"icon-folder\" title=\"$title\"></i>
|
||||
$title</button>";
|
||||
$bar->appendButton('Custom', $dhtml, 'folder');
|
||||
JToolbarHelper::divider();
|
||||
}
|
||||
|
||||
// Add a delete button
|
||||
if ($user->authorise('core.delete', 'com_media'))
|
||||
{
|
||||
$title = JText::_('JTOOLBAR_DELETE');
|
||||
$dhtml = "<button onclick=\"MediaManager.submit('folder.delete')\" class=\"btn btn-small\">
|
||||
<i class=\"icon-remove\" title=\"$title\"></i>
|
||||
$title</button>";
|
||||
$bar->appendButton('Custom', $dhtml, 'delete');
|
||||
JToolbarHelper::divider();
|
||||
}
|
||||
// Add a delete button
|
||||
if ($user->authorise('core.admin', 'com_media'))
|
||||
{
|
||||
JToolbarHelper::preferences('com_media');
|
||||
JToolbarHelper::divider();
|
||||
}
|
||||
JToolbarHelper::help('JHELP_CONTENT_MEDIA_MANAGER');
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
$user = JFactory::getUser();
|
||||
?>
|
||||
<form target="_parent" action="index.php?option=com_media&tmpl=index&folder=<?php echo $this->state->folder; ?>" method="post" id="mediamanager-form" name="mediamanager-form">
|
||||
<div class="manager">
|
||||
<table class="table table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<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 ($user->authorise('core.delete', 'com_media')):?>
|
||||
<th width="8%"><?php echo JText::_('JACTION_DELETE'); ?></th>
|
||||
<?php endif;?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php echo $this->loadTemplate('up'); ?>
|
||||
|
||||
<?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->documents); $i < $n; $i++) :
|
||||
$this->setDoc($i);
|
||||
echo $this->loadTemplate('doc');
|
||||
endfor; ?>
|
||||
|
||||
<?php for ($i = 0, $n = count($this->images); $i < $n; $i++) :
|
||||
$this->setImage($i);
|
||||
echo $this->loadTemplate('img');
|
||||
endfor; ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="hidden" name="task" value="list" />
|
||||
<input type="hidden" name="username" value="" />
|
||||
<input type="hidden" name="password" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</div>
|
||||
</form>
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$params = new JRegistry;
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_doc, &$params));
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a title="<?php echo $this->_tmp_doc->name; ?>">
|
||||
<?php echo JHtml::_('image', $this->_tmp_doc->icon_16, $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->_tmp_doc->title, array('width' => 16, 'height' => 16), true);?> </a>
|
||||
</td>
|
||||
<td class="description" title="<?php echo $this->_tmp_doc->name; ?>">
|
||||
<?php echo $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 $this->state->folder; ?>&rm[]=<?php echo $this->_tmp_doc->name; ?>" rel="<?php echo $this->_tmp_doc->name; ?>"><i class="icon-remove hasTooltip" title="<?php echo JHtml::tooltipText('JACTION_DELETE');?>"></i></a>
|
||||
<input type="checkbox" name="rm[]" value="<?php echo $this->_tmp_doc->name; ?>" />
|
||||
</td>
|
||||
<?php endif;?>
|
||||
</tr>
|
||||
<?php
|
||||
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_doc, &$params));
|
||||
?>
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @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 $this->_tmp_folder->path_relative; ?>" target="folderframe">
|
||||
<i class="icon-folder-2"></i></a>
|
||||
</td>
|
||||
<td class="description">
|
||||
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo $this->_tmp_folder->path_relative; ?>" target="folderframe"><?php echo $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 $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; ?>"><i class="icon-remove hasTooltip" title="<?php echo JHtml::tooltipText('JACTION_DELETE');?>"></i></a>
|
||||
<input type="checkbox" name="rm[]" value="<?php echo $this->_tmp_folder->name; ?>" />
|
||||
</td>
|
||||
<?php endif;?>
|
||||
</tr>
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
JHtml::_('bootstrap.tooltip');
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$params = new JRegistry;
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_img, &$params));
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="img-preview" href="<?php echo COM_MEDIA_BASEURL.'/'.$this->_tmp_img->path_relative; ?>" title="<?php echo $this->_tmp_img->name; ?>"><?php echo JHtml::_('image', COM_MEDIA_BASEURL.'/'.$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.'/'.$this->_tmp_img->path_relative; ?>" title="<?php echo $this->_tmp_img->name; ?>" rel="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 $this->state->folder; ?>&rm[]=<?php echo $this->_tmp_img->name; ?>" rel="<?php echo $this->_tmp_img->name; ?>"><i class="icon-remove hasTooltip" title="<?php echo JHtml::tooltipText('JACTION_DELETE');?>"></i></a>
|
||||
<input type="checkbox" name="rm[]" value="<?php echo $this->_tmp_img->name; ?>" />
|
||||
</td>
|
||||
<?php endif;?>
|
||||
</tr>
|
||||
<?php
|
||||
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_img, &$params));
|
||||
?>
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$user = JFactory::getUser();
|
||||
?>
|
||||
<tr>
|
||||
<td class="imgTotal">
|
||||
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo $this->state->parent; ?>" target="folderframe">
|
||||
<i class="icon-arrow-up"></i></a>
|
||||
</td>
|
||||
<td class="description">
|
||||
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo $this->state->parent; ?>" target="folderframe">..</a>
|
||||
</td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<?php if ($user->authorise('core.delete', 'com_media')):?>
|
||||
<td> </td>
|
||||
<?php endif;?>
|
||||
</tr>
|
@ -0,0 +1 @@
|
||||
<!DOCTYPE html><title></title>
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<form target="_parent" action="index.php?option=com_media&tmpl=index&folder=<?php echo $this->state->folder; ?>" method="post" id="mediamanager-form" name="mediamanager-form">
|
||||
<ul class="manager thumbnails">
|
||||
<?php
|
||||
echo $this->loadTemplate('up');
|
||||
?>
|
||||
|
||||
<?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->documents); $i < $n; $i++) :
|
||||
$this->setDoc($i);
|
||||
echo $this->loadTemplate('doc');
|
||||
endfor; ?>
|
||||
|
||||
<?php for ($i = 0, $n = count($this->images); $i < $n; $i++) :
|
||||
$this->setImage($i);
|
||||
echo $this->loadTemplate('img');
|
||||
endfor; ?>
|
||||
|
||||
<input type="hidden" name="task" value="" />
|
||||
<input type="hidden" name="username" value="" />
|
||||
<input type="hidden" name="password" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</ul>
|
||||
</form>
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
$user = JFactory::getUser();
|
||||
$params = new JRegistry;
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_doc, &$params));
|
||||
?>
|
||||
<li class="imgOutline thumbnail height-80 width-80 center">
|
||||
<?php if ($user->authorise('core.delete', 'com_media')):?>
|
||||
<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 $this->state->folder; ?>&rm[]=<?php echo $this->_tmp_doc->name; ?>" rel="<?php echo $this->_tmp_doc->name; ?>" title="<?php echo JText::_('JACTION_DELETE');?>">x</a>
|
||||
<input class="pull-left" type="checkbox" name="rm[]" value="<?php echo $this->_tmp_doc->name; ?>" />
|
||||
<div class="clearfix"></div>
|
||||
<?php endif;?>
|
||||
<div class="height-50">
|
||||
<a style="display: block; width: 100%; height: 100%" title="<?php echo $this->_tmp_doc->name; ?>" >
|
||||
<?php echo JHtml::_('image', $this->_tmp_doc->icon_32, $this->_tmp_doc->name, null, true, true) ? JHtml::_('image', $this->_tmp_doc->icon_32, $this->_tmp_doc->title, null, true) : JHtml::_('image', 'media/con_info.png', $this->_tmp_doc->name, null, true); ?></a>
|
||||
</div>
|
||||
<div class="small" title="<?php echo $this->_tmp_doc->name; ?>" >
|
||||
<?php echo JHtml::_('string.truncate', $this->_tmp_doc->name, 10, false); ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_doc, &$params));
|
||||
?>
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
$user = JFactory::getUser();
|
||||
?>
|
||||
<li class="imgOutline thumbnail height-80 width-80 center">
|
||||
<?php if ($user->authorise('core.delete', 'com_media')):?>
|
||||
<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 $this->state->folder; ?>&rm[]=<?php echo $this->_tmp_folder->name; ?>" rel="<?php echo $this->_tmp_folder->name; ?> :: <?php echo $this->_tmp_folder->files + $this->_tmp_folder->folders; ?>" title="<?php echo JText::_('JACTION_DELETE');?>">x</a>
|
||||
<input class="pull-left" type="checkbox" name="rm[]" value="<?php echo $this->_tmp_folder->name; ?>" />
|
||||
<div class="clearfix"></div>
|
||||
<?php endif;?>
|
||||
<div class="height-50">
|
||||
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo $this->_tmp_folder->path_relative; ?>" target="folderframe">
|
||||
<i class="icon-folder-2"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="small">
|
||||
<a href="index.php?option=com_media&view=mediaList&tmpl=component&folder=<?php echo $this->_tmp_folder->path_relative; ?>" target="folderframe"><?php echo JHtml::_('string.truncate', $this->_tmp_folder->name, 10, false); ?></a>
|
||||
</div>
|
||||
</li>
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
$user = JFactory::getUser();
|
||||
$params = new JRegistry;
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_img, &$params));
|
||||
?>
|
||||
<li class="imgOutline thumbnail height-80 width-80 center">
|
||||
<?php if ($user->authorise('core.delete', 'com_media')):?>
|
||||
<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 $this->state->folder; ?>&rm[]=<?php echo $this->_tmp_img->name; ?>" rel="<?php echo $this->_tmp_img->name; ?>" title="<?php echo JText::_('JACTION_DELETE');?>">x</a>
|
||||
<input class="pull-left" type="checkbox" name="rm[]" value="<?php echo $this->_tmp_img->name; ?>" />
|
||||
<div class="clearfix"></div>
|
||||
<?php endif;?>
|
||||
<div class="height-50">
|
||||
<a class="img-preview" href="<?php echo COM_MEDIA_BASEURL.'/'.$this->_tmp_img->path_relative; ?>" title="<?php echo $this->_tmp_img->name; ?>" >
|
||||
<?php echo JHtml::_('image', COM_MEDIA_BASEURL.'/'.$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_60, 'height' => $this->_tmp_img->height_60)); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="small">
|
||||
<a href="<?php echo COM_MEDIA_BASEURL.'/'.$this->_tmp_img->path_relative; ?>" title="<?php echo $this->_tmp_img->name; ?>" class="preview"><?php echo JHtml::_('string.truncate', $this->_tmp_img->name, 10, false); ?></a>
|
||||
</div>
|
||||
</li>
|
||||
<?php
|
||||
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_img, &$params));
|
||||
?>
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<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 $this->state->parent; ?>" target="folderframe">
|
||||
<i class="icon-arrow-up"></i></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 $this->state->parent; ?>" target="folderframe">..</a>
|
||||
</div>
|
||||
</li>
|
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* HTML View class for the Media component
|
||||
*
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_media
|
||||
* @since 1.0
|
||||
*/
|
||||
class MediaViewMediaList extends JViewLegacy
|
||||
{
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Do not allow cache
|
||||
JResponse::allowCache(false);
|
||||
|
||||
JHtml::_('behavior.framework', true);
|
||||
|
||||
JFactory::getDocument()->addScriptDeclaration("
|
||||
window.addEvent('domready', function()
|
||||
{
|
||||
window.parent.document.updateUploader();
|
||||
$$('a.img-preview').each(function(el)
|
||||
{
|
||||
el.addEvent('click', function(e)
|
||||
{
|
||||
window.top.document.preview.fromElement(el);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
});");
|
||||
|
||||
$images = $this->get('images');
|
||||
$documents = $this->get('documents');
|
||||
$folders = $this->get('folders');
|
||||
$state = $this->get('state');
|
||||
|
||||
$this->baseURL = JUri::root();
|
||||
$this->images = &$images;
|
||||
$this->documents = &$documents;
|
||||
$this->folders = &$folders;
|
||||
$this->state = &$state;
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
function setFolder($index = 0)
|
||||
{
|
||||
if (isset($this->folders[$index]))
|
||||
{
|
||||
$this->_tmp_folder = &$this->folders[$index];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tmp_folder = new JObject;
|
||||
}
|
||||
}
|
||||
|
||||
function setImage($index = 0)
|
||||
{
|
||||
if (isset($this->images[$index]))
|
||||
{
|
||||
$this->_tmp_img = &$this->images[$index];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tmp_img = new JObject;
|
||||
}
|
||||
}
|
||||
|
||||
function setDoc($index = 0)
|
||||
{
|
||||
if (isset($this->documents[$index]))
|
||||
{
|
||||
$this->_tmp_doc = &$this->documents[$index];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tmp_doc = new JObject;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user