diff --git a/classes/views/class-jaiminho-view-subscribers-csvimport.php b/classes/views/class-jaiminho-view-subscribers-csvimport.php
new file mode 100644
index 0000000..ab07020
--- /dev/null
+++ b/classes/views/class-jaiminho-view-subscribers-csvimport.php
@@ -0,0 +1,116 @@
+security_check();
+// $uploadfiles = $_FILES['uploadfiles'];
+// if (is_array($uploadfiles)) {
+// foreach ($uploadfiles['name'] as $key => $value) {
+//
+// // look only for uploded files
+// if ($uploadfiles['error'][$key] == 0) {
+//
+// $filetmp = $uploadfiles['tmp_name'][$key];
+//
+// //clean filename and extract extension
+// $filename = $uploadfiles['name'][$key];
+//
+// // get file info
+// // @fixme: wp checks the file extension....
+// $filetype = wp_check_filetype( basename( $filename ), null );
+// $filetitle = preg_replace('/\.[^.]+$/', '', basename( $filename ) );
+// $filename = $filetitle . '.' . $filetype['ext'];
+// $upload_dir = wp_upload_dir();
+// if( $filetype['ext'] != 'csv' ){
+// SendPress_Admin::redirect('Subscribers_Csvimport',array('listID'=> SPNL()->validate->_int( 'listID' )));
+// }
+//
+// /**
+// * Check if the filename already exist in the directory and rename the
+// * file if necessary
+// */
+// $i = 0;
+// while ( file_exists( $upload_dir['path'] .'/' . $filename ) ) {
+// $filename = $filetitle . '_' . $i . '.' . $filetype['ext'];
+// $i++;
+// }
+// $filedest = $upload_dir['path'] . '/' . $filename;
+//
+// $filedest = str_replace('\\','/', $filedest);
+// /**
+// * Check write permissions
+// */
+// if ( !is_writeable( $upload_dir['path'] ) ) {
+// SendPress_Option::set('import_error', true);
+// //$this->_error = true;
+// //$this->msg_e('Unable to write to directory %s. Is this directory writable by the server?');
+// //return;
+// }
+//
+// /**
+// * Save temporary file to uploads dir
+// */
+// if ( !@move_uploaded_file($filetmp, $filedest) ){
+// SendPress_Option::set('import_error', true);
+// //$this->msg_e("Error, the file $filetmp could not moved to : $filedest ");
+// //continue;
+// }
+//
+// update_post_meta(SPNL()->validate->_int( 'listID' ),'csv_import',$filedest);
+// if(SendPress_Option::get('import_error', false) == false ){
+// SendPress_Admin::redirect('Subscribers_Csvprep',array('listID'=> SPNL()->validate->_int( 'listID' )));
+// }
+// /*
+// $attachment = array(
+// 'post_mime_type' => $filetype['type'],
+// 'post_title' => $filetitle,
+// 'post_content' => '',
+// 'post_status' => 'inherit'
+// );
+//
+// $attach_id = wp_insert_attachment( $attachment, $filedest );
+// require_once( ABSPATH . "wp-admin" . '/includes/image.php' );
+// $attach_data = wp_generate_attachment_metadata( $attach_id, $filedest );
+// wp_update_attachment_metadata( $attach_id, $attach_data );
+// */
+// }
+// }
+// }
+// }
+
+ function html() { ?>
+
+
+ .
+
+
+
+
validate->_int( 'listID' )); ?>
+
+
+validate->_int('listID') );
+ wp_redirect( esc_url_raw( admin_url('admin.php?page='.SPNL()->validate->page() ) ) );
+ }
+
+ function delete_lists_bulk(){
+ $list_delete = SPNL()->validate->_int_array('list');
+ foreach ($list_delete as $listID) {
+ SendPress_Data::delete_list( SPNL()->validate->int($listID));
+ }
+ wp_redirect( esc_url_raw( admin_url('admin.php?page='.SPNL()->validate->page() ) ) );
+ }
+
+
+ function export_list(){
+ //$this->security_check();
+ $l = SPNL()->validate->_int('listID');
+ if( $l > 0 ){
+ $items = SendPress_Data::export_subscirbers( $l );
+ header("Content-type:text/octect-stream");
+ header("Content-Disposition:attachment;filename=sendpress.csv");
+ print "email,firstname,lastname,status \n";
+ foreach($items as $user) {
+ print $user->email . ",". $user->firstname.",". $user->lastname.",". $user->status."\n" ;
+ }
+ }
+ exit;
+ }
+
+ function sub_menu(){
+ ?>
+
+
+
+
+ - validate->_isset('view') ){ ?>class="active" >
+
+
+
+ - validate->_string('view') === 'all'){ ?>class="active" >
+
+
+
+ - validate->_string('view') === 'custom'){ ?>class="active" >
+
+
+
+
+
+
+
+
+ __('Lists per page', 'sendpress'),
+ 'default' => 10,
+ 'option' => 'sendpress_lists_per_page'
+ );
+ add_screen_option( 'per_page', $args );
+ }
+
+ function default_header(){
+ ?>
+
+ prepare_items();
+
+ ?>
+
+
+
+
+ 'text/csv') );
+ $filetitle = preg_replace('/\.[^.]+$/', '', basename( $filename ) );
+ $filename = $filetitle . '.' . $filetype['ext'];
+ var_dump($filetype);
+ var_dump(basename( $filename ));
+ $upload_dir = wp_upload_dir();
+ if( $filetype['ext'] != 'csv' ){
+ SendPress_Admin::redirect('Subscribers_Csvimport',array('listID'=> SPNL()->validate->_int( 'listID' )));
+ }
+
+ /**
+ * Check if the filename already exist in the directory and rename the
+ * file if necessary
+ */
+ $i = 0;
+ while ( file_exists( $upload_dir['path'] .'/' . $filename ) ) {
+ $filename = $filetitle . '_' . $i . '.' . $filetype['ext'];
+ $i++;
+ }
+ $filedest = $upload_dir['path'] . '/' . $filename;
+
+ $filedest = str_replace('\\','/', $filedest);
+ /**
+ * Check write permissions
+ */
+ if ( !is_writeable( $upload_dir['path'] ) ) {
+ SendPress_Option::set('import_error', true);
+ }
+
+ /**
+ * Save temporary file to uploads dir
+ */
+ if ( !@move_uploaded_file($filetmp, $filedest) ){
+ SendPress_Option::set('import_error', true);
+ var_dump("Aqui não entra");
+ }
+ var_dump(SPNL()->validate->_int( 'listID' ));
+ var_dump($filedest);
+ update_post_meta(SPNL()->validate->_int( 'listID' ),'csv_import',$filedest);
+ if(SendPress_Option::get('import_error', false) == false ){
+ SendPress_Admin::redirect('Subscribers_Csvprep',array('listID'=> SPNL()->validate->_int( 'listID' )));
+ }
+ }
+ }
+ }
function mce_buttons( $buttons ) {
array_unshift( $buttons, 'fontselect' );
array_unshift( $buttons, 'fontsizeselect' );
@@ -379,11 +437,9 @@ public function jaiminho_network_settings()
public function jaiminho_fix_tables_html()
{
- //var_dump(isset($_POST['fix_tables']));
- global $wpdb;
+ global $wpdb;
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
- //$wpdb->hide_errors();
$collate = '';
if ( $wpdb->has_cap( 'collation' ) ) {
@@ -1060,6 +1116,10 @@ public function jaiminho_get_view_class($page, $current_view, $emails_credits, $
return "Jaiminho_View_Emails_Tempclone";
case "SendPress_View_Reports":
return "Jaiminho_View_Reports";
+ case "SendPress_View_Subscribers":
+ return "Jaiminho_View_Subscribers";
+ case "SendPress_View_Subscribers_Csvimport":
+ return "Jaiminho_View_Subscribers_Csvimport";
case "SendPress_View_Subscribers_Listcreate":
wp_enqueue_script('jaiminho_disable');
return $view_class;