function import_save() { @ini_set('max_execution_time', 0); $this->requireSecurity(); $this->_resetGlobMsg(); //we need to save a new list in that situation if (!empty($_REQUEST['wysija']['list']['newlistname'])) { $model_list = WYSIJA::get('list', 'model'); $data_list = array(); $data_list['is_enabled'] = 1; $data_list['name'] = $_REQUEST['wysija']['list']['newlistname']; $_REQUEST['wysija']['user_list']['list'][] = $model_list->insert($data_list); } //if there is no list selected, we return to the same form prompting the user to take action if (!isset($_REQUEST['wysija']['user_list']['list']) || !$_REQUEST['wysija']['user_list']['list']) { $this->error(__('You need to select at least one list.', WYSIJA), true); return $this->importmatch(); } $import = new WJ_Import(); $data_numbers = $import->import_subscribers(); $duplicate_emails_count = $import->get_duplicate_emails_count(); if ($data_numbers === false) { return $this->redirect('admin.php?page=wysija_subscribers&action=import'); } //get a list of list name $model_list = WYSIJA::get('list', 'model'); $results = $model_list->get(array('name'), array('list_id' => $_REQUEST['wysija']['user_list']['list'])); $list_names = array(); foreach ($results as $k => $v) { $list_names[] = $v['name']; } $this->notice(sprintf(__('%1$s subscribers added to %2$s.', WYSIJA), $data_numbers['list_user_ids'], '"' . implode('", "', $list_names) . '"')); if (count($duplicate_emails_count) > 0) { $list_emails = ''; $i = 0; foreach ($duplicate_emails_count as $email_address => $occurences) { if ($i > 0) { $list_emails .= ', '; } $list_emails .= $email_address . ' (' . $occurences . ')'; $i++; } //$emailsalreadyinserted=array_keys($emailsCount); $this->notice(sprintf(__('%1$s emails appear more than once in your file : %2$s.', WYSIJA), count($duplicate_emails_count), $list_emails), 0); } if (count($data_numbers['invalid']) > 0) { $string = sprintf(__('%1$s emails are not valid : %2$s.', WYSIJA), count($data_numbers['invalid']), utf8_encode(implode(', ', $data_numbers['invalid']))); $this->notice($string, 0); } $this->redirect(); }