mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-10-30 21:52:00 +01:00
feature 2616: remove useless code (photos_add_direct_process or uploadify related variables)
git-svn-id: http://piwigo.org/svn/trunk@28919 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
1 parent
d12f97545f
commit
7e9b6530ec
9 files changed
+3
-590
No files matched your search
@@ -21,40 +21,10 @@
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Uploaded photos |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
if (isset($page['thumbnails']))
|
||||
{
|
||||
$template->assign(
|
||||
array(
|
||||
'thumbnails' => $page['thumbnails'],
|
||||
)
|
||||
);
|
||||
|
||||
// only display the batch link if we have more than 1 photo
|
||||
if (count($page['thumbnails']) > 1)
|
||||
{
|
||||
$template->assign(
|
||||
array(
|
||||
'batch_link' => $page['batch_link'],
|
||||
'batch_label' => sprintf(
|
||||
l10n('Manage this set of %d photos'),
|
||||
count($page['thumbnails'])
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Photo selection |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
$uploadify_path = PHPWG_ROOT_PATH.'admin/include/uploadify';
|
||||
|
||||
$upload_max_filesize = min(
|
||||
get_ini_size('upload_max_filesize'),
|
||||
get_ini_size('post_max_size')
|
||||
@@ -72,7 +42,6 @@ else
|
||||
$template->assign(
|
||||
array(
|
||||
'F_ADD_ACTION'=> PHOTOS_ADD_BASE_URL,
|
||||
'uploadify_path' => $uploadify_path,
|
||||
'upload_max_filesize' => $upload_max_filesize,
|
||||
'upload_max_filesize_shorthand' => $upload_max_filesize_shorthand,
|
||||
)
|
||||
@@ -117,29 +86,10 @@ if ($conf['original_resize'])
|
||||
}
|
||||
|
||||
|
||||
$upload_modes = array('html', 'multiple');
|
||||
$upload_mode = isset($conf['upload_mode']) ? $conf['upload_mode'] : 'multiple';
|
||||
|
||||
if (isset($_GET['upload_mode']) and $upload_mode != $_GET['upload_mode'] and in_array($_GET['upload_mode'], $upload_modes))
|
||||
{
|
||||
$upload_mode = $_GET['upload_mode'];
|
||||
conf_update_param('upload_mode', $upload_mode);
|
||||
}
|
||||
|
||||
// what is the upload switch mode
|
||||
$index_of_upload_mode = array_flip($upload_modes);
|
||||
$upload_mode_index = $index_of_upload_mode[$upload_mode];
|
||||
$upload_switch = $upload_modes[ ($upload_mode_index + 1) % 2 ];
|
||||
|
||||
$template->assign(
|
||||
array(
|
||||
'upload_mode' => $upload_mode,
|
||||
'form_action' => PHOTOS_ADD_BASE_URL.'&upload_mode='.$upload_mode.'&processed=1',
|
||||
'switch_url' => PHOTOS_ADD_BASE_URL.'&upload_mode='.$upload_switch,
|
||||
'upload_id' => md5(rand()),
|
||||
'session_id' => session_id(),
|
||||
'form_action' => PHOTOS_ADD_BASE_URL,
|
||||
'pwg_token' => get_pwg_token(),
|
||||
'another_upload_link' => PHOTOS_ADD_BASE_URL.'&upload_mode='.$upload_mode,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -151,7 +101,7 @@ if (pwg_image::get_library() == 'ext_imagick')
|
||||
$template->assign('tif_enabled', true);
|
||||
}
|
||||
|
||||
if ('html' == $upload_mode)
|
||||
if (false) // TODO manage zip files in pwg.images.upload
|
||||
{
|
||||
$upload_file_types.= ', zip';
|
||||
}
|
||||
@@ -278,7 +228,7 @@ if (!isset($_SESSION['upload_hide_warnings']))
|
||||
$template->assign(
|
||||
array(
|
||||
'setup_warnings' => $setup_warnings,
|
||||
'hide_warnings_link' => PHOTOS_ADD_BASE_URL.'&upload_mode='.$upload_mode.'&hide_warnings=1'
|
||||
'hide_warnings_link' => PHOTOS_ADD_BASE_URL.'&hide_warnings=1'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based photo gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
|
||||
if (isset($_GET['processed']))
|
||||
{
|
||||
// echo '<pre>POST'."\n"; print_r($_POST); echo '</pre>';
|
||||
// echo '<pre>FILES'."\n"; print_r($_FILES); echo '</pre>';
|
||||
// echo '<pre>SESSION'."\n"; print_r($_SESSION); echo '</pre>';
|
||||
// exit();
|
||||
|
||||
// sometimes, you have submitted the form but you have nothing in $_POST
|
||||
// and $_FILES. This may happen when you have an HTML upload and you
|
||||
// exceeded the post_max_size (but not the upload_max_size)
|
||||
if (!isset($_POST['submit_upload']))
|
||||
{
|
||||
$page['errors'][] = l10n(
|
||||
'The uploaded files exceed the post_max_size directive in php.ini: %sB',
|
||||
ini_get('post_max_size')
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$category_id = $_POST['category'];
|
||||
}
|
||||
|
||||
if (isset($_POST['onUploadError']) and is_array($_POST['onUploadError']) and count($_POST['onUploadError']) > 0)
|
||||
{
|
||||
foreach ($_POST['onUploadError'] as $error)
|
||||
{
|
||||
$page['errors'][] = $error;
|
||||
}
|
||||
}
|
||||
|
||||
$image_ids = array();
|
||||
|
||||
if (isset($_FILES) and !empty($_FILES['image_upload']))
|
||||
{
|
||||
$starttime = get_moment();
|
||||
|
||||
foreach ($_FILES['image_upload']['error'] as $idx => $error)
|
||||
{
|
||||
if (UPLOAD_ERR_OK == $error)
|
||||
{
|
||||
$images_to_add = array();
|
||||
|
||||
$extension = pathinfo($_FILES['image_upload']['name'][$idx], PATHINFO_EXTENSION);
|
||||
if ('zip' == strtolower($extension))
|
||||
{
|
||||
$upload_dir = $conf['upload_dir'].'/buffer';
|
||||
prepare_directory($upload_dir);
|
||||
|
||||
$temporary_archive_name = date('YmdHis').'-'.generate_key(10);
|
||||
$archive_path = $upload_dir.'/'.$temporary_archive_name.'.zip';
|
||||
|
||||
move_uploaded_file(
|
||||
$_FILES['image_upload']['tmp_name'][$idx],
|
||||
$archive_path
|
||||
);
|
||||
|
||||
define('PCLZIP_TEMPORARY_DIR', $upload_dir.'/');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/pclzip.lib.php');
|
||||
$zip = new PclZip($archive_path);
|
||||
if ($list = $zip->listContent())
|
||||
{
|
||||
$indexes_to_extract = array();
|
||||
|
||||
foreach ($list as $node)
|
||||
{
|
||||
if (1 == $node['folder'])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_valid_image_extension(pathinfo($node['filename'], PATHINFO_EXTENSION)))
|
||||
{
|
||||
$indexes_to_extract[] = $node['index'];
|
||||
|
||||
$images_to_add[] = array(
|
||||
'source_filepath' => $upload_dir.'/'.$temporary_archive_name.'/'.$node['filename'],
|
||||
'original_filename' => basename($node['filename']),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($indexes_to_extract) > 0)
|
||||
{
|
||||
$zip->extract(
|
||||
PCLZIP_OPT_PATH, $upload_dir.'/'.$temporary_archive_name,
|
||||
PCLZIP_OPT_BY_INDEX, $indexes_to_extract,
|
||||
PCLZIP_OPT_ADD_TEMP_FILE_ON
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (is_valid_image_extension($extension))
|
||||
{
|
||||
$images_to_add[] = array(
|
||||
'source_filepath' => $_FILES['image_upload']['tmp_name'][$idx],
|
||||
'original_filename' => $_FILES['image_upload']['name'][$idx],
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($images_to_add as $image_to_add)
|
||||
{
|
||||
$image_id = add_uploaded_file(
|
||||
$image_to_add['source_filepath'],
|
||||
$image_to_add['original_filename'],
|
||||
array($category_id),
|
||||
$_POST['level']
|
||||
);
|
||||
|
||||
$image_ids[] = $image_id;
|
||||
|
||||
// TODO: if $image_id is not an integer, something went wrong
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error_message = file_upload_error_message($error);
|
||||
|
||||
$page['errors'][] = l10n(
|
||||
'Error on file "%s" : %s',
|
||||
$_FILES['image_upload']['name'][$idx],
|
||||
$error_message
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$endtime = get_moment();
|
||||
$elapsed = ($endtime - $starttime) * 1000;
|
||||
// printf('%.2f ms', $elapsed);
|
||||
|
||||
} // if (!empty($_FILES))
|
||||
|
||||
if (isset($_POST['upload_id']))
|
||||
{
|
||||
// we're on a multiple upload, with uploadify and so on
|
||||
if (isset($_SESSION['uploads_error'][ $_POST['upload_id'] ]))
|
||||
{
|
||||
foreach ($_SESSION['uploads_error'][ $_POST['upload_id'] ] as $error)
|
||||
{
|
||||
$page['errors'][] = $error;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['uploads'][ $_POST['upload_id'] ]))
|
||||
{
|
||||
$image_ids = $_SESSION['uploads'][ $_POST['upload_id'] ];
|
||||
}
|
||||
}
|
||||
|
||||
$page['thumbnails'] = array();
|
||||
foreach ($image_ids as $image_id)
|
||||
{
|
||||
// we could return the list of properties from the add_uploaded_file
|
||||
// function, but I like the "double check". And it costs nothing
|
||||
// compared to the upload process.
|
||||
$thumbnail = array();
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
id,
|
||||
file,
|
||||
path
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE id = '.$image_id.'
|
||||
;';
|
||||
$image_infos = pwg_db_fetch_assoc(pwg_query($query));
|
||||
|
||||
$thumbnail['file'] = $image_infos['file'];
|
||||
|
||||
$thumbnail['src'] = DerivativeImage::thumb_url($image_infos);
|
||||
|
||||
// TODO: when implementing this plugin in Piwigo core, we should have
|
||||
// a function get_image_name($name, $file) (if name is null, then
|
||||
// compute a temporary name from filename) that would be also used in
|
||||
// picture.php. UPDATE: in fact, "get_name_from_file($file)" already
|
||||
// exists and is used twice (batch_manager_unit + comments, but not in
|
||||
// picture.php I don't know why) with the same pattern if
|
||||
// (empty($name)) {$name = get_name_from_file($file)}, a clean
|
||||
// function get_image_name($name, $file) would be better
|
||||
$thumbnail['title'] = get_name_from_file($image_infos['file']);
|
||||
|
||||
$thumbnail['link'] = get_root_url().'admin.php?page=photo-'.$image_id.'&cat_id='.$category_id;
|
||||
|
||||
$page['thumbnails'][] = $thumbnail;
|
||||
}
|
||||
|
||||
if (!empty($page['thumbnails']))
|
||||
{
|
||||
$page['infos'][] = l10n('%d photos uploaded', count($page['thumbnails']));
|
||||
|
||||
if (0 != $_POST['level'])
|
||||
{
|
||||
$page['infos'][] = l10n(
|
||||
'Privacy level set to "%s"',
|
||||
l10n(sprintf('Level %d', $_POST['level']))
|
||||
);
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM '.IMAGE_CATEGORY_TABLE.'
|
||||
WHERE category_id = '.$category_id.'
|
||||
;';
|
||||
list($count) = pwg_db_fetch_row(pwg_query($query));
|
||||
$category_name = get_cat_display_name_from_id($category_id, 'admin.php?page=album-');
|
||||
|
||||
// information
|
||||
$page['infos'][] = l10n(
|
||||
'Album "%s" now contains %d photos',
|
||||
'<em>'.$category_name.'</em>',
|
||||
$count
|
||||
);
|
||||
|
||||
$page['batch_link'] = PHOTOS_ADD_BASE_URL.'&batch='.implode(',', $image_ids);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 778 B |
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
|
||||
|
||||
mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/
|
||||
|
||||
SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
|
||||
SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
|
||||
http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(a){this.initSWFUpload(a)}}SWFUpload.prototype.initSWFUpload=function(b){try{this.customSettings={};this.settings=b;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(a){delete SWFUpload.instances[this.movieName];throw a}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 2009-03-25";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.completeURL=function(a){if(typeof(a)!=="string"||a.match(/^https?:\/\//i)||a.match(/^\//)){return a}var c=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");var b=window.location.pathname.lastIndexOf("/");if(b<=0){path="/"}else{path=window.location.pathname.substr(0,b)+"/"}return path+a};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(b,a){this.settings[b]=(this.settings[b]==undefined)?a:this.settings[b]};this.ensureDefault("upload_url","");this.ensureDefault("preserve_relative_urls",false);this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("assume_success_timeout",0);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_placeholder",null);this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(!!this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url+(this.settings.flash_url.indexOf("?")<0?"?":"&")+"preventswfcaching="+new Date().getTime()}if(!this.settings.preserve_relative_urls){this.settings.upload_url=SWFUpload.completeURL(this.settings.upload_url);this.settings.button_image_url=SWFUpload.completeURL(this.settings.button_image_url)}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){var a,b;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}a=document.getElementById(this.settings.button_placeholder_id)||this.settings.button_placeholder;if(a==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id}b=document.createElement("div");b.innerHTML=this.getFlashHTML();a.parentNode.replaceChild(b.firstChild,a);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'"Line truncated
|
||||
|
||||
/*
|
||||
Uploadify v3.0.0
|
||||
Copyright (c) 2010 Ronnie Garcia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
if(jQuery)(function(a){a.extend(a.fn,{uploadify:function(b,c){a(this).each(function(){function t(b,c,d){g.queue.queueBytesUploaded+=b.size;a("#"+b.id).find(".data").html(" - "+uploadifyLang["uploadComplete"]);if(g.settings.onUploadSuccess)g.settings.onUploadSuccess(b,c,d)}function s(b){var c=new Date;g.timer=c.getTime();g.bytesLoaded=0;if(g.queue.uploadQueue.length==0){g.queue.uploadSize=b.size}if(g.settings.checkExisting!==false){a.ajax({type:"POST",async:false,url:g.settings.checkExisting,data:{filename:b.name},success:function(c){if(c==1){var d=confirm(uploadifyLang["existsMsg1"]+' "'+b.name+'" '+uploadifyLang["existsMsg2"]+".\n"+uploadifyLang["existsMsg3"]);if(!d){g.cancelUpload(b.id);a("#"+b.id).remove();if(g.queue.uploadQueue.length>0&&g.queue.queueLength>0){if(g.queue.uploadQueue[0]=="*"){g.startUpload()}else{g.startUpload(g.queue.uploadQueue.shift())}}}}}})}if(g.settings.onUploadStart)g.settings.onUploadStart(b)}function r(b,c,d){var e=new Date;var f=e.getTime();var h=f-g.timer;g.timer=f;var i=c-g.bytesLoaded;g.bytesLoaded=c;var j=g.queue.queueBytesUploaded+c;var k=Math.round(c/d*100);var l=0;var m=i/1024/(h/1e3);m=Math.floor(m*10)/10;if(g.queue.averageSpeed>0){g.queue.averageSpeed=(g.queue.averageSpeed+m)/2}else{g.queue.averageSpeed=m}if(m>1e3){l=m*.001;g.queue.averageSpeed=l}var n="KB/s";if(l>0){n="MB/s"}if(a.inArray("onUploadProgress",g.settings.skipDefault)<0){if(g.settings.progressData=="percentage"){a("#"+b.id).find(".data").html(" - "+k+"%")}else if(g.settings.progressData=="speed"){a("#"+b.id).find(".data").html(" - "+g.queue.averageSpeed.toFixed(2)+" "+n)}else if(g.settings.progressData=="all"){a("#"+b.id).find(".data").html(" - "+k+"% - "+g.queue.averageSpeed.toFixed(2)+" "+n)}a("#"+b.id).find(".uploadifyProgressBar").css("width",k+"%")}if(g.settings.onUploadProgress)g.settings.onUploadProgress(b,c,d,j,g.queue.uploadSize)}function q(b,c,d){var e=uploadifyLang["errorString1"];if(c!=SWFUpload.UPLOAD_ERROR.FILE_CANCELLED&&c!=SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED){a("#"+b.id).addClass("uploadifyError")}a("#"+b.id).find(".uploadifyProgressBar").css("width","1px");switch(c){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:e=uploadifyLang["errorString2"]+" ("+d+")";break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:e=uploadifyLang["errorString3"];break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:e=uploadifyLang["errorString4"];break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:e=uploadifyLang["errorString5"];break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:alert(uploadifyLang["errorString6"]+" ("+d+").");e=uploadifyLang["errorString7"];break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:e=uploadifyLang["errorString8"];break;case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:e=uploadifyLang["errorString9"];break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:e=uploadifyLang["errorString10"];break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:e=uploadifyLang["errorString11"];g.queue.queueSize-=b.size;if(b.status==SWFUpload.FILE_STATUS.IN_PROGRESS||a.inArray(b.id,g.queue.uploadQueue)>=0){g.queue.uploadSize-=b.size}delete g.queue.files[b.id];break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:e=uploadifyLang["errorString12"];break}if(c!=SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND&&b.status!=SWFUpload.FILE_STATUS.COMPLETE){a("#"+b.id).find(".data").html(" - "+e)}if(g.settings.onUploadError)g.settings.onUploadError(b,c,d,e,g.queue)}function p(b){var c=g.getStats();g.queue.queueLength=c.files_queued;if(g.queue.uploadQueue[0]=="*"){if(g.queue.queueLength>0){g.startUpload()}else{g.queue.uploadQueue=[];if(g.settings.onQueueComplete)g.settings.onQueueComplete(c)}}else{if(g.settings.onUploadComplete)g.settings.onUploadComplete(b,g.queue);if(g.queue.queueLength>0){g.startUpload(g.queue.uploadQueue.shift())}else{g.queue.uploadQueue=[];if(g.settings.onQueueComplete)g.settings.onQueueComplete(c)}}if(a.inArray("onUploadComplete",g.settings.skipDefault)<0){if(g.settings.removeCompleted){switch(b.filestatus){case SWFUpload.FILE_STATUS.COMPLETE:setTimeout(function(){if(a("#"+b.id)){g.queue.queueSize-=b.size;delete g.queue.files[b.id];a("#"+b.id).fadeOut(500,function(){a(this).remove()})}},g.settings.removeTimeout*1e3);break;case SWFUpload.FILE_STATUS.ERROR:if(!g.settings.requeueErrors){setTimeout(function(){if(a("#"+b.id)){g.queue.queueSize-=b.size;delete g.queue.files[b.id];a("#"+b.id).fadeOut(500,function(){a(this).remove()})}},g.settings.removeTimeout*1e3)}break}}}}function o(){var a=g.getStats();if(g.settings.onQueueComplete)g.settings.onQueueComplete(a)}function n(b,c,d){if(a.inArray("onSelectError",g.settings.skipDefault)<0){switch(c){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:if(g.settings.queueSizeLimit>d){g.queue.errorMsg+="\n"+uploadifyLang["errorMsg2"]+" ("+d+")."}else{g.queue.errorMsg+="\n"+uploadifyLang["errorMsg3"]+" ("+g.settings.queueSizeLimit+")."}break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:g.queue.errorMsg+="\n"+uploadifyLang["errorMsg4"]+' "'+b.name+'" '+uploadifyLang["errorMsg5"]+"Line truncated
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
Uploadify v3.0.0
|
||||
Copyright (c) 2010 Ronnie Garcia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
.uploadify {margin:0 auto 10px auto}
|
||||
|
||||
.uploadifyButton {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
color: #eeeeee;
|
||||
padding: 8px 0;
|
||||
text-align: center;
|
||||
height: 14px;
|
||||
width: 100%;
|
||||
background-color: #464646;
|
||||
-webkit-border-radius:5px;
|
||||
-moz-border-radius:5px;
|
||||
border-radius:5px;
|
||||
letter-spacing:2px;
|
||||
}
|
||||
.uploadify:hover .uploadifyButton {
|
||||
color:#fff;
|
||||
background-color: #333;
|
||||
cursor:pointer;
|
||||
}
|
||||
.uploadifyQueueItem {
|
||||
background-color: #F5F5F5;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
font: 11px Verdana, Geneva, sans-serif;
|
||||
margin-top: 5px;
|
||||
max-width: 350px;
|
||||
padding: 10px;
|
||||
}
|
||||
.uploadifyQueueItem .cancel {
|
||||
float: right;
|
||||
}
|
||||
.uploadifyQueueItem .fileName, .uploadifyQueueItem .data {
|
||||
float: left;
|
||||
}
|
||||
.uploadifyQueue .completed {
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
.uploadifyProgress {
|
||||
background-color: #E5E5E5;
|
||||
margin-top: 25px;
|
||||
height: 3px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.uploadifyProgressBar {
|
||||
background-color: #0099FF;
|
||||
height: 3px;
|
||||
width: 1px;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
}
|
||||
.uploadifyError {
|
||||
background-color: #FDE5DD !important;
|
||||
}
|
||||
|
||||
|
||||
/* Piwigo specific */
|
||||
#fileQueue {
|
||||
width: 420px;
|
||||
max-height: 300px;
|
||||
overflow: auto;
|
||||
margin: 0 auto 10px auto;
|
||||
padding: 5px 0 10px 0;
|
||||
}
|
||||
|
||||
.uploadifyQueueItem {
|
||||
border: 1px solid #666;
|
||||
background-color: #444;
|
||||
color:#999;
|
||||
margin: 5px auto 0 auto;
|
||||
padding: 10px;
|
||||
width: 350px;
|
||||
|
||||
}
|
||||
.uploadifyError {
|
||||
border: 2px solid #FBCBBC !important;
|
||||
background-color: #FDE5DD !important;
|
||||
}
|
||||
.uploadifyQueueItem .cancel {
|
||||
float: right;
|
||||
}
|
||||
.uploadifyProgress {
|
||||
background-color: #333;
|
||||
border: 1px solid #666;
|
||||
width: 100%;
|
||||
}
|
||||
.uploadifyProgressBar {
|
||||
background-color: #FF3363;
|
||||
width: 1px;
|
||||
height: 3px;
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
<?php
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Piwigo - a PHP based photo gallery |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org |
|
||||
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
|
||||
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | This program is free software; you can redistribute it and/or modify |
|
||||
// | it under the terms of the GNU General Public License as published by |
|
||||
// | the Free Software Foundation |
|
||||
// | |
|
||||
// | This program is distributed in the hope that it will be useful, but |
|
||||
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
||||
// | General Public License for more details. |
|
||||
// | |
|
||||
// | You should have received a copy of the GNU General Public License |
|
||||
// | along with this program; if not, write to the Free Software |
|
||||
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
|
||||
// | USA. |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
define('PHPWG_ROOT_PATH','../../../');
|
||||
define('IN_ADMIN', true);
|
||||
|
||||
$_COOKIE['pwg_id'] = $_POST['session_id'];
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
|
||||
|
||||
check_pwg_token();
|
||||
|
||||
ob_start();
|
||||
echo '$_FILES'."\n";
|
||||
print_r($_FILES);
|
||||
echo '$_POST'."\n";
|
||||
print_r($_POST);
|
||||
echo '$user'."\n";
|
||||
print_r($user);
|
||||
$tmp = ob_get_contents();
|
||||
ob_end_clean();
|
||||
// error_log($tmp, 3, "/tmp/php-".date('YmdHis').'-'.sprintf('%020u', rand()).".log");
|
||||
|
||||
if ($_FILES['Filedata']['error'] !== UPLOAD_ERR_OK)
|
||||
{
|
||||
$error_message = file_upload_error_message($_FILES['Filedata']['error']);
|
||||
|
||||
add_upload_error(
|
||||
$_POST['upload_id'],
|
||||
sprintf(
|
||||
l10n('Error on file "%s" : %s'),
|
||||
$_FILES['Filedata']['name'],
|
||||
$error_message
|
||||
)
|
||||
);
|
||||
|
||||
echo "File Size Error";
|
||||
exit();
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
$image_id = add_uploaded_file(
|
||||
$_FILES['Filedata']['tmp_name'],
|
||||
$_FILES['Filedata']['name'],
|
||||
array($_POST['category_id']),
|
||||
$_POST['level']
|
||||
);
|
||||
|
||||
$_SESSION['uploads'][ $_POST['upload_id'] ][] = $image_id;
|
||||
|
||||
$query = '
|
||||
SELECT
|
||||
id,
|
||||
path
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE id = '.$image_id.'
|
||||
;';
|
||||
$image_infos = pwg_db_fetch_assoc(pwg_query($query));
|
||||
|
||||
$thumbnail_url = preg_replace('#^'.PHPWG_ROOT_PATH.'#', './', DerivativeImage::thumb_url($image_infos));
|
||||
|
||||
$return = array(
|
||||
'image_id' => $image_id,
|
||||
'category_id' => $_POST['category_id'],
|
||||
'thumbnail_url' => $thumbnail_url,
|
||||
);
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if (!empty($output))
|
||||
{
|
||||
add_upload_error($_POST['upload_id'], $output);
|
||||
$return['error_message'] = $output;
|
||||
}
|
||||
|
||||
echo json_encode($return);
|
||||
?>
|
||||
Binary file not shown.
@@ -1,32 +0,0 @@
|
||||
// this file must be in UTF-8 format
|
||||
|
||||
var uploadifyLang = new Array();
|
||||
|
||||
uploadifyLang['buttonText'] = 'SELECT FILES';
|
||||
uploadifyLang['fileTypeDesc'] = 'All Files (*.*)';
|
||||
uploadifyLang['replaceMsg1'] = 'The file named';
|
||||
uploadifyLang['replaceMsg2'] = 'is already in the queue';
|
||||
uploadifyLang['replaceMsg3'] = 'Do you want to replace the existing item in the queue?';
|
||||
uploadifyLang['existsMsg1'] = 'A file with the name';
|
||||
uploadifyLang['existsMsg2'] = 'already exists on the server';
|
||||
uploadifyLang['existsMsg3'] = 'Would you like to replace the existing file?';
|
||||
uploadifyLang['errorMsg1'] = 'Some files were not added to the queue:';
|
||||
uploadifyLang['errorMsg2'] = 'The number of files selected exceeds the remaining upload limit';
|
||||
uploadifyLang['errorMsg3'] = 'The number of files selected exceeds the queue size limit';
|
||||
uploadifyLang['errorMsg4'] = 'The file';
|
||||
uploadifyLang['errorMsg5'] = 'exceeds the size limit';
|
||||
uploadifyLang['errorMsg6'] = 'is empty';
|
||||
uploadifyLang['errorMsg7'] = 'is not an accepted file type';
|
||||
uploadifyLang['errorString1'] = 'Error';
|
||||
uploadifyLang['errorString2'] = 'HTTP Error';
|
||||
uploadifyLang['errorString3'] = 'Missing Upload URL';
|
||||
uploadifyLang['errorString4'] = 'IO Error';
|
||||
uploadifyLang['errorString5'] = 'Security Error';
|
||||
uploadifyLang['errorString6'] = 'The upload limit has been reached';
|
||||
uploadifyLang['errorString7'] = 'Exceeds Upload Limit';
|
||||
uploadifyLang['errorString8'] = 'Failed';
|
||||
uploadifyLang['errorString9'] = 'File ID Not Found';
|
||||
uploadifyLang['errorString10'] = 'Validation Error';
|
||||
uploadifyLang['errorString11'] = 'Cancelled';
|
||||
uploadifyLang['errorString12'] = 'Stopped';
|
||||
uploadifyLang['uploadComplete'] = 'Complete';
|
||||
@@ -57,12 +57,6 @@ DELETE FROM '.CADDIE_TABLE.'
|
||||
redirect(get_root_url().'admin.php?page=batch_manager&filter=prefilter-caddie');
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | process form |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/photos_add_direct_process.inc.php');
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | prepare form |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
Reference in new issue
Block a user