primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,42 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
defined('_JEXEC') or die('Restricted access');
/** Load the default controller */
require_once( JPATH_COMPONENT.'/controller.php' );
// Check for requests for named controller
$controller = JRequest::getWord('controller', False);
if ( $controller ) {
// Invoke the named controller, if it exists
$path = JPATH_COMPONENT.'/controllers/'.$controller.'.php';
$controller = JString::ucfirst($controller);
jimport('joomla.filesystem.file');
if ( JFile::exists($path) ) {
require_once( $path );
$classname = 'AttachmentsController' . $controller;
}
else {
$errmsg = JText::_('ATTACH_UNKNOWN_CONTROLLER') . ' (ERR 48)';
JError::raiseError(500, $errmsg);
}
}
else {
$classname = 'AttachmentsController';
}
// Invoke the requested function of the controller
$controller = new $classname( array('default_task' => 'noop') );
$controller->execute( JRequest::getCmd('task') );
$controller->redirect();

View File

@ -0,0 +1,806 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
defined('_JEXEC') or die('Restricted access');
/** Load the Attachements defines */
require_once(JPATH_SITE.'/components/com_attachments/defines.php');
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/legacy/controller.php');
/** Load the attachments helper */
require_once(JPATH_SITE.'/components/com_attachments/helper.php');
require_once(JPATH_SITE.'/components/com_attachments/javascript.php');
/**
* The main attachments controller class (for the front end)
*
* @package Attachments
*/
class AttachmentsController extends JControllerLegacy
{
/**
* Constructor
*
* @param array $default : An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
*/
public function __construct( $default = array() )
{
parent::__construct( $default );
}
/**
* A noop function so this controller does not have a usable default
*/
public function noop()
{
$errmsg = JText::_('ATTACH_ERROR_NO_FUNCTION_SPECIFIED') . ' (ERR 0)';
JError::raiseError(500, $errmsg);
}
/**
* Method to get a model object, loading it if required.
*
* @param string The model name. Optional.
* @param string The class prefix. Optional.
* @param array Configuration array for model. Optional.
* @return object The model.
*/
public function getModel($name = 'Attachments', $prefix = 'AttachmentModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
/**
* Display a form for uploading a file/url
*/
public function upload()
{
// Access check.
if (!JFactory::getUser()->authorise('core.create', 'com_attachments')) {
return JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR') . ' (ERR 1)');
}
// Get the parent info
$parent_entity = 'default';
if ( JRequest::getString('article_id') ) {
$pid_info = explode(',', JRequest::getString('article_id'));
$parent_type = 'com_content';
}
else {
$pid_info = explode(',', JRequest::getString('parent_id'));
// Be extra cautious and remove all non-cmd characters except for ':'
$parent_type = preg_replace('/[^A-Z0-9_\.:-]/i', '', JRequest::getString('parent_type', 'com_content'));
// If the entity is embedded in the parent type, split them
if ( strpos($parent_type, '.') ) {
$parts = explode('.', $parent_type);
$parent_type = $parts[0];
$parent_entity = $parts[1];
}
if ( strpos($parent_type, ':') ) {
$parts = explode(':', $parent_type);
$parent_type = $parts[0];
$parent_entity = $parts[1];
}
}
// Get the parent id
$parent_id = null;
if ( is_numeric($pid_info[0]) ) {
$parent_id = (int)$pid_info[0];
}
// See if the parent is new (or already exists)
$new_parent = false;
if ( count($pid_info) > 1 ) {
if ( $pid_info[1] == 'new' ) {
$new_parent = true;
}
}
// Get the article/parent handler
JPluginHelper::importPlugin('attachments');
$apm = getAttachmentsPluginManager();
if ( !$apm->attachmentsPluginInstalled($parent_type) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_PARENT_TYPE_S', $parent_type) . ' (ERR 2)';
JError::raiseError(500, $errmsg);
}
$parent = $apm->getAttachmentsPlugin($parent_type);
$parent_entity = $parent->getCanonicalEntityId($parent_entity);
$parent_entity_name = JText::_('ATTACH_' . $parent_entity);
// Make sure this user can add attachments to this parent
$user = JFactory::getUser();
if ( !$parent->userMayAddAttachment($parent_id, $parent_entity, $new_parent) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_NO_PERMISSION_TO_UPLOAD_S', $parent_entity_name) . ' (ERR 3)';
JError::raiseError(500, $errmsg);
}
// Get the title of the parent
$parent_title = '';
if ( !$new_parent ) {
$parent_title = $parent->getTitle($parent_id, $parent_entity);
}
// Use a different template for the iframe view
$from = JRequest::getWord('from');
$Itemid = JRequest::getInt('Itemid', 1);
if ( $from == 'closeme') {
JRequest::setVar('tmpl', 'component');
}
// Get the component parameters
jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams('com_attachments');
// Make sure the attachments directory exists
$upload_dir = JPATH_BASE.'/'.AttachmentsDefines::$ATTACHMENTS_SUBDIR;
$secure = $params->get('secure', false);
if ( !AttachmentsHelper::setup_upload_directory( $upload_dir, $secure ) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_UNABLE_TO_SETUP_UPLOAD_DIR_S', $upload_dir) . ' (ERR 4)';
JError::raiseError(500, $errmsg);
}
// Determine the type of upload
$default_uri_type = 'file';
$uri_type = JRequest::getWord('uri', $default_uri_type);
if ( !in_array( $uri_type, AttachmentsDefines::$LEGAL_URI_TYPES ) ) {
// Make sure only legal values are entered
$uri_type = 'file';
}
// Set up the view to redisplay the form with warnings
require_once(JPATH_COMPONENT_SITE.'/views/upload/view.html.php');
$view = new AttachmentsViewUpload();
// Set up the view
if ( $new_parent ) {
$parent_id_str = (string)$parent_id . ",new";
}
else {
$parent_id_str = (string)$parent_id;
}
AttachmentsHelper::add_view_urls($view, 'upload', $parent_id_str, $parent_type, null, $from);
// We do not have a real attachment yet so fake it
$attachment = new JObject();
// Set up the defaults
$attachment->uri_type = $uri_type;
$attachment->state = $params->get('publish_default', false);
$attachment->url = '';
$attachment->url_relative = false;
$attachment->url_verify = true;
$attachment->display_name = '';
$attachment->description = '';
$attachment->user_field_1 = '';
$attachment->user_field_2 = '';
$attachment->user_field_3 = '';
$attachment->parent_id = $parent_id;
$attachment->parent_type = $parent_type;
$attachment->parent_entity = $parent_entity;
$attachment->parent_title = $parent_title;
$view->attachment = $attachment;
$view->parent = $parent;
$view->new_parent = $new_parent;
$view->Itemid = $Itemid;
$view->from = $from;
$view->params = $params;
$view->error = false;
$view->error_msg = false;
// Display the upload form
$view->display();
}
/**
* Save a new or edited attachment
*/
public function save()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// Make sure that the user is logged in
$user = JFactory::getUser();
// Get the parameters
jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams('com_attachments');
// Get the article/parent handler
$new_parent = JRequest::getBool('new_parent', false);
$parent_type = JRequest::getCmd('parent_type', 'com_content');
$parent_entity = JRequest::getCmd('parent_entity', 'default');
JPluginHelper::importPlugin('attachments');
$apm = getAttachmentsPluginManager();
if ( !$apm->attachmentsPluginInstalled($parent_type) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_PARENT_TYPE_S', $parent_type) . ' (ERR 5)';
JError::raiseError(500, $errmsg);
}
$parent = $apm->getAttachmentsPlugin($parent_type);
$parent_entity = $parent->getCanonicalEntityId($parent_entity);
$parent_entity_name = JText::_('ATTACH_' . $parent_entity);
// Make sure we have a valid parent ID
$parent_id = JRequest::getInt('parent_id', -1);
if ( !$new_parent && (($parent_id == 0) ||
($parent_id == -1) ||
!$parent->parentExists($parent_id, $parent_entity)) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_PARENT_S_ID_N',
$parent_entity_name , $parent_id) . ' (ERR 6)';
JError::raiseError(500, $errmsg);
}
// Verify that this user may add attachments to this parent
if ( !$parent->userMayAddAttachment($parent_id, $parent_entity, $new_parent) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_NO_PERMISSION_TO_UPLOAD_S', $parent_entity_name) . ' (ERR 7)';
JError::raiseError(500, $errmsg);
}
// Get the Itemid
$Itemid = JRequest::getInt('Itemid', 1);
// How to redirect?
$from = JRequest::getWord('from', 'closeme');
$uri = JFactory::getURI();
$base_url = $uri->base(false);
if ( $from ) {
if ( $from == 'frontpage' ) {
$redirect_to = $uri->root(true);
}
elseif ( $from == 'article' ) {
$redirect_to = JRoute::_($base_url . "index.php?option=com_content&view=article&id=$parent_id", False);
}
else {
$redirect_to = $uri->root(true);
}
}
else {
$redirect_to = $uri->root(true);
}
// See if we should cancel
if ( $_POST['submit'] == JText::_('ATTACH_CANCEL') ) {
$msg = JText::_('ATTACH_UPLOAD_CANCELED');
$this->setRedirect( $redirect_to, $msg );
return;
}
// Figure out if we are uploading or updating
$save_type = JString::strtolower(JRequest::getWord('save_type'));
if ( !in_array($save_type, AttachmentsDefines::$LEGAL_SAVE_TYPES) ) {
$errmsg = JText::_('ATTACH_ERROR_INVALID_SAVE_PARAMETERS') . ' (ERR 8)';
JError::raiseError(500, $errmsg);
}
// If this is an update, get the attachment id
$attachment_id = false;
if ( $save_type == 'update' ) {
$attachment_id = JRequest::getInt('id');
}
// Bind the info from the form
JTable::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_attachments/tables');
$attachment = JTable::getInstance('Attachment', 'AttachmentsTable');
if ( $attachment_id && !$attachment->load($attachment_id) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_CANNOT_UPDATE_ATTACHMENT_INVALID_ID_N', $id) . ' (ERR 9)';
JError::raiseError(500, $errmsg);
}
if (!$attachment->bind(JRequest::get('post'))) {
$errmsg = $attachment->getError() . ' (ERR 10)';
JError::raiseError(500, $errmsg);
}
// Note what the old uri type is, if updating
$old_uri_type = null;
if ( $save_type == 'update' ) {
$old_uri_type = $attachment->uri_type;
}
// Figure out what the new URI is
if ( $save_type == 'upload' ) {
// See if we are uploading a file or URL
$new_uri_type = JRequest::getWord('uri_type');
if ( $new_uri_type && !in_array( $new_uri_type, AttachmentsDefines::$LEGAL_URI_TYPES ) ) {
// Make sure only legal values are entered
$new_uri_type = '';
}
// Fix the access level
if ( !$params->get('allow_frontend_access_editing', false) ) {
$attachment->access = $params->get('default_access_level', AttachmentsDefines::$DEFAULT_ACCESS_LEVEL_ID);
}
}
elseif ( $save_type == 'update' ) {
// See if we are updating a file or URL
$new_uri_type = JRequest::getWord('update');
if ( $new_uri_type && !in_array( $new_uri_type, AttachmentsDefines::$LEGAL_URI_TYPES ) ) {
// Make sure only legal values are entered
$new_uri_type = '';
}
// Since URLs can be edited, we always evaluate them from scratch
if ( ($new_uri_type == '') && ($old_uri_type == 'url') ) {
$new_uri_type = 'url';
}
// Double-check to see if the URL changed
$old_url = JRequest::getString('old_url');
if ( !$new_uri_type && $old_url && ($old_url != $attachment->url) ) {
$new_uri_type = 'url';
}
}
// Get more info about the type of upload/update
$verify_url = false;
$relative_url = false;
if ( $new_uri_type == 'url' ) {
if ( JRequest::getWord('verify_url') == 'verify' ) {
$verify_url = true;
}
if ( JRequest::getWord('relative_url') == 'relative' ) {
$relative_url = true;
}
}
// Handle the various ways this function might get invoked
if ( $save_type == 'upload' ) {
$attachment->created_by = $user->get('id');
$attachment->parent_id = $parent_id;
}
// Update the modified info
$now = JFactory::getDate();
$attachment->modified_by = $user->get('id');
$attachment->modified = $now->toSql();
// Set up a couple of items that the upload function may need
$parent->new = $new_parent;
if ( $new_parent ) {
$attachment->parent_id = null;
$parent->title = '';
}
else {
$attachment->parent_id = $parent_id;
$parent->title = $parent->getTitle($parent_id, $parent_entity);
}
// Upload new file/url and create/update the attachment
if ( $new_uri_type == 'file' ) {
// Upload a new file
$msg = AttachmentsHelper::upload_file($attachment, $parent, $attachment_id, $save_type);
// NOTE: store() is not needed if upload_file() is called since it does it
}
elseif ( $new_uri_type == 'url' ) {
$attachment->url_relative = $relative_url;
$attachment->url_verify = $verify_url;
// Upload/add the new URL
$msg = AttachmentsHelper::add_url($attachment, $parent, $verify_url, $relative_url,
$old_uri_type, $attachment_id);
// NOTE: store() is not needed if add_url() is called since it does it
}
else {
// Save the updated attachment info
if (!$attachment->store()) {
$errmsg = $attachment->getError() . ' (ERR 11)';
JError::raiseError(500, $errmsg);
}
$lang = JFactory::getLanguage();
$lang->load('com_attachments', JPATH_SITE);
$msg = JText::_('ATTACH_ATTACHMENT_UPDATED');
}
// If we are supposed to close this iframe, do it now.
if ( in_array( $from, $parent->knownFroms() ) ) {
// If there is no parent_id, the parent is being created, use the username instead
if ( $new_parent ) {
$pid = 0;
}
else {
$pid = (int)$parent_id;
}
// Close the iframe and refresh the attachments list in the parent window
$base_url = $uri->root(true);
$lang = JRequest::getCmd('lang', '');
AttachmentsJavascript::closeIframeRefreshAttachments($base_url, $parent_type, $parent_entity, $pid, $lang, $from);
exit();
}
$this->setRedirect( $redirect_to, $msg );
}
/**
* Download a file
*/
public function download()
{
// Get the attachment ID
$id = JRequest::getInt('id');
if ( !is_numeric($id) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_ATTACHMENT_ID_N', $id) . ' (ERR 12)';
JError::raiseError(500, $errmsg);
}
// NOTE: The helper download_attachment($id) function does the access check
AttachmentsHelper::download_attachment($id);
}
/**
* Delete an attachment
*/
public function delete()
{
$db = JFactory::getDBO();
// Make sure we have a valid attachment ID
$id = JRequest::getInt( 'id');
if ( is_numeric($id) ) {
$id = (int)$id;
}
else {
$errmsg = JText::sprintf('ATTACH_ERROR_CANNOT_DELETE_INVALID_ATTACHMENT_ID_N', $id) . ' (ERR 13)';
JError::raiseError(500, $errmsg);
}
// Get the attachment info
require_once(JPATH_COMPONENT_SITE.'/models/attachment.php');
$model = new AttachmentsModelAttachment();
$model->setId($id);
$attachment = $model->getAttachment();
if ( !$attachment ) {
$errmsg = JText::sprintf('ATTACH_ERROR_CANNOT_DELETE_INVALID_ATTACHMENT_ID_N', $id) . ' (ERR 14)';
JError::raiseError(500, $errmsg);
}
$filename_sys = $attachment->filename_sys;
$filename = $attachment->filename;
$parent_id = $attachment->parent_id;
$parent_type = $attachment->parent_type;
$parent_entity = $attachment->parent_entity;
// Get the article/parent handler
JPluginHelper::importPlugin('attachments');
$apm = getAttachmentsPluginManager();
if ( !$apm->attachmentsPluginInstalled($parent_type) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_PARENT_TYPE_S', $parent_type) . ' (ERR 15)';
JError::raiseError(500, $errmsg);
}
$parent = $apm->getAttachmentsPlugin($parent_type);
$parent_entity_name = JText::_('ATTACH_' . $parent_entity);
// Check to make sure we can edit it
if ( !$parent->userMayDeleteAttachment($attachment) ) {
return JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR') . ' (ERR 16)');
}
// Make sure the parent exists
// NOTE: $parent_id===null means the parent is being created
if ( ($parent_id !== null) && !$parent->parentExists($parent_id, $parent_entity) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_CANNOT_DELETE_INVALID_S_ID_N',
$parent_entity_name, $parent_id) . ' (ERR 17)';
JError::raiseError(500, $errmsg);
}
// See if this user can edit (or delete) the attachment
if ( !$parent->userMayDeleteAttachment($attachment) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_NO_PERMISSION_TO_DELETE_S', $parent_entity_name) . ' (ERR 18)';
JError::raiseError(500, $errmsg);
}
// First delete the actual attachment files (if any)
if ( $filename_sys ) {
jimport('joomla.filesystem.file');
if ( JFile::exists( $filename_sys )) {
JFile::delete($filename_sys);
}
}
// Delete the entries in the attachments table
$query = $db->getQuery(true);
$query->delete('#__attachments')->where('id = '.(int)$id);
$db->setQuery($query);
if (!$db->query()) {
$errmsg = $db->getErrorMsg() . ' (ERR 19)';
JError::raiseError(500, $errmsg);
}
// Clean up after ourselves
AttachmentsHelper::clean_directory($filename_sys);
// Get the Itemid
$Itemid = JRequest::getInt( 'Itemid', 1);
$msg = JText::_('ATTACH_DELETED_ATTACHMENT') . " '$filename'";
// Figure out how to redirect
$from = JRequest::getWord('from', 'closeme');
$uri = JFactory::getURI();
if ( in_array($from, $parent->knownFroms()) ) {
// If there is no parent_id, the parent is being created, use the username instead
if ( !$parent_id ) {
$pid = 0;
}
else {
$pid = (int)$parent_id;
}
// Close the iframe and refresh the attachments list in the parent window
$base_url = $uri->root(true);
$lang = JRequest::getCmd('lang', '');
AttachmentsJavascript::closeIframeRefreshAttachments($base_url, $parent_type, $parent_entity, $pid, $lang, $from);
exit();
}
else {
$redirect_to = $uri->root(true);
}
$this->setRedirect( $redirect_to, $msg );
}
/**
* Show the warning for deleting an attachment
*/
public function delete_warning()
{
// Make sure we have a valid attachment ID
$attachment_id = JRequest::getInt('id');
if ( is_numeric($attachment_id) ) {
$attachment_id = (int)$attachment_id;
}
else {
$errmsg = JText::sprintf('ATTACH_ERROR_CANNOT_DELETE_INVALID_ATTACHMENT_ID_N', $attachment_id) . ' (ERR 20)';
JError::raiseError(500, $errmsg);
}
// Get the attachment record
JTable::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_attachments/tables');
$attachment = JTable::getInstance('Attachment', 'AttachmentsTable');
if ( !$attachment->load($attachment_id) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_CANNOT_DELETE_INVALID_ATTACHMENT_ID_N', $attachment_id) . ' (ERR 21)';
JError::raiseError(500, $errmsg);
}
// Get the parent object
$parent_type = $attachment->parent_type;
JPluginHelper::importPlugin('attachments');
$apm = getAttachmentsPluginManager();
if ( !$apm->attachmentsPluginInstalled($parent_type) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_PARENT_TYPE_S', $parent_type) . ' (ERR 22)';
JError::raiseError(500, $errmsg);
}
$parent = $apm->getAttachmentsPlugin($parent_type);
// Check to make sure we can edit it
$parent_id = $attachment->parent_id;
if ( !$parent->userMayDeleteAttachment($attachment) ) {
$errmsg = JText::_('ATTACH_ERROR_NO_PERMISSION_TO_DELETE_ATTACHMENT') . ' (ERR 23)';
JError::raiseError(500, $errmsg);
}
// Set up the view
require_once(JPATH_COMPONENT.'/views/warning/view.html.php');
$view = new AttachmentsViewWarning( );
$view->parent_id = $parent_id;
$view->option = JRequest::getCmd('option');
$view->from = JRequest::getWord('from', 'closeme');
$view->tmpl = JRequest::getWord('tmpl');
// Prepare for the query
$view->warning_title = JText::_('ATTACH_WARNING');
if ( $attachment->uri_type == 'file' ) {
$fname = "( {$attachment->filename} )";
}
else {
$fname = "( {$attachment->url} )";
}
$view->warning_question = JText::_('ATTACH_REALLY_DELETE_ATTACHMENT') . '<br/>' . $fname;
$base_url = JFactory::getURI()->base(false);
$delete_url = $base_url . "index.php?option=com_attachments&task=delete&id=$attachment_id";
$delete_url = JRoute::_($delete_url);
$view->action_url = $delete_url;
$view->action_button_label = JText::_('ATTACH_DELETE');
$view->display();
}
/**
* Display a form for updating/editing an attachment
*/
public function update()
{
// Call with: index.php?option=com_attachments&task=update&id=1&tmpl=component
// or: component/attachments/update/id/1/tmpl/component
// Make sure we have a valid attachment ID
$id = JRequest::getInt( 'id');
if ( is_numeric($id) ) {
$id = (int)$id;
}
else {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_ATTACHMENT_ID_N', $id) . ' (ERR 24)';
JError::raiseError(500, $errmsg);
}
// Get the attachment record
require_once(JPATH_COMPONENT_SITE.'/models/attachment.php');
$model = new AttachmentsModelAttachment();
$model->setId($id);
$attachment = $model->getAttachment();
if ( !$attachment ) {
$errmsg = JText::sprintf('ATTACH_ERROR_CANNOT_UPDATE_ATTACHMENT_INVALID_ID_N', $id) . ' (ERR 25)';
JError::raiseError(500, $errmsg);
}
// Get the component parameters
jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams('com_attachments');
// Get the article/parent handler
$parent_id = $attachment->parent_id;
$parent_type = $attachment->parent_type;
$parent_entity = $attachment->parent_entity;
JPluginHelper::importPlugin('attachments');
$apm = getAttachmentsPluginManager();
if ( !$apm->attachmentsPluginInstalled($parent_type) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_PARENT_TYPE_S', $parent_type) . ' (ERR 26)';
JError::raiseError(500, $errmsg);
}
$parent = $apm->getAttachmentsPlugin($parent_type);
// Check to make sure we can edit it
if ( !$parent->userMayEditAttachment($attachment) ) {
return JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR') . ' (ERR 27)');
}
// Set up the entity name for display
$parent_entity_name = JText::_('ATTACH_' . $parent_entity);
// Verify that this user may add attachments to this parent
$user = JFactory::getUser();
$new_parent = false;
if ( $parent_id === null ) {
$parent_id = 0;
$new_parent = true;
}
// Make sure the attachments directory exists
$upload_dir = JPATH_BASE.'/'.AttachmentsDefines::$ATTACHMENTS_SUBDIR;
$secure = $params->get('secure', false);
if ( !AttachmentsHelper::setup_upload_directory( $upload_dir, $secure ) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_UNABLE_TO_SETUP_UPLOAD_DIR_S', $upload_dir) . ' (ERR 28)';
JError::raiseError(500, $errmsg);
}
// Make sure the update parameter is legal
$update = JRequest::getWord('update');
if ( $update && !in_array($update, AttachmentsDefines::$LEGAL_URI_TYPES) ) {
$update = false;
}
// Suppress the display filename if we are switching from file to url
$display_name = $attachment->display_name;
if ( $update && ($update != $attachment->uri_type) ) {
$attachment->display_name = '';
}
// Set up the view
require_once(JPATH_COMPONENT_SITE.'/views/update/view.html.php');
$view = new AttachmentsViewUpdate();
$from = JRequest::getWord('from', 'closeme');
AttachmentsHelper::add_view_urls($view, 'update', $parent_id,
$attachment->parent_type, $id, $from);
$view->update = $update;
$view->new_parent = $new_parent;
$view->attachment = $attachment;
$view->parent = $parent;
$view->params = $params;
$view->from = $from;
$view->Itemid = JRequest::getInt('Itemid', 1);
$view->error = false;
$view->error_msg = false;
$view->display();
}
/**
* Return the attachments list as HTML (for use by Ajax)
*/
public function attachmentsList()
{
$parent_id = JRequest::getInt('parent_id', false);
$parent_type = JRequest::getWord('parent_type', '');
$parent_entity = JRequest::getWord('parent_entity', 'default');
$show_links = JRequest::getBool('show_links', true);
$allow_edit = JRequest::getBool('allow_edit', true);
$from = JRequest::getWord('from', 'closeme');
$title = '';
$response = '';
if ( ($parent_id === false) || ($parent_type == '') ) {
return '';
}
// Allow remapping of parent ID (eg, for Joomfish)
$lang = JRequest::getWord('lang', '');
if ($lang and jimport('attachments_remapper.remapper'))
{
$parent_id = AttachmentsRemapper::remapParentID($parent_id, $parent_type, $parent_entity);
}
require_once(JPATH_SITE.'/components/com_attachments/controllers/attachments.php');
$controller = new AttachmentsControllerAttachments();
$response = $controller->displayString($parent_id, $parent_type, $parent_entity,
$title, $show_links, $allow_edit, false, $from);
echo $response;
}
/**
* Request the user log in
*/
public function requestLogin()
{
// Set up the view to redisplay the form with warnings
require_once(JPATH_COMPONENT_SITE . '/views/login/view.html.php');
$view = new AttachmentsViewLogin();
// Display the view
$view->return_url = JRequest::getString('return');
$view->display(null, false, false);
}
}

