1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193:
<?php
zp_register_filter('admin_headers', 'jQueryUpload_headers', 0);
zp_register_filter('admin_head', 'jQueryUpload_head');
function jQueryUpload_headers() {
ob_start();
}
function jQueryUpload_head() {
$head = ob_get_contents();
ob_end_clean();
preg_match_all('~(<script.*/js/jquery\.js.*</script>)~', $head, $matches);
$head = str_replace('<script src="' . WEBPATH . '/' . ZENFOLDER . '/js/jqueryui/jquery-ui-zenphoto.js" type="text/javascript"></script>', '<script src="' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/uploader_jQuery/jqueryui/jquery-ui-zenphoto.js"></script>', $head);
echo $head;
}
function upload_head() {
$myfolder = WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/uploader_jQuery';
?>
<script type="text/javascript" src="<?php echo $myfolder; ?>/jquery.tmpl.min.js"></script>
<script type="text/javascript" src="<?php echo $myfolder; ?>/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="<?php echo $myfolder; ?>/jquery.fileupload.js"></script>
<script type="text/javascript" src="<?php echo $myfolder; ?>/jquery.fileupload-ui.js"></script>
<link rel="stylesheet" href="<?php echo $myfolder; ?>/jquery.fileupload-ui.css">
<?php
return $myfolder . '/uploader.php';
}
function upload_extra($uploadlimit, $passedalbum) {
global $_zp_current_admin_obj;
?>
<script type="text/javascript">
var upload_fail = false;
$(function() {
'use strict';
$('#fileupload').fileupload({
url: '<?php echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/uploader_jQuery/uploader.php' ?>'<?php if ($uploadlimit) echo ",
maxFileSize:" . $uploadlimit; ?>
});
$('#fileupload .files').delegate(
'a:not([target^=_blank])',
'click',
function(e) {
e.preventDefault();
$('<iframe style="display:none;"></iframe>')
.prop('src', this.href)
.appendTo('body');
}
);
$('#fileupload').bind('fileuploadfail', function(e, data) {
upload_fail = true;
});
$('#fileupload').bind('fileuploadstop', function(e, data) {
if (upload_fail) {
upload_fail = false;
} else {
<?php
if (zp_loggedin(ALBUM_RIGHTS | MANAGE_ALL_ALBUM_RIGHTS)) {
?>
launchScript('admin-edit.php', ['page=edit', 'subpage=1', 'tab=imageinfo', 'album=' + encodeURIComponent($('#folderdisplay').val()), 'uploaded=1', 'albumimagesort=id_desc']);
<?php
} else {
?>
launchScript('admin-upload.php', ['uploaded=1']);
<?php
}
?>
}
});
});
</script>
<div id="fileupload">
<form action="uploader.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="existingfolder" id="existingfolder" value="false" />
<input type="hidden" name="auth" id="auth" value="<?php echo $_zp_current_admin_obj->getPass(); ?>" />
<input type="hidden" name="id" id="id" value="<?php echo $_zp_current_admin_obj->getID(); ?>" />
<input type="hidden" name="folder" id="folderslot" value="<?php echo html_encode($passedalbum); ?>" />
<input type="hidden" name="albumtitle" id="albumtitleslot" value="" />
<input type="hidden" name="publishalbum" id="publishalbumslot" value="" />
<div class="fileupload-buttonbar">
<label class="fileinput-button"> <span><?php echo gettext('Add files...'); ?>
</span> <input type="file" name="files[]" multiple>
</label>
<span id="fileUploadbuttons">
<button type="submit" class="start"><?php echo gettext('Start upload'); ?></button>
<button type="reset" class="cancel"><?php echo gettext('Cancel upload'); ?></button>
</span>
</div>
</form>
<div class="fileupload-content">
<table class="files"></table>
<div class="fileupload-progressbar"></div>
</div>
</div>
<script id="template-upload" type="text/x-jquery-tmpl">
<tr class="template-upload{{if error}} ui-state-error{{/if}}">
<td class="preview"></td>
<td class="name">{{if name}}${name}{{else}}Untitled{{/if}}</td>
<td class="size">${sizef}</td>
{{if error}}
<td class="error" colspan="2"><?php echo gettext('Error:'); ?>
{{if error === 'maxFileSize'}}<?php echo gettext('File is too big'); ?>
{{else error === 'minFileSize'}}<?php echo gettext('File is too small'); ?>
{{else error === 'acceptFileTypes'}}<?php echo gettext('Filetype not allowed'); ?>
{{else error === 'maxNumberOfFiles'}}<?php echo gettext('Max number of files exceeded'); ?>
{{else}}${error}
{{/if}}
</td>
{{else}}
<td class="progress"><div></div></td>
<td class="start" style="display:none"><button><?php echo gettext('Start'); ?></button></td>
{{/if}}
<td class="cancel"><button><?php echo gettext('Cancel'); ?></button></td>
</tr>
</script>
<script id="template-download" type="text/x-jquery-tmpl">
{{if error !== 'emptyResult'}}
<tr class="template-download{{if error}}} ui-state-error{{/if}}">
{{if error}}
<td></td>
<td class="name">${name}</td>
<td class="size">${sizef}</td>
<td class="error" colspan="2"><?php echo gettext('Error:'); ?>
{{if error === 1}}<?php echo gettext('File exceeds upload_max_filesize (php.ini directive)'); ?>
{{else error === 2}}<?php echo gettext('File exceeds MAX_FILE_SIZE (HTML form directive)'); ?>
{{else error === 3}}<?php echo gettext('File was only partially uploaded'); ?>
{{else error === 4}}<?php echo gettext('No File was uploaded'); ?>
{{else error === 5}}<?php echo gettext('Missing a temporary folder'); ?>
{{else error === 6}}<?php echo gettext('Failed to write file to disk'); ?>
{{else error === 7}}<?php echo gettext('File upload stopped by extension'); ?>
{{else error === 'maxFileSize'}}<?php echo gettext('File is too big'); ?>
{{else error === 'minFileSize'}}<?php echo gettext('File is too small'); ?>
{{else error === 'acceptFileTypes'}}<?php echo gettext('Filetype not allowed'); ?>
{{else error === 'maxNumberOfFiles'}}<?php echo gettext('Max number of files exceeded'); ?>
{{else error === 'uploadedBytes'}}<?php echo gettext('Uploaded bytes exceed file size'); ?>
{{else error === 'emptyResult'}}<?php echo gettext('Empty file upload result'); ?>
{{else}}${error}
{{/if}}
</td>
<td class="delete">
<button data-type="${delete_type}" data-url="${delete_url}">Delete</button>
</td>
{{else}}
<td class="preview">
{{if thumbnail_url}}
<a href="${url}" target="_blank"><img src="${thumbnail_url}"></a>
{{/if}}
</td>
<td class="name">
<a href="${url}"{{if thumbnail_url}} target="_blank"{{/if}}>${name}</a>
</td>
<td class="size">${sizef}</td>
<td colspan="2"></td>
<td class="delete"><img src="<?php echo WEBPATH . '/' . ZENFOLDER; ?>/images/pass.png" /></td>
{{/if}}
</tr>
{{/if}}
</script>
<?php
}
function upload_form($uploadlimit, $passedalbum) {
}
?>