Version Description
Download this release
Release Info
Developer | smackcoders |
Plugin | Ultimate CSV Importer |
Version | 3.6.2 |
Comparing to | |
See all releases |
Code changes from version 3.6.1 to 3.6.2
- Readme.txt +12 -3
- images/Importicon_24.png +0 -0
- images/facebook.png +0 -0
- images/googleplus.png +0 -0
- images/icon.png +0 -0
- images/linkedin.png +0 -0
- images/twitter.png +0 -0
- index.php +4 -4
- lib/jquery-plugins/UploadHandler.php +3 -0
- lib/jquery-plugins/uploader.php +20 -1
- modules/comments/templates/index.php +1 -1
- modules/custompost/templates/index.php +1 -1
- modules/page/templates/index.php +1 -1
- modules/post/templates/index.php +1 -1
- modules/users/templates/index.php +1 -1
- templates/UploadHandler.php +0 -1350
- templates/uploader.php +0 -4
Readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: smackcoders
|
|
3 |
Donate link: http://www.smackcoders.com/donate.html
|
4 |
Tags: batch, csv, excel, import, spreadsheet, autoblog, Autoblogger, csvimporter, data, dataimport, importer, wpcsvimporter, wpimporter, acf, auto blog, csv import, csv to post, data import, Easy CSV Importer, eci, import plugin, admin, user, users, Advanced CSV Import, Advanced CSV Importer, affiliate, amazon, author, automatic, blog, buddypress, bulk, bulk edit, bulk editor, categories, comments, content, csv file, csv format, csv importer, custom post, e-commerce, free, images, language, manage, media, meta, multisite, News, page, photos, pictures, plugin, Post, seo, shop, shortcode, tags, Taxonomy, text, title, video, woocommerce, wordpress, xml, youtube
|
5 |
Requires at least: 3.6.0
|
6 |
-
Tested up to: 3.9.
|
7 |
-
Stable tag: 3.6.
|
8 |
-
Version: 3.6.
|
9 |
Author: smackcoders
|
10 |
Author URI: http://profiles.wordpress.org/smackcoders/
|
11 |
|
@@ -174,6 +174,9 @@ This will solve your issue or get support from hosting if you dint have sufficie
|
|
174 |
|
175 |
== Changelog ==
|
176 |
|
|
|
|
|
|
|
177 |
= 3.6.1 =
|
178 |
* Multi-site support issue fixed
|
179 |
* Duplicate import issue fixed
|
@@ -341,6 +344,12 @@ This will solve your issue or get support from hosting if you dint have sufficie
|
|
341 |
|
342 |
== Upgrade Notice ==
|
343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
= 3.6 =
|
345 |
* Must upgrade with major values added features
|
346 |
|
3 |
Donate link: http://www.smackcoders.com/donate.html
|
4 |
Tags: batch, csv, excel, import, spreadsheet, autoblog, Autoblogger, csvimporter, data, dataimport, importer, wpcsvimporter, wpimporter, acf, auto blog, csv import, csv to post, data import, Easy CSV Importer, eci, import plugin, admin, user, users, Advanced CSV Import, Advanced CSV Importer, affiliate, amazon, author, automatic, blog, buddypress, bulk, bulk edit, bulk editor, categories, comments, content, csv file, csv format, csv importer, custom post, e-commerce, free, images, language, manage, media, meta, multisite, News, page, photos, pictures, plugin, Post, seo, shop, shortcode, tags, Taxonomy, text, title, video, woocommerce, wordpress, xml, youtube
|
5 |
Requires at least: 3.6.0
|
6 |
+
Tested up to: 3.9.2
|
7 |
+
Stable tag: 3.6.2
|
8 |
+
Version: 3.6.2
|
9 |
Author: smackcoders
|
10 |
Author URI: http://profiles.wordpress.org/smackcoders/
|
11 |
|
174 |
|
175 |
== Changelog ==
|
176 |
|
177 |
+
= 3.6.2 =
|
178 |
+
* Hot security fix added.
|
179 |
+
|
180 |
= 3.6.1 =
|
181 |
* Multi-site support issue fixed
|
182 |
* Duplicate import issue fixed
|
344 |
|
345 |
== Upgrade Notice ==
|
346 |
|
347 |
+
= 3.6.2 =
|
348 |
+
* Important Security Update
|
349 |
+
|
350 |
+
= 3.6.1 =
|
351 |
+
* Important issue fixes update
|
352 |
+
|
353 |
= 3.6 =
|
354 |
* Must upgrade with major values added features
|
355 |
|
images/Importicon_24.png
CHANGED
File without changes
|
images/facebook.png
CHANGED
File without changes
|
images/googleplus.png
CHANGED
File without changes
|
images/icon.png
CHANGED
File without changes
|
images/linkedin.png
CHANGED
File without changes
|
images/twitter.png
CHANGED
File without changes
|
index.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/******************************
|
3 |
* Plugin Name: WP Ultimate CSV Importer
|
4 |
* Description: A plugin that helps to import the data's from a CSV file.
|
5 |
-
* Version: 3.6.
|
6 |
* Author: smackcoders.com
|
7 |
* Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
|
8 |
* Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
|
@@ -51,7 +51,7 @@ define('WP_CONST_ULTIMATE_CSV_IMP_URL', 'http://www.smackcoders.com/wp-ultimate-
|
|
51 |
define('WP_CONST_ULTIMATE_CSV_IMP_NAME', 'WP Ultimate CSV Importer');
|
52 |
define('WP_CONST_ULTIMATE_CSV_IMP_SLUG', 'wp-ultimate-csv-importer');
|
53 |
define('WP_CONST_ULTIMATE_CSV_IMP_SETTINGS', 'WP Ultimate CSV Importer');
|
54 |
-
define('WP_CONST_ULTIMATE_CSV_IMP_VERSION', '3.6');
|
55 |
define('WP_CONST_ULTIMATE_CSV_IMP_DIR', WP_PLUGIN_URL . '/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/');
|
56 |
define('WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY', plugin_dir_path(__FILE__));
|
57 |
define('WP_CSVIMP_PLUGIN_BASE', WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY);
|
@@ -113,7 +113,7 @@ function action_csv_imp_admin_init() {
|
|
113 |
wp_enqueue_style('ultimate-importer-css', plugins_url('css/main.css', __FILE__));
|
114 |
// For chart js
|
115 |
wp_enqueue_script('high_chart', plugins_url('js/highcharts.js', __FILE__));
|
116 |
-
wp_enqueue_script('export_module', plugins_url('js/exporting
|
117 |
wp_enqueue_script('pie_chart', plugins_url('js/highcharts-3d.js', __FILE__));
|
118 |
wp_enqueue_script('dropdown', plugins_url('js/dropdown.js', __FILE__));
|
119 |
|
@@ -184,7 +184,7 @@ function wpcsvimporter_add_dashboard_widgets() {
|
|
184 |
|
185 |
wp_enqueue_script('dashpiechart', plugins_url('js/dashchart.js', __FILE__));
|
186 |
wp_enqueue_script('high_chart', plugins_url('js/highcharts.js', __FILE__));
|
187 |
-
wp_enqueue_script('export_module', plugins_url('js/exporting
|
188 |
wp_enqueue_script('pie_chart', plugins_url('js/highcharts-3d.js', __FILE__));
|
189 |
wp_add_dashboard_widget('wpcsvimporter_dashboard_piehart', 'Ultimate-CSV-Importer-Statistics', 'roundchart',$screen = get_current_screen() , 'advanced' ,'high' );
|
190 |
wp_add_dashboard_widget('wpcsvimporter_dashboard_linechart', 'Ultimate-CSV-Importer-Activity', 'linetwoStats',$screen = get_current_screen(),'advanced','high');
|
2 |
/******************************
|
3 |
* Plugin Name: WP Ultimate CSV Importer
|
4 |
* Description: A plugin that helps to import the data's from a CSV file.
|
5 |
+
* Version: 3.6.2
|
6 |
* Author: smackcoders.com
|
7 |
* Plugin URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
|
8 |
* Author URI: http://www.smackcoders.com/wp-ultimate-csv-importer-pro.html
|
51 |
define('WP_CONST_ULTIMATE_CSV_IMP_NAME', 'WP Ultimate CSV Importer');
|
52 |
define('WP_CONST_ULTIMATE_CSV_IMP_SLUG', 'wp-ultimate-csv-importer');
|
53 |
define('WP_CONST_ULTIMATE_CSV_IMP_SETTINGS', 'WP Ultimate CSV Importer');
|
54 |
+
define('WP_CONST_ULTIMATE_CSV_IMP_VERSION', '3.6.2');
|
55 |
define('WP_CONST_ULTIMATE_CSV_IMP_DIR', WP_PLUGIN_URL . '/' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/');
|
56 |
define('WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY', plugin_dir_path(__FILE__));
|
57 |
define('WP_CSVIMP_PLUGIN_BASE', WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY);
|
113 |
wp_enqueue_style('ultimate-importer-css', plugins_url('css/main.css', __FILE__));
|
114 |
// For chart js
|
115 |
wp_enqueue_script('high_chart', plugins_url('js/highcharts.js', __FILE__));
|
116 |
+
wp_enqueue_script('export_module', plugins_url('js/exporting.js', __FILE__));
|
117 |
wp_enqueue_script('pie_chart', plugins_url('js/highcharts-3d.js', __FILE__));
|
118 |
wp_enqueue_script('dropdown', plugins_url('js/dropdown.js', __FILE__));
|
119 |
|
184 |
|
185 |
wp_enqueue_script('dashpiechart', plugins_url('js/dashchart.js', __FILE__));
|
186 |
wp_enqueue_script('high_chart', plugins_url('js/highcharts.js', __FILE__));
|
187 |
+
wp_enqueue_script('export_module', plugins_url('js/exporting.js', __FILE__));
|
188 |
wp_enqueue_script('pie_chart', plugins_url('js/highcharts-3d.js', __FILE__));
|
189 |
wp_add_dashboard_widget('wpcsvimporter_dashboard_piehart', 'Ultimate-CSV-Importer-Statistics', 'roundchart',$screen = get_current_screen() , 'advanced' ,'high' );
|
190 |
wp_add_dashboard_widget('wpcsvimporter_dashboard_linechart', 'Ultimate-CSV-Importer-Activity', 'linetwoStats',$screen = get_current_screen(),'advanced','high');
|
lib/jquery-plugins/UploadHandler.php
CHANGED
@@ -1079,6 +1079,9 @@ class UploadHandler
|
|
1079 |
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
|
1080 |
$index = null, $content_range = null)
|
1081 |
{
|
|
|
|
|
|
|
1082 |
$file = new stdClass();
|
1083 |
$file->name = $this->get_file_name($name, $type, $index, $content_range);
|
1084 |
$file->size = $this->fix_integer_overflow(intval($size));
|
1079 |
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
|
1080 |
$index = null, $content_range = null)
|
1081 |
{
|
1082 |
+
$post_url = admin_url() . 'admin.php?page=' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/index.php&__module=' . $_POST['current_module'] . '&step=uploadfile';
|
1083 |
+
if($post_url != $_SERVER['HTTP_REFERER'])
|
1084 |
+
die('Your requested url were wrong! Please contact your admin.');
|
1085 |
$file = new stdClass();
|
1086 |
$file->name = $this->get_file_name($name, $type, $index, $content_range);
|
1087 |
$file->size = $this->fix_integer_overflow(intval($size));
|
lib/jquery-plugins/uploader.php
CHANGED
@@ -12,4 +12,23 @@
|
|
12 |
|
13 |
error_reporting(E_ALL | E_STRICT);
|
14 |
require('UploadHandler.php');
|
15 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
error_reporting(E_ALL | E_STRICT);
|
14 |
require('UploadHandler.php');
|
15 |
+
$current_user = wp_get_current_user();
|
16 |
+
if(is_multisite()) {
|
17 |
+
if ( current_user_can( 'administrator' ) ) {
|
18 |
+
if($current_user->ID != 0)
|
19 |
+
$upload_handler = new UploadHandler();
|
20 |
+
}
|
21 |
+
}
|
22 |
+
else {
|
23 |
+
if ( current_user_can( 'author' ) ) {
|
24 |
+
$HelperObj = new WPImporter_includes_helper();
|
25 |
+
$settings = $HelperObj->getSettings();
|
26 |
+
if(isset($settings['enable_plugin_access_for_author']) && $settings['enable_plugin_access_for_author'] == 'enable_plugin_access_for_author') {
|
27 |
+
if($current_user->ID != 0)
|
28 |
+
$upload_handler = new UploadHandler();
|
29 |
+
}
|
30 |
+
} else if ( current_user_can( 'administrator' ) ) {
|
31 |
+
if($current_user->ID != 0)
|
32 |
+
$upload_handler = new UploadHandler();
|
33 |
+
}
|
34 |
+
}
|
modules/comments/templates/index.php
CHANGED
@@ -108,7 +108,7 @@ else{
|
|
108 |
jQuery(function () {
|
109 |
'use strict';
|
110 |
var uploadPath = document.getElementById('uploaddir').value;
|
111 |
-
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/
|
112 |
jQuery('#fileupload').fileupload({
|
113 |
url: url,
|
114 |
dataType: 'json',
|
108 |
jQuery(function () {
|
109 |
'use strict';
|
110 |
var uploadPath = document.getElementById('uploaddir').value;
|
111 |
+
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/lib/jquery-plugins/uploader.php')+'?uploadPath='+uploadPath+'&curr_action=<?php echo $_REQUEST['__module']; ?>';
|
112 |
jQuery('#fileupload').fileupload({
|
113 |
url: url,
|
114 |
dataType: 'json',
|
modules/custompost/templates/index.php
CHANGED
@@ -105,7 +105,7 @@ $impCE = new WPImporter_includes_helper();
|
|
105 |
jQuery(function () {
|
106 |
'use strict';
|
107 |
var uploadPath = document.getElementById('uploaddir').value;
|
108 |
-
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/
|
109 |
jQuery('#fileupload').fileupload({
|
110 |
url: url,
|
111 |
dataType: 'json',
|
105 |
jQuery(function () {
|
106 |
'use strict';
|
107 |
var uploadPath = document.getElementById('uploaddir').value;
|
108 |
+
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/lib/jquery-plugins/uploader.php')+'?uploadPath='+uploadPath+'&curr_action=<?php echo $_REQUEST['__module']; ?>';
|
109 |
jQuery('#fileupload').fileupload({
|
110 |
url: url,
|
111 |
dataType: 'json',
|
modules/page/templates/index.php
CHANGED
@@ -104,7 +104,7 @@ $impCE = new WPImporter_includes_helper();
|
|
104 |
jQuery(function () {
|
105 |
'use strict';
|
106 |
var uploadPath = document.getElementById('uploaddir').value;
|
107 |
-
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/
|
108 |
jQuery('#fileupload').fileupload({
|
109 |
url: url,
|
110 |
dataType: 'json',
|
104 |
jQuery(function () {
|
105 |
'use strict';
|
106 |
var uploadPath = document.getElementById('uploaddir').value;
|
107 |
+
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/lib/jquery-plugins/uploader.php')+'?uploadPath='+uploadPath+'&curr_action=<?php echo $_REQUEST['__module']; ?>';
|
108 |
jQuery('#fileupload').fileupload({
|
109 |
url: url,
|
110 |
dataType: 'json',
|
modules/post/templates/index.php
CHANGED
@@ -108,7 +108,7 @@ $impCE = new WPImporter_includes_helper();
|
|
108 |
jQuery(function () {
|
109 |
'use strict';
|
110 |
var uploadPath = document.getElementById('uploaddir').value;
|
111 |
-
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/
|
112 |
jQuery('#fileupload').fileupload({
|
113 |
url: url,
|
114 |
dataType: 'json',
|
108 |
jQuery(function () {
|
109 |
'use strict';
|
110 |
var uploadPath = document.getElementById('uploaddir').value;
|
111 |
+
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/lib/jquery-plugins/uploader.php')+'?uploadPath='+uploadPath+'&curr_action=<?php echo $_REQUEST['__module']; ?>';
|
112 |
jQuery('#fileupload').fileupload({
|
113 |
url: url,
|
114 |
dataType: 'json',
|
modules/users/templates/index.php
CHANGED
@@ -109,7 +109,7 @@ else{
|
|
109 |
jQuery(function () {
|
110 |
'use strict';
|
111 |
var uploadPath = document.getElementById('uploaddir').value;
|
112 |
-
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/
|
113 |
jQuery('#fileupload').fileupload({
|
114 |
url: url,
|
115 |
dataType: 'json',
|
109 |
jQuery(function () {
|
110 |
'use strict';
|
111 |
var uploadPath = document.getElementById('uploaddir').value;
|
112 |
+
var url = (document.getElementById('pluginurl').value+'/plugins/<?php echo WP_CONST_ULTIMATE_CSV_IMP_SLUG;?>/lib/jquery-plugins/uploader.php')+'?uploadPath='+uploadPath+'&curr_action=<?php echo $_REQUEST['__module']; ?>';
|
113 |
jQuery('#fileupload').fileupload({
|
114 |
url: url,
|
115 |
dataType: 'json',
|
templates/UploadHandler.php
CHANGED
@@ -35,1353 +35,3 @@
|
|
35 |
* "Copyright Smackcoders. 2014. All rights reserved".
|
36 |
********************************************************************************/
|
37 |
|
38 |
-
require_once ("../../../../wp-load.php");
|
39 |
-
require_once ("../includes/WPImporter_includes_helper.php");
|
40 |
-
class UploadHandler
|
41 |
-
{
|
42 |
-
|
43 |
-
protected $options;
|
44 |
-
|
45 |
-
// PHP File Upload error message codes:
|
46 |
-
// http://php.net/manual/en/features.file-upload.errors.php
|
47 |
-
protected $error_messages = array(
|
48 |
-
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
|
49 |
-
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
|
50 |
-
3 => 'The uploaded file was only partially uploaded',
|
51 |
-
4 => 'No file was uploaded',
|
52 |
-
6 => 'Missing a temporary folder',
|
53 |
-
7 => 'Failed to write file to disk',
|
54 |
-
8 => 'A PHP extension stopped the file upload',
|
55 |
-
'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini',
|
56 |
-
'max_file_size' => 'File is too big',
|
57 |
-
'min_file_size' => 'File is too small',
|
58 |
-
'accept_file_types' => 'Filetype not allowed',
|
59 |
-
'max_number_of_files' => 'Maximum number of files exceeded',
|
60 |
-
'max_width' => 'Image exceeds maximum width',
|
61 |
-
'min_width' => 'Image requires a minimum width',
|
62 |
-
'max_height' => 'Image exceeds maximum height',
|
63 |
-
'min_height' => 'Image requires a minimum height'
|
64 |
-
);
|
65 |
-
|
66 |
-
protected $image_objects = array();
|
67 |
-
|
68 |
-
function __construct($options = null, $initialize = true, $error_messages = null) {
|
69 |
-
|
70 |
-
$this->options = array(
|
71 |
-
'script_url' => $this->get_full_url().'/',
|
72 |
-
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
|
73 |
-
'upload_url' => $this->get_full_url().'/files/',
|
74 |
-
'user_dirs' => false,
|
75 |
-
'mkdir_mode' => 0755,
|
76 |
-
'param_name' => 'files',
|
77 |
-
// Set the following option to 'POST', if your server does not support
|
78 |
-
// DELETE requests. This is a parameter sent to the client:
|
79 |
-
'delete_type' => 'DELETE',
|
80 |
-
'access_control_allow_origin' => '*',
|
81 |
-
'access_control_allow_credentials' => false,
|
82 |
-
'access_control_allow_methods' => array(
|
83 |
-
'OPTIONS',
|
84 |
-
'HEAD',
|
85 |
-
'GET',
|
86 |
-
'POST',
|
87 |
-
'PUT',
|
88 |
-
'PATCH',
|
89 |
-
'DELETE'
|
90 |
-
),
|
91 |
-
'access_control_allow_headers' => array(
|
92 |
-
'Content-Type',
|
93 |
-
'Content-Range',
|
94 |
-
'Content-Disposition'
|
95 |
-
),
|
96 |
-
// Enable to provide file downloads via GET requests to the PHP script:
|
97 |
-
// 1. Set to 1 to download files via readfile method through PHP
|
98 |
-
// 2. Set to 2 to send a X-Sendfile header for lighttpd/Apache
|
99 |
-
// 3. Set to 3 to send a X-Accel-Redirect header for nginx
|
100 |
-
// If set to 2 or 3, adjust the upload_url option to the base path of
|
101 |
-
// the redirect parameter, e.g. '/files/'.
|
102 |
-
'download_via_php' => false,
|
103 |
-
// Read files in chunks to avoid memory limits when download_via_php
|
104 |
-
// is enabled, set to 0 to disable chunked reading of files:
|
105 |
-
'readfile_chunk_size' => 10 * 1024 * 1024, // 10 MiB
|
106 |
-
// Defines which files can be displayed inline when downloaded:
|
107 |
-
'inline_file_types' => '/\.(gif|jpe?g|png)$/i',
|
108 |
-
// Defines which files (based on their names) are accepted for upload:
|
109 |
-
'accept_file_types' => '/.+$/i',
|
110 |
-
// The php.ini settings upload_max_filesize and post_max_size
|
111 |
-
// take precedence over the following max_file_size setting:
|
112 |
-
'max_file_size' => null,
|
113 |
-
'min_file_size' => 1,
|
114 |
-
// The maximum number of files for the upload directory:
|
115 |
-
'max_number_of_files' => null,
|
116 |
-
// Defines which files are handled as image files:
|
117 |
-
'image_file_types' => '/\.(gif|jpe?g|png)$/i',
|
118 |
-
// Image resolution restrictions:
|
119 |
-
'max_width' => null,
|
120 |
-
'max_height' => null,
|
121 |
-
'min_width' => 1,
|
122 |
-
'min_height' => 1,
|
123 |
-
// Set the following option to false to enable resumable uploads:
|
124 |
-
'discard_aborted_uploads' => true,
|
125 |
-
// Set to 0 to use the GD library to scale and orient images,
|
126 |
-
// set to 1 to use imagick (if installed, falls back to GD),
|
127 |
-
// set to 2 to use the ImageMagick convert binary directly:
|
128 |
-
'image_library' => 1,
|
129 |
-
// Uncomment the following to define an array of resource limits
|
130 |
-
// for imagick:
|
131 |
-
/*
|
132 |
-
'imagick_resource_limits' => array(
|
133 |
-
imagick::RESOURCETYPE_MAP => 32,
|
134 |
-
imagick::RESOURCETYPE_MEMORY => 32
|
135 |
-
),
|
136 |
-
*/
|
137 |
-
// Command or path for to the ImageMagick convert binary:
|
138 |
-
'convert_bin' => 'convert',
|
139 |
-
// Uncomment the following to add parameters in front of each
|
140 |
-
// ImageMagick convert call (the limit constraints seem only
|
141 |
-
// to have an effect if put in front):
|
142 |
-
/*
|
143 |
-
'convert_params' => '-limit memory 32MiB -limit map 32MiB',
|
144 |
-
*/
|
145 |
-
// Command or path for to the ImageMagick identify binary:
|
146 |
-
'identify_bin' => 'identify',
|
147 |
-
'image_versions' => array(
|
148 |
-
// The empty image version key defines options for the original image:
|
149 |
-
'' => array(
|
150 |
-
// Automatically rotate images based on EXIF meta data:
|
151 |
-
'auto_orient' => true
|
152 |
-
),
|
153 |
-
// Uncomment the following to create medium sized images:
|
154 |
-
/*
|
155 |
-
'medium' => array(
|
156 |
-
'max_width' => 800,
|
157 |
-
'max_height' => 600
|
158 |
-
),
|
159 |
-
*/
|
160 |
-
'thumbnail' => array(
|
161 |
-
// Uncomment the following to use a defined directory for the thumbnails
|
162 |
-
// instead of a subdirectory based on the version identifier.
|
163 |
-
// Make sure that this directory doesn't allow execution of files if you
|
164 |
-
// don't pose any restrictions on the type of uploaded files, e.g. by
|
165 |
-
// copying the .htaccess file from the files directory for Apache:
|
166 |
-
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/thumb/',
|
167 |
-
//'upload_url' => $this->get_full_url().'/thumb/',
|
168 |
-
// Uncomment the following to force the max
|
169 |
-
// dimensions and e.g. create square thumbnails:
|
170 |
-
//'crop' => true,
|
171 |
-
'max_width' => 80,
|
172 |
-
'max_height' => 80
|
173 |
-
)
|
174 |
-
)
|
175 |
-
);
|
176 |
-
if ($options) {
|
177 |
-
$this->options = $options + $this->options;
|
178 |
-
}
|
179 |
-
if ($error_messages) {
|
180 |
-
$this->error_messages = $error_messages + $this->error_messages;
|
181 |
-
}
|
182 |
-
if ($initialize) {
|
183 |
-
$this->initialize();
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
-
protected function initialize() {
|
188 |
-
switch ($this->get_server_var('REQUEST_METHOD')) {
|
189 |
-
case 'OPTIONS':
|
190 |
-
case 'HEAD':
|
191 |
-
$this->head();
|
192 |
-
break;
|
193 |
-
case 'GET':
|
194 |
-
$this->get();
|
195 |
-
break;
|
196 |
-
case 'PATCH':
|
197 |
-
case 'PUT':
|
198 |
-
case 'POST':
|
199 |
-
$this->post();
|
200 |
-
break;
|
201 |
-
case 'DELETE':
|
202 |
-
$this->delete();
|
203 |
-
break;
|
204 |
-
default:
|
205 |
-
$this->header('HTTP/1.1 405 Method Not Allowed');
|
206 |
-
}
|
207 |
-
}
|
208 |
-
|
209 |
-
protected function get_full_url() {
|
210 |
-
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0;
|
211 |
-
return
|
212 |
-
($https ? 'https://' : 'http://').
|
213 |
-
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
214 |
-
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
215 |
-
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
216 |
-
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
217 |
-
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
218 |
-
}
|
219 |
-
|
220 |
-
protected function get_user_id() {
|
221 |
-
@session_start();
|
222 |
-
return session_id();
|
223 |
-
}
|
224 |
-
|
225 |
-
protected function get_user_path() {
|
226 |
-
if ($this->options['user_dirs']) {
|
227 |
-
return $this->get_user_id().'/';
|
228 |
-
}
|
229 |
-
return '';
|
230 |
-
}
|
231 |
-
|
232 |
-
protected function get_upload_path($file_name = null, $version = null) {
|
233 |
-
$HelperObj = new WPImporter_includes_helper();
|
234 |
-
//$uploadDir = 'ultimate_importer';
|
235 |
-
$uploadDir = $HelperObj->uploadDir;
|
236 |
-
|
237 |
-
$file_name = $file_name ? $file_name : '';
|
238 |
-
if (empty($version)) {
|
239 |
-
$version_path = '';
|
240 |
-
} else {
|
241 |
-
$version_dir = @$this->options['image_versions'][$version]['upload_dir'];
|
242 |
-
if ($version_dir) {
|
243 |
-
return $version_dir.$this->get_user_path().$file_name;
|
244 |
-
}
|
245 |
-
$version_path = $version.'/';
|
246 |
-
}
|
247 |
-
|
248 |
-
$uploadpath = $_REQUEST['uploadPath'];
|
249 |
-
$file_name = $HelperObj->convert_string2hash_key($file_name); // Code added by Fredrick Marks
|
250 |
-
|
251 |
-
return $uploadpath.'/'.$uploadDir.'/'.$this->get_user_path().$version_path.$file_name;
|
252 |
-
}
|
253 |
-
|
254 |
-
|
255 |
-
protected function get_query_separator($url) {
|
256 |
-
return strpos($url, '?') === false ? '?' : '&';
|
257 |
-
}
|
258 |
-
|
259 |
-
protected function get_download_url($file_name, $version = null, $direct = false) {
|
260 |
-
if (!$direct && $this->options['download_via_php']) {
|
261 |
-
$url = $this->options['script_url']
|
262 |
-
.$this->get_query_separator($this->options['script_url'])
|
263 |
-
.'file='.rawurlencode($file_name);
|
264 |
-
if ($version) {
|
265 |
-
$url .= '&version='.rawurlencode($version);
|
266 |
-
}
|
267 |
-
return $url.'&download=1';
|
268 |
-
}
|
269 |
-
if (empty($version)) {
|
270 |
-
$version_path = '';
|
271 |
-
} else {
|
272 |
-
$version_url = @$this->options['image_versions'][$version]['upload_url'];
|
273 |
-
if ($version_url) {
|
274 |
-
return $version_url.$this->get_user_path().rawurlencode($file_name);
|
275 |
-
}
|
276 |
-
$version_path = rawurlencode($version).'/';
|
277 |
-
}
|
278 |
-
return $this->options['upload_url'].$this->get_user_path()
|
279 |
-
.$version_path.rawurlencode($file_name);
|
280 |
-
}
|
281 |
-
|
282 |
-
protected function set_additional_file_properties($file) {
|
283 |
-
$file->deleteUrl = $this->options['script_url']
|
284 |
-
.$this->get_query_separator($this->options['script_url'])
|
285 |
-
.$this->get_singular_param_name()
|
286 |
-
.'='.rawurlencode($file->name);
|
287 |
-
$file->deleteType = $this->options['delete_type'];
|
288 |
-
if ($file->deleteType !== 'DELETE') {
|
289 |
-
$file->deleteUrl .= '&_method=DELETE';
|
290 |
-
}
|
291 |
-
if ($this->options['access_control_allow_credentials']) {
|
292 |
-
$file->deleteWithCredentials = true;
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
-
// Fix for overflowing signed 32 bit integers,
|
297 |
-
// works for sizes up to 2^32-1 bytes (4 GiB - 1):
|
298 |
-
protected function fix_integer_overflow($size) {
|
299 |
-
if ($size < 0) {
|
300 |
-
$size += 2.0 * (PHP_INT_MAX + 1);
|
301 |
-
}
|
302 |
-
return $size;
|
303 |
-
}
|
304 |
-
|
305 |
-
protected function get_file_size($file_path, $clear_stat_cache = false) {
|
306 |
-
if ($clear_stat_cache) {
|
307 |
-
clearstatcache(true, $file_path);
|
308 |
-
}
|
309 |
-
return $this->fix_integer_overflow(filesize($file_path));
|
310 |
-
|
311 |
-
}
|
312 |
-
|
313 |
-
protected function is_valid_file_object($file_name) {
|
314 |
-
$file_path = $this->get_upload_path($file_name);
|
315 |
-
if (is_file($file_path) && $file_name[0] !== '.') {
|
316 |
-
return true;
|
317 |
-
}
|
318 |
-
return false;
|
319 |
-
}
|
320 |
-
|
321 |
-
protected function get_file_object($file_name) {
|
322 |
-
if ($this->is_valid_file_object($file_name)) {
|
323 |
-
$file = new stdClass();
|
324 |
-
$file->name = $file_name;
|
325 |
-
$file->size = $this->get_file_size(
|
326 |
-
$this->get_upload_path($file_name)
|
327 |
-
);
|
328 |
-
$file->url = $this->get_download_url($file->name);
|
329 |
-
foreach($this->options['image_versions'] as $version => $options) {
|
330 |
-
if (!empty($version)) {
|
331 |
-
if (is_file($this->get_upload_path($file_name, $version))) {
|
332 |
-
$file->{$version.'Url'} = $this->get_download_url(
|
333 |
-
$file->name,
|
334 |
-
$version
|
335 |
-
);
|
336 |
-
}
|
337 |
-
}
|
338 |
-
}
|
339 |
-
$this->set_additional_file_properties($file);
|
340 |
-
return $file;
|
341 |
-
}
|
342 |
-
return null;
|
343 |
-
}
|
344 |
-
|
345 |
-
protected function get_file_objects($iteration_method = 'get_file_object') {
|
346 |
-
$upload_dir = $this->get_upload_path();
|
347 |
-
if (!is_dir($upload_dir)) {
|
348 |
-
return array();
|
349 |
-
}
|
350 |
-
return array_values(array_filter(array_map(
|
351 |
-
array($this, $iteration_method),
|
352 |
-
scandir($upload_dir)
|
353 |
-
)));
|
354 |
-
}
|
355 |
-
|
356 |
-
protected function count_file_objects() {
|
357 |
-
return count($this->get_file_objects('is_valid_file_object'));
|
358 |
-
}
|
359 |
-
|
360 |
-
protected function get_error_message($error) {
|
361 |
-
return array_key_exists($error, $this->error_messages) ?
|
362 |
-
$this->error_messages[$error] : $error;
|
363 |
-
}
|
364 |
-
|
365 |
-
function get_config_bytes($val) {
|
366 |
-
$val = trim($val);
|
367 |
-
$last = strtolower($val[strlen($val)-1]);
|
368 |
-
switch($last) {
|
369 |
-
case 'g':
|
370 |
-
$val *= 1024;
|
371 |
-
case 'm':
|
372 |
-
$val *= 1024;
|
373 |
-
case 'k':
|
374 |
-
$val *= 1024;
|
375 |
-
}
|
376 |
-
return $this->fix_integer_overflow($val);
|
377 |
-
}
|
378 |
-
|
379 |
-
protected function validate($uploaded_file, $file, $error, $index) {
|
380 |
-
if ($error) {
|
381 |
-
$file->error = $this->get_error_message($error);
|
382 |
-
return false;
|
383 |
-
}
|
384 |
-
$content_length = $this->fix_integer_overflow(intval(
|
385 |
-
$this->get_server_var('CONTENT_LENGTH')
|
386 |
-
));
|
387 |
-
$post_max_size = $this->get_config_bytes(ini_get('post_max_size'));
|
388 |
-
if ($post_max_size && ($content_length > $post_max_size)) {
|
389 |
-
$file->error = $this->get_error_message('post_max_size');
|
390 |
-
return false;
|
391 |
-
}
|
392 |
-
if (!preg_match($this->options['accept_file_types'], $file->name)) {
|
393 |
-
$file->error = $this->get_error_message('accept_file_types');
|
394 |
-
return false;
|
395 |
-
}
|
396 |
-
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
397 |
-
$file_size = $this->get_file_size($uploaded_file);
|
398 |
-
} else {
|
399 |
-
$file_size = $content_length;
|
400 |
-
}
|
401 |
-
if ($this->options['max_file_size'] && (
|
402 |
-
$file_size > $this->options['max_file_size'] ||
|
403 |
-
$file->size > $this->options['max_file_size'])
|
404 |
-
) {
|
405 |
-
$file->error = $this->get_error_message('max_file_size');
|
406 |
-
return false;
|
407 |
-
}
|
408 |
-
if ($this->options['min_file_size'] &&
|
409 |
-
$file_size < $this->options['min_file_size']) {
|
410 |
-
$file->error = $this->get_error_message('min_file_size');
|
411 |
-
return false;
|
412 |
-
}
|
413 |
-
if (is_int($this->options['max_number_of_files']) && (
|
414 |
-
$this->count_file_objects() >= $this->options['max_number_of_files'])
|
415 |
-
) {
|
416 |
-
$file->error = $this->get_error_message('max_number_of_files');
|
417 |
-
return false;
|
418 |
-
}
|
419 |
-
$max_width = @$this->options['max_width'];
|
420 |
-
$max_height = @$this->options['max_height'];
|
421 |
-
$min_width = @$this->options['min_width'];
|
422 |
-
$min_height = @$this->options['min_height'];
|
423 |
-
if (($max_width || $max_height || $min_width || $min_height)) {
|
424 |
-
list($img_width, $img_height) = $this->get_image_size($uploaded_file);
|
425 |
-
}
|
426 |
-
if (!empty($img_width)) {
|
427 |
-
if ($max_width && $img_width > $max_width) {
|
428 |
-
$file->error = $this->get_error_message('max_width');
|
429 |
-
return false;
|
430 |
-
}
|
431 |
-
if ($max_height && $img_height > $max_height) {
|
432 |
-
$file->error = $this->get_error_message('max_height');
|
433 |
-
return false;
|
434 |
-
}
|
435 |
-
if ($min_width && $img_width < $min_width) {
|
436 |
-
$file->error = $this->get_error_message('min_width');
|
437 |
-
return false;
|
438 |
-
}
|
439 |
-
if ($min_height && $img_height < $min_height) {
|
440 |
-
$file->error = $this->get_error_message('min_height');
|
441 |
-
return false;
|
442 |
-
}
|
443 |
-
}
|
444 |
-
return true;
|
445 |
-
}
|
446 |
-
|
447 |
-
protected function upcount_name_callback($matches) {
|
448 |
-
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
449 |
-
$ext = isset($matches[2]) ? $matches[2] : '';
|
450 |
-
|
451 |
-
return '-'.$index.$ext; // Code modified by Fredrick Marks
|
452 |
-
}
|
453 |
-
|
454 |
-
protected function upcount_name($name) { // Code modified by Fredrick Marks
|
455 |
-
return preg_replace_callback(
|
456 |
-
'/(?:(?:\-([\d]+))?(\.[^.]+))?$/',
|
457 |
-
array($this, 'upcount_name_callback'),
|
458 |
-
$name,
|
459 |
-
1
|
460 |
-
);
|
461 |
-
}
|
462 |
-
|
463 |
-
protected function get_unique_filename($name,
|
464 |
-
$type = null, $index = null, $content_range = null) {
|
465 |
-
while(is_dir($this->get_upload_path($name))) {
|
466 |
-
$name = $this->upcount_name($name);
|
467 |
-
}
|
468 |
-
// Keep an existing filename if this is part of a chunked upload:
|
469 |
-
$uploaded_bytes = $this->fix_integer_overflow(intval($content_range[1]));
|
470 |
-
while(is_file($this->get_upload_path($name))) {
|
471 |
-
if ($uploaded_bytes === $this->get_file_size(
|
472 |
-
$this->get_upload_path($name))) {
|
473 |
-
|
474 |
-
break;
|
475 |
-
}
|
476 |
-
else
|
477 |
-
{
|
478 |
-
|
479 |
-
}
|
480 |
-
$name = $this->upcount_name($name);
|
481 |
-
}
|
482 |
-
return $name;
|
483 |
-
}
|
484 |
-
|
485 |
-
protected function trim_file_name($name,
|
486 |
-
$type = null, $index = null, $content_range = null) {
|
487 |
-
// Remove path information and dots around the filename, to prevent uploading
|
488 |
-
// into different directories or replacing hidden system files.
|
489 |
-
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
490 |
-
$name = trim(basename(stripslashes($name)), ".\x00..\x20");
|
491 |
-
// Use a timestamp for empty filenames:
|
492 |
-
if (!$name) {
|
493 |
-
$name = str_replace('.', '-', microtime(true));
|
494 |
-
}
|
495 |
-
// Add missing file extension for known image types:
|
496 |
-
if (strpos($name, '.') === false &&
|
497 |
-
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
|
498 |
-
$name .= '.'.$matches[1];
|
499 |
-
}
|
500 |
-
//return $name;
|
501 |
-
|
502 |
-
//Edited original file starts
|
503 |
-
|
504 |
-
//Add version as (1), if the file import first time
|
505 |
-
$version_zero=array();
|
506 |
-
$rem_csv=array();
|
507 |
-
|
508 |
-
$temp_name= str_replace("(","[",$name);
|
509 |
-
$name= str_replace(")","]",$temp_name);
|
510 |
-
|
511 |
-
$rem_csv=explode(".csv",$name);
|
512 |
-
$version_zero= explode("(",$rem_csv[0]);
|
513 |
-
/* if(!is_array($version_zero)){
|
514 |
-
return $version_zero[0];
|
515 |
-
}else{
|
516 |
-
return 'HERE';
|
517 |
-
}*/
|
518 |
-
$file_name_arr=array();
|
519 |
-
$file_name_arr= explode('.csv',$name);
|
520 |
-
$current_action= $_REQUEST['curr_action'];
|
521 |
-
if(!is_array($version_zero))
|
522 |
-
return $file_name_arr[0].'-'.$current_action.' .csv'; // Code modified by Fredrick Marks
|
523 |
-
else
|
524 |
-
return $file_name_arr[0].'-'.$current_action.'-1.csv'; // Code modified by Fredrick Marks
|
525 |
-
//Edited original file ends
|
526 |
-
}
|
527 |
-
|
528 |
-
protected function get_file_name($name,
|
529 |
-
$type = null, $index = null, $content_range = null) {
|
530 |
-
return $this->get_unique_filename(
|
531 |
-
$this->trim_file_name($name, $type, $index, $content_range),
|
532 |
-
$type,
|
533 |
-
$index,
|
534 |
-
$content_range
|
535 |
-
);
|
536 |
-
}
|
537 |
-
|
538 |
-
protected function handle_form_data($file, $index) {
|
539 |
-
// Handle form data, e.g. $_REQUEST['description'][$index]
|
540 |
-
}
|
541 |
-
|
542 |
-
protected function get_scaled_image_file_paths($file_name, $version) {
|
543 |
-
$file_path = $this->get_upload_path($file_name);
|
544 |
-
if (!empty($version)) {
|
545 |
-
$version_dir = $this->get_upload_path(null, $version);
|
546 |
-
if (!is_dir($version_dir)) {
|
547 |
-
mkdir($version_dir, $this->options['mkdir_mode'], true);
|
548 |
-
}
|
549 |
-
$new_file_path = $version_dir.'/'.$file_name;
|
550 |
-
} else {
|
551 |
-
$new_file_path = $file_path;
|
552 |
-
}
|
553 |
-
return array($file_path, $new_file_path);
|
554 |
-
}
|
555 |
-
|
556 |
-
protected function gd_get_image_object($file_path, $func, $no_cache = false) {
|
557 |
-
if (empty($this->image_objects[$file_path]) || $no_cache) {
|
558 |
-
$this->gd_destroy_image_object($file_path);
|
559 |
-
$this->image_objects[$file_path] = $func($file_path);
|
560 |
-
}
|
561 |
-
return $this->image_objects[$file_path];
|
562 |
-
}
|
563 |
-
|
564 |
-
protected function gd_set_image_object($file_path, $image) {
|
565 |
-
$this->gd_destroy_image_object($file_path);
|
566 |
-
$this->image_objects[$file_path] = $image;
|
567 |
-
}
|
568 |
-
|
569 |
-
protected function gd_destroy_image_object($file_path) {
|
570 |
-
$image = @$this->image_objects[$file_path];
|
571 |
-
return $image && imagedestroy($image);
|
572 |
-
}
|
573 |
-
|
574 |
-
protected function gd_imageflip($image, $mode) {
|
575 |
-
if (function_exists('imageflip')) {
|
576 |
-
return imageflip($image, $mode);
|
577 |
-
}
|
578 |
-
$new_width = $src_width = imagesx($image);
|
579 |
-
$new_height = $src_height = imagesy($image);
|
580 |
-
$new_img = imagecreatetruecolor($new_width, $new_height);
|
581 |
-
$src_x = 0;
|
582 |
-
$src_y = 0;
|
583 |
-
switch ($mode) {
|
584 |
-
case '1': // flip on the horizontal axis
|
585 |
-
$src_y = $new_height - 1;
|
586 |
-
$src_height = -$new_height;
|
587 |
-
break;
|
588 |
-
case '2': // flip on the vertical axis
|
589 |
-
$src_x = $new_width - 1;
|
590 |
-
$src_width = -$new_width;
|
591 |
-
break;
|
592 |
-
case '3': // flip on both axes
|
593 |
-
$src_y = $new_height - 1;
|
594 |
-
$src_height = -$new_height;
|
595 |
-
$src_x = $new_width - 1;
|
596 |
-
$src_width = -$new_width;
|
597 |
-
break;
|
598 |
-
default:
|
599 |
-
return $image;
|
600 |
-
}
|
601 |
-
imagecopyresampled(
|
602 |
-
$new_img,
|
603 |
-
$image,
|
604 |
-
0,
|
605 |
-
0,
|
606 |
-
$src_x,
|
607 |
-
$src_y,
|
608 |
-
$new_width,
|
609 |
-
$new_height,
|
610 |
-
$src_width,
|
611 |
-
$src_height
|
612 |
-
);
|
613 |
-
return $new_img;
|
614 |
-
}
|
615 |
-
|
616 |
-
protected function gd_orient_image($file_path, $src_img) {
|
617 |
-
if (!function_exists('exif_read_data')) {
|
618 |
-
return false;
|
619 |
-
}
|
620 |
-
$exif = @exif_read_data($file_path);
|
621 |
-
if ($exif === false) {
|
622 |
-
return false;
|
623 |
-
}
|
624 |
-
$orientation = intval(@$exif['Orientation']);
|
625 |
-
if ($orientation < 2 || $orientation > 8) {
|
626 |
-
return false;
|
627 |
-
}
|
628 |
-
switch ($orientation) {
|
629 |
-
case 2:
|
630 |
-
$new_img = $this->gd_imageflip(
|
631 |
-
$src_img,
|
632 |
-
defined('IMG_FLIP_VERTICAL') ? IMG_FLIP_VERTICAL : 2
|
633 |
-
);
|
634 |
-
break;
|
635 |
-
case 3:
|
636 |
-
$new_img = imagerotate($src_img, 180, 0);
|
637 |
-
break;
|
638 |
-
case 4:
|
639 |
-
$new_img = $this->gd_imageflip(
|
640 |
-
$src_img,
|
641 |
-
defined('IMG_FLIP_HORIZONTAL') ? IMG_FLIP_HORIZONTAL : 1
|
642 |
-
);
|
643 |
-
break;
|
644 |
-
case 5:
|
645 |
-
$tmp_img = $this->gd_imageflip(
|
646 |
-
$src_img,
|
647 |
-
defined('IMG_FLIP_HORIZONTAL') ? IMG_FLIP_HORIZONTAL : 1
|
648 |
-
);
|
649 |
-
$new_img = imagerotate($tmp_img, 270, 0);
|
650 |
-
imagedestroy($tmp_img);
|
651 |
-
break;
|
652 |
-
case 6:
|
653 |
-
$new_img = imagerotate($src_img, 270, 0);
|
654 |
-
break;
|
655 |
-
case 7:
|
656 |
-
$tmp_img = $this->gd_imageflip(
|
657 |
-
$src_img,
|
658 |
-
defined('IMG_FLIP_VERTICAL') ? IMG_FLIP_VERTICAL : 2
|
659 |
-
);
|
660 |
-
$new_img = imagerotate($tmp_img, 270, 0);
|
661 |
-
imagedestroy($tmp_img);
|
662 |
-
break;
|
663 |
-
case 8:
|
664 |
-
$new_img = imagerotate($src_img, 90, 0);
|
665 |
-
break;
|
666 |
-
default:
|
667 |
-
return false;
|
668 |
-
}
|
669 |
-
$this->gd_set_image_object($file_path, $new_img);
|
670 |
-
return true;
|
671 |
-
}
|
672 |
-
|
673 |
-
protected function gd_create_scaled_image($file_name, $version, $options) {
|
674 |
-
if (!function_exists('imagecreatetruecolor')) {
|
675 |
-
error_log('Function not found: imagecreatetruecolor');
|
676 |
-
return false;
|
677 |
-
}
|
678 |
-
list($file_path, $new_file_path) =
|
679 |
-
$this->get_scaled_image_file_paths($file_name, $version);
|
680 |
-
$type = strtolower(substr(strrchr($file_name, '.'), 1));
|
681 |
-
switch ($type) {
|
682 |
-
case 'jpg':
|
683 |
-
case 'jpeg':
|
684 |
-
$src_func = 'imagecreatefromjpeg';
|
685 |
-
$write_func = 'imagejpeg';
|
686 |
-
$image_quality = isset($options['jpeg_quality']) ?
|
687 |
-
$options['jpeg_quality'] : 75;
|
688 |
-
break;
|
689 |
-
case 'gif':
|
690 |
-
$src_func = 'imagecreatefromgif';
|
691 |
-
$write_func = 'imagegif';
|
692 |
-
$image_quality = null;
|
693 |
-
break;
|
694 |
-
case 'png':
|
695 |
-
$src_func = 'imagecreatefrompng';
|
696 |
-
$write_func = 'imagepng';
|
697 |
-
$image_quality = isset($options['png_quality']) ?
|
698 |
-
$options['png_quality'] : 9;
|
699 |
-
break;
|
700 |
-
default:
|
701 |
-
return false;
|
702 |
-
}
|
703 |
-
$src_img = $this->gd_get_image_object(
|
704 |
-
$file_path,
|
705 |
-
$src_func,
|
706 |
-
!empty($options['no_cache'])
|
707 |
-
);
|
708 |
-
$image_oriented = false;
|
709 |
-
if (!empty($options['auto_orient']) && $this->gd_orient_image(
|
710 |
-
$file_path,
|
711 |
-
$src_img
|
712 |
-
)) {
|
713 |
-
$image_oriented = true;
|
714 |
-
$src_img = $this->gd_get_image_object(
|
715 |
-
$file_path,
|
716 |
-
$src_func
|
717 |
-
);
|
718 |
-
}
|
719 |
-
$max_width = $img_width = imagesx($src_img);
|
720 |
-
$max_height = $img_height = imagesy($src_img);
|
721 |
-
if (!empty($options['max_width'])) {
|
722 |
-
$max_width = $options['max_width'];
|
723 |
-
}
|
724 |
-
if (!empty($options['max_height'])) {
|
725 |
-
$max_height = $options['max_height'];
|
726 |
-
}
|
727 |
-
$scale = min(
|
728 |
-
$max_width / $img_width,
|
729 |
-
$max_height / $img_height
|
730 |
-
);
|
731 |
-
if ($scale >= 1) {
|
732 |
-
if ($image_oriented) {
|
733 |
-
return $write_func($src_img, $new_file_path, $image_quality);
|
734 |
-
}
|
735 |
-
if ($file_path !== $new_file_path) {
|
736 |
-
return copy($file_path, $new_file_path);
|
737 |
-
}
|
738 |
-
return true;
|
739 |
-
}
|
740 |
-
if (empty($options['crop'])) {
|
741 |
-
$new_width = $img_width * $scale;
|
742 |
-
$new_height = $img_height * $scale;
|
743 |
-
$dst_x = 0;
|
744 |
-
$dst_y = 0;
|
745 |
-
$new_img = imagecreatetruecolor($new_width, $new_height);
|
746 |
-
} else {
|
747 |
-
if (($img_width / $img_height) >= ($max_width / $max_height)) {
|
748 |
-
$new_width = $img_width / ($img_height / $max_height);
|
749 |
-
$new_height = $max_height;
|
750 |
-
} else {
|
751 |
-
$new_width = $max_width;
|
752 |
-
$new_height = $img_height / ($img_width / $max_width);
|
753 |
-
}
|
754 |
-
$dst_x = 0 - ($new_width - $max_width) / 2;
|
755 |
-
$dst_y = 0 - ($new_height - $max_height) / 2;
|
756 |
-
$new_img = imagecreatetruecolor($max_width, $max_height);
|
757 |
-
}
|
758 |
-
// Handle transparency in GIF and PNG images:
|
759 |
-
switch ($type) {
|
760 |
-
case 'gif':
|
761 |
-
case 'png':
|
762 |
-
imagecolortransparent($new_img, imagecolorallocate($new_img, 0, 0, 0));
|
763 |
-
case 'png':
|
764 |
-
imagealphablending($new_img, false);
|
765 |
-
imagesavealpha($new_img, true);
|
766 |
-
break;
|
767 |
-
}
|
768 |
-
$success = imagecopyresampled(
|
769 |
-
$new_img,
|
770 |
-
$src_img,
|
771 |
-
$dst_x,
|
772 |
-
$dst_y,
|
773 |
-
0,
|
774 |
-
0,
|
775 |
-
$new_width,
|
776 |
-
$new_height,
|
777 |
-
$img_width,
|
778 |
-
$img_height
|
779 |
-
) && $write_func($new_img, $new_file_path, $image_quality);
|
780 |
-
$this->gd_set_image_object($file_path, $new_img);
|
781 |
-
return $success;
|
782 |
-
}
|
783 |
-
|
784 |
-
protected function imagick_get_image_object($file_path, $no_cache = false) {
|
785 |
-
if (empty($this->image_objects[$file_path]) || $no_cache) {
|
786 |
-
$this->imagick_destroy_image_object($file_path);
|
787 |
-
$image = new Imagick();
|
788 |
-
if (!empty($this->options['imagick_resource_limits'])) {
|
789 |
-
foreach ($this->options['imagick_resource_limits'] as $type => $limit) {
|
790 |
-
$image->setResourceLimit($type, $limit);
|
791 |
-
}
|
792 |
-
}
|
793 |
-
$image->readImage($file_path);
|
794 |
-
$this->image_objects[$file_path] = $image;
|
795 |
-
}
|
796 |
-
return $this->image_objects[$file_path];
|
797 |
-
}
|
798 |
-
|
799 |
-
protected function imagick_set_image_object($file_path, $image) {
|
800 |
-
$this->imagick_destroy_image_object($file_path);
|
801 |
-
$this->image_objects[$file_path] = $image;
|
802 |
-
}
|
803 |
-
|
804 |
-
protected function imagick_destroy_image_object($file_path) {
|
805 |
-
$image = @$this->image_objects[$file_path];
|
806 |
-
return $image && $image->destroy();
|
807 |
-
}
|
808 |
-
|
809 |
-
protected function imagick_orient_image($image) {
|
810 |
-
$orientation = $image->getImageOrientation();
|
811 |
-
$background = new ImagickPixel('none');
|
812 |
-
switch ($orientation) {
|
813 |
-
case imagick::ORIENTATION_TOPRIGHT: // 2
|
814 |
-
$image->flopImage(); // horizontal flop around y-axis
|
815 |
-
break;
|
816 |
-
case imagick::ORIENTATION_BOTTOMRIGHT: // 3
|
817 |
-
$image->rotateImage($background, 180);
|
818 |
-
break;
|
819 |
-
case imagick::ORIENTATION_BOTTOMLEFT: // 4
|
820 |
-
$image->flipImage(); // vertical flip around x-axis
|
821 |
-
break;
|
822 |
-
case imagick::ORIENTATION_LEFTTOP: // 5
|
823 |
-
$image->flopImage(); // horizontal flop around y-axis
|
824 |
-
$image->rotateImage($background, 270);
|
825 |
-
break;
|
826 |
-
case imagick::ORIENTATION_RIGHTTOP: // 6
|
827 |
-
$image->rotateImage($background, 90);
|
828 |
-
break;
|
829 |
-
case imagick::ORIENTATION_RIGHTBOTTOM: // 7
|
830 |
-
$image->flipImage(); // vertical flip around x-axis
|
831 |
-
$image->rotateImage($background, 270);
|
832 |
-
break;
|
833 |
-
case imagick::ORIENTATION_LEFTBOTTOM: // 8
|
834 |
-
$image->rotateImage($background, 270);
|
835 |
-
break;
|
836 |
-
default:
|
837 |
-
return false;
|
838 |
-
}
|
839 |
-
$image->setImageOrientation(imagick::ORIENTATION_TOPLEFT); // 1
|
840 |
-
return true;
|
841 |
-
}
|
842 |
-
|
843 |
-
protected function imagick_create_scaled_image($file_name, $version, $options) {
|
844 |
-
list($file_path, $new_file_path) =
|
845 |
-
$this->get_scaled_image_file_paths($file_name, $version);
|
846 |
-
$image = $this->imagick_get_image_object(
|
847 |
-
$file_path,
|
848 |
-
!empty($options['no_cache'])
|
849 |
-
);
|
850 |
-
if ($image->getImageFormat() === 'GIF') {
|
851 |
-
// Handle animated GIFs:
|
852 |
-
$images = $image->coalesceImages();
|
853 |
-
foreach ($images as $frame) {
|
854 |
-
$image = $frame;
|
855 |
-
$this->imagick_set_image_object($file_name, $image);
|
856 |
-
break;
|
857 |
-
}
|
858 |
-
}
|
859 |
-
$image_oriented = false;
|
860 |
-
if (!empty($options['auto_orient'])) {
|
861 |
-
$image_oriented = $this->imagick_orient_image($image);
|
862 |
-
}
|
863 |
-
$new_width = $max_width = $img_width = $image->getImageWidth();
|
864 |
-
$new_height = $max_height = $img_height = $image->getImageHeight();
|
865 |
-
if (!empty($options['max_width'])) {
|
866 |
-
$new_width = $max_width = $options['max_width'];
|
867 |
-
}
|
868 |
-
if (!empty($options['max_height'])) {
|
869 |
-
$new_height = $max_height = $options['max_height'];
|
870 |
-
}
|
871 |
-
if (!($image_oriented || $max_width < $img_width || $max_height < $img_height)) {
|
872 |
-
if ($file_path !== $new_file_path) {
|
873 |
-
return copy($file_path, $new_file_path);
|
874 |
-
}
|
875 |
-
return true;
|
876 |
-
}
|
877 |
-
$crop = !empty($options['crop']);
|
878 |
-
if ($crop) {
|
879 |
-
$x = 0;
|
880 |
-
$y = 0;
|
881 |
-
if (($img_width / $img_height) >= ($max_width / $max_height)) {
|
882 |
-
$new_width = 0; // Enables proportional scaling based on max_height
|
883 |
-
$x = ($img_width / ($img_height / $max_height) - $max_width) / 2;
|
884 |
-
} else {
|
885 |
-
$new_height = 0; // Enables proportional scaling based on max_width
|
886 |
-
$y = ($img_height / ($img_width / $max_width) - $max_height) / 2;
|
887 |
-
}
|
888 |
-
}
|
889 |
-
$success = $image->resizeImage(
|
890 |
-
$new_width,
|
891 |
-
$new_height,
|
892 |
-
isset($options['filter']) ? $options['filter'] : imagick::FILTER_LANCZOS,
|
893 |
-
isset($options['blur']) ? $options['blur'] : 1,
|
894 |
-
$new_width && $new_height // fit image into constraints if not to be cropped
|
895 |
-
);
|
896 |
-
if ($success && $crop) {
|
897 |
-
$success = $image->cropImage(
|
898 |
-
$max_width,
|
899 |
-
$max_height,
|
900 |
-
$x,
|
901 |
-
$y
|
902 |
-
);
|
903 |
-
if ($success) {
|
904 |
-
$success = $image->setImagePage($max_width, $max_height, 0, 0);
|
905 |
-
}
|
906 |
-
}
|
907 |
-
$type = strtolower(substr(strrchr($file_name, '.'), 1));
|
908 |
-
switch ($type) {
|
909 |
-
case 'jpg':
|
910 |
-
case 'jpeg':
|
911 |
-
if (!empty($options['jpeg_quality'])) {
|
912 |
-
$image->setImageCompression(Imagick::COMPRESSION_JPEG);
|
913 |
-
$image->setImageCompressionQuality($options['jpeg_quality']);
|
914 |
-
}
|
915 |
-
break;
|
916 |
-
}
|
917 |
-
if (!empty($options['strip'])) {
|
918 |
-
$image->stripImage();
|
919 |
-
}
|
920 |
-
return $success && $image->writeImage($new_file_path);
|
921 |
-
}
|
922 |
-
|
923 |
-
protected function imagemagick_create_scaled_image($file_name, $version, $options) {
|
924 |
-
list($file_path, $new_file_path) =
|
925 |
-
$this->get_scaled_image_file_paths($file_name, $version);
|
926 |
-
$resize = @$options['max_width']
|
927 |
-
.(empty($options['max_height']) ? '' : 'x'.$options['max_height']);
|
928 |
-
if (!$resize && empty($options['auto_orient'])) {
|
929 |
-
if ($file_path !== $new_file_path) {
|
930 |
-
return copy($file_path, $new_file_path);
|
931 |
-
}
|
932 |
-
return true;
|
933 |
-
}
|
934 |
-
$cmd = $this->options['convert_bin'];
|
935 |
-
if (!empty($this->options['convert_params'])) {
|
936 |
-
$cmd .= ' '.$this->options['convert_params'];
|
937 |
-
}
|
938 |
-
$cmd .= ' '.escapeshellarg($file_path);
|
939 |
-
if (!empty($options['auto_orient'])) {
|
940 |
-
$cmd .= ' -auto-orient';
|
941 |
-
}
|
942 |
-
if ($resize) {
|
943 |
-
// Handle animated GIFs:
|
944 |
-
$cmd .= ' -coalesce';
|
945 |
-
if (empty($options['crop'])) {
|
946 |
-
$cmd .= ' -resize '.escapeshellarg($resize.'>');
|
947 |
-
} else {
|
948 |
-
$cmd .= ' -resize '.escapeshellarg($resize.'^');
|
949 |
-
$cmd .= ' -gravity center';
|
950 |
-
$cmd .= ' -crop '.escapeshellarg($resize.'+0+0');
|
951 |
-
}
|
952 |
-
// Make sure the page dimensions are correct (fixes offsets of animated GIFs):
|
953 |
-
$cmd .= ' +repage';
|
954 |
-
}
|
955 |
-
if (!empty($options['convert_params'])) {
|
956 |
-
$cmd .= ' '.$options['convert_params'];
|
957 |
-
}
|
958 |
-
$cmd .= ' '.escapeshellarg($new_file_path);
|
959 |
-
exec($cmd, $output, $error);
|
960 |
-
if ($error) {
|
961 |
-
error_log(implode('\n', $output));
|
962 |
-
return false;
|
963 |
-
}
|
964 |
-
return true;
|
965 |
-
}
|
966 |
-
|
967 |
-
protected function get_image_size($file_path) {
|
968 |
-
if ($this->options['image_library']) {
|
969 |
-
if (extension_loaded('imagick')) {
|
970 |
-
$image = new Imagick();
|
971 |
-
try {
|
972 |
-
if (@$image->pingImage($file_path)) {
|
973 |
-
$dimensions = array($image->getImageWidth(), $image->getImageHeight());
|
974 |
-
$image->destroy();
|
975 |
-
return $dimensions;
|
976 |
-
}
|
977 |
-
return false;
|
978 |
-
} catch (Exception $e) {
|
979 |
-
error_log($e->getMessage());
|
980 |
-
}
|
981 |
-
}
|
982 |
-
if ($this->options['image_library'] === 2) {
|
983 |
-
$cmd = $this->options['identify_bin'];
|
984 |
-
$cmd .= ' -ping '.escapeshellarg($file_path);
|
985 |
-
exec($cmd, $output, $error);
|
986 |
-
if (!$error && !empty($output)) {
|
987 |
-
// image.jpg JPEG 1920x1080 1920x1080+0+0 8-bit sRGB 465KB 0.000u 0:00.000
|
988 |
-
$infos = preg_split('/\s+/', $output[0]);
|
989 |
-
$dimensions = preg_split('/x/', $infos[2]);
|
990 |
-
return $dimensions;
|
991 |
-
}
|
992 |
-
return false;
|
993 |
-
}
|
994 |
-
}
|
995 |
-
if (!function_exists('getimagesize')) {
|
996 |
-
error_log('Function not found: getimagesize');
|
997 |
-
return false;
|
998 |
-
}
|
999 |
-
return @getimagesize($file_path);
|
1000 |
-
}
|
1001 |
-
|
1002 |
-
protected function create_scaled_image($file_name, $version, $options) {
|
1003 |
-
if ($this->options['image_library'] === 2) {
|
1004 |
-
return $this->imagemagick_create_scaled_image($file_name, $version, $options);
|
1005 |
-
}
|
1006 |
-
if ($this->options['image_library'] && extension_loaded('imagick')) {
|
1007 |
-
return $this->imagick_create_scaled_image($file_name, $version, $options);
|
1008 |
-
}
|
1009 |
-
return $this->gd_create_scaled_image($file_name, $version, $options);
|
1010 |
-
}
|
1011 |
-
|
1012 |
-
protected function destroy_image_object($file_path) {
|
1013 |
-
if ($this->options['image_library'] && extension_loaded('imagick')) {
|
1014 |
-
return $this->imagick_destroy_image_object($file_path);
|
1015 |
-
}
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
protected function is_valid_image_file($file_path) {
|
1019 |
-
if (!preg_match($this->options['image_file_types'], $file_path)) {
|
1020 |
-
return false;
|
1021 |
-
}
|
1022 |
-
if (function_exists('exif_imagetype')) {
|
1023 |
-
return @exif_imagetype($file_path);
|
1024 |
-
}
|
1025 |
-
$image_info = $this->get_image_size($file_path);
|
1026 |
-
return $image_info && $image_info[0] && $image_info[1];
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
protected function handle_image_file($file_path, $file) {
|
1030 |
-
$failed_versions = array();
|
1031 |
-
foreach($this->options['image_versions'] as $version => $options) {
|
1032 |
-
if ($this->create_scaled_image($file->name, $version, $options)) {
|
1033 |
-
if (!empty($version)) {
|
1034 |
-
$file->{$version.'Url'} = $this->get_download_url(
|
1035 |
-
$file->name,
|
1036 |
-
$version
|
1037 |
-
);
|
1038 |
-
} else {
|
1039 |
-
$file->size = $this->get_file_size($file_path, true);
|
1040 |
-
}
|
1041 |
-
} else {
|
1042 |
-
$failed_versions[] = $version;
|
1043 |
-
}
|
1044 |
-
}
|
1045 |
-
switch (count($failed_versions)) {
|
1046 |
-
case 0:
|
1047 |
-
break;
|
1048 |
-
case 1:
|
1049 |
-
$file->error = 'Failed to create scaled version: '
|
1050 |
-
.$failed_versions[0];
|
1051 |
-
break;
|
1052 |
-
default:
|
1053 |
-
$file->error = 'Failed to create scaled versions: '
|
1054 |
-
.implode($failed_versions,', ');
|
1055 |
-
}
|
1056 |
-
// Free memory:
|
1057 |
-
$this->destroy_image_object($file_path);
|
1058 |
-
}
|
1059 |
-
|
1060 |
-
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
|
1061 |
-
$index = null, $content_range = null) {
|
1062 |
-
$file = new stdClass();
|
1063 |
-
$file->name = $this->get_file_name($name, $type, $index, $content_range);
|
1064 |
-
$file->size = $this->fix_integer_overflow(intval($size));
|
1065 |
-
$file->type = $type;
|
1066 |
-
if ($this->validate($uploaded_file, $file, $error, $index)) {
|
1067 |
-
$this->handle_form_data($file, $index);
|
1068 |
-
$upload_dir = $this->get_upload_path();
|
1069 |
-
if (!is_dir($upload_dir)) {
|
1070 |
-
mkdir($upload_dir, $this->options['mkdir_mode'], true);
|
1071 |
-
}
|
1072 |
-
$file_path = $this->get_upload_path($file->name);
|
1073 |
-
$append_file = $content_range && is_file($file_path) &&
|
1074 |
-
$file->size > $this->get_file_size($file_path);
|
1075 |
-
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
1076 |
-
// multipart/formdata uploads (POST method uploads)
|
1077 |
-
if ($append_file) {
|
1078 |
-
file_put_contents(
|
1079 |
-
$file_path,
|
1080 |
-
fopen($uploaded_file, 'r'),
|
1081 |
-
FILE_APPEND
|
1082 |
-
);
|
1083 |
-
} else {
|
1084 |
-
move_uploaded_file($uploaded_file, $file_path);
|
1085 |
-
}
|
1086 |
-
} else {
|
1087 |
-
// Non-multipart uploads (PUT method support)
|
1088 |
-
file_put_contents(
|
1089 |
-
$file_path,
|
1090 |
-
fopen('php://input', 'r'),
|
1091 |
-
$append_file ? FILE_APPEND : 0
|
1092 |
-
);
|
1093 |
-
}
|
1094 |
-
$file_size = $this->get_file_size($file_path, $append_file);
|
1095 |
-
if ($file_size === $file->size) {
|
1096 |
-
$file->url = $this->get_download_url($file->name);
|
1097 |
-
if ($this->is_valid_image_file($file_path)) {
|
1098 |
-
$this->handle_image_file($file_path, $file);
|
1099 |
-
}
|
1100 |
-
} else {
|
1101 |
-
$file->size = $file_size;
|
1102 |
-
if (!$content_range && $this->options['discard_aborted_uploads']) {
|
1103 |
-
unlink($file_path);
|
1104 |
-
$file->error = 'abort';
|
1105 |
-
}
|
1106 |
-
}
|
1107 |
-
$this->set_additional_file_properties($file);
|
1108 |
-
}
|
1109 |
-
return $file;
|
1110 |
-
}
|
1111 |
-
|
1112 |
-
protected function readfile($file_path) {
|
1113 |
-
$file_size = $this->get_file_size($file_path);
|
1114 |
-
$chunk_size = $this->options['readfile_chunk_size'];
|
1115 |
-
if ($chunk_size && $file_size > $chunk_size) {
|
1116 |
-
$handle = fopen($file_path, 'rb');
|
1117 |
-
while (!feof($handle)) {
|
1118 |
-
echo fread($handle, $chunk_size);
|
1119 |
-
ob_flush();
|
1120 |
-
flush();
|
1121 |
-
}
|
1122 |
-
fclose($handle);
|
1123 |
-
return $file_size;
|
1124 |
-
}
|
1125 |
-
return readfile($file_path);
|
1126 |
-
}
|
1127 |
-
|
1128 |
-
protected function body($str) {
|
1129 |
-
echo $str;
|
1130 |
-
}
|
1131 |
-
|
1132 |
-
protected function header($str) {
|
1133 |
-
header($str);
|
1134 |
-
}
|
1135 |
-
|
1136 |
-
protected function get_server_var($id) {
|
1137 |
-
return isset($_SERVER[$id]) ? $_SERVER[$id] : '';
|
1138 |
-
}
|
1139 |
-
|
1140 |
-
protected function generate_response($content, $print_response = true) {
|
1141 |
-
if ($print_response) {
|
1142 |
-
$json = json_encode($content);
|
1143 |
-
$redirect = isset($_REQUEST['redirect']) ?
|
1144 |
-
stripslashes($_REQUEST['redirect']) : null;
|
1145 |
-
if ($redirect) {
|
1146 |
-
$this->header('Location: '.sprintf($redirect, rawurlencode($json)));
|
1147 |
-
return;
|
1148 |
-
}
|
1149 |
-
$this->head();
|
1150 |
-
if ($this->get_server_var('HTTP_CONTENT_RANGE')) {
|
1151 |
-
$files = isset($content[$this->options['param_name']]) ?
|
1152 |
-
$content[$this->options['param_name']] : null;
|
1153 |
-
if ($files && is_array($files) && is_object($files[0]) && $files[0]->size) {
|
1154 |
-
$this->header('Range: 0-'.(
|
1155 |
-
$this->fix_integer_overflow(intval($files[0]->size)) - 1
|
1156 |
-
));
|
1157 |
-
}
|
1158 |
-
}
|
1159 |
-
$this->body($json);
|
1160 |
-
}
|
1161 |
-
return $content;
|
1162 |
-
}
|
1163 |
-
|
1164 |
-
protected function get_version_param() {
|
1165 |
-
return isset($_GET['version']) ? basename(stripslashes($_GET['version'])) : null;
|
1166 |
-
}
|
1167 |
-
|
1168 |
-
protected function get_singular_param_name() {
|
1169 |
-
return substr($this->options['param_name'], 0, -1);
|
1170 |
-
}
|
1171 |
-
|
1172 |
-
protected function get_file_name_param() {
|
1173 |
-
$name = $this->get_singular_param_name();
|
1174 |
-
return isset($_GET[$name]) ? basename(stripslashes($_GET[$name])) : null;
|
1175 |
-
}
|
1176 |
-
|
1177 |
-
protected function get_file_names_params() {
|
1178 |
-
$params = isset($_GET[$this->options['param_name']]) ?
|
1179 |
-
$_GET[$this->options['param_name']] : array();
|
1180 |
-
foreach ($params as $key => $value) {
|
1181 |
-
$params[$key] = basename(stripslashes($value));
|
1182 |
-
}
|
1183 |
-
return $params;
|
1184 |
-
}
|
1185 |
-
|
1186 |
-
protected function get_file_type($file_path) {
|
1187 |
-
switch (strtolower(pathinfo($file_path, PATHINFO_EXTENSION))) {
|
1188 |
-
case 'jpeg':
|
1189 |
-
case 'jpg':
|
1190 |
-
return 'image/jpeg';
|
1191 |
-
case 'png':
|
1192 |
-
return 'image/png';
|
1193 |
-
case 'gif':
|
1194 |
-
return 'image/gif';
|
1195 |
-
default:
|
1196 |
-
return '';
|
1197 |
-
}
|
1198 |
-
}
|
1199 |
-
|
1200 |
-
protected function download() {
|
1201 |
-
switch ($this->options['download_via_php']) {
|
1202 |
-
case 1:
|
1203 |
-
$redirect_header = null;
|
1204 |
-
break;
|
1205 |
-
case 2:
|
1206 |
-
$redirect_header = 'X-Sendfile';
|
1207 |
-
break;
|
1208 |
-
case 3:
|
1209 |
-
$redirect_header = 'X-Accel-Redirect';
|
1210 |
-
break;
|
1211 |
-
default:
|
1212 |
-
return $this->header('HTTP/1.1 403 Forbidden');
|
1213 |
-
}
|
1214 |
-
$file_name = $this->get_file_name_param();
|
1215 |
-
if (!$this->is_valid_file_object($file_name)) {
|
1216 |
-
return $this->header('HTTP/1.1 404 Not Found');
|
1217 |
-
}
|
1218 |
-
if ($redirect_header) {
|
1219 |
-
return $this->header(
|
1220 |
-
$redirect_header.': '.$this->get_download_url(
|
1221 |
-
$file_name,
|
1222 |
-
$this->get_version_param(),
|
1223 |
-
true
|
1224 |
-
)
|
1225 |
-
);
|
1226 |
-
}
|
1227 |
-
$file_path = $this->get_upload_path($file_name, $this->get_version_param());
|
1228 |
-
// Prevent browsers from MIME-sniffing the content-type:
|
1229 |
-
$this->header('X-Content-Type-Options: nosniff');
|
1230 |
-
if (!preg_match($this->options['inline_file_types'], $file_name)) {
|
1231 |
-
$this->header('Content-Type: application/octet-stream');
|
1232 |
-
$this->header('Content-Disposition: attachment; filename="'.$file_name.'"');
|
1233 |
-
} else {
|
1234 |
-
$this->header('Content-Type: '.$this->get_file_type($file_path));
|
1235 |
-
$this->header('Content-Disposition: inline; filename="'.$file_name.'"');
|
1236 |
-
}
|
1237 |
-
$this->header('Content-Length: '.$this->get_file_size($file_path));
|
1238 |
-
$this->header('Last-Modified: '.gmdate('D, d M Y H:i:s T', filemtime($file_path)));
|
1239 |
-
$this->readfile($file_path);
|
1240 |
-
}
|
1241 |
-
|
1242 |
-
protected function send_content_type_header() {
|
1243 |
-
$this->header('Vary: Accept');
|
1244 |
-
if (strpos($this->get_server_var('HTTP_ACCEPT'), 'application/json') !== false) {
|
1245 |
-
$this->header('Content-type: application/json');
|
1246 |
-
} else {
|
1247 |
-
$this->header('Content-type: text/plain');
|
1248 |
-
}
|
1249 |
-
}
|
1250 |
-
|
1251 |
-
protected function send_access_control_headers() {
|
1252 |
-
$this->header('Access-Control-Allow-Origin: '.$this->options['access_control_allow_origin']);
|
1253 |
-
$this->header('Access-Control-Allow-Credentials: '
|
1254 |
-
.($this->options['access_control_allow_credentials'] ? 'true' : 'false'));
|
1255 |
-
$this->header('Access-Control-Allow-Methods: '
|
1256 |
-
.implode(', ', $this->options['access_control_allow_methods']));
|
1257 |
-
$this->header('Access-Control-Allow-Headers: '
|
1258 |
-
.implode(', ', $this->options['access_control_allow_headers']));
|
1259 |
-
}
|
1260 |
-
|
1261 |
-
public function head() {
|
1262 |
-
$this->header('Pragma: no-cache');
|
1263 |
-
$this->header('Cache-Control: no-store, no-cache, must-revalidate');
|
1264 |
-
$this->header('Content-Disposition: inline; filename="files.json"');
|
1265 |
-
// Prevent Internet Explorer from MIME-sniffing the content-type:
|
1266 |
-
$this->header('X-Content-Type-Options: nosniff');
|
1267 |
-
if ($this->options['access_control_allow_origin']) {
|
1268 |
-
$this->send_access_control_headers();
|
1269 |
-
}
|
1270 |
-
$this->send_content_type_header();
|
1271 |
-
}
|
1272 |
-
|
1273 |
-
public function get($print_response = true) {
|
1274 |
-
if ($print_response && isset($_GET['download'])) {
|
1275 |
-
return $this->download();
|
1276 |
-
}
|
1277 |
-
$file_name = $this->get_file_name_param();
|
1278 |
-
if ($file_name) {
|
1279 |
-
$response = array(
|
1280 |
-
$this->get_singular_param_name() => $this->get_file_object($file_name)
|
1281 |
-
);
|
1282 |
-
} else {
|
1283 |
-
$response = array(
|
1284 |
-
$this->options['param_name'] => $this->get_file_objects()
|
1285 |
-
);
|
1286 |
-
}
|
1287 |
-
return $this->generate_response($response, $print_response);
|
1288 |
-
}
|
1289 |
-
|
1290 |
-
public function checkFileExists($fileName){
|
1291 |
-
$file_contents=array();
|
1292 |
-
$file_contents= $_REQUEST;
|
1293 |
-
$file_with_path=$file_contents['uploadPath'].'/ultimate_importer/'.$fileName;
|
1294 |
-
|
1295 |
-
if(file_exists($file_with_path))
|
1296 |
-
return true;
|
1297 |
-
else
|
1298 |
-
return false;
|
1299 |
-
}
|
1300 |
-
|
1301 |
-
public function post($print_response = true) {
|
1302 |
-
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
|
1303 |
-
return $this->delete($print_response);
|
1304 |
-
}
|
1305 |
-
|
1306 |
-
|
1307 |
-
$upload = isset($_FILES[$this->options['param_name']]) ?
|
1308 |
-
$_FILES[$this->options['param_name']] : null;
|
1309 |
-
// Parse the Content-Disposition header, if available:
|
1310 |
-
/*added by prem
|
1311 |
-
$fil_nam=explode(".csv",$upload['name'][0]);
|
1312 |
-
$fileExists = $this->checkFileExists($fil_nam[0].'-'.$_REQUEST['curr_action'].' (1).csv');//var_dump($fileExists);
|
1313 |
-
if($fileExists){
|
1314 |
-
$fileExistsArray = array('fileExists' => $fileExists);
|
1315 |
-
return $this->generate_response($fileExistsArray,true);
|
1316 |
-
}*/
|
1317 |
-
|
1318 |
-
|
1319 |
-
$file_name = $this->get_server_var('HTTP_CONTENT_DISPOSITION') ?
|
1320 |
-
rawurldecode(preg_replace(
|
1321 |
-
'/(^[^"]+")|("$)/',
|
1322 |
-
'',
|
1323 |
-
$this->get_server_var('HTTP_CONTENT_DISPOSITION')
|
1324 |
-
)) : null;
|
1325 |
-
$content_range = $this->get_server_var('HTTP_CONTENT_RANGE') ?
|
1326 |
-
preg_split('/[^0-9]+/', $this->get_server_var('HTTP_CONTENT_RANGE')) : null;
|
1327 |
-
$size = $content_range ? $content_range[3] : null;
|
1328 |
-
$files = array();
|
1329 |
-
if ($upload && is_array($upload['tmp_name'])) {
|
1330 |
-
foreach ($upload['tmp_name'] as $index => $value) {
|
1331 |
-
$files[] = $this->handle_file_upload(
|
1332 |
-
$upload['tmp_name'][$index],
|
1333 |
-
$file_name ? $file_name : $upload['name'][$index],
|
1334 |
-
$size ? $size : $upload['size'][$index],
|
1335 |
-
$upload['type'][$index],
|
1336 |
-
$upload['error'][$index],
|
1337 |
-
$index,
|
1338 |
-
$content_range
|
1339 |
-
);
|
1340 |
-
}
|
1341 |
-
} else {
|
1342 |
-
$files[] = $this->handle_file_upload(
|
1343 |
-
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
|
1344 |
-
$file_name ? $file_name : (isset($upload['name']) ?
|
1345 |
-
$upload['name'] : null),
|
1346 |
-
$size ? $size : (isset($upload['size']) ?
|
1347 |
-
$upload['size'] : $this->get_server_var('CONTENT_LENGTH')),
|
1348 |
-
isset($upload['type']) ?
|
1349 |
-
$upload['type'] : $this->get_server_var('CONTENT_TYPE'),
|
1350 |
-
isset($upload['error']) ? $upload['error'] : null,
|
1351 |
-
null,
|
1352 |
-
$content_range
|
1353 |
-
);
|
1354 |
-
}
|
1355 |
-
# code added by goku to get the uploaded filename
|
1356 |
-
$files[0]->uploadedname = $upload['name'][0];
|
1357 |
-
return $this->generate_response(
|
1358 |
-
array($this->options['param_name'] => $files),
|
1359 |
-
$print_response
|
1360 |
-
);
|
1361 |
-
}
|
1362 |
-
|
1363 |
-
public function delete($print_response = true) {
|
1364 |
-
$file_names = $this->get_file_names_params();
|
1365 |
-
if (empty($file_names)) {
|
1366 |
-
$file_names = array($this->get_file_name_param());
|
1367 |
-
}
|
1368 |
-
$response = array();
|
1369 |
-
foreach($file_names as $file_name) {
|
1370 |
-
$file_path = $this->get_upload_path($file_name);
|
1371 |
-
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
|
1372 |
-
if ($success) {
|
1373 |
-
foreach($this->options['image_versions'] as $version => $options) {
|
1374 |
-
if (!empty($version)) {
|
1375 |
-
$file = $this->get_upload_path($file_name, $version);
|
1376 |
-
if (is_file($file)) {
|
1377 |
-
unlink($file);
|
1378 |
-
}
|
1379 |
-
}
|
1380 |
-
}
|
1381 |
-
}
|
1382 |
-
$response[$file_name] = $success;
|
1383 |
-
}
|
1384 |
-
return $this->generate_response($response, $print_response);
|
1385 |
-
}
|
1386 |
-
|
1387 |
-
}
|
35 |
* "Copyright Smackcoders. 2014. All rights reserved".
|
36 |
********************************************************************************/
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/uploader.php
CHANGED
@@ -34,7 +34,3 @@
|
|
34 |
* Notices must display the words
|
35 |
* "Copyright Smackcoders. 2014. All rights reserved".
|
36 |
********************************************************************************/
|
37 |
-
|
38 |
-
error_reporting(E_ALL | E_STRICT);
|
39 |
-
require('UploadHandler.php');
|
40 |
-
$upload_handler = new UploadHandler();
|
34 |
* Notices must display the words
|
35 |
* "Copyright Smackcoders. 2014. All rights reserved".
|
36 |
********************************************************************************/
|
|
|
|
|
|
|
|