View File

@ -0,0 +1,148 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
defined('_JEXEC') or die('Restricted access');
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/legacy/controller.php');
/**
* Class for a controller for dealing with lists of attachments
*
* @package Attachments
*/
class AttachmentsControllerAttachments extends JControllerLegacy
{
/**
* Constructor
*
* @param array $default : An optional associative array of configuration settings.
* Recognized key values include 'name', 'default_task', 'model_path', and
* 'view_path' (this list is not meant to be comprehensive).
*/
public function __construct( $default = array('default_task' => 'noop') )
{
parent::__construct( $default );
}
/**
* A noop function so this controller does not have a usable default
*/
public function noop()
{
$errmsg = JText::_('ATTACH_ERROR_NO_FUNCTION_SPECIFIED') . ' (ERR 59)';
JError::raiseError(500, $errmsg);
}
/**
* Disable the default display function
*/
public function display($cachable = false, $urlparams = false)
{
// Do nothing (not sure why this works...)
}
/**
* Display the attachments list
*
* @param int $parent_id the id of the parent
* @param string $parent_type the type of parent
* @param string $parent_entity the type entity of the parent
* @param string $title title to be shown above the list of articles. If null, use system defaults.
* @param bool $show_file_links enable showing links for the filenames
* @param bool $allow_edit enable showing edit/delete links (if permissions are okay)
* @param bool $echo if true the output will be echoed; otherwise the results are returned.
* @param string $from The 'from' info
*
* @return the string (if $echo is false)
*/
public function displayString($parent_id, $parent_type, $parent_entity,
$title=null, $show_file_links=true, $allow_edit=true,
$echo=true, $from=null)
{
$document = JFactory::getDocument();
// Get an instance of the model
require_once(JPATH_SITE.'/components/com_attachments/models/attachments.php');
$model = new AttachmentsModelAttachments();
if ( !$model ) {
$errmsg = JText::_('ATTACH_ERROR_UNABLE_TO_FIND_MODEL') . ' (ERR 60)';
JError::raiseError(500, $errmsg);
}
$model->setParentId($parent_id, $parent_type, $parent_entity);
// Get the component parameters
jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams('com_attachments');
// Set up to list the attachments for this article/content item
$sort_order = $params->get('sort_order', 'filename');
$model->setSortOrder($sort_order);
// If none of the attachments should be visible, exit now
if ( ! $model->someVisible() ) {
return false;
}
// Get the view
$this->addViewPath(JPATH_SITE.'/components/com_attachments/views');
$viewType = $document->getType();
$view = $this->getView('Attachments', $viewType);
if ( !$view ) {
$errmsg = JText::_('ATTACH_ERROR_UNABLE_TO_FIND_VIEW') . ' (ERR 61)';
JError::raiseError(500, $errmsg);
}
$view->setModel($model);
// Construct the update URL template
$base_url = JFactory::getURI()->base(false);
$update_url = $base_url . "index.php?option=com_attachments&task=update&id=%d";
$update_url .= "&from=$from&tmpl=component";
$update_url = JRoute::_($update_url);
$view->update_url = $update_url;
// Construct the delete URL template
$delete_url = $base_url . "index.php?option=com_attachments&task=delete_warning&id=%d";
$delete_url .= "&parent_type=$parent_type&parent_entity=$parent_entity&parent_id=" . (int)$parent_id;
$delete_url .= "&from=$from&tmpl=component";
$delete_url = JRoute::_($delete_url);
$view->delete_url = $delete_url;
// Set some display settings
$view->title = $title;
$view->show_file_links = $show_file_links;
$view->allow_edit = $allow_edit;
$view->from = $from;
// Get the view to generate the display output from the template
if ( $view->display() === true ) {
// Display or return the results
if ( $echo ) {
echo $view->getOutput();
}
else {
return $view->getOutput();
}
}
return false;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,105 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @author Jonathan M. Cameron <jmcameron@jmcameron.net>
* @copyright Copyright (C) 2011-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
*/
// No direct access.
defined('_JEXEC') or die('Restricted access');
/**
* Attachments extension definies
*
* @package Attachments
*
* @since 2.2
*/
class AttachmentsDefines
{
/** The Attachments extension version number
*/
public static $ATTACHMENTS_VERSION = '3.2.6';
/** The Attachments extension version date
*/
public static $ATTACHMENTS_VERSION_DATE = 'March 26, 2018';
/** Project URL
*/
public static $PROJECT_URL = 'http://joomlacode.org/gf/project/attachments3/';
/** Supported save types for uploading/updating
*/
public static $LEGAL_SAVE_TYPES = Array('upload', 'update');
/** Supported URI types for uploading/updating
*/
public static $LEGAL_URI_TYPES = Array('file', 'url');
/** Default access level (if default_access_level parameter is not set)
*
* 1 = Public
* 2 = Registered
*/
public static $DEFAULT_ACCESS_LEVEL_ID = '2';
/** Default 'Public' access level (in case it is different on this system)
*/
public static $PUBLIC_ACCESS_LEVEL_ID = '1';
/** Default permissions for new attachments rules
*
* These are the default settings for the custom ACL permissions for the
* Attachments extension.
*
* Be careul if you edit this to conform to the proper json syntax!
*
* NB: Unfortunately, the syntax for setting a static variable does not
* allow breaking the string up with dots to join the parts to make
* this easier to read.
*/
public static $DEFAULT_ATTACHMENTS_ACL_PERMISSIONS = '{"attachments.delete.own":{"6":1,"3":1},"attachments.edit.state.own":{"6":1,"4":1},"attachments.edit.state.ownparent":{"6":1,"4":1},"attachments.edit.ownparent":{"6":1,"3":1},"attachments.delete.ownparent":{"6":1,"3":1}}';
/** Maximum filename length (MUST match the `filename` SQL definition)
*/
public static $MAXIMUM_FILENAME_LENGTH = 256;
/** Maximum filename path length (MUST match the `filename_sys` SQL definition)
*/
public static $MAXIMUM_FILENAME_SYS_LENGTH = 512;
/** Maximum URL length (MUST match the `url` SQL definition)
*/
public static $MAXIMUM_URL_LENGTH = 1024;
/** Attachments subdirectory
*
* NOTE: If you have any existing attachments, follow one of these procedures
*
* 1. If you do not care to keep any existing attachments, follow these steps:
* - Suspend front-end operation of your website
* - In the back end attachments page, delete all attachments
* - Delete the attachments directory
* - Change the value below and save this file
* - Resume front-end operation of your website
*
* 2. If you are simply renaming the attachments directory, do the following
* steps:
* - Suspend front-end operation of your website
* - Rename the attachments directory (must be within the top
* directory of your website)
* - Change the value below and save this file
* - In the back end attachments page, under the "Utilities" command
* on the right end of the toolbar, choose the "Regenerate system filenames"
* command
* - Resume front-end operation of your website
*/
public static $ATTACHMENTS_SUBDIR = 'attachments';
}

View File

@ -0,0 +1,307 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
defined('_JEXEC') or die('Restricted access');
/**
* A utility class to help deal with file types
*
* @package Attachments
*/
class AttachmentsFileTypes {
/** Array of lookups for icon filename given a filename extension */
static $attachments_icon_from_file_extension =
Array( 'aif' => 'music.gif',
'aiff' => 'music.gif',
'avi' => 'video.gif',
'bmp' => 'image.gif',
'bz2' => 'archive.gif',
'c' => 'c.gif',
'c++' => 'cpp.gif',
'cab' => 'zip.gif',
'cc' => 'cpp.gif',
'cpp' => 'cpp.gif',
'css' => 'css.gif',
'csv' => 'csv.gif',
'doc' => 'word.gif',
'docx' => 'wordx.gif',
'eps' => 'eps.gif',
'gif' => 'image.gif',
'gz' => 'archive.gif',
'h' => 'h.gif',
'iv' => '3d.gif',
'jpg' => 'image.gif',
'js' => 'js.gif',
'midi' => 'midi.gif',
'mov' => 'mov.gif',
'mp3' => 'music.gif',
'mpeg' => 'video.gif',
'mpg' => 'video.gif',
'odg' => 'oo-draw.gif',
'odp' => 'oo-impress.gif',
'ods' => 'oo-calc.gif',
'odt' => 'oo-write.gif',
'pdf' => 'pdf.gif',
'php' => 'php.gif',
'png' => 'image.gif',
'pps' => 'ppt.gif',
'ppt' => 'ppt.gif',
'pptx' => 'pptx.gif',
'ps' => 'ps.gif',
'ra' => 'audio.gif',
'ram' => 'audio.gif',
'rar' => 'archive.gif',
'rtf' => 'rtf.gif',
'sql' => 'sql.gif',
'swf' => 'flash.gif',
'tar' => 'archive.gif',
'txt' => 'text.gif',
'vcf' => 'vcard.gif',
'vrml' => '3d.gif',
'wav' => 'audio.gif',
'wma' => 'music.gif',
'wmv' => 'video.gif',
'wrl' => '3d.gif',
'xls' => 'excel.gif',
'xlsx' => 'excelx.gif',
'xml' => 'xml.gif',
'zip' => 'zip.gif',
// Artificial
'_generic' => 'generic.gif',
'_link' => 'link.gif',
);
/** Array of lookups for icon filename from mime type */
static $attachments_icon_from_mime_type =
Array( 'application/bzip2' => 'archive.gif',
'application/excel' => 'excel.gif',
'application/msword' => 'word.gif',
'application/pdf' => 'pdf.gif',
'application/postscript' => 'ps.gif',
'application/powerpoint' => 'ppt.gif',
'application/vnd.ms-cab-compressed' => 'zip.gif',
'application/vnd.ms-excel' => 'excel.gif',
'application/vnd.ms-powerpoint' => 'ppt.gif',
'application/vnd.ms-pps' => 'ppt.gif',
'application/vnd.ms-word' => 'word.gif',
'application/vnd.oasis.opendocument.graphics' => 'oo-draw.gif',
'application/vnd.oasis.opendocument.presentation' => 'oo-impress.gif',
'application/vnd.oasis.opendocument.spreadsheet' => 'oo-calc.gif',
'application/vnd.oasis.opendocument.text' => 'oo-write.gif',
'application/vnd.openxmlformats' => 'xml.gif',
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx.gif',
'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppt.gif',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx.gif',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'wordx.gif',
'application/x-bz2' => 'archive.gif',
'application/x-gzip' => 'archive.gif',
'application/x-javascript' => 'js.gif',
'application/x-midi' => 'midi.gif',
'application/x-shockwave-flash' => 'flash.gif',
'application/x-rar-compressed' => 'archive.gif',
'application/x-tar' => 'archive.gif',
'application/x-vrml' => '3d.gif',
'application/x-zip' => 'zip.gif',
'application/xml' => 'xml.gif',
'audio/mpeg' => 'music.gif',
'audio/x-aiff' => 'music.gif',
'audio/x-ms-wma' => 'music.gif',
'audio/x-pn-realaudio' => 'audio.gif',
'audio/x-wav' => 'audio.gif',
'image/bmp' => 'image.gif',
'image/gif' => 'image.gif',
'image/jpeg' => 'image.gif',
'image/png' => 'image.gif',
'model/vrml' => '3d.gif',
'text/css' => 'css.gif',
'text/html' => 'generic.gif',
'text/plain' => 'text.gif',
'text/rtf' => 'rtf.gif',
'text/x-vcard' => 'vcard.gif',
'video/mpeg' => 'video.gif',
'video/quicktime' => 'mov.gif',
'video/x-ms-wmv' => 'video.gif',
'video/x-msvideo' => 'video.gif',
// Artificial
'link/generic' => 'generic.gif',
'link/unknown' => 'link.gif'
);
/** Array of lookups for mime type from filename extension */
static $attachments_mime_type_from_extension =
Array( 'aif' => 'audio/x-aiff',
'aiff' => 'audio/x-aiff',
'avi' => 'video/x-msvideo',
'bmp' => 'image/bmp',
'bz2' => 'application/x-bz2',
'c' => 'text/plain',
'c++' => 'text/plain',
'cab' => 'application/vnd.ms-cab-compressed',
'cc' => 'text/plain',
'cpp' => 'text/plain',
'css' => 'text/css',
'csv' => 'text/csv',
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'eps' => 'application/postscript',
'gif' => 'image/gif',
'gz' => 'application/x-gzip',
'h' => 'text/plain',
'iv' => 'graphics/x-inventor',
'jpg' => 'image/jpeg',
'js' => 'application/x-javascript',
'midi' => 'application/x-midi',
'mov' => 'video/quicktime',
'mp3' => 'audio/mpeg',
'mpeg' => 'audio/mpeg',
'mpg' => 'audio/mpeg',
'odg' => 'application/vnd.oasis.opendocument.graphics',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'odt' => 'application/vnd.oasis.opendocument.text',
'pdf' => 'application/pdf',
'php' => 'text/plain',
'png' => 'image/png',
'pps' => 'application/vnd.ms-powerpoint',
'ppt' => 'application/vnd.ms-powerpoint',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'ps' => 'application/postscript',
'ra' => 'audio/x-pn-realaudio',
'ram' => 'audio/x-pn-realaudio',
'rar' => 'application/x-rar-compressed',
'rtf' => 'application/rtf',
'sql' => 'text/plain',
'swf' => 'application/x-shockwave-flash',
'tar' => 'application/x-tar',
'txt' => 'text/plain',
'vcf' => 'text/x-vcard',
'vrml' => 'application/x-vrml',
'wav' => 'audio/x-wav',
'wma' => 'audio/x-ms-wma',
'wmv' => 'video/x-ms-wmv',
'wrl' => 'x-world/x-vrml',
'xls' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xml' => 'application/xml',
'zip' => 'application/x-zip'
);
/** Array of known PDF mime types */
static $attachments_pdf_mime_types =
array('application/pdf',
'application/x-pdf',
'application/vnd.fdf',
'application/download',
'application/x-download',
'binary/octet-stream'
);
/**
* Get the icon filename for a specific filename (or mime type)
*
* @param string $filename the filename to check
* @param string $mime_type the MIME type to check (if the filename fails)
*
* @return the icon filename (or '' if none is found)
*/
public static function icon_filename($filename, $mime_type)
{
// Recognize some special cases first
if ( ($mime_type == 'link/unknown') OR ($mime_type == 'unknown') ) {
return 'link.gif';
}
if ( $mime_type == 'link/broken' ) {
return 'link_bad.gif';
}
if ( $filename ) {
// Make sure it is a real filename
if (strpos($filename, '.') === false) {
// Do not know any better, assume it is text
return 'text/plain';
}
$path_info = pathinfo($filename);
// Try the extension first
$extension = JString::strtolower($path_info['extension']);
if ( array_key_exists( $extension, AttachmentsFileTypes::$attachments_icon_from_file_extension ) ) {
$iconf = AttachmentsFileTypes::$attachments_icon_from_file_extension[$extension];
if ( JString::strlen($iconf) > 0 ) {
return $iconf;
}
}
}
else {
// Try the mime type
if ( array_key_exists( $mime_type, AttachmentsFileTypes::$attachments_icon_from_mime_type ) ) {
$iconf = AttachmentsFileTypes::$attachments_icon_from_mime_type[$mime_type];
if ( $iconf && (JString::strlen($iconf) > 0) ) {
return $iconf;
}
}
}
return '';
}
/**
* Get an array of unique icon filenames
*
* @return an array of unique icon filenames
*/
public static function unique_icon_filenames()
{
$vals = array_unique(array_values(AttachmentsFileTypes::$attachments_icon_from_file_extension));
sort($vals);
return $vals;
}
/**
* Get the mime type for a specific file
*
* @param string $filename the filename to check
*
* @return the mime type string
*/
public static function mime_type($filename)
{
$path_info = pathinfo($filename);
// Make sure it is a real filename
if (strpos($filename, '.') === false) {
return 'unknown';
}
// Try the extension first
$extension = strtolower($path_info['extension']);
if ( array_key_exists($extension, AttachmentsFileTypes::$attachments_mime_type_from_extension) ) {
$mime_type = AttachmentsFileTypes::$attachments_mime_type_from_extension[$extension];
if ( strlen($mime_type) > 0 )
return $mime_type;
}
return false;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,74 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
defined('_JEXEC') or die('Restricted access');
/**
* A class for attachments javascript functions
*
* @package Attachments
*/
class AttachmentsJavascript
{
/**
* Set up the appropriate Javascript framework (Mootools or jQuery)
*/
public static function setupJavascript($add_refresh_script = true)
{
if (version_compare(JVERSION, '3.0', 'ge'))
{
JHtml::_('behavior.framework', true);
JHtml::_('behavior.modal', 'a.modal');
}
else
{
// up the style sheet (to get the visual for the button working)
JHtml::_('behavior.mootools');
}
if ($add_refresh_script)
{
JHtml::script('com_attachments/attachments_refresh.js', false, true);
}
}
/**
* Close the iframe
*/
public static function closeIframeRefreshAttachments($base_url, $parent_type, $parent_entity, $parent_id, $lang, $from)
{
echo "<script type=\"text/javascript\">
window.parent.refreshAttachments(\"$base_url\",\"$parent_type\",\"$parent_entity\",$parent_id,\"$lang\",\"$from\");
window.parent.SqueezeBox.close();
</script>";
}
/**
* Set up the Javascript for the modal button
*/
public static function setupModalJavascript()
{
JHtml::_('behavior.modal', 'a.modal-button');
}
/**
* Close the modal window and reload the parent
*/
public static function closeModal()
{
echo '<script>var myparent = window.parent; window.parent.SqueezeBox.close(); myparent.location.reload();</script>';
}
}

View File

@ -0,0 +1,118 @@
; en-GB.com_attachments.ini (site component)
; Attachments for Joomla! extension
; Copyright (C) 2007-2018 Jonathan M. Cameron, All rights reserved.
; License http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
; Note : All ini files need to be saved as UTF-8 - No BOM
; English translation
; For forms, etc, from the front end
ATTACH_ACCESS_COLON="Access: "
ATTACH_ACCESS_LEVEL_TOOLTIP="Access level defining who can view or download this attachment."
ATTACH_ADD_ATTACHMENT="Add attachment"
ATTACH_ADD_URL="Add URL"
ATTACH_ATTACHMENT="Attachment"
ATTACH_ATTACHMENTS="Attachments"
ATTACH_ATTACHMENT_FILENAME_URL="Attachment Filename / URL"
ATTACH_ATTACHMENT_SAVED="Attachment saved!"
ATTACH_ATTACHMENT_UPDATED="Attachment updated!"
ATTACH_ATTACH_FILE_COLON="Attach file:"
ATTACH_CANCEL="Cancel"
ATTACH_CHANGES_TO_ATTACHMENT_SAVED="Changes to attachment saved"
ATTACH_CHANGE_FILE="Update File"
ATTACH_CHANGE_FILE_TOOLTIP="Update the file for this attachment. (Other changes on this form will be lost.)"
ATTACH_CHANGE_TO_FILE="Change to File"
ATTACH_CHANGE_TO_FILE_TOOLTIP="Attach a file for this attachment. (Other changes on this form will be lost.)"
ATTACH_CHANGE_TO_URL="Change to URL"
ATTACH_CHANGE_TO_URL_TOOLTIP="Change uploaded file to a URL/link. (Other changes on this form will be lost.)"
ATTACH_DELETE="Delete"
ATTACH_DELETED_ATTACHMENT="Deleted attachment"
ATTACH_DESCRIPTION="Description"
ATTACH_DESCRIPTION_COLON="Description:"
ATTACH_DISPLAY_FILENAME_OPTIONAL_COLON="Display Filename (optional):"
ATTACH_DISPLAY_FILENAME_TOOLTIP="Optional: Enter an alternate filename or label to display instead of the full filename."
ATTACH_DISPLAY_URL_COLON="Display URL:"
ATTACH_DISPLAY_URL_TOOLTIP="Optional: Enter an alternate URL or label to display instead of the full URL."
ATTACH_ENTER_NEW_URL_COLON="Enter new URL:"
ATTACH_ENTER_URL="Enter URL"
ATTACH_ENTER_URL_INSTEAD="Enter URL instead"
ATTACH_ENTER_URL_TOOLTIP="Enter a URL here. The resource pointed to by the URL will not be uploaded; only the URL itself will be saved. NOTE: When entering relative URLs, unselect 'verify URL' and select 'relative URL'."
ATTACH_ERROR_ADDING_HTACCESS_S="Please add an '.htaccess' file to your upload directory (%s) to prevent access to the directory."
ATTACH_ERROR_ADDING_INDEX_HTML_IN_S="Please add an 'index.html' file to your upload directory (%s) to prevent browsing of the directory."
ATTACH_ERROR_BAD_CHARACTER_S_IN_FILENAME_S="ERROR: Bad character (%s) in filename (%s), please rename it and try again!"
ATTACH_ERROR_CANNOT_DELETE_INVALID_ATTACHMENT_ID_N="ERROR: Cannot delete attachment: Unable to get valid attachment ID (%d)!"
ATTACH_ERROR_CANNOT_DELETE_INVALID_S_ID_N="ERROR: Cannot delete attachment for invalid %s ID: '%d'"
ATTACH_ERROR_CANNOT_SWITCH_PARENT_S_NEW_FILE_S_ALREADY_EXISTS="ERROR: Cannot switch %s; new file '%s' already exists!"
ATTACH_ERROR_CANNOT_SWITCH_PARENT_S_RENAMING_FILE_S_FAILED="ERROR: Cannot switch %s; renaming file '%' failed!"
ATTACH_ERROR_CANNOT_UPDATE_ATTACHMENT_INVALID_ID_N="ERROR: Cannot update attachment; invalid attachment ID (%d)!"
ATTACH_ERROR_CHANGE_IN_MEDIA_MANAGER="(Change this in the Media Manager settings.)"
ATTACH_ERROR_CHECKING_URL_S="Error checking URL: '%s'! <br/>(You may wish to disable the 'Verify URL existence' option and try again.)"
ATTACH_ERROR_CONNECTING_TO_URL_S="Error connecting to URL '%s'! <br/>(You may wish to disable the 'Verify URL existence' option and try again.)"
ATTACH_ERROR_COULD_NOT_ACCESS_URL_S="ERROR: Could not access URL '%s'! <br/>(You may wish to disable the 'Verify URL existence' option and try again.)"
ATTACH_ERROR_FILEPATH_TOO_LONG_N_N_S="ERROR: The filename with path is too long (%d > max %d). <br/>(File: %s)!"
ATTACH_ERROR_FILE_S_ALREADY_ON_SERVER="ERROR: File '%s' already exists on the server. Please select another file or rename your file!"
ATTACH_ERROR_FILE_S_NOT_FOUND_ON_SERVER="ERROR: File '%s' not found on server!"
ATTACH_ERROR_FILE_S_TOO_BIG_N_N_N="File '%s' is too big at %.1f MB (max attachment size=%d MB, max PHP upload size=%d MB)"
ATTACH_ERROR_ILLEGAL_FILE_EXTENSION="Illegal file extension:"
ATTACH_ERROR_ILLEGAL_FILE_MIME_TYPE="Illegal file Mime type:"
ATTACH_ERROR_INVALID_ATTACHMENT_ID_N="ERROR: Invalid attachment ID (%s)!"
ATTACH_ERROR_INVALID_PARENT_TYPE_S="ERROR: Invalid parent type ('%s')!"
ATTACH_ERROR_INVALID_SAVE_PARAMETERS="ERROR: Invalid save parameters!"
ATTACH_ERROR_IN_URL_SYNTAX_S="Error in URL syntax: '%s'!"
ATTACH_ERROR_MAY_BE_LARGER_THAN_LIMIT="Perhaps your file is larger than the size limit of"
ATTACH_ERROR_MOVING_FILE="Error uploading (error moving file)"
ATTACH_ERROR_NO_FUNCTION_SPECIFIED="ERROR: No function specified!"
ATTACH_ERROR_NO_PARENT_ENTITY_SPECIFIED="ERROR: No parent entity specified!"
ATTACH_ERROR_NO_PARENT_ID_SPECIFIED="ERROR: No parent ID specified!"
ATTACH_ERROR_NO_PARENT_TYPE_SPECIFIED="ERROR: No parent type specified!"
ATTACH_ERROR_NO_PERMISSION_TO_DELETE_ATTACHMENT="ERROR: You do not have permission to delete this attachment!"
ATTACH_ERROR_NO_PERMISSION_TO_DELETE_S="ERROR: You do not have permission to delete an attachment for this %s!"
ATTACH_ERROR_NO_PERMISSION_TO_DOWNLOAD="ERROR: You do not have permission to download this attachment!"
ATTACH_ERROR_NO_PERMISSION_TO_UPLOAD_S="ERROR: You do not have permission to add an attachment to this %s! "
ATTACH_ERROR_SAVING_FILE_ATTACHMENT_RECORD="Error saving file attachment record!"
ATTACH_ERROR_SAVING_URL_ATTACHMENT_RECORD="Error saving URL attachment record!"
ATTACH_ERROR_UNABLE_TO_CREATE_DIR_S="ERROR: Unable to create directory! <p>'%s'</p>"
ATTACH_ERROR_UNABLE_TO_FIND_MODEL="ERROR: Unable to find model!"
ATTACH_ERROR_UNABLE_TO_FIND_VIEW="ERROR: Unable to find view!"
ATTACH_ERROR_UNABLE_TO_SETUP_UPLOAD_DIR_S="ERROR: Unable create or setup upload directory (%s)!"
ATTACH_ERROR_UNKNOWN_PARENT_ID="ERROR: Unknown parent id!"
ATTACH_ERROR_UNKNOWN_PARENT_TYPE_S="ERROR: Unknown parent type '%s'!"
ATTACH_ERROR_UNKNOWN_PROTCOL_S_IN_URL_S="ERROR: Unknown protocol '%s' in URL: '%s'!"
ATTACH_ERROR_UPLOADING_FILE_S="Error uploading file '%s'!"
ATTACH_EXISTING_ATTACHMENTS="Existing&nbsp;Attachments:"
ATTACH_FILENAME_COLON="Filename:"
ATTACH_FILE_SIZE_KB="Size(kB)"
ATTACH_FILE_TYPE="File type"
ATTACH_FOR_PARENT_S_COLON_S="For %s: <i>'%s'</i>"
ATTACH_LAST_MODIFIED_ON_D_BY_S="Last modified on %s by: %s"
ATTACH_NORMAL_UPDATE="Normal update"
ATTACH_NORMAL_UPDATE_TOOLTIP="Normal update (edit attachment info only)"
ATTACH_NOTE_ENTER_URL_WITH_HTTP="NOTE: Enter URL with 'http...' prefix; otherwise the URL is presumed to be relative."
ATTACH_OPTIONAL="(Optional)"
ATTACH_PUBLISHED="Published"
ATTACH_REALLY_DELETE_ATTACHMENT="Really delete attachment?"
ATTACH_RELATIVE_URL="Relative URL?"
ATTACH_RELATIVE_URL_TOOLTIP="Check this box to enter a URL relative to this Joomla! website. You will probably also need to unselect 'Verify URL' to add a relative URL."
ATTACH_SELECT_FILE_TO_UPLOAD_INSTEAD="Select file to upload instead"
ATTACH_SELECT_NEW_FILE_IF_YOU_WANT_TO_UPDATE_ATTACHMENT_FILE="Select new file (if you want to update the attachment file):"
ATTACH_UNKNOWN_CONTROLLER="Unknown controller!"
ATTACH_UPDATE="Update"
ATTACH_UPDATED_ATTACHMENT="Updated Attachment"
ATTACH_UPDATE_ATTACHMENT_COLON="Update Attachment:"
ATTACH_UPDATE_ATTACHMENT_FILE_S="Update Attachment File: '%s'"
ATTACH_UPDATE_ATTACHMENT_FOR_PARENT_S_COLON_S="Update attachment for %s: <i>'%s'</i>"
ATTACH_UPDATE_ATTACHMENT_URL_S="Update Attachment URL: '%s'"
ATTACH_UPLOAD_ATTACHMENT="Upload attachment"
ATTACH_UPLOAD_CANCELED="Upload Canceled!"
ATTACH_UPLOAD_VERB="Upload"
ATTACH_URL_IS_VALID="URL is valid"
ATTACH_URL_IS_VALID_TOOLTIP="Use this checkbox to manually change whether the link is valid. Ignored for new or edited links."
ATTACH_VERIFY_URL_EXISTENCE="Verify URL existence?"
ATTACH_VERIFY_URL_EXISTENCE_TOOLTIP="Check this box to verify that the URL works (only for new or edited URLs). Unselecting this will still validate the URL correctness."
ATTACH_WARNING="Warning!"
ATTACH_WARNING_ADMIN_MUST_PUBLISH="NOTE: Your attachment will not be published by default. Please contact your system administrator to have your attachment published."
ATTACH_WARNING_FILENAME_TRUNCATED="Warning: Filename was too long! Truncated to:"
ATTACH_WARNING_MUST_LOGIN_TO_DOWNLOAD_ATTACHMENT="WARNING: You must be logged in to download this attachment!"
ATTACH_WARNING_YOU_ARE_ALREADY_LOGGED_IN="WARNING: You are already logged in!"
ATTACH_YOU_MUST_SELECT_A_FILE_TO_UPLOAD="You must select a file to upload!"

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,118 @@
; it-IT.com_attachments.ini (site component)
; Attachments for Joomla! extension
; Copyright (C) 2007-2013 Jonathan M. Cameron, All rights reserved.
; License GNU GPL 3: http://www.gnu.org/licenses/gpl-3.0.html
; Note : All ini files need to be saved as UTF-8 - No BOM
; Italian translation by: Piero Mattirolo (2.0, 3.0), Lemminkainen (version 1.3.4)
; For forms, etc, from the front end
ATTACH_ACCESS_COLON="Accesso: "
ATTACH_ACCESS_LEVEL_TOOLTIP="Livello di accesso che definisce chi può vedere o scaricare questo allegato."
ATTACH_ADD_ATTACHMENT="Aggiungi Allegato"
ATTACH_ADD_URL="Aggiungi URL"
ATTACH_ATTACHMENT="Allegato"
ATTACH_ATTACHMENTS="Allegati"
ATTACH_ATTACHMENT_FILENAME_URL="Nome / URL dell'allegato"
ATTACH_ATTACHMENT_SAVED="Allegato Salvato"
ATTACH_ATTACHMENT_UPDATED="Allegato aggiornato!"
ATTACH_ATTACH_FILE_COLON="Allega File"
ATTACH_CANCEL="Annulla"
ATTACH_CHANGES_TO_ATTACHMENT_SAVED="Modifiche all'allegato salvato"
ATTACH_CHANGE_FILE="Aggiorna il File"
ATTACH_CHANGE_FILE_TOOLTIP="Aggiorna il file per questo allegato (Le altre modifiche a questo form andranno perse.)"
ATTACH_CHANGE_TO_FILE="Cambia File"
ATTACH_CHANGE_TO_FILE_TOOLTIP="Allega un file a questo allegato (Le altre modifiche a questo form andranno perse)"
ATTACH_CHANGE_TO_URL="Cambia con URL"
ATTACH_CHANGE_TO_URL_TOOLTIP="Modifica URL/link del file caricato. (Le altre modifiche a questo form andranno perse)"
ATTACH_DELETE="Elimina"
ATTACH_DELETED_ATTACHMENT="Allegato Cancellato"
ATTACH_DESCRIPTION="Descrizione"
ATTACH_DESCRIPTION_COLON="Descrizione:"
ATTACH_DISPLAY_FILENAME_OPTIONAL_COLON="Mostra il nome del file (opzionale):"
ATTACH_DISPLAY_FILENAME_TOOLTIP="Facoltativo: Inserire un nome o un'etichetta per il file da mostrare in alternativa al nome del file completo."
ATTACH_DISPLAY_URL_COLON="Mostra URL:"
ATTACH_DISPLAY_URL_TOOLTIP="Opzionale: Inserisci URL o etichetta da mostrare in alternativa al posto dell'URL completo."
ATTACH_ENTER_NEW_URL_COLON="Inserisci nuovo URL:"
ATTACH_ENTER_URL="Inserisci URL"
ATTACH_ENTER_URL_INSTEAD="Inserisci URL alternativo"
ATTACH_ENTER_URL_TOOLTIP="Inserisci un URL qui. La risorsa indicata dall'URL non sarà caricata; sarà salvato soltanto l'URL stesso. NOTA: Se l' URL è relativo, deseleziona 'verifica URL' e seleziona 'URL relativo'."
ATTACH_ERROR_ADDING_HTACCESS_S="Ricorda di inserire un file '.htaccess' nella directory di upload (%s) per prevenire l'accesso alla directory."
ATTACH_ERROR_ADDING_INDEX_HTML_IN_S="Ricorda di inserire un file 'index.html' nella directory di upload (%s) per prevenire il browsing della directory."
ATTACH_ERROR_BAD_CHARACTER_S_IN_FILENAME_S="ERRORE: carattere non ammesso (%s) nel nome del file (%s), cambia il nome e riprova!"
ATTACH_ERROR_CANNOT_DELETE_INVALID_ATTACHMENT_ID_N="ERRORE: Impossibile cancellare l'allegato: Impossibile ottenere valida ID dell'allegato (%d)!"
ATTACH_ERROR_CANNOT_DELETE_INVALID_S_ID_N="ERRORE: Impossibile cancellare l'allegato a causa dell'ID %s non valida: '%d'"
ATTACH_ERROR_CANNOT_SWITCH_PARENT_S_NEW_FILE_S_ALREADY_EXISTS="ERRORE: Impossibile scambiare %s; Il nuovo file '%s' esiste già!"
ATTACH_ERROR_CANNOT_SWITCH_PARENT_S_RENAMING_FILE_S_FAILED="ERRORE: Impossibile scambiare %s; la rinominazione del file '%' è fallita!"
ATTACH_ERROR_CANNOT_UPDATE_ATTACHMENT_INVALID_ID_N="ERRORE: Impossibile aggiornare l'allegato. ID allegato non valida ID (%d)!"
ATTACH_ERROR_CHANGE_IN_MEDIA_MANAGER="(Questa modifica deve essere effettuata in Gestione Media.)"
ATTACH_ERROR_CHECKING_URL_S="Errore durante la verifica URL: '%s'! <br/>(Potresti disabilitare 'Verifica esistenza URL' e riprovare)"
ATTACH_ERROR_CONNECTING_TO_URL_S="Errore impossibile connettersi a URL '%s'! <br/>(Potresti disabilitare 'Verifica esistenza URL' e riprovare)"
ATTACH_ERROR_COULD_NOT_ACCESS_URL_S="ERRORE: Impossibile accedere a URL '%s'! <br/>(Potresti disabilitare l'opzione 'Verifica esistenza URL' e riprovare)."
ATTACH_ERROR_FILEPATH_TOO_LONG_N_N_S="ERRORE: il nome del file con il percorso è troppo lungo (%d > max %d). <br/>(File: %s)!"
ATTACH_ERROR_FILE_S_ALREADY_ON_SERVER="ERRORE: Il file '%s' è già presente sul server. Seleziona un altro file o rinominalo!"
ATTACH_ERROR_FILE_S_NOT_FOUND_ON_SERVER="ERROR: Il file '%s' non esiste sul server!"
ATTACH_ERROR_FILE_S_TOO_BIG_N_N_N="Il file '%s' è troppo grande %.1f MB (max attachment size=%d MB, max PHP upload size=%d MB)"
ATTACH_ERROR_ILLEGAL_FILE_EXTENSION="Estensione del file non consentita:"
ATTACH_ERROR_ILLEGAL_FILE_MIME_TYPE="Tipo MIME del file non consentito:"
ATTACH_ERROR_INVALID_ATTACHMENT_ID_N="ERRORE: ID allegato (%s) non valida"
ATTACH_ERROR_INVALID_PARENT_TYPE_S="ERRORE: Tipo genitore non valido ('%s')!"
ATTACH_ERROR_INVALID_SAVE_PARAMETERS="ERRORE: Parametri di salvataggio non validi!"
ATTACH_ERROR_IN_URL_SYNTAX_S="Errore nella sintassi URL: '%s'!"
ATTACH_ERROR_MAY_BE_LARGER_THAN_LIMIT="Probabilmente il tuo file è più grande del limite consentito di"
ATTACH_ERROR_MOVING_FILE="Errore nel caricamento (errore nello spostamento del file)"
ATTACH_ERROR_NO_FUNCTION_SPECIFIED="ERRORE:Nessuna funzione specificata!"
ATTACH_ERROR_NO_PARENT_ENTITY_SPECIFIED="ERRORE: Non è stata specificata nessuna entità genitore!"
ATTACH_ERROR_NO_PARENT_ID_SPECIFIED="ERRORE: Non è stato indicata l'ID del genitore!"
ATTACH_ERROR_NO_PARENT_TYPE_SPECIFIED="ERRORE: Non è stato indicato il tipo di genitore!"
ATTACH_ERROR_NO_PERMISSION_TO_DELETE_ATTACHMENT="ERRORE: eliminazione di questo allegato non è consentita!"
ATTACH_ERROR_NO_PERMISSION_TO_DELETE_S="ERRORE: Non disponi delle autorizzazioni necessarie per cancellare un allegato per questo %s!"
ATTACH_ERROR_NO_PERMISSION_TO_DOWNLOAD="ERRORE: Non disponi delle autorizzazioni necessarie per eseguire il download di questo allegato!"
ATTACH_ERROR_NO_PERMISSION_TO_UPLOAD_S="ERRORE: non disponi dell'autorizzazione per aggiungere un allegato a questo %s!"
ATTACH_ERROR_SAVING_FILE_ATTACHMENT_RECORD="Errore durante il salvataggio del record relativo al file allegato!"
ATTACH_ERROR_SAVING_URL_ATTACHMENT_RECORD="Errore durante il salvataggio del record relativo all'URL!"
ATTACH_ERROR_UNABLE_TO_CREATE_DIR_S="ERRORE: Impossibile creare la directory! <p>'%s'</p>"
ATTACH_ERROR_UNABLE_TO_FIND_MODEL="ERRORE: Impossibile trovare il modello!"
ATTACH_ERROR_UNABLE_TO_FIND_VIEW="ERRORE: Impossibile trovare la vista!"
ATTACH_ERROR_UNABLE_TO_SETUP_UPLOAD_DIR_S="ERRORW: Impossibile creare o impostare la directory di upload (%s)!"
ATTACH_ERROR_UNKNOWN_PARENT_ID="ERRORW: ID genitore sconosciuto!"
ATTACH_ERROR_UNKNOWN_PARENT_TYPE_S="ERRORE: Tipo genitore sconosciuto '%s'!"
ATTACH_ERROR_UNKNOWN_PROTCOL_S_IN_URL_S="ERRORE: Protocollo sconosciuto '%s' nell'URL: '%s'!"
ATTACH_ERROR_UPLOADING_FILE_S="Errore durante il caricamento del file '%s'!"
ATTACH_EXISTING_ATTACHMENTS="Allegati&nbsp;Esistenti"
ATTACH_FILENAME_COLON="Nome del File:"
ATTACH_FILE_SIZE_KB="Dimensione(KB)"
ATTACH_FILE_TYPE="Tipo di File"
ATTACH_FOR_PARENT_S_COLON_S="Per %s: <i>'%s'</i>"
ATTACH_LAST_MODIFIED_ON_D_BY_S="Modificato l'ultima volta il %s da: %s"
ATTACH_NORMAL_UPDATE="Aggiornamento normale"
ATTACH_NORMAL_UPDATE_TOOLTIP="Aggiornamento normale (modifica delle sole info dell'allegato)"
ATTACH_NOTE_ENTER_URL_WITH_HTTP="NOTA: Inseriere URL con il prefisso 'http...' ; diversamente l'URL è ritenuto relativo."
ATTACH_OPTIONAL="(Facoltativo)"
ATTACH_PUBLISHED="Pubblicato"
ATTACH_REALLY_DELETE_ATTACHMENT="Confermi la cancellazione dell'allegato?"
ATTACH_RELATIVE_URL="URL relativo"
ATTACH_RELATIVE_URL_TOOLTIP="Spunta questo box per inserire un URL relativo a questo sito Joomla!. Probabilmente dovrai anche desiabilitare 'Verifica URL' per inserire un URL relativo."
ATTACH_SELECT_FILE_TO_UPLOAD_INSTEAD="Seleziona il file da caricare"
ATTACH_SELECT_NEW_FILE_IF_YOU_WANT_TO_UPDATE_ATTACHMENT_FILE="Seleziona un nuovo file (se desideri aggiornare il file dell'allegato):"
ATTACH_UNKNOWN_CONTROLLER="Controller sconosciuto!"
ATTACH_UPDATE="Aggiorna"
ATTACH_UPDATED_ATTACHMENT="Allegato aggiornato"
ATTACH_UPDATE_ATTACHMENT_COLON="Aggiorna l'allegato:"
ATTACH_UPDATE_ATTACHMENT_FILE_S="Aggiorna File Allegato: '%s'"
ATTACH_UPDATE_ATTACHMENT_FOR_PARENT_S_COLON_S="Aggiorna allegato per %s: <i>'%s'</i>"
ATTACH_UPDATE_ATTACHMENT_URL_S="Aggiorna l'URL dell'allegato: '%s'"
ATTACH_UPLOAD_ATTACHMENT="Carica allegato"
ATTACH_UPLOAD_CANCELED="Caricamento interrotto!"
ATTACH_UPLOAD_VERB="Carica"
ATTACH_URL_IS_VALID="URL è valido"
ATTACH_URL_IS_VALID_TOOLTIP="Usa questo checkbox per indicare manualmente se il link è valido. Ignorato nel caso di link nuovi o modificati."
ATTACH_VERIFY_URL_EXISTENCE="Verifca esistenza dell'URL?"
ATTACH_VERIFY_URL_EXISTENCE_TOOLTIP="Seleziona questo checkbox per verificare se l'URL è corretto (solo per URL nuovi o modificati). Disabilitandolo sarè comunque verificata la correttezza dell'URL."
ATTACH_WARNING="Attenzione!"
ATTACH_WARNING_ADMIN_MUST_PUBLISH="<strong>NOTA:</strong> Il tuo allegato non sarà pubblicato automaticamente. Per la pubblicazione contatta l'amministratore del sistema."
ATTACH_WARNING_FILENAME_TRUNCATED="Attenzione: il nome del file era troppo lungo! E' stato troncato a:"
ATTACH_WARNING_MUST_LOGIN_TO_DOWNLOAD_ATTACHMENT="ATTENZIONE: devi avere fatto l'accesso per scaricare questo allegato!"
ATTACH_WARNING_YOU_ARE_ALREADY_LOGGED_IN="ATTENZIONE: hai già fatto l'accesso!"
ATTACH_YOU_MUST_SELECT_A_FILE_TO_UPLOAD="Devi selezionare un file da caricare!"

View File

@ -0,0 +1,30 @@
<?php
/**
* Attachments component Legacy controller class compatibility
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2011-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access.
defined('_JEXEC') or die('Restricted access');
if (!class_exists('JControllerLegacy', false))
{
if (version_compare(JVERSION, '3.0', 'ge'))
{
// Joomla 3.0
jimport('legacy.controller.legacy');
}
else if (version_compare(JVERSION, '2.5', 'ge'))
{
// Joomla 2.5
jimport('cms.controller.legacy');
}
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Attachments component Legacy controllerForm class compatibility
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2011-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access.
defined('_JEXEC') or die('Restricted access');
if (!class_exists('JControllerFormLegacy', false))
{
if (version_compare(JVERSION, '3.0', 'ge'))
{
// Joomla 3.0
jimport('legacy.controller.form');
class JControllerFormLegacy extends JControllerForm
{
}
}
else if (version_compare(JVERSION, '2.5', 'ge'))
{
// Joomla 2.5
if (!class_exists('JControllerForm', false))
{
jimport('joomla.application.component.controllerform');
}
class JControllerFormLegacy extends JControllerForm
{
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,30 @@
<?php
/**
* Attachments component Legacy model class compatibility
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2011-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access.
defined('_JEXEC') or die('Restricted access');
if (!class_exists('JModelLegacy', false))
{
if (version_compare(JVERSION, '3.0', 'ge'))
{
// Joomla 3.0
jimport('legacy.model.legacy');
}
else if (version_compare(JVERSION, '2.5', 'ge'))
{
// Joomla 2.5
jimport('cms.model.legacy');
}
}

View File

@ -0,0 +1,30 @@
<?php
/**
* Attachments component Legacy view class compatibility
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2011-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access.
defined('_JEXEC') or die('Restricted access');
if (!class_exists('JViewLegacy', false))
{
if (version_compare(JVERSION, '3.0', 'ge'))
{
// Joomla 3.0
jimport('legacy.view.legacy');
}
else if (version_compare(JVERSION, '2.5', 'ge'))
{
// Joomla 2.5
jimport( 'joomla.application.component.view' );
jimport('cms.view.legacy');
}
}

View File

@ -0,0 +1,215 @@
<?php
/**
* Attachment model definition
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
defined('_JEXEC') or die('Restricted access');
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/legacy/model.php');
/**
* Attachment Model
*
* @package Attachments
*/
class AttachmentsModelAttachment extends JModelLegacy
{
/**
* Attachment ID
*/
var $_id = null;
/**
* Attachment object/data
*
* @var object
*/
var $_attachment = null;
/**
* Constructor, build object and determines its ID
*/
public function __construct()
{
parent::__construct();
// Get the cid array from the request
$cid = JRequest::getVar('cid', false, 'DEFAULT', 'array');
if ($cid) {
// Accept only the first id from the array
$id = $cid[0];
}
else {
$id = JRequest::getInt('id',0);
}
$this->setId($id);
}
/**
* Reset the model ID and data
*/
public function setId($id=0)
{
$this->_id = $id;
$this->_attachment = null;
}
/**
* Load the attachment data
*
* @return true if loaded successfully
*/
private function _loadAttachment()
{
if ($this->_id == 0) {
return false;
}
if ( empty($this->_attachment) ) {
$user = JFactory::getUser();
$user_levels = $user->getAuthorisedViewLevels();
// If the user is not logged in, add extra view levels (if configured)
if ( $user->get('username') == '' ) {
// Get the component parameters
jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams('com_attachments');
// Add the specified access levels
$guest_levels = $params->get('show_guest_access_levels', Array('1'));
if (is_array($guest_levels)) {
foreach ($guest_levels as $glevel) {
$user_levels[] = $glevel;
}
}
else {
$user_levels[] = $glevel;
}
}
$user_levels = implode(',', array_unique($user_levels));
// Load the attachment data and make sure this user has access
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select('a.*, a.id as id');
$query->from('#__attachments as a');
$query->where('a.id = '.(int)$this->_id);
if ( !$user->authorise('core.admin') ) {
$query->where('a.access in ('.$user_levels.')');
}
$db->setQuery($query, 0, 1);
$this->_attachment = $db->loadObject();
if ( empty($this->_attachment) ) {
return false;
}
// Retrieve the information about the parent
$parent_type = $this->_attachment->parent_type;
$parent_entity = $this->_attachment->parent_entity;
JPluginHelper::importPlugin('attachments');
$apm = getAttachmentsPluginManager();
if ( !$apm->attachmentsPluginInstalled($parent_type) ) {
$this->_attachment->parent_type = false;
return false;
}
$parent = $apm->getAttachmentsPlugin($parent_type);
// Set up the parent info
$parent_id = $this->_attachment->parent_id;
$this->_attachment->parent_title = $parent->getTitle($parent_id, $parent_entity);
$this->_attachment->parent_published =
$parent->isParentPublished($parent_id, $parent_entity);
}
return true;
}
/**
* Create a new Attachment object
*/
private function _initAttachment()
{
echo "_initData not implemented yet <br />";
return null;
}
/**
* Get the data
*
* @return object
*/
public function getAttachment()
{
if ( !$this->_loadAttachment() ) {
// If the load fails, create a new one
$this->_initAttachment();
}
return $this->_attachment;
}
/**
* Save the attachment
*
* @param object $data mixed object or associative array of data to save
*
* @return Boolean true on success
*/
public function save($data)
{
// Get the table
$table = $this->getTable('Attachments');
// Save the data
if ( !$table->save($data) ) {
// An error occured, save the model error message
$this->setError($table->getError());
return false;
}
return true;
}
/**
* Increment the download cout
*
* @param int $attachment_id the attachment ID
*/
public function incrementDownloadCount()
{
// Update the download count
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->update('#__attachments')->set('download_count = (download_count + 1)');
$query->where('id = ' .(int)$this->_id);
$db->setQuery($query);
if ( !$db->query() ) {
$errmsg = $db->stderr() . ' (ERR 49)';
JError::raiseError(500, $errmsg);
}
}
}

View File

@ -0,0 +1,580 @@
<?php
/**
* Attachment list model definition
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.helper');
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/legacy/model.php');
/**
* Attachment List Model for all attachments belonging to one
* content article (or other content-related entity)
*
* @package Attachments
*/
class AttachmentsModelAttachments extends JModelLegacy
{
/**
* ID of parent of the list of attachments
*/
var $_parent_id = null;
/**
* type of parent
*/
var $_parent_type = null;
/**
* type of parent entity (each parent_type can support several)
*/
var $_parent_entity = null;
/**
* Parent class object (an Attachments extension plugin object)
*/
var $_parent = null;
/**
* Parent title
*/
var $_parent_title = null;
/**
* Parent entity name
*/
var $_parent_entity_name = null;
/**
* Whether some of the attachments should be visible to the user
*/
var $_some_visible = null;
/**
* Whether some of the attachments should be modifiable to the user
*/
var $_some_modifiable = null;
/**
* The desired sort order
*/
var $_sort_order;
/**
* The list of attachments for the specified article/content entity
*/
var $_list = null;
/**
* Number of attachments
*
* NOTE: After the list of attachments has been retrieved, if it is empty, this is set to zero.
* But _list remains null. You can use this to check to see if the list has been loaded.
*/
var $_num_attachments = null;
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
}
/**
* Set the parent id (and optionally the parent type)
*
* NOTE: If the $id is null, it will get both $id and $parent_id from JRequest
*
* @param int $id the id of the parent
* @param string $parent_type the parent type (defaults to 'com_content')
* @param string $parent_entity the parent entity (defaults to 'default')
*/
public function setParentId($id=null, $parent_type='com_content', $parent_entity='default')
{
// Get the parent id and type
if ( is_numeric($id) ) {
$parent_id = (int)$id;
}
else {
// It was not an argument, so get parent id and type from the JRequest
$parent_id = JRequest::getInt('article_id', null);
// Deal with special case of editing from the front end
if ( $parent_id == null ) {
if ( (JRequest::getCmd('view') == 'article') &&
(JRequest::getCmd('task') == 'edit' )) {
$parent_id = JRequest::getInt('id', null);
}
}
// If article_id is not specified, get the general parent id/type
if ( $parent_id == null ) {
$parent_id = JRequest::getInt('parent_id', null);
if ( $parent_id == null ) {
$errmsg = JText::_('ATTACH_ERROR_NO_PARENT_ID_SPECIFIED') . ' (ERR 50)';
JError::raiseError(500, $errmsg);
}
}
}
// Reset instance variables
$this->_parent_id = $parent_id;
$this->_parent_type = $parent_type;
$this->_parent_entity = $parent_entity;
$this->_parent = null;
$this->_parent_class = null;
$this->_parent_title = null;
$this->_parent_entity_name = null;
$this->_list = null;
$this->_sort_order = null;
$this->_some_visible = null;
$this->_some_modifiable = null;
$this->_num_attachments = null;
}
/**
* Get the parent id
*
* @return the parent id
*/
public function getParentId()
{
if ( $this->_parent_id === null ) {
$errmsg = JText::_('ATTACH_ERROR_NO_PARENT_ID_SPECIFIED') . ' (ERR 51)';
JError::raiseError(500, $errmsg);
}
return $this->_parent_id;
}
/**
* Get the parent type
*
* @return the parent type
*/
public function getParentType()
{
if ( $this->_parent_type == null ) {
$errmsg = JText::_('ATTACH_ERROR_NO_PARENT_TYPE_SPECIFIED') . ' (ERR 52)';
throw Exception($errmsg);
// JError::raiseError(500, $errmsg);
}
return $this->_parent_type;
}
/**
* Get the parent entity
*
* @return the parent entity
*/
public function getParentEntity()
{
if ( $this->_parent_entity == null ) {
$errmsg = JText::_('ATTACH_ERROR_NO_PARENT_ENTITY_SPECIFIED') . ' (ERR 53)';
JError::raiseError(500, $errmsg);
}
// Make sure we have a good parent_entity value
if ( $this->_parent_entity == 'default' ) {
$parent = $this->getParentClass();
$this->_parent_entity = $parent->getDefaultEntity();
}
return $this->_parent_entity;
}
/**
* Get the parent class object
*
* @return the parent class object
*/
public function &getParentClass()
{
if ( $this->_parent_type == null ) {
$errmsg = JText::_('ATTACH_ERROR_NO_PARENT_TYPE_SPECIFIED') . ' (ERR 54)';
JError::raiseError(500, $errmsg);
}
if ( $this->_parent_class == null ) {
// Get the parent handler
JPluginHelper::importPlugin('attachments');
$apm = getAttachmentsPluginManager();
if ( !$apm->attachmentsPluginInstalled($this->_parent_type) ) {
$errmsg = JText::sprintf('ATTACH_ERROR_INVALID_PARENT_TYPE_S', $parent_type) . ' (ERR 55)';
JError::raiseError(500, $errmsg);
}
$this->_parent_class = $apm->getAttachmentsPlugin($this->_parent_type);
}
return $this->_parent_class;
}
/**
* Get the title for the parent
*
* @return the title for the parent
*/
public function getParentTitle()
{
// Get the title if we have not done it before
if ( $this->_parent_title == null ) {
$parent = $this->getParentClass();
// Make sure we have an article ID
if ( $this->_parent_id === null ) {
$errmsg = JText::_('ATTACH_ERROR_UNKNOWN_PARENT_ID') . ' (ERR 56)';
JError::raiseError(500, $errmsg);
}
$this->_parent_title = $parent->getTitle( $this->_parent_id, $this->_parent_entity );
}
return $this->_parent_title;
}
/**
* Get the EntityName for the parent
*
* @return the entity name for the parent
*/
public function getParentEntityName()
{
// Get the parent entity name if we have not done it before
if ( $this->_parent_entity_name == null ) {
// Make sure we have an article ID
if ( $this->_parent_id === null ) {
$errmsg = JText::_('ATTACH_ERROR_NO_PARENT_ID_SPECIFIED') . ' (ERR 57)';
JError::raiseError(500, $errmsg);
}
$this->_parent_entity_name = JText::_('ATTACH_' . $this->getParentEntity());
}
return $this->_parent_entity_name;
}
/**
* Set the sort order (do this before doing getAttachmentsList)
*
* @param string $new_sort_order name of the new sort order
*/
public function setSortOrder($new_sort_order)
{
if ( $new_sort_order == 'filename' )
$order_by = 'filename';
else if ( $new_sort_order == 'filename_desc' )
$order_by = 'filename DESC';
else if ( $new_sort_order == 'file_size' )
$order_by = 'file_size';
else if ( $new_sort_order == 'file_size_desc' )
$order_by = 'file_size DESC';
else if ( $new_sort_order == 'description' )
$order_by = 'description';
else if ( $new_sort_order == 'description_desc' )
$order_by = 'description DESC';
else if ( $new_sort_order == 'display_name' )
$order_by = 'display_name, filename';
else if ( $new_sort_order == 'display_name_desc' )
$order_by = 'display_name DESC, filename';
else if ( $new_sort_order == 'created' )
$order_by = 'created';
else if ( $new_sort_order == 'created_desc' )
$order_by = 'created DESC';
else if ( $new_sort_order == 'modified' )
$order_by = 'modified';
else if ( $new_sort_order == 'modified_desc' )
$order_by = 'modified DESC';
else if ( $new_sort_order == 'user_field_1' )
$order_by = 'user_field_1';
else if ( $new_sort_order == 'user_field_1_desc' )
$order_by = 'user_field_1 DESC';
else if ( $new_sort_order == 'user_field_2' )
$order_by = 'user_field_2';
else if ( $new_sort_order == 'user_field_2_desc' )
$order_by = 'user_field_2 DESC';
else if ( $new_sort_order == 'user_field_3' )
$order_by = 'user_field_3';
else if ( $new_sort_order == 'user_field_3_desc' )
$order_by = 'user_field_3 DESC';
else if ( $new_sort_order == 'id' )
$order_by = 'id';
else
$order_by = 'filename';
$this->_sort_order = $order_by;
}
/**
* Get or build the list of attachments
*
* @return the list of attachments for this parent
*/
public function &getAttachmentsList()
{
// Just return it if it has already been created
if ( $this->_list != null ) {
return $this->_list;
}
// Get the component parameters
$params = JComponentHelper::getParams('com_attachments');
// Create the list
// Get the parent id and type
$parent_id = $this->getParentId();
$parent_type = $this->getParentType();
$parent_entity = $this->getParentEntity();
// Use parent entity corresponding to values saved in the attachments table
$parent = $this->getParentClass();
// Define the list order
if ( ! $this->_sort_order ) {
$this->_sort_order = 'filename';
}
// Determine allowed access levels
$db = JFactory::getDBO();
$user = JFactory::getUser();
$user_levels = $user->getAuthorisedViewLevels();
// If the user is not logged in, add extra view levels (if configured)
$secure = $params->get('secure', false);
$logged_in = $user->get('username') <> '';
if ( !$logged_in AND $secure ) {
$user_levels = Array('1'); // Override the authorised levels
// NOTE: Public attachments are ALWAYS visible
$guest_levels = $params->get('show_guest_access_levels', Array());
if (is_array($guest_levels)) {
foreach ($guest_levels as $glevel) {
$user_levels[] = $glevel;
}
}
else {
$user_levels[] = $glevel;
}
}
$user_levels = implode(',', array_unique($user_levels));
// Create the query
$query = $db->getQuery(true);
$query->select('a.*, u.name as creator_name')->from('#__attachments AS a');
$query->leftJoin('#__users AS u ON u.id = a.created_by');
if ( $parent_id == 0 ) {
// If the parent ID is zero, the parent is being created so we have
// do the query differently
$user_id = $user->get('id');
$query->where('a.parent_id IS NULL AND u.id=' . (int)$user_id);
}
else {
$query->where('a.parent_id='.(int)$parent_id);
// Handle the state part of the query
if ( $user->authorise('core.edit.state', 'com_attachments') ) {
// Do not filter on state since this user can change the state of any attachment
}
elseif ( $user->authorise('attachments.edit.state.own', 'com_attachments') ) {
$query->where('((a.created_by = '.(int)$user->id.') OR (a.state = 1))');
}
elseif ( $user->authorise('attachments.edit.state.ownparent', 'com_attachments') ) {
// The user can edit the state of any attachment if they created the article/parent
$parent_creator_id = $parent->getParentCreatorId($parent_id, $parent_entity);
if ( (int)$parent_creator_id == (int)$user->get('id') ) {
// Do not filter on state since this user can change the state of any attachment on this article/parent
}
else {
// Since the user is not the creator, they should only see published attachments
$query->where('a.state = 1');
}
}
else {
// For everyone else only show published attachments
$query->where('a.state = 1');
}
}
$query->where('a.parent_type=' . $db->quote($parent_type) . ' AND a.parent_entity=' . $db->quote($parent_entity));
if ( !$user->authorise('core.admin') ) {
$query->where('a.access IN ('.$user_levels.')');
}
$query->order($this->_sort_order);
// Do the query
$db->setQuery($query);
$attachments = $db->loadObjectList();
if ( $db->getErrorNum() ) {
$errmsg = $db->stderr() . ' (ERR 58)';
JError::raiseError(500, $errmsg);
}
$this->_some_visible = false;
$this->_some_modifiable = false;
// Install the list of attachments in this object
$this->_num_attachments = count($attachments);
// The query only returns items that are visible/accessible for
// the user, so if it contains anything, they will be visible
$this->_some_visible = $this->_num_attachments > 0;
// Add permissions for each attachment in the list
if ( $this->_num_attachments > 0 ) {
$this->_list = $attachments;
// Add the permissions to each row
$parent = $this->getParentClass();
// Add permissions
foreach ( $attachments as $attachment ) {
$attachment->user_may_delete = $parent->userMayDeleteAttachment($attachment);
$attachment->user_may_edit = $parent->userMayEditAttachment($attachment);
if ( $attachment->user_may_edit ) {
$this->_some_modifiable = true;
}
}
// Fix relative URLs
foreach ( $attachments as $attachment ) {
if ( $attachment->uri_type == 'url' ) {
$url = $attachment->url;
if ( strpos($url, '://') === false ) {
$uri = JFactory::getURI();
$attachment->url = $uri->base(true) . '/' . $url;
}
}
}
}
// Finally, return the list!
return $this->_list;
}
/**
* Get the number of attachments
*
* @return the number of attachments for this parent
*/
public function numAttachments()
{
return $this->_num_attachments;
}
/**
* Are some of the attachments be visible?
*
* @return true if there are attachments and some should be visible
*/
public function someVisible()
{
// See if the attachments list has been loaded
if ( $this->_list == null ) {
// See if we have already loaded the attachements list
if ( $this->_num_attachments === 0 ) {
return false;
}
// Since the attachments have not been loaded, load them now
$this->getAttachmentsList();
}
return $this->_some_visible;
}
/**
* Should some of the attachments be modifiable?
*
* @return true if there are attachments and some should be modifiable
*/
public function someModifiable()
{
// See if the attachments list has been loaded
if ( $this->_list == null ) {
// See if we have already loaded the attachements list
if ( $this->_num_attachments === 0 ) {
return false;
}
// Since the attachments have not been loaded, load them now
$this->getAttachmentsList();
}
return $this->_some_modifiable;
}
/**
* Returns the types of attachments
*
* @return 'file', 'url', 'both', or false (if no attachments)
*/
public function types()
{
// Make sure the attachments are loaded
if ( $this->_list == null ) {
// See if we have already loaded the attachements list
if ( $this->_num_attachments === 0 ) {
return false;
}
// Since the attachments have not been loaded, load them now
$this->getAttachmentsList();
}
// Scan the attachments
$types = false;
foreach ( $this->_list as $attachment ) {
if ( $types ) {
if ( $attachment->uri_type != $types ) {
return 'both';
}
}
else {
$types = $attachment->uri_type;
}
}
return $types;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,260 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
defined('_JEXEC') or die('Restricted access');
/**
* Build the route
*
* @param &object &$query the query to construct
*
* @return the segments
*/
function AttachmentsBuildRoute(&$query)
{
// Syntax to upload an attachment:
// index.php?option=com_attachments&task=upload&article_id=44
// --> index.php/attachments/upload/article/44
// or:
// index.php?option=com_attachments&task=upload&parent_id=44
// --> index.php/attachments/upload/parent/44
// Syntax to delete an attachment:
// index.php?option=com_attachments&task=delete&id=4&article_id=44&from=article
// --> /attachments/delete/4/artcile/44
// --> /attachments/delete/4/article/44/from/article
// or:
// index.php?option=com_attachments&task=delete&id=4&parent_id=44&from=parent
// --> /attachments/delete/4/parent/44
// --> /attachments/delete/4/parent/44/from/parent
// Note: The 'from' clause indicates which view the item was called from (eg, article or frontpage)
$segments = array();
// get a menu item based on Itemid or currently active
$app = JFactory::getApplication();
$menu = $app->getMenu();
// we need a menu item. Either the one specified in the query, or the current active one if none specified
if (empty($query['Itemid'])) {
$menuItem = $menu->getActive();
}
else {
$menuItem = $menu->getItem($query['Itemid']);
}
if ( isset($query['task']) ) {
$task = $query['task'];
$segments[] = $task;
unset($query['task']);
}
if ( isset($query['id']) ) {
if ( $task == 'update' ) {
$segments[] = 'id';
}
$segments[] = $query['id'];
unset($query['id']);
}
if ( isset($query['article_id']) ) {
$segments[] = 'article';
$segments[] = $query['article_id'];
unset($query['article_id']);
}
if ( isset($query['parent_id']) ) {
$segments[] = 'parent';
$segments[] = $query['parent_id'];
unset($query['parent_id']);
}
if ( isset($query['parent_type']) ) {
$segments[] = 'parent_type';
$segments[] = $query['parent_type'];
unset($query['parent_type']);
}
if ( isset($query['parent_entity']) ) {
$segments[] = 'parent_entity';
$segments[] = $query['parent_entity'];
unset($query['parent_entity']);
}
if ( isset($query['controller']) ) {
$segments[] = 'controller';
$segments[] = $query['controller'];
unset($query['controller']);
}
if ( isset($query['uri']) ) {
$segments[] = 'uri';
$segments[] = $query['uri'];
unset($query['uri']);
}
if ( isset($query['update']) ) {
$segments[] = 'update';
$segments[] = $query['update'];
unset($query['update']);
}
if ( isset($query['from']) ) {
$segments[] = 'from';
$segments[] = $query['from'];
unset($query['from']);
}
if ( isset($query['tmpl']) ) {
$segments[] = 'tmpl';
$segments[] = $query['tmpl'];
unset($query['tmpl']);
}
return $segments;
}
/**
* Parse the route
*
* @param array $segments
*
* @return the variables parsed from the route
*/
function AttachmentsParseRoute($segments)
{
$vars = array();
// NOTE: The task=taskname pair must ALWAYS on the right after opton=com_attachments.
// if a controller is specified, it must appear later in the URL.
$task = $segments[0];
$vars['task'] = $task;
$i = 1;
// Handle the the main keyword clause that have an id immediately following them
if ( ($task == 'delete') || ($task == 'delete_warning') || ($task == 'download') ) {
$vars['id'] = $segments[$i];
$i = 2;
}
// Handle the other clauses
while ( $i < count($segments) ) {
// Look for article IDs
if ( ($segments[$i] == 'article') && ($segments[$i-1] != 'from') ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'article' without a following article ID!<br />";
exit;
}
$vars['article_id'] = $segments[$i+1];
$i++;
}
// Look for parent ID clause
if ( (($segments[$i] == 'parent') || ($segments[$i] == 'parent_id')) && ($segments[$i-1] != 'from') ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'parent' without a following parent ID!<br />";
exit;
}
$vars['parent_id'] = $segments[$i+1];
$i++;
}
// Look for 'parent_type' clause
if ( $segments[$i] == 'parent_type' ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'parent_type' without the actual type!<br />";
exit;
}
$vars['parent_type'] = $segments[$i+1];
$i++;
}
// Look for 'parent_entity' clause
if ( $segments[$i] == 'parent_entity' ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'parent_entity' without the actual type!<br />";
exit;
}
$vars['parent_entity'] = $segments[$i+1];
$i++;
}
// Look for 'controller' clause
if ( $segments[$i] == 'controller' ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'controller' without controller type!<br />";
exit;
}
$vars['controller'] = $segments[$i+1];
$i++;
}
// Look for 'id' clause
if ( $segments[$i] == 'id' ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'id' without any info!<br />";
exit;
}
$vars['id'] = $segments[$i+1];
}
// Look for 'uri' clause
if ( $segments[$i] == 'uri' ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'uri' without any info!<br />";
exit;
}
$vars['uri'] = $segments[$i+1];
$i++;
}
// Look for 'update' clause
if ( $segments[$i] == 'update' ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'update' without any info!<br />";
exit;
}
$vars['update'] = $segments[$i+1];
$i++;
}
// Look for 'from' clause
if ( $segments[$i] == 'from' ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'from' without any info!<br />";
exit;
}
$vars['from'] = $segments[$i+1];
$i++;
}
// Look for 'tmpl' clause
if ( $segments[$i] == 'tmpl' ) {
if ( $i+1 >= count($segments) ) {
echo "<br />Error in AttachmentsParseRoute: Found 'tmpl' without any template name!<br />";
exit;
}
$vars['tmpl'] = $segments[$i+1];
$i++;
}
$i++;
}
return $vars;
}
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,26 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
?>
<div class="requestLogin">
<?php if ($this->logged_in): ?>
<h1><?php echo JText::_('ATTACH_WARNING_YOU_ARE_ALREADY_LOGGED_IN'); ?></h1>
<?php else: ?>
<h1><?php echo $this->must_be_logged_in; ?></h1>
<h2><a href="<?php echo $this->login_url; ?>"><?php echo $this->login_label; ?></a></h2>
<h2><a href="<?php echo $this->register_url; ?>"><?php echo $this->register_label; ?></a></h2>
<?php endif; ?>
</div>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,75 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// no direct access
defined( '_JEXEC' ) or die('Restricted access');
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/legacy/view.php');
/**
* HTML View class for asking the user to log in
*
* @package Attachments
*/
class AttachmentsViewLogin extends JViewLegacy
{
/**
* Display the login view
*/
public function display($tpl = null)
{
// Add the stylesheets
JHtml::stylesheet('com_attachments/attachments_frontend_form.css', array(), true);
$lang = JFactory::getLanguage();
if ( $lang->isRTL() ) {
JHtml::stylesheet('com_attachments/attachments_frontend_form_rtl.css', array(), true);
}
// Is the user already logged in?
$user = JFactory::getUser();
$this->logged_in = $user->get('username') <> '';
// Get the component parameters for the registration and login URL
jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams('com_attachments');
$base_url = JFactory::getURI()->base(false);
$register_url = $params->get('register_url', 'index.php?option=com_users&view=registration');
$register_url = JRoute::_($base_url . $register_url);
$this->register_url = $register_url;
// Construct the login URL
$return = '';
if ( $this->return_url ) {
$return = '&return=' . $this->return_url;
}
$base_url = JFactory::getURI()->base(false);
$login_url = $params->get('login_url', 'index.php?option=com_users&view=login') . $return;
$this->login_url = JRoute::_($base_url . $login_url);
// Get the warning message
$this->must_be_logged_in = JText::_('ATTACH_WARNING_MUST_LOGIN_TO_DOWNLOAD_ATTACHMENT');
// Get a phrase from the login module to create the account
$lang->load('com_users');
$register = JText::_('COM_USERS_REGISTER_DEFAULT_LABEL');
$this->register_label = $register;
$login = JText::_('JLOGIN');
$this->login_label = $login;
parent::display($tpl);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<metadata>
<view title="ATTACH_UPDATE_DO_NOT_ATTACH_TO_MENU_ITEM" hidden="true">
</view>
</metadata>

View File

@ -0,0 +1,262 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
// Add the plugins stylesheet to style the list of attachments
$user = JFactory::getUser();
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$uri = JFactory::getURI();
$lang = JFactory::getLanguage();
// For convenience
$attachment = $this->attachment;
$params = $this->params;
$update = $this->update;
$parent_id = $attachment->parent_id;
if ( $parent_id === null ) {
$parent_id = 0;
}
// set up URL redisplay in case of errors
$old_url = '';
if ( $this->error_msg && ($update == 'url') ) {
$old_url = $attachment->url;
}
// Decide what type of update to do
if ( $update == 'file' ) {
$enctype = "enctype=\"multipart/form-data\"";
}
else {
$enctype = '';
}
// Prepare for error displays
$update_id = 'upload';
$filename = $attachment->filename;
if ( $this->error ) {
switch ( $this->error ) {
case 'no_file':
$update_id = 'upload_warning';
$filename = '';
break;
case 'file_too_big':
$upload_id = 'upload_warning';
break;
case 'file_already_on_server':
$upload_id = 'upload_warning';
break;
}
}
// Format modified date
jimport( 'joomla.utilities.date' );
$tz = new DateTimeZone( $user->getParam('timezone', $app->getCfg('offset')) );
$mdate = JFactory::getDate($attachment->modified);
$mdate->setTimezone($tz);
$date_format = $params->get('date_format', 'Y-m-d H:i');
$last_modified = $mdate->format($date_format, true);
// If this is an error re-display, display the CSS links directly
$echo_css = $this->error;
/** Load the Attachments helper */
require_once(JPATH_SITE.'/components/com_attachments/helper.php');
require_once(JPATH_SITE.'/components/com_attachments/javascript.php');
// Add the stylesheets
$uri = JFactory::getURI();
AttachmentsJavascript::setupJavascript();
if ( $attachment->uri_type == 'file' ) {
$header_msg = JText::sprintf('ATTACH_UPDATE_ATTACHMENT_FILE_S', $filename);
}
else {
$header_msg = JText::sprintf('ATTACH_UPDATE_ATTACHMENT_URL_S', $attachment->url);
}
// If this is an error re-display, display the CSS links directly
if ( $this->error )
{
echo $this->startHTML();
}
?>
<div id="uploadAttachmentsPage">
<h1><?php echo $header_msg; ?></h1>
<form class="attachments" <?php echo $enctype ?> name="upload_form"
action="<?php echo $this->save_url; ?>" method="post">
<fieldset>
<legend><?php echo JText::sprintf('ATTACH_UPDATE_ATTACHMENT_FOR_PARENT_S_COLON_S',
$attachment->parent_entity_name, $attachment->parent_title); ?></legend>
<?php if ( $this->error_msg ): ?>
<div class="formWarning" id="formWarning"><?php echo $this->error_msg; ?></div>
<?php endif; ?>
<?php if ( $update == 'file' ): ?>
<p><label for="<?php echo $update_id; ?>"><?php
echo JText::_('ATTACH_SELECT_NEW_FILE_IF_YOU_WANT_TO_UPDATE_ATTACHMENT_FILE') ?></label>
<a class="changeButton" href="<?php echo $this->normal_update_url ?>"
title="<?php echo JText::_('ATTACH_NORMAL_UPDATE_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_NORMAL_UPDATE') ?></a> <br />
<input type="file" name="upload" id="<?php echo $update_id; ?>"
size="78" maxlength="1024" />
</p>
<?php elseif ( $update == 'url' ): ?>
<p><label for="<?php echo $update_id; ?>"><?php echo JText::_('ATTACH_ENTER_URL') ?></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<label for="verify_url"><?php echo JText::_('ATTACH_VERIFY_URL_EXISTENCE') ?></label>
<input type="checkbox" name="verify_url" value="verify" <?php echo $this->verify_url_checked ?>
title="<?php echo JText::_('ATTACH_VERIFY_URL_EXISTENCE_TOOLTIP'); ?>" />
&nbsp;&nbsp;&nbsp;&nbsp;
<label for="relative_url"><?php echo JText::_('ATTACH_RELATIVE_URL') ?></label>
<input type="checkbox" name="relative_url" value="relative" <?php echo $this->relative_url_checked ?>
title="<?php echo JText::_('ATTACH_RELATIVE_URL_TOOLTIP'); ?>" />
<a class="changeButton" href="<?php echo $this->normal_update_url ?>"
title="<?php echo JText::_('ATTACH_NORMAL_UPDATE_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_NORMAL_UPDATE') ?></a> <br />
<input type="text" name="url" id="<?php echo $update_id; ?>"
size="80" maxlength="255" title="<?php echo JText::_('ATTACH_ENTER_URL_TOOLTIP'); ?>"
value="<?php echo $old_url; ?>" /><br /><?php
echo JText::_('ATTACH_NOTE_ENTER_URL_WITH_HTTP'); ?>
</p>
<?php else: ?>
<?php if ( $attachment->uri_type == 'file' ): ?>
<p><label><?php echo JText::_('ATTACH_FILENAME_COLON'); ?></label> <?php echo $filename; ?>
<a class="changeButton" href="<?php echo $this->change_file_url ?>"
title="<?php echo JText::_('ATTACH_CHANGE_FILE_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_CHANGE_FILE') ?></a>
<a class="changeButton" href="<?php echo $this->change_url_url ?>"
title="<?php echo JText::_('ATTACH_CHANGE_TO_URL_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_CHANGE_TO_URL') ?></a>
</p>
<?php elseif ( $attachment->uri_type == 'url' ): ?>
<p><label for="<?php echo $update_id; ?>"><?php echo JText::_('ATTACH_ENTER_NEW_URL_COLON') ?></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<label for="verify_url"><?php echo JText::_('ATTACH_VERIFY_URL_EXISTENCE') ?></label>
<input type="checkbox" name="verify_url" value="verify" <?php echo $this->verify_url_checked ?>
title="<?php echo JText::_('ATTACH_VERIFY_URL_EXISTENCE_TOOLTIP'); ?>" />
&nbsp;&nbsp;&nbsp;&nbsp;
<label for="relative_url"><?php echo JText::_('ATTACH_RELATIVE_URL') ?></label>
<input type="checkbox" name="relative_url" value="relative" <?php echo $this->relative_url_checked ?>
title="<?php echo JText::_('ATTACH_RELATIVE_URL_TOOLTIP'); ?>" />
<a class="changeButton" href="<?php echo $this->change_file_url ?>"
title="<?php echo JText::_('ATTACH_CHANGE_TO_FILE_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_CHANGE_TO_FILE') ?></a> </p>
<p><label for="url_valid"><?php echo JText::_('ATTACH_URL_IS_VALID') ?></label>
<?php echo $this->lists['url_valid']; ?>
</p>
<p>
<input type="text" name="url" id="<?php echo $update_id ?>"
size="80" maxlength="255" title="<?php echo JText::_('ATTACH_ENTER_URL_TOOLTIP'); ?>"
value="<?php echo $attachment->url; ?>" /><br /><?php
echo JText::_('ATTACH_NOTE_ENTER_URL_WITH_HTTP'); ?>
<input type="hidden" name="old_url" value="<?php echo $old_url; ?>" />
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( (($attachment->uri_type == 'file') AND ($update == '') ) OR ($update == 'file') ): ?>
<p class="display_name"><label for="display_name"
title="<?php echo JText::_('ATTACH_DISPLAY_FILENAME_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_DISPLAY_FILENAME_OPTIONAL_COLON'); ?></label>
<input type="text" name="display_name" id="display_name"
size="70" maxlength="80"
title="<?php echo JText::_('ATTACH_DISPLAY_FILENAME_TOOLTIP'); ?>"
value="<?php echo $attachment->display_name; ?>" />
<input type="hidden" name="old_display_name" value="<?php echo $attachment->display_name; ?>" />
</p>
<?php elseif ( (($attachment->uri_type == 'url') AND ($update == '')) OR ($update == 'url') ): ?>
<p class="display_name"><label for="display_name"
title="<?php echo JText::_('ATTACH_DISPLAY_URL_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_DISPLAY_URL_COLON'); ?></label>
<input type="text" name="display_name" id="display_name"
size="70" maxlength="80"
title="<?php echo JText::_('ATTACH_DISPLAY_URL_TOOLTIP'); ?>"
value="<?php echo $attachment->display_name; ?>" />
<input type="hidden" name="old_display_name" value="<?php echo $attachment->display_name; ?>" />
</p>
<?php endif; ?>
<p><label for="description"><?php echo JText::_('ATTACH_DESCRIPTION_COLON'); ?></label>
<input type="text" name="description" id="description"
size="70" maxlength="255" value="<?php echo stripslashes($attachment->description) ?>" /></p>
<?php if ( $this->may_publish ): ?>
<div class="at_control"><label><?php echo JText::_('ATTACH_PUBLISHED'); ?></label><?php echo $this->lists['published']; ?></div>
<?php endif; ?>
<?php if ( $params->get('allow_frontend_access_editing', false) ): ?>
&nbsp;&nbsp;&nbsp;&nbsp;
<div class="at_control"><label for="access" title="<?php echo $this->access_level_tooltip; ?>"><? echo JText::_('ATTACH_ACCESS_COLON'); ?></label> <?php echo $this->access_level; ?></div>
<?php endif; ?>
<?php if ( $params->get('user_field_1_name') ): ?>
<p><label for="user_field_1"><?php echo $params->get('user_field_1_name'); ?>:</label>
<input type="text" name="user_field_1" id="user_field_1" size="70" maxlength="100"
value="<?php echo stripslashes($attachment->user_field_1); ?>" /></p>
<?php endif; ?>
<?php if ( $params->get('user_field_2_name') ): ?>
<p><label for="user_field_2"><?php echo $params->get('user_field_2_name'); ?>:</label>
<input type="text" name="user_field_2" id="user_field_2" size="70" maxlength="100"
value="<?php echo stripslashes($attachment->user_field_2); ?>" /></p>
<?php endif; ?>
<?php if ( $params->get('user_field_3_name') ): ?>
<p><label for="user_field_3"><?php echo $params->get('user_field_3_name'); ?>:</label>
<input type="text" name="user_field_3" id="user_field_3" size="70" maxlength="100"
value="<?php echo stripslashes($attachment->user_field_3); ?>" /></p>
<?php endif; ?>
<p><?php echo JText::sprintf('ATTACH_LAST_MODIFIED_ON_D_BY_S',
$last_modified, $attachment->modifier_name); ?></p>
</fieldset>
<input type="hidden" name="MAX_FILE_SIZE" value="524288" />
<input type="hidden" name="submitted" value="TRUE" />
<input type="hidden" name="id" value="<?php echo $attachment->id; ?>" />
<input type="hidden" name="save_type" value="update" />
<input type="hidden" name="update" value="<?php echo $update; ?>" />
<input type="hidden" name="uri_type" value="<?php echo $attachment->uri_type; ?>" />
<input type="hidden" name="new_parent" value="<?php echo $this->new_parent; ?>" />
<input type="hidden" name="parent_id" value="<?php echo $parent_id; ?>" />
<input type="hidden" name="parent_type" value="<?php echo $attachment->parent_type; ?>" />
<input type="hidden" name="parent_entity" value="<?php echo $attachment->parent_entity; ?>" />
<input type="hidden" name="from" value="<?php echo $this->from; ?>" />
<input type="hidden" name="Itemid" value="<?php echo $this->Itemid; ?>" />
<?php echo JHtml::_( 'form.token' ); ?>
<div class="form_buttons">
<input type="submit" name="submit" value="<?php echo JText::_('ATTACH_UPDATE'); ?>" />
<span class="right">
<input type="button" name="cancel" value="<?php echo JText::_('ATTACH_CANCEL'); ?>"
onClick="window.parent.SqueezeBox.close();" />
</span>
</div>
</form>
<?php
// Generate the list of existing attachments
if ( ($update == 'file') || ($attachment->uri_type == 'file') ) {
require_once(JPATH_SITE.'/components/com_attachments/controllers/attachments.php');
$controller = new AttachmentsControllerAttachments();
$controller->display($parent_id, $attachment->parent_type, $attachment->parent_entity,
'ATTACH_EXISTING_ATTACHMENTS',
false, false, true, $this->from);
}
echo '</div>';
if ( $this->error ) {
echo $this->endHTML();
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,88 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access
defined('_JEXEC') or die();
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/views/view.php');
/** Load the Attachments helper */
require_once(JPATH_SITE.'/components/com_attachments/helper.php');
/**
* View for the uploads
*
* @package Attachments
*/
class AttachmentsViewUpdate extends AttachmentsFormView
{
/**
* Display the view
*/
public function display($tpl=null)
{
// Access check.
if ( !(JFactory::getUser()->authorise('core.edit', 'com_attachments') OR
JFactory::getUser()->authorise('core.edit.own', 'com_attachments')) ) {
return JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR') . ' (ERR 62)');
}
// For convenience
$attachment = $this->attachment;
$parent = $this->parent;
// Construct derived data
$attachment->parent_entity_name = JText::_('ATTACH_' . $attachment->parent_entity);
$attachment->parent_title = $parent->getTitle($attachment->parent_id, $attachment->parent_entity);
if (!isset($attachment->modifier_name))
{
AttachmentsHelper::addAttachmentUserNames($attachment);
}
$this->relative_url_checked = $attachment->url_relative ? 'checked="yes"' : '';
$this->verify_url_checked = $attachment->url_verify ? 'checked="yes"' : '';
$this->may_publish = $parent->userMayChangeAttachmentState($attachment->parent_id,
$attachment->parent_entity,
$attachment->created_by
);
// Set up some HTML for display in the form
$this->lists = Array();
$this->lists['published'] = JHtml::_('select.booleanlist', 'state',
'class="inputbox"', $attachment->state);
$this->lists['url_valid'] = JHtml::_('select.booleanlist', 'url_valid',
'class="inputbox" title="' . JText::_('ATTACH_URL_IS_VALID_TOOLTIP') . '"',
$attachment->url_valid);
// Set up for editing the access level
if ( $this->params->get('allow_frontend_access_editing', false) ) {
require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/fields/accesslevels.php');
$this->access_level = JFormFieldAccessLevels::getAccessLevels('access', 'access', $attachment->access);
$this->access_level_tooltip = JText::_('ATTACH_ACCESS_LEVEL_TOOLTIP');
}
// Add the stylesheets
JHtml::stylesheet('com_attachments/attachments_frontend_form.css', array(), true);
$lang = JFactory::getLanguage();
if ( $lang->isRTL() ) {
JHtml::stylesheet('com_attachments/attachments_frontend_form_rtl.css', array(), true);
}
// Display the form
parent::display($tpl);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<metadata>
<view title="ATTACH_UPLOAD_DO_NOT_ATTACH_TO_MENU_ITEM" hidden="true">
</view>
</metadata>

View File

@ -0,0 +1,211 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
// Load the Attachments helper
require_once(JPATH_SITE.'/components/com_attachments/helper.php');
require_once(JPATH_SITE.'/components/com_attachments/javascript.php');
// Add the plugins stylesheet to style the list of attachments
$uri = JFactory::getURI();
// Add javascript
AttachmentsJavascript::setupJavascript();
AttachmentsJavascript::setupModalJavascript();
// For convenience
$attachment = $this->attachment;
$params = $this->params;
// Get the parent id and a few other convenience items
$parent_id = $attachment->parent_id;
if ( $parent_id === null ) {
$parent_id = 0;
}
// Set up to toggle between uploading file/urls
if ( $attachment->uri_type == 'file' ) {
$upload_toggle_button_text = JText::_('ATTACH_ENTER_URL_INSTEAD');
$upload_toggle_url = $this->upload_url_url;
$upload_button_text = JText::_('ATTACH_UPLOAD_VERB');
}
else {
$upload_toggle_button_text = JText::_('ATTACH_SELECT_FILE_TO_UPLOAD_INSTEAD');
$upload_toggle_url = $this->upload_file_url;
$upload_button_text = JText::_('ATTACH_ADD_URL');
}
// If this is for an existing content item, modify the URL appropriately
if ( $this->new_parent ) {
$upload_toggle_url .= "&amp;parent_id=0,new";
}
if ( JRequest::getWord('editor') ) {
$upload_toggle_url .= "&amp;editor=" . JRequest::getWord('editor');
}
// Needed URLs
$save_url = JRoute::_($this->save_url);
$base_url = $uri->root(true) . '/';
// Prepare for error displays
$upload_id = 'upload';
switch ( $this->error ) {
case 'no_file':
$upload_id = 'upload_warning';
break;
case 'file_too_big':
$upload_id = 'upload_warning';
break;
case 'file_already_on_server':
$upload_id = 'upload_warning';
break;
}
// If this is an error re-display, display the CSS links directly
if ( $this->error )
{
echo $this->startHTML();
}
// Display the form
?>
<div id="uploadAttachmentsPage">
<h1><?php echo JText::sprintf('ATTACH_FOR_PARENT_S_COLON_S', $attachment->parent_entity_name, $attachment->parent_title) ?></h1>
<form class="attachments" enctype="multipart/form-data" name="upload_form"
action="<?php echo $this->save_url; ?>" method="post">
<fieldset>
<legend><?php echo JText::_('ATTACH_UPLOAD_ATTACHMENT'); ?></legend>
<?php if ( $this->error_msg ): ?>
<div class="formWarning" id="formWarning"><?php echo $this->error_msg; ?></div>
<?php endif; ?>
<?php if ( $attachment->uri_type == 'file' ): ?>
<p><label for="<?php echo $upload_id ?>"><?php
echo JText::_('ATTACH_ATTACH_FILE_COLON') ?></label>
<a class="changeButton" href="<?php echo $upload_toggle_url ?>"><?php
echo $upload_toggle_button_text;?></a></p>
<p><input type="file" name="upload" id="<?php echo $upload_id; ?>"
size="78" maxlength="1024" /></p>
<p class="display_name"><label for="display_name"
title="<?php echo JText::_('ATTACH_DISPLAY_FILENAME_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_DISPLAY_FILENAME_OPTIONAL_COLON'); ?></label>
<input type="text" name="display_name" id="display_name"
size="70" maxlength="80"
title="<?php echo JText::_('ATTACH_DISPLAY_FILENAME_TOOLTIP'); ?>"
value="<?php echo $attachment->display_name; ?>" /></p>
<?php else: ?>
<p><label for="<?php echo $upload_id ?>"><?php
echo JText::_('ATTACH_ENTER_URL') ?></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<label for="verify_url"><?php echo JText::_('ATTACH_VERIFY_URL_EXISTENCE') ?></label>
<input type="checkbox" name="verify_url" value="verify" <?php echo $this->verify_url_checked ?>
title="<?php echo JText::_('ATTACH_VERIFY_URL_EXISTENCE_TOOLTIP'); ?>" />
&nbsp;&nbsp;&nbsp;&nbsp;
<label for="relative_url"><?php echo JText::_('ATTACH_RELATIVE_URL') ?></label>
<input type="checkbox" name="relative_url" value="relative" <?php echo $this->relative_url_checked ?>
title="<?php echo JText::_('ATTACH_RELATIVE_URL_TOOLTIP'); ?>" />
<a class="changeButton" href="<?php echo $upload_toggle_url ?>"><?php
echo $upload_toggle_button_text;?></a><br />
<input type="text" name="url" id="<?php echo $upload_id; ?>"
size="80" maxlength="255" title="<?php echo JText::_('ATTACH_ENTER_URL_TOOLTIP'); ?>"
value="<?php echo $attachment->url; ?>" /><br /><?php
echo JText::_('ATTACH_NOTE_ENTER_URL_WITH_HTTP'); ?></p>
<p class="display_name"><label for="display_name"
title="<?php echo JText::_('ATTACH_DISPLAY_URL_TOOLTIP'); ?>"
><?php echo JText::_('ATTACH_DISPLAY_URL_COLON'); ?></label>
<input type="text" name="display_name" id="display_name"
size="70" maxlength="80"
title="<?php echo JText::_('ATTACH_DISPLAY_URL_TOOLTIP'); ?>"
value="<?php echo $attachment->display_name; ?>" /></p>
<?php endif; ?>
<p><label for="description"><?php echo JText::_('ATTACH_DESCRIPTION_COLON'); ?></label>
<input type="text" name="description" id="description"
size="70" maxlength="255"
value="<?php echo stripslashes($attachment->description); ?>" /></p>
<?php if ( $this->may_publish ): ?>
<div class="at_control"><label><?php echo JText::_('ATTACH_PUBLISHED'); ?></label><?php echo $this->publish; ?></div>
<?php endif; ?>
<?php if ( $params->get('allow_frontend_access_editing', false) ): ?>
&nbsp;&nbsp;&nbsp;&nbsp;
<div class="at_control"><label for="access" title="<?php echo $this->access_level_tooltip; ?>"><? echo JText::_('ATTACH_ACCESS_COLON'); ?></label> <?php echo $this->access_level; ?></div>
<?php endif; ?>
<?php if ( $params->get('user_field_1_name', false) ): ?>
<p><label for="user_field_1"><?php echo $params->get('user_field_1_name'); ?>:</label>
<input type="text" name="user_field_1" id="user_field_1" size="70" maxlength="100"
value="<?php echo stripslashes($attachment->user_field_1); ?>" /></p>
<?php endif; ?>
<?php if ( $params->get('user_field_2_name', false) ): ?>
<p><label for="user_field_2"><?php echo $params->get('user_field_2_name'); ?>:</label>
<input type="text" name="user_field_2" id="user_field_2" size="70" maxlength="100"
value="<?php echo stripslashes($attachment->user_field_2); ?>" /></p>
<?php endif; ?>
<?php if ( $params->get('user_field_3_name', false) ): ?>
<p><label for="user_field_3"><?php echo $params->get('user_field_3_name'); ?>:</label>
<input type="text" name="user_field_3" id="user_field_3" size="70" maxlength="100"
value="<?php echo stripslashes($attachment->user_field_3); ?>" /></p>
<?php endif; ?>
</fieldset>
<input type="hidden" name="MAX_FILE_SIZE" value="524288" />
<input type="hidden" name="submitted" value="TRUE" />
<input type="hidden" name="save_type" value="upload" />
<input type="hidden" name="uri_type" value="<?php echo $attachment->uri_type; ?>" />
<input type="hidden" name="update_file" value="TRUE" />
<input type="hidden" name="parent_id" value="<?php echo $parent_id; ?>" />
<input type="hidden" name="parent_type" value="<?php echo $attachment->parent_type; ?>" />
<input type="hidden" name="parent_entity" value="<?php echo $attachment->parent_entity; ?>" />
<input type="hidden" name="new_parent" value="<?php echo $this->new_parent; ?>" />
<input type="hidden" name="from" value="<?php echo $this->from; ?>" />
<input type="hidden" name="Itemid" value="<?php echo $this->Itemid; ?>" />
<?php echo JHtml::_( 'form.token' ); ?>
<br/><div class="form_buttons">
<input type="submit" name="submit" value="<?php echo $upload_button_text ?>" />
<span class="right">
<input type="button" name="cancel" value="<?php echo JText::_('ATTACH_CANCEL'); ?>"
onClick="window.parent.SqueezeBox.close();" />
</span>
</div>
</form>
<?php
// Display the auto-publish warning, if appropriate
if ( !$params->get('publish_default', false) && !$this->may_publish ) {
$msg = $params->get('auto_publish_warning', '');
if ( JString::strlen($msg) == 0 ) {
$msg = JText::_('ATTACH_WARNING_ADMIN_MUST_PUBLISH');
}
else {
$msg = JText::_($msg);
}
echo "<h2>$msg</h2>";
}
// Show the existing attachments (if any)
if ( $parent_id || ($parent_id === 0) ) {
require_once(JPATH_SITE.'/components/com_attachments/controllers/attachments.php');
$controller = new AttachmentsControllerAttachments();
$controller->displayString($parent_id, $attachment->parent_type, $attachment->parent_entity,
'ATTACH_EXISTING_ATTACHMENTS',
false, false, true, $this->from);
}
echo "</div>";
if ( $this->error ) {
echo $this->endHTML();
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,77 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access
defined('_JEXEC') or die();
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/views/view.php');
/**
* View for the uploads
*
* @package Attachments
*/
class AttachmentsViewUpload extends AttachmentsFormView
{
/**
* Display the view
*/
public function display($tpl=null)
{
// Access check.
if (!JFactory::getUser()->authorise('core.create', 'com_attachments')) {
return JError::raiseError(404, JText::_('JERROR_ALERTNOAUTHOR') . ' (ERR 64)' );
}
// For convenience below
$attachment = $this->attachment;
$parent = $this->parent;
// Set up for editing the access level
if ( $this->params->get('allow_frontend_access_editing', false) ) {
require_once(JPATH_COMPONENT_ADMINISTRATOR.'/models/fields/accesslevels.php');
$this->access_level = JFormFieldAccessLevels::getAccessLevels('access', 'access', null);
$this->access_level_tooltip = JText::_('ATTACH_ACCESS_LEVEL_TOOLTIP');
}
// Set up publishing info
$user = JFactory::getUser();
$this->may_publish = $parent->userMayChangeAttachmentState($attachment->parent_id,
$attachment->parent_entity, $user->id);
if ( $this->may_publish ) {
$this->publish = JHtml::_('select.booleanlist', 'state', 'class="inputbox"', $attachment->state);
}
// Construct derived data
$attachment->parent_entity_name = JText::_('ATTACH_' . $attachment->parent_entity);
$attachment->parent_title = $parent->getTitle($attachment->parent_id, $attachment->parent_entity);
$this->relative_url_checked = $attachment->url_relative ? 'checked="yes"' : '';
$this->verify_url_checked = $attachment->url_verify ? 'checked="yes"' : '';
// Add the stylesheets for the form
JHtml::stylesheet('com_attachments/attachments_frontend_form.css', array(), true);
$lang = JFactory::getLanguage();
if ( $lang->isRTL() ) {
JHtml::stylesheet('com_attachments/attachments_frontend_form_rtl.css', array(), true);
}
// Display the upload form
parent::display($tpl);
}
}

View File

@ -0,0 +1,90 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// No direct access
defined('_JEXEC') or die();
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/legacy/view.php');
/**
* View for the uploads
*
* @package Attachments
*/
class AttachmentsFormView extends JViewLegacy
{
/**
* Return the starting HTML for the page
*
* Note: When displaying a View directly from user code (not a conroller),
* it does not automatically create the HTML <html>, <body> and
* <head> tags. This code fixes that.
*
* There is probably a better way to do this!
*/
protected function startHTML()
{
jimport('joomla.filesystem.file');
require_once JPATH_BASE.'/libraries/joomla/document/html/renderer/head.php';
$document = JFactory::getDocument();
$this->assignRef('document', $document);
$app = JFactory::getApplication();
$this->template = $app->getTemplate(true)->template;
$template_dir = $this->baseurl.'/templates/'.$this->template;
$file ='/templates/system/css/system.css';
if (JFile::exists(JPATH_SITE.$file)) {
$document->addStyleSheet($this->baseurl.$file);
}
// Try to add the typical template stylesheets
$files = Array('template.css', 'position.css', 'layout.css', 'general.css');
foreach($files as $file) {
$path = JPATH_SITE.'/templates/'.$this->template.'/css/'.$file;
if (JFile::exists($path)) {
$document->addStyleSheet($this->baseurl.'/templates/'.$this->template.'/css/'.$file);
}
}
// Add the CSS for the attachments list (whether we need it or not)
JHtml::stylesheet('com_attachments/attachments_list.css', array(), true);
$head_renderer = new JDocumentRendererHead($document);
$html = '';
$html .= "<html>\n";
$html .= "<head>\n";
$html .= $head_renderer->fetchHead($document);
$html .= "</head>\n";
$html .= "<body id=\"attachments_iframe\">\n";
return $html;
}
/**
* Return the ending HTML tags for the page
*/
protected function endHTML()
{
$html = "\n";
$html .= "</body>\n";
$html .= "</html>\n";
return $html;
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,56 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
$template = JFactory::getApplication()->getTemplate();
// Load the tooltip behavior.
JHtml::_('behavior.tooltip');
$uri = JFactory::getURI();
$document = JFactory::getDocument();
/** Load the Attachments helper */
require_once(JPATH_SITE.'/components/com_attachments/helper.php');
require_once(JPATH_SITE.'/components/com_attachments/javascript.php');
// Add the regular css file
AttachmentsJavascript::setupJavascript(false);
// Hide the vertical scrollbar using javascript
$hide_scrollbar = "window.addEvent('domready', function() {
document.documentElement.style.overflow = \"hidden\";
document.body.scroll = \"no\";});";
$document->addScriptDeclaration($hide_scrollbar);
?>
<div class="attachmentsWarning">
<h1><?php echo $this->warning_title; ?></h1>
<h2 id="warning_msg"><?php echo $this->warning_question ?></h2>
<form action="<?php echo $this->action_url; ?>" name="warning_form" method="post">
<div class="form_buttons">
<span class="left">&nbsp;</span>
<input type="submit" name="submit" value="<?php echo $this->action_button_label ?>" />
<span class="right">
<input type="button" name="cancel" value="<?php echo JText::_('ATTACH_CANCEL'); ?>"
onClick="window.parent.SqueezeBox.close();" />
</span>
</div>
<input type="hidden" name="option" value="<?php echo $this->option;?>" />
<input type="hidden" name="from" value="<?php echo $this->from;?>" />
<?php echo JHtml::_( 'form.token' ); ?>
</form>
</div>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,42 @@
<?php
/**
* Attachments component
*
* @package Attachments
* @subpackage Attachments_Component
*
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
* @link http://joomlacode.org/gf/project/attachments/frs/
* @author Jonathan M. Cameron
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
/** Define the legacy classes, if necessary */
require_once(JPATH_SITE.'/components/com_attachments/legacy/view.php');
/**
* View for warnings
*
* @package Attachments
*/
class AttachmentsViewWarning extends JViewLegacy
{
/**
* Display the view
*/
public function display($tpl = null)
{
// Add the stylesheets
JHtml::stylesheet('com_attachments/attachments_frontend_form.css', array(), true);
$lang = JFactory::getLanguage();
if ( $lang->isRTL() ) {
JHtml::stylesheet('com_attachments/attachments_frontend_form_rtl.css', array(), true);
}
parent::display($tpl);
}
}