* version 3, these Appropriate Legal Notices must retain the display of the * WP Ultimate CSV Importer copyright notice. If the display of the logo is * not reasonably feasible for technical reasons, the Appropriate Legal * Notices must display the words * "Copyright Smackcoders. 2014. All rights reserved". ********************************************************************************/ if (!defined('ABSPATH')) { exit; } // Exit if accessed directly $impObj = new WPImporter_includes_helper(); $nonceKey = $impObj->create_nonce_key(); if (!wp_verify_nonce($nonceKey, 'smack_nonce')) { die('You are not allowed to do this operation.Please contact your admin.'); } $impCheckobj = CallWPImporterObj::checkSecurity(); if ($impCheckobj != 'true') { die($impCheckobj); } global $wpdb; $all_arr = array(); $all_arr = $_REQUEST['postdata']; $all_arr = $all_arr[0]; if ($all_arr['action'] == 'file_exist_check') { $file_with_version = $all_arr['filename']; $temp_arr = array(); $temp_arr = explode("(", $file_with_version); $file_name = $temp_arr[0] . '.csv'; $all_csv_names = $wpdb->get_results("select csv_name from smack_dashboard_manager"); $all_names = array(); foreach ($all_csv_names as $key1 => $value1) {
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index = null, $content_range = null) { $impCheckobj = CallWPImporterObj::checkSecurity(); if ($impCheckobj != 'true') { die($impCheckobj); } if ($_SERVER['HTTP_REFERER'] != urldecode($_SERVER['HTTP_REFERER'])) { if (!$_SERVER['HTTP_REFERER']) { die('Your requested url were wrong! Please contact your admin.'); } } else { if (!$_SERVER['HTTP_REFERER']) { die('Your requested url were wrong! Please contact your admin.'); } } $file = new stdClass(); $file->name = $this->get_file_name($name, $type, $index, $content_range); $file->size = $this->fix_integer_overflow(intval($size)); $file->type = $type; if ($this->validate($uploaded_file, $file, $error, $index)) { $this->handle_form_data($file, $index); $upload_dir = $this->get_upload_path(); if (!is_dir($upload_dir)) { mkdir($upload_dir, $this->options['mkdir_mode'], true); } $file_path = $this->get_upload_path($file->name); $append_file = $content_range && is_file($file_path) && $file->size > $this->get_file_size($file_path); if ($uploaded_file && is_uploaded_file($uploaded_file)) { // multipart/formdata uploads (POST method uploads) if ($append_file) { file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND); } else { move_uploaded_file($uploaded_file, $file_path); } } else { // Non-multipart uploads (PUT method support) file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0); } $file_size = $this->get_file_size($file_path, $append_file); if ($file_size === $file->size) { $file->url = $this->get_download_url($file->name); if ($this->is_valid_image_file($file_path)) { $this->handle_image_file($file_path, $file); } } else { $file->size = $file_size; if (!$content_range && $this->options['discard_aborted_uploads']) { unlink($file_path); $file->error = 'abort'; } } $this->set_additional_file_properties($file); } return $file; }