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 @@
<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);
}
}