| ... | ... |
@@ -163,7 +163,7 @@ if($imageupload) {
|
| 163 | 163 |
if(isset($_POST['submit'])) {
|
| 164 | 164 |
$multi_upload = new multi_upfiles; |
| 165 | 165 |
$multi_upload->upload_dir = STORIESPATH."/".USERUID."/images/"; // "files" is the folder for the uploaded files (you have to create this folder) |
| 166 |
- $multi_upload->extensions = array(".png", ".gif", ".jpg", ".jpeg"); // specify the allowed extensions here
|
|
| 166 |
+ $multi_upload->extensions = array(".png", ".gif", ".jpg", ".jpeg", ".webp"); // specify the allowed extensions here
|
|
| 167 | 167 |
$multi_upload->message[] = $multi_upload->extra_text(4); // a different standard message for multiple files |
| 168 | 168 |
//$multi_upload->rename_file = true; // set to "true" if you want to rename all files with a timestamp value |
| 169 | 169 |
$multi_upload->do_filename_check = "n"; // check filename ... |
| ... | ... |
@@ -33,7 +33,7 @@ function buildImageList( ) {
|
| 33 | 33 |
$path = STORIESPATH . "/" . USERUID . "/images/".$file; |
| 34 | 34 |
$image_files[] = "[\"" . STORIESPATH . "/" . USERUID . "/images/$file\", \"" . STORIESPATH . "/" . USERUID . "/images/$file\"]"; |
| 35 | 35 |
|
| 36 |
- $image4_files[] = '{ "title": "'. $file. '", "value": "'.$path.'" }';
|
|
| 36 |
+ $image_new_files[] = '{ "title": "'. $file. '", "value": "'.$path.'" }';
|
|
| 37 | 37 |
|
| 38 | 38 |
} |
| 39 | 39 |
} |
| ... | ... |
@@ -44,8 +44,8 @@ function buildImageList( ) {
|
| 44 | 44 |
$text .= ");\n\n"; |
| 45 | 45 |
fwrite($handle, $text); |
| 46 | 46 |
|
| 47 |
- $text = "var tinyMCE4ImageList = [\n"; |
|
| 48 |
- $text .= implode(", \n", $image4_files);
|
|
| 47 |
+ $text = "var tinyMCENewImageList = [\n"; |
|
| 48 |
+ $text .= implode(", \n", $image_new_files);
|
|
| 49 | 49 |
$text .= "];\n\n"; |
| 50 | 50 |
fwrite($handle, $text); |
| 51 | 51 |
|
| ... | ... |
@@ -30,7 +30,11 @@ function buildImageList( ) {
|
| 30 | 30 |
$dir = opendir(STORIESPATH."/".USERUID."/images/"); |
| 31 | 31 |
while($file = readdir($dir)) {
|
| 32 | 32 |
if(!in_array($file, array(".", "..", "/", "index.php", "imagelist.js"))) {
|
| 33 |
- $image_files[] = "[\"".STORIESPATH."/".USERUID."/images/$file\", \"".STORIESPATH."/".USERUID."/images/$file\"]"; |
|
| 33 |
+ $path = STORIESPATH . "/" . USERUID . "/images/".$file; |
|
| 34 |
+ $image_files[] = "[\"" . STORIESPATH . "/" . USERUID . "/images/$file\", \"" . STORIESPATH . "/" . USERUID . "/images/$file\"]"; |
|
| 35 |
+ |
|
| 36 |
+ $image4_files[] = '{ "title": "'. $file. '", "value": "'.$path.'" }';
|
|
| 37 |
+ |
|
| 34 | 38 |
} |
| 35 | 39 |
} |
| 36 | 40 |
if(isset($image_files)) {
|
| ... | ... |
@@ -39,6 +43,12 @@ function buildImageList( ) {
|
| 39 | 43 |
$text .= implode(", \n", $image_files);
|
| 40 | 44 |
$text .= ");\n\n"; |
| 41 | 45 |
fwrite($handle, $text); |
| 46 |
+ |
|
| 47 |
+ $text = "var tinyMCE4ImageList = [\n"; |
|
| 48 |
+ $text .= implode(", \n", $image4_files);
|
|
| 49 |
+ $text .= "];\n\n"; |
|
| 50 |
+ fwrite($handle, $text); |
|
| 51 |
+ |
|
| 42 | 52 |
fclose($handle); |
| 43 | 53 |
} |
| 44 | 54 |
} |
| ... | ... |
@@ -218,4 +228,4 @@ if($imageupload) {
|
| 218 | 228 |
else {
|
| 219 | 229 |
$output .= write_message(_NOTAUTHORIZED); |
| 220 | 230 |
} |
| 221 |
-?> |
|
| 222 | 231 |
\ No newline at end of file |
| 232 |
+?> |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,221 @@ |
| 1 |
+<?php |
|
| 2 |
+// ---------------------------------------------------------------------- |
|
| 3 |
+// eFiction 3.2 |
|
| 4 |
+// Copyright (c) 2007 by Tammy Keefer |
|
| 5 |
+// Valid HTML 4.01 Transitional |
|
| 6 |
+// Based on eFiction 1.1 |
|
| 7 |
+// Copyright (C) 2003 by Rebecca Smallwood. |
|
| 8 |
+// http://efiction.sourceforge.net/ |
|
| 9 |
+// ---------------------------------------------------------------------- |
|
| 10 |
+// LICENSE |
|
| 11 |
+// |
|
| 12 |
+// This program is free software; you can redistribute it and/or |
|
| 13 |
+// modify it under the terms of the GNU General Public License (GPL) |
|
| 14 |
+// as published by the Free Software Foundation; either version 2 |
|
| 15 |
+// of the License, or (at your option) any later version. |
|
| 16 |
+// |
|
| 17 |
+// This program is distributed in the hope that it will be useful, |
|
| 18 |
+// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 19 |
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 20 |
+// GNU General Public License for more details. |
|
| 21 |
+// |
|
| 22 |
+// To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|
| 23 |
+// ---------------------------------------------------------------------- |
|
| 24 |
+ |
|
| 25 |
+if(!defined("_CHARSET")) exit( );
|
|
| 26 |
+ |
|
| 27 |
+// $upfile = isset($_FILES['upfile']) ? $_FILES['upfile'] : false; |
|
| 28 |
+include("includes/upload_class.php");
|
|
| 29 |
+function buildImageList( ) {
|
|
| 30 |
+ $dir = opendir(STORIESPATH."/".USERUID."/images/"); |
|
| 31 |
+ while($file = readdir($dir)) {
|
|
| 32 |
+ if(!in_array($file, array(".", "..", "/", "index.php", "imagelist.js"))) {
|
|
| 33 |
+ $image_files[] = "[\"".STORIESPATH."/".USERUID."/images/$file\", \"".STORIESPATH."/".USERUID."/images/$file\"]"; |
|
| 34 |
+ } |
|
| 35 |
+ } |
|
| 36 |
+ if(isset($image_files)) {
|
|
| 37 |
+ $handle = fopen(STORIESPATH."/".USERUID."/images/imagelist.js", 'w'); |
|
| 38 |
+ $text = "var tinyMCEImageList = new Array(\n"; |
|
| 39 |
+ $text .= implode(", \n", $image_files);
|
|
| 40 |
+ $text .= ");\n\n"; |
|
| 41 |
+ fwrite($handle, $text); |
|
| 42 |
+ fclose($handle); |
|
| 43 |
+ } |
|
| 44 |
+} |
|
| 45 |
+ |
|
| 46 |
+class multi_upfiles extends file_upload {
|
|
| 47 |
+ |
|
| 48 |
+ var $number_of_files = 0; |
|
| 49 |
+ var $names_array; |
|
| 50 |
+ var $tmp_names_array; |
|
| 51 |
+ var $error_array; |
|
| 52 |
+ var $wrong_extensions = 0; |
|
| 53 |
+ var $bad_filenames = array( ); |
|
| 54 |
+ |
|
| 55 |
+ function extra_text($msg_num) {
|
|
| 56 |
+ switch ($this->language) {
|
|
| 57 |
+ case "de": |
|
| 58 |
+ // add you translations here |
|
| 59 |
+ break; |
|
| 60 |
+ default: |
|
| 61 |
+ $extra_msg[1] = "<strong>".$this->the_file."</strong>"; |
|
| 62 |
+ $extra_msg[2] = sprintf(_WRONGEXT, $this->wrong_extensions, $this->ext_string); |
|
| 63 |
+ $extra_msg[3] = "<strong>".$this->the_file."</strong> "._IMAGETOOBIG; |
|
| 64 |
+ $extra_msg[4] = _NOFILESSELECTED; |
|
| 65 |
+ $extra_msg[5] = _BADFILENAMES."<strong>".implode(",", $this->bad_filenames)."</strong>";
|
|
| 66 |
+ } |
|
| 67 |
+ return $extra_msg[$msg_num]; |
|
| 68 |
+ } |
|
| 69 |
+ // some error (HTTP)reporting, change the messages or remove options if you like. |
|
| 70 |
+ // this method checkes the number of files for upload |
|
| 71 |
+ // this example works with one or more files |
|
| 72 |
+ function count_files() {
|
|
| 73 |
+ foreach ($this->names_array as $test) {
|
|
| 74 |
+ if ($test != "") {
|
|
| 75 |
+ $this->number_of_files++; |
|
| 76 |
+ } |
|
| 77 |
+ } |
|
| 78 |
+ if ($this->number_of_files > 0) {
|
|
| 79 |
+ return true; |
|
| 80 |
+ } else {
|
|
| 81 |
+ return false; |
|
| 82 |
+ } |
|
| 83 |
+ } |
|
| 84 |
+ function get_img_size($file) {
|
|
| 85 |
+ $img_size = getimagesize($file); |
|
| 86 |
+ $this->x_size = $img_size[0]; |
|
| 87 |
+ $this->y_size = $img_size[1]; |
|
| 88 |
+ } |
|
| 89 |
+ function upload_multi_files () {
|
|
| 90 |
+ global $output, $imageheight, $imagewidth; |
|
| 91 |
+ $this->message = array(); |
|
| 92 |
+ if ($this->count_files()) {
|
|
| 93 |
+ foreach ($this->names_array as $key => $value) {
|
|
| 94 |
+ if ($value != "") {
|
|
| 95 |
+ $this->the_file = $value; |
|
| 96 |
+ $new_name = $this->set_file_name(); |
|
| 97 |
+ $ext = $this->get_extension($new_name); |
|
| 98 |
+ $validImage = true; |
|
| 99 |
+ if($ext == ".jpg" || $ext == ".gif" || $ext == ".jpeg") {
|
|
| 100 |
+ $this->get_img_size($this->tmp_names_array[$key]); |
|
| 101 |
+ if($this->x_size > $imageheight) {
|
|
| 102 |
+ $this->message[] = $this->extra_text(3); |
|
| 103 |
+ $validImage = false; |
|
| 104 |
+ } |
|
| 105 |
+ else if($this->y_size > $imagewidth) {
|
|
| 106 |
+ $this->message[] = $this->extra_text(3); |
|
| 107 |
+ $validImage = false; |
|
| 108 |
+ } |
|
| 109 |
+ } |
|
| 110 |
+ if($validImage) {
|
|
| 111 |
+ if ($this->check_file_name($new_name)) {
|
|
| 112 |
+ if ($this->validateExtension()) {
|
|
| 113 |
+ $this->file_copy = $new_name; |
|
| 114 |
+ $this->the_temp_file = $this->tmp_names_array[$key]; |
|
| 115 |
+ if (is_uploaded_file($this->the_temp_file)) {
|
|
| 116 |
+ if($this->move_upload($this->the_temp_file, $this->file_copy)) {
|
|
| 117 |
+ $this->message[] = $this->error_text($this->error_array[$key]); |
|
| 118 |
+ if ($this->rename_file) $this->message[] = $this->error_text(16); |
|
| 119 |
+ sleep(1); // wait a seconds to get an new timestamp (if rename is set) |
|
| 120 |
+ } else {
|
|
| 121 |
+ $this->message[] = $this->extra_text(1); |
|
| 122 |
+ $this->message[] = $this->error_text($this->error_array[$key]); |
|
| 123 |
+ } |
|
| 124 |
+ } |
|
| 125 |
+ } else {
|
|
| 126 |
+ $this->wrong_extensions++; |
|
| 127 |
+ } |
|
| 128 |
+ } else {
|
|
| 129 |
+ $this->bad_filenames[] = $this->the_file; |
|
| 130 |
+ } |
|
| 131 |
+ } |
|
| 132 |
+ } |
|
| 133 |
+ } |
|
| 134 |
+ if (count($this->bad_filenames) > 0) $this->message[] = $this->extra_text(5); |
|
| 135 |
+ if ($this->wrong_extensions > 0) {
|
|
| 136 |
+ $this->show_extensions(); |
|
| 137 |
+ $this->message[] = $this->extra_text(2); |
|
| 138 |
+ } |
|
| 139 |
+ } else {
|
|
| 140 |
+ $this->message[] = $this->extra_text(3); |
|
| 141 |
+ } |
|
| 142 |
+ $output .= write_message(is_array($this->message) ? implode("<br />", $this->message) : _ERROR);
|
|
| 143 |
+ } |
|
| 144 |
+} |
|
| 145 |
+ |
|
| 146 |
+ |
|
| 147 |
+$output .= "<div id=\"pagetitle\">"._MANAGEIMAGES."</div>"; |
|
| 148 |
+if($imageupload) {
|
|
| 149 |
+ |
|
| 150 |
+ $max_size = 1024*250; // the max. size for uploading |
|
| 151 |
+ |
|
| 152 |
+ |
|
| 153 |
+ if(isset($_POST['submit'])) {
|
|
| 154 |
+ $multi_upload = new multi_upfiles; |
|
| 155 |
+ $multi_upload->upload_dir = STORIESPATH."/".USERUID."/images/"; // "files" is the folder for the uploaded files (you have to create this folder) |
|
| 156 |
+ $multi_upload->extensions = array(".png", ".gif", ".jpg", ".jpeg"); // specify the allowed extensions here
|
|
| 157 |
+ $multi_upload->message[] = $multi_upload->extra_text(4); // a different standard message for multiple files |
|
| 158 |
+ //$multi_upload->rename_file = true; // set to "true" if you want to rename all files with a timestamp value |
|
| 159 |
+ $multi_upload->do_filename_check = "n"; // check filename ... |
|
| 160 |
+ |
|
| 161 |
+ $multi_upload->tmp_names_array = $_FILES['upfile']['tmp_name']; |
|
| 162 |
+ $multi_upload->names_array = $_FILES['upfile']['name']; |
|
| 163 |
+ $multi_upload->error_array = $_FILES['upfile']['error']; |
|
| 164 |
+ $multi_upload->replace = "n"; |
|
| 165 |
+ $multi_upload->upload_multi_files(); |
|
| 166 |
+ buildImageList( ); |
|
| 167 |
+ } |
|
| 168 |
+ if(isset($_GET['upload']) && !isset($_POST['submit'])) {
|
|
| 169 |
+ $output .= "<form method=\"post\" action=\"user.php?action=manageimages&upload=upload\" ENCTYPE=\"multipart/form-data\"> |
|
| 170 |
+ <input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"$max_size\">"; |
|
| 171 |
+ for($x = 1; $x < 6; $x++) {
|
|
| 172 |
+ $output .= "<div style='width: 300px; margin: 0 auto;'><label for='upfile$x'>"._IMAGE." $x:</label><input id=\"upfile$x\" type=\"file\" class=\"textbox\" name=\"upfile[]\"></div>"; |
|
| 173 |
+ } |
|
| 174 |
+ $output .= "<div style='text-align: center;'><input name=\"submit\" type=\"submit\" class=\"button\" value=\"upload\"></div></form>"; |
|
| 175 |
+ } |
|
| 176 |
+ else {
|
|
| 177 |
+ if(isset($_GET['delete'])) {
|
|
| 178 |
+ $folder = STORIESPATH."/".USERUID."/images"; |
|
| 179 |
+ $validFile = false; |
|
| 180 |
+ $directory = opendir($folder); |
|
| 181 |
+ while($filename = readdir($directory)) {
|
|
| 182 |
+ if($filename == $_GET['delete']) $validFile = true; |
|
| 183 |
+ } |
|
| 184 |
+ if($validFile) {
|
|
| 185 |
+ $success = unlink($folder ."/". $_GET['delete']); |
|
| 186 |
+ if($success) $output .= write_message(_ACTIONSUCCESSFUL); |
|
| 187 |
+ else $output .= write_error(_ERROR); |
|
| 188 |
+ } |
|
| 189 |
+ } |
|
| 190 |
+ $folder1 = STORIESPATH."/".USERUID.""; |
|
| 191 |
+ if(!file_exists($folder1)) {
|
|
| 192 |
+ mkdir($folder1, 0755); |
|
| 193 |
+ chmod($folder1, 0777); |
|
| 194 |
+ } |
|
| 195 |
+ |
|
| 196 |
+ $folder = STORIESPATH."/".USERUID."/images"; |
|
| 197 |
+ if (!file_exists($folder)) {
|
|
| 198 |
+ mkdir($folder, 0755); |
|
| 199 |
+ chmod($folder, 0777); |
|
| 200 |
+ } |
|
| 201 |
+ |
|
| 202 |
+ $directory = opendir("$folder");
|
|
| 203 |
+ $output .= "<div style=\"width: 90%; margin: 0 auto;\"><table cellpadding=\"3\" cellspacing=\"0\" width=\"100%\" class=\"tblborder\"> |
|
| 204 |
+ <tr><th class='tblborder'>"._FILENAME."</th><th class='tblborder'>"._IMAGECODE."</th><th class='tblborder'>"._OPTIONS."</th></tr>"; |
|
| 205 |
+ $count = 0; |
|
| 206 |
+ while($filename = readdir($directory)) {
|
|
| 207 |
+ if($filename=="." || $filename==".." || $filename == "imagelist.js") continue; |
|
| 208 |
+ list($imght, $imgwth, $type, $attr) = getimagesize("$folder/$filename");
|
|
| 209 |
+ $output .= "<tr><td class='tblborder'>$filename</td><td class='tblborder'><img src=\"$folder/$filename\"></td><td class='tblborder' style='text-align: center;'><a href=\"javascript:pop('$folder/$filename', $imgwth, $imght, 'yes')\">"._VIEW."</a> | <a href=\"user.php?action=manageimages&delete=$filename\" onclick=\"return confirm('"._CONFIRMDELETE."')\">"._DELETE."</a></td></tr>";
|
|
| 210 |
+ $count++; |
|
| 211 |
+ } |
|
| 212 |
+ if($count == 0) $output .= "<tr><td colspan='3' style='text-align: center;'>"._NORESULTS."</td></tr>"; |
|
| 213 |
+ $output .= "</table></div>"; |
|
| 214 |
+ $output .= write_message("<a href=\"user.php?action=manageimages&upload=upload\">"._UPLOADIMAGE."</a>");
|
|
| 215 |
+ |
|
| 216 |
+ } |
|
| 217 |
+} |
|
| 218 |
+else {
|
|
| 219 |
+ $output .= write_message(_NOTAUTHORIZED); |
|
| 220 |
+} |
|
| 221 |
+?> |
|
| 0 | 222 |
\ No newline at end of file |