Ejemplo n.º 1
0
 * 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) {
 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         //or if( is_null(self::$_instance) ) or if( self::$_instance == null )
         self::$_instance = new WPImporter_includes_helper();
     }
     return self::$_instance;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
$impCheckobj = CallWPImporterObj::checkSecurity();
if ($impCheckobj != 'true') {
    die($impCheckobj);
}
$noncevar = isset($_REQUEST['wpnonce']) ? $_REQUEST['wpnonce'] : '';
if (!wp_verify_nonce($noncevar, 'smack_nonce')) {
    die('You are not allowed to do this operation.Please contact your admin.');
}
$requested_module = "";
if (isset($requested_module)) {
    $requested_module = $_REQUEST['checkmodule'];
}
$post_url = admin_url() . 'admin.php?page=' . WP_CONST_ULTIMATE_CSV_IMP_SLUG . '/index.php&__module=' . $requested_module . '&step=mapping_settings';
if ($_SERVER['HTTP_REFERER'] != urldecode($_SERVER['HTTP_REFERER'])) {
    if ($post_url != urldecode($_SERVER['HTTP_REFERER'])) {
        die('Your requested url were wrong! Please contact your admin.');
    }
} else {
    if ($post_url != $_SERVER['HTTP_REFERER']) {
        die('Your requested url were wrong! Please contact your admin.');
    }
}
$impObj = CallWPImporterObj::getInstance();
$filename = $_POST['file_name'];
$delimeter = '';
$result = $impObj->csv_file_readdata($filename, $impObj);
#$result = $impObj->csv_file_data($filename);
foreach ($result[$_REQUEST['record_no']] as $key => $value) {
    $data[] = html_entity_decode($value);
}
print_r(json_encode($data));
Ejemplo n.º 5
0
 ********************************************************************************/
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$noncevar = isset($_POST['postdata']['wpnonce']) ? sanitize_text_field($_POST['postdata']['wpnonce']) : '';
if (!wp_verify_nonce($noncevar, 'smack_nonce')) {
    die('You are not allowed to do this operation.Please contact your admin.');
}
$impCheckobj = CallWPImporterObj::checkSecurity();
if ($impCheckobj != 'true') {
    die($impCheckobj);
}
require_once WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY . 'lib/skinnymvc/core/base/SkinnyBaseActions.php';
require_once WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY . 'lib/skinnymvc/core/SkinnyActions.php';
$skinnyObj = new CallWPImporterObj();
$curr_action = $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['selectedImporter'];
$importedAs = Null;
$inserted_post_count = 0;
$noofrecords = '';
if ($curr_action != 'post' && $curr_action != 'page' && $curr_action != 'custompost') {
    require_once WP_CSVIMP_PLUGIN_BASE . '/modules/' . $curr_action . '/actions/actions.php';
}
if ($curr_action == 'post' || $curr_action == 'page' || $curr_action == 'custompost') {
    $importObj = new WPImporter_includes_helper();
    if ($curr_action == 'post') {
        $importedAs = 'Post';
    }
    if ($curr_action == 'page') {
        $importedAs = 'Page';
    }
Ejemplo n.º 6
0
$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);
}
$post = $page = $custompost = $users = $eshop = $settings = $support = $dashboard = $filemanager = $mappingtemplate = $schedulemapping = $export = '';
$active_plugins = get_option('active_plugins');
if (in_array('eshop/eshop.php', $active_plugins)) {
    $eshop = true;
}
$custompost = true;
$impCEM = CallWPImporterObj::getInstance();
$get_settings = array();
$get_settings = $impCEM->getSettings();
$requestedModule = sanitize_text_field($_REQUEST['__module']);
$requestedAction = isset($_REQUEST['action']) ? sanitize_text_field($_REQUEST['action']) : '';
$mod = isset($requestedModule) ? $requestedModule : '';
$module = $manager = '';
if (is_array($get_settings) && !empty($get_settings)) {
    foreach ($get_settings as $key) {
        $key = true;
    }
}
if (isset($requestedAction) && $requestedAction != '') {
    $action = $requestedAction;
    ${$action} = 'activate';
} else {
Ejemplo n.º 7
0
 ********************************************************************************/
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$noncevar = isset($_POST['postdata']['wpnonce']) ? $_POST['postdata']['wpnonce'] : '';
if (!wp_verify_nonce($noncevar, 'smack_nonce')) {
    die('You are not allowed to do this operation.Please contact your admin.');
}
$impCheckobj = CallWPImporterObj::checkSecurity();
if ($impCheckobj != 'true') {
    die($impCheckobj);
}
require_once WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY . 'lib/skinnymvc/core/base/SkinnyBaseActions.php';
require_once WP_CONST_ULTIMATE_CSV_IMP_DIRECTORY . 'lib/skinnymvc/core/SkinnyActions.php';
$skinnyObj = new CallWPImporterObj();
$curr_action = $_SESSION['SMACK_MAPPING_SETTINGS_VALUES']['selectedImporter'];
$importedAs = Null;
$inserted_post_count = 0;
$noofrecords = '';
if ($curr_action != 'post' && $curr_action != 'page' && $curr_action != 'custompost') {
    require_once WP_CSVIMP_PLUGIN_BASE . '/modules/' . $curr_action . '/actions/actions.php';
}
if ($curr_action == 'post' || $curr_action == 'page' || $curr_action == 'custompost') {
    $importObj = new WPImporter_includes_helper();
    if ($curr_action == 'post') {
        $importedAs = 'Post';
    }
    if ($curr_action == 'page') {
        $importedAs = 'Page';
    }