| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/media.php.tar |
home/wuectly/www/plugins/fields/media/media.php 0000604 00000002014 15245535616 0015617 0 ustar 00 <?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Media
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);
/**
* Fields Media Plugin
*
* @since 3.7.0
*/
class PlgFieldsMedia extends FieldsPlugin
{
/**
* Transforms the field into a DOM XML element and appends it as a child on the given parent.
*
* @param stdClass $field The field.
* @param DOMElement $parent The field node parent.
* @param JForm $form The form.
*
* @return DOMElement
*
* @since 3.7.0
*/
public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
{
$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);
if (!$fieldNode)
{
return $fieldNode;
}
$fieldNode->setAttribute('hide_default', 'true');
return $fieldNode;
}
}
home/wuectly/www/plugins/fields/media/tmpl/media.php 0000604 00000001230 15245556140 0016565 0 ustar 00 <?php
/**
* @package Joomla.Plugin
* @subpackage Fields.Media
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if ($field->value == '')
{
return;
}
$class = $fieldParams->get('image_class');
if ($class)
{
$class = ' class="' . htmlentities($class, ENT_COMPAT, 'UTF-8', true) . '"';
}
$value = (array) $field->value;
$buffer = '';
foreach ($value as $path)
{
if (!$path)
{
continue;
}
$buffer .= sprintf('<img src="%s"%s>',
htmlentities($path, ENT_COMPAT, 'UTF-8', true),
$class
);
}
echo $buffer;
home/wuectly/www/components/com_media/media.php 0000604 00000001160 15245561125 0015706 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage com_media
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Load the com_media language files, default to the admin file and fall back to site if one isn't found
$lang = JFactory::getLanguage();
$lang->load('com_media', JPATH_ADMINISTRATOR, null, false, true)
|| $lang->load('com_media', JPATH_SITE, null, false, true);
// Hand processing over to the admin base file
require_once JPATH_COMPONENT_ADMINISTRATOR . '/media.php';
home/wuectly/www/administrator/components/com_media/media.php 0000604 00000003240 15245571353 0020573 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$input = JFactory::getApplication()->input;
$user = JFactory::getUser();
$asset = $input->get('asset');
$author = $input->get('author');
// Access check.
if (!$user->authorise('core.manage', 'com_media') && (!$asset || (!$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))))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
$params = JComponentHelper::getParams('com_media');
// Load the helper class
JLoader::register('MediaHelper', JPATH_ADMINISTRATOR . '/components/com_media/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';
}
$mediaBaseDir = JPATH_ROOT . '/' . $params->get($path, 'images');
if (!is_dir($mediaBaseDir))
{
throw new \InvalidArgumentException(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 500);
}
define('COM_MEDIA_BASE', $mediaBaseDir);
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();
home/wuectly/www/libraries/fof/form/field/media.php 0000604 00000006131 15245607132 0016362 0 ustar 00 <?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @note This file has been modified by the Joomla! Project and no longer reflects the original work of its author.
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
JFormHelper::loadFieldClass('media');
/**
* Form Field class for the FOF framework
* Media selection field.
*
* @package FrameworkOnFramework
* @since 2.0
*/
class FOFFormFieldMedia extends JFormFieldMedia implements FOFFormField
{
protected $static;
protected $repeatable;
/** @var FOFTable The item being rendered in a repeatable form field */
public $item;
/** @var int A monotonically increasing number, denoting the row number in a repeatable view */
public $rowid;
/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to the the value.
*
* @return mixed The property value or null.
*
* @since 2.0
*/
public function __get($name)
{
switch ($name)
{
case 'static':
if (empty($this->static))
{
$this->static = $this->getStatic();
}
return $this->static;
break;
case 'repeatable':
if (empty($this->repeatable))
{
$this->repeatable = $this->getRepeatable();
}
return $this->repeatable;
break;
default:
return parent::__get($name);
}
}
/**
* Get the rendering of this field type for static display, e.g. in a single
* item view (typically a "read" task).
*
* @since 2.0
*
* @return string The field HTML
*/
public function getStatic()
{
$imgattr = array(
'id' => $this->id
);
if ($this->element['class'])
{
$imgattr['class'] = (string) $this->element['class'];
}
if ($this->element['style'])
{
$imgattr['style'] = (string) $this->element['style'];
}
if ($this->element['width'])
{
$imgattr['width'] = (string) $this->element['width'];
}
if ($this->element['height'])
{
$imgattr['height'] = (string) $this->element['height'];
}
if ($this->element['align'])
{
$imgattr['align'] = (string) $this->element['align'];
}
if ($this->element['rel'])
{
$imgattr['rel'] = (string) $this->element['rel'];
}
if ($this->element['alt'])
{
$alt = JText::_((string) $this->element['alt']);
}
else
{
$alt = null;
}
if ($this->element['title'])
{
$imgattr['title'] = JText::_((string) $this->element['title']);
}
if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value))
{
$src = FOFPlatform::getInstance()->URIroot() . $this->value;
}
else
{
$src = '';
}
return JHtml::_('image', $src, $alt, $imgattr);
}
/**
* Get the rendering of this field type for a repeatable (grid) display,
* e.g. in a view listing many item (typically a "browse" task)
*
* @since 2.0
*
* @return string The field HTML
*/
public function getRepeatable()
{
return $this->getStatic();
}
}
home/wuectly/www/administrator/components/com_media/helpers/media.php 0000604 00000011733 15245654257 0022250 0 ustar 00 <?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Object\CMSObject;
/**
* Media helper class.
*
* @since 1.6
* @deprecated 4.0 Use JHelperMedia instead
*/
abstract class MediaHelper
{
/**
* Checks if the file is an image
*
* @param string $fileName The filename
*
* @return boolean
*
* @since 1.5
* @deprecated 4.0 Use JHelperMedia::isImage instead
*/
public static function isImage($fileName)
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::isImage() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->isImage($fileName);
}
/**
* Gets the file extension for the purpose of using an icon.
*
* @param string $fileName The filename
*
* @return string File extension
*
* @since 1.5
* @deprecated 4.0 Use JHelperMedia::getTypeIcon instead
*/
public static function getTypeIcon($fileName)
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::getTypeIcon() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->getTypeIcon($fileName);
}
/**
* Checks if the file can be uploaded
*
* @param array $file File information
* @param string $error An error message to be returned
*
* @return boolean
*
* @since 1.5
* @deprecated 4.0 Use JHelperMedia::canUpload instead
*/
public static function canUpload($file, $error = '')
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::canUpload() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->canUpload($file, 'com_media');
}
/**
* Method to parse a file size
*
* @param integer $size The file size in bytes
*
* @return string The converted file size
*
* @since 1.6
* @deprecated 4.0 Use JHtml::_('number.bytes') instead
*/
public static function parseSize($size)
{
try
{
JLog::add(
sprintf("%s() is deprecated. Use JHtml::_('number.bytes') instead.", __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
return JHtml::_('number.bytes', $size);
}
/**
* Calculate the size of a resized image
*
* @param integer $width Image width
* @param integer $height Image height
* @param integer $target Target size
*
* @return array The new width and height
*
* @since 3.2
* @deprecated 4.0 Use JHelperMedia::imageResize instead
*/
public static function imageResize($width, $height, $target)
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::imageResize() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->imageResize($width, $height, $target);
}
/**
* Counts the files and directories in a directory that are not php or html files.
*
* @param string $dir Directory name
*
* @return array The number of files and directories in the given directory
*
* @since 1.5
* @deprecated 4.0 Use JHelperMedia::countFiles instead
*/
public static function countFiles($dir)
{
try
{
JLog::add(
sprintf('%s() is deprecated. Use JHelperMedia::countFiles() instead.', __METHOD__),
JLog::WARNING,
'deprecated'
);
}
catch (RuntimeException $exception)
{
// Informational log only
}
$mediaHelper = new JHelperMedia;
return $mediaHelper->countFiles($dir);
}
/**
* Generates the URL to the object in the action logs component
*
* @param string $contentType The content type
* @param integer $id The integer id
* @param CMSObject $mediaObject The media object being uploaded
*
* @return string The link for the action log
*
* @since 3.9.27
*/
public static function getContentTypeLink($contentType, $id, CMSObject $mediaObject)
{
if ($contentType === 'com_media.file')
{
return '';
}
$link = 'index.php?option=com_media&view=media';
$uploadedPath = substr($mediaObject->get('filepath'), strlen(COM_MEDIA_BASE) + 1);
// Now remove the filename
$uploadedBasePath = substr_replace(
$uploadedPath,
'',
(strlen(DIRECTORY_SEPARATOR . $mediaObject->get('name')) * -1)
);
if (!empty($uploadedBasePath))
{
$link = $link . '&folder=' . $uploadedBasePath;
}
return $link;
}
}
home/wuectly/www/layouts/joomla/form/field/media.php 0000604 00000014010 15245673050 0016612 0 ustar 00 <?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Layout variables
* -----------------
* @var string $autocomplete Autocomplete attribute for the field.
* @var boolean $autofocus Is autofocus enabled?
* @var string $class Classes for the input.
* @var string $description Description of the field.
* @var boolean $disabled Is this field disabled?
* @var string $group Group the field belongs to. <fields> section in form XML.
* @var boolean $hidden Is this field hidden in the form?
* @var string $hint Placeholder for the field.
* @var string $id DOM id of the field.
* @var string $label Label of the field.
* @var string $labelclass Classes to apply to the label.
* @var boolean $multiple Does this field support multiple values?
* @var string $name Name of the input field.
* @var string $onchange Onchange attribute for the field.
* @var string $onclick Onclick attribute for the field.
* @var string $pattern Pattern (Reg Ex) of value of the form field.
* @var boolean $readonly Is this field read only?
* @var boolean $repeat Allows extensions to duplicate elements.
* @var boolean $required Is this field required?
* @var integer $size Size attribute of the input.
* @var boolean $spellcheck Spellcheck state for the form field.
* @var string $validate Validation rules to apply.
* @var string $value Value attribute of the field.
* @var array $checkedOptions Options that will be set as checked.
* @var boolean $hasValue Has this field a value assigned?
* @var array $options Options available for this field.
*
* @var string $preview The preview image relative path
* @var integer $previewHeight The image preview height
* @var integer $previewWidth The image preview width
* @var string $asset The asset text
* @var string $authorField The label text
* @var string $folder The folder text
* @var string $link The link text
*/
extract($displayData);
// Load the modal behavior script.
JHtml::_('behavior.modal');
// Include jQuery
JHtml::_('jquery.framework');
JHtml::_('script', 'media/mediafield-mootools.min.js', array('version' => 'auto', 'relative' => true, 'framework' => true));
// Tooltip for INPUT showing whole image path
$options = array(
'onShow' => 'jMediaRefreshImgpathTip',
);
JHtml::_('behavior.tooltip', '.hasTipImgpath', $options);
if (!empty($class))
{
$class .= ' hasTipImgpath';
}
else
{
$class = 'hasTipImgpath';
}
$attr = '';
$attr .= ' title="' . htmlspecialchars('<span id="TipImgpath"></span>', ENT_COMPAT, 'UTF-8') . '"';
// Initialize some field attributes.
$attr .= !empty($class) ? ' class="input-small field-media-input ' . $class . '"' : ' class="input-small"';
$attr .= !empty($size) ? ' size="' . $size . '"' : '';
// Initialize JavaScript field attributes.
$attr .= !empty($onchange) ? ' onchange="' . $onchange . '"' : '';
// The text field.
echo '<div class="input-prepend input-append">';
// The Preview.
$showPreview = true;
$showAsTooltip = false;
switch ($preview)
{
case 'no': // Deprecated parameter value
case 'false':
case 'none':
$showPreview = false;
break;
case 'yes': // Deprecated parameter value
case 'true':
case 'show':
break;
case 'tooltip':
default:
$showAsTooltip = true;
$options = array(
'onShow' => 'jMediaRefreshPreviewTip',
);
JHtml::_('behavior.tooltip', '.hasTipPreview', $options);
break;
}
// Pre fill the contents of the popover
if ($showPreview)
{
if ($value && file_exists(JPATH_ROOT . '/' . $value))
{
$src = JUri::root() . $value;
}
else
{
$src = '';
}
$width = $previewWidth;
$height = $previewHeight;
$style = '';
$style .= ($width > 0) ? 'max-width:' . $width . 'px;' : '';
$style .= ($height > 0) ? 'max-height:' . $height . 'px;' : '';
$imgattr = array(
'id' => $id . '_preview',
'class' => 'media-preview',
'style' => $style,
);
$img = JHtml::_('image', $src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgattr);
$previewImg = '<div id="' . $id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>';
$previewImgEmpty = '<div id="' . $id . '_preview_empty"' . ($src ? ' style="display:none"' : '') . '>'
. JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>';
if ($showAsTooltip)
{
echo '<div class="media-preview add-on">';
$tooltip = $previewImgEmpty . $previewImg;
$options = array(
'title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'),
'text' => '<span class="icon-eye" aria-hidden="true"></span>',
'class' => 'hasTipPreview'
);
echo JHtml::_('tooltip', $tooltip, $options);
echo '</div>';
}
else
{
echo '<div class="media-preview add-on" style="height:auto">';
echo ' ' . $previewImgEmpty;
echo ' ' . $previewImg;
echo '</div>';
}
}
echo ' <input type="text" name="' . $name . '" id="' . $id . '" value="'
. htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly"' . $attr . ' data-basepath="'
. JUri::root() . '"/>';
?>
<a class="modal btn" title="<?php echo JText::_('JLIB_FORM_BUTTON_SELECT'); ?>" href="
<?php echo ($readonly ? ''
: ($link ?: 'index.php?option=com_media&view=images&tmpl=component&asset=' . $asset . '&author='
. $authorField) . '&fieldid=' . $id . '&folder=' . $folder) . '"'
. ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}"'; ?>>
<?php echo JText::_('JLIB_FORM_BUTTON_SELECT'); ?></a><a class="btn hasTooltip" title="<?php echo JText::_('JLIB_FORM_BUTTON_CLEAR'); ?>" href="#" onclick="jInsertFieldValue('', '<?php echo $id; ?>'); return false;">
<span class="icon-remove" aria-hidden="true"></span></a>
</div>