MailPoet Newsletters (Previous) - Version 2.5.7

Version Description

  • 2013-09-04 =
  • fixed missing cron schedules for post notifications and scheduled newsletters
  • fixed issue with auto save when switching themes
  • fixed issue preventing the deletion of newly added image
  • fixed sending method not being override in multisite
  • fixed validation messages not translated on some MS sites due to language locale issue
  • improved better use of the language definition so that we understand on which language a WPML site is for instance
  • improved better use of the language definition (removed WPLANG) so that we understand on which language a WPML site is for instance
  • added retina icons for text editor
Download this release

Release Info

Developer wysija
Plugin Icon 128x128 MailPoet Newsletters (Previous)
Version 2.5.7
Comparing to
See all releases

Code changes from version 2.5.2 to 2.5.7

Files changed (137) hide show
  1. classes/WJ_Export.php +194 -0
  2. classes/WJ_Import.php +689 -0
  3. controllers/ajax/campaigns.php +22 -6
  4. controllers/back.php +20 -68
  5. controllers/back/campaigns.php +125 -96
  6. controllers/back/config.php +378 -378
  7. controllers/back/subscribers.php +204 -837
  8. controllers/front/confirm.php +5 -58
  9. controllers/front/stats.php +1 -1
  10. core/base.php +165 -128
  11. core/controller.php +11 -7
  12. core/model.php +65 -24
  13. core/view.php +14 -3
  14. css/admin-campaigns-welcome_new.css +1 -0
  15. css/admin-campaigns.css +1 -1
  16. css/admin-config.css +1 -1
  17. css/admin-global.css +1 -1
  18. css/admin.css +1 -1
  19. helpers/back.php +2 -2
  20. helpers/bounce.php +4 -3
  21. helpers/cron.php +156 -146
  22. helpers/file.php +2 -1
  23. helpers/form_engine.php +4 -8
  24. helpers/forms.php +4 -4
  25. helpers/front.php +272 -246
  26. helpers/http.php +22 -0
  27. helpers/import.php +2 -2
  28. helpers/licence.php +35 -6
  29. helpers/mailer.php +21 -10
  30. helpers/package.php +2 -1
  31. helpers/stats.php +1 -16
  32. helpers/toolbox.php +364 -319
  33. helpers/update.php +19 -21
  34. helpers/user.php +94 -13
  35. helpers/wj_engine.php +7 -11
  36. inc/debug.php +1 -1
  37. index.php +1 -1
  38. js/admin-campaigns-editTemplate.js +1 -1
  39. js/admin-campaigns-welcome_new.js +1 -0
  40. js/admin-subscribers-export.js +1 -0
  41. js/admin-wysija.js +1 -1
  42. js/admin.js +1 -1
  43. js/front-subscribers.js +1 -1
  44. js/tinymce/themes/advanced/img/wpicons-2x.png +0 -0
  45. js/tinymce/themes/advanced/skins/highcontrast/content.css +0 -24
  46. js/tinymce/themes/advanced/skins/highcontrast/dialog.css +0 -106
  47. js/tinymce/themes/advanced/skins/highcontrast/ui.css +0 -106
  48. js/tinymce/themes/advanced/skins/o2k7/content.css +0 -48
  49. js/tinymce/themes/advanced/skins/o2k7/dialog.css +0 -118
  50. js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  51. js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  52. js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  53. js/tinymce/themes/advanced/skins/o2k7/ui.css +0 -222
  54. js/tinymce/themes/advanced/skins/o2k7/ui_black.css +0 -8
  55. js/tinymce/themes/advanced/skins/o2k7/ui_silver.css +0 -5
  56. js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png +0 -0
  57. js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png +0 -0
  58. js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif +0 -0
  59. js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png +0 -0
  60. js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif +0 -0
  61. js/tinymce/themes/advanced/skins/wp_theme/ui.css +2 -1
  62. languages/wysija-newsletters-af.mo +0 -0
  63. languages/wysija-newsletters-ar.mo +0 -0
  64. languages/wysija-newsletters-bg_BG.mo +0 -0
  65. languages/wysija-newsletters-bs_BA.mo +0 -0
  66. languages/wysija-newsletters-ca.mo +0 -0
  67. languages/wysija-newsletters-ca_ES.mo +0 -0
  68. languages/wysija-newsletters-cs_CZ.mo +0 -0
  69. languages/wysija-newsletters-da_DK.mo +0 -0
  70. languages/wysija-newsletters-de_DE.mo +0 -0
  71. languages/wysija-newsletters-el.mo +0 -0
  72. languages/wysija-newsletters-en_US.mo +0 -0
  73. languages/wysija-newsletters-es.mo +0 -0
  74. languages/wysija-newsletters-es_AR.mo +0 -0
  75. languages/wysija-newsletters-es_ES.mo +0 -0
  76. languages/wysija-newsletters-eu.mo +0 -0
  77. languages/wysija-newsletters-fa.mo +0 -0
  78. languages/wysija-newsletters-fa_IR.mo +0 -0
  79. languages/wysija-newsletters-fi.mo +0 -0
  80. languages/wysija-newsletters-fr_FR.mo +0 -0
  81. languages/wysija-newsletters-gl_ES.mo +0 -0
  82. languages/wysija-newsletters-he_IL.mo +0 -0
  83. languages/wysija-newsletters-hi_IN.mo +0 -0
  84. languages/wysija-newsletters-hr_HR.mo +0 -0
  85. languages/wysija-newsletters-hu_HU.mo +0 -0
  86. languages/wysija-newsletters-hy_AM.mo +0 -0
  87. languages/wysija-newsletters-id.mo +0 -0
  88. languages/wysija-newsletters-it_IT.mo +0 -0
  89. languages/wysija-newsletters-ja.mo +0 -0
  90. languages/wysija-newsletters-ko_KR.mo +0 -0
  91. languages/wysija-newsletters-lt_LT.mo +0 -0
  92. languages/wysija-newsletters-lv.mo +0 -0
  93. languages/wysija-newsletters-lv_LV.mo +0 -0
  94. languages/wysija-newsletters-mk_MK.mo +0 -0
  95. languages/wysija-newsletters-my_MM.mo +0 -0
  96. languages/wysija-newsletters-nb_NO.mo +0 -0
  97. languages/wysija-newsletters-nl_NL.mo +0 -0
  98. languages/wysija-newsletters-pl_PL.mo +0 -0
  99. languages/wysija-newsletters-pt_BR.mo +0 -0
  100. languages/wysija-newsletters-pt_PT.mo +0 -0
  101. languages/wysija-newsletters-ro_RO.mo +0 -0
  102. languages/wysija-newsletters-ru_RU.mo +0 -0
  103. languages/wysija-newsletters-sk_SK.mo +0 -0
  104. languages/wysija-newsletters-sl_SI.mo +0 -0
  105. languages/wysija-newsletters-sr_RS.mo +0 -0
  106. languages/wysija-newsletters-sr_RS@latin.mo +0 -0
  107. languages/wysija-newsletters-sv_SE.mo +0 -0
  108. languages/wysija-newsletters-tr_TR.mo +0 -0
  109. languages/wysija-newsletters-uk.mo +0 -0
  110. languages/wysija-newsletters-ur_PK.mo +0 -0
  111. languages/wysija-newsletters-vi.mo +0 -0
  112. languages/wysija-newsletters-zh_HK.mo +0 -0
  113. languages/wysija-newsletters-zh_TW.mo +0 -0
  114. models/config.php +6 -4
  115. models/email.php +3 -3
  116. models/list.php +71 -66
  117. models/user.php +485 -117
  118. readme.txt +36 -1
  119. tools/templates/email_v2/block_content.html +0 -37
  120. tools/templates/email_v2/block_divider.html +0 -13
  121. tools/templates/email_v2/block_gallery.html +0 -8
  122. tools/templates/email_v2/block_gallery_item.html +0 -8
  123. tools/templates/email_v2/block_raw.html +0 -2
  124. tools/templates/email_v2/block_template.html +0 -2
  125. tools/templates/email_v2/email_template.html +0 -26
  126. tools/templates/email_v2/footer_template.html +0 -17
  127. tools/templates/email_v2/header_template.html +0 -17
  128. tools/templates/email_v2/index.html +0 -0
  129. tools/templates/email_v2/unsubscribe_template.html +0 -1
  130. tools/templates/email_v2/viewbrowser_template.html +0 -1
  131. tools/templates/email_v3/block_content_BACKUP.html +0 -37
  132. tools/templates/toolbar/images.html +1 -1
  133. tools/templates/toolbar/themes.html +1 -1
  134. views/back.php +14 -11
  135. views/back/campaigns.php +52 -28
  136. views/back/config.php +200 -144
  137. views/back/subscribers.php +38 -35
classes/WJ_Export.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Export.
5
+ *
6
+ * Exporting subscribers
7
+ */
8
+ class WJ_Export extends WYSIJA_object{
9
+
10
+ private $_file_header = '';
11
+ private $_file_handle = null;
12
+ private $_user_ids_rows = 0;
13
+ private $_user_ids = array();
14
+ private $_fields = array();
15
+ private $_export_batch = 2000;
16
+ private $_filter_list = '';
17
+ private $_filter_confirmed = '';
18
+ private $_fields_separator = ';';
19
+ private $_lines_separator = "\n";
20
+
21
+ //needed for tung's batch actions
22
+ public $batch_select = null;
23
+
24
+
25
+ function __construct() {
26
+ if(!empty($_POST['wysija']['export']['fields'])) $this->_fields = $_POST['wysija']['export']['fields'];
27
+ if(!empty($_POST['wysija']['export']['user_ids'])) $this->_user_ids = $this->_get_posted_user_ids();
28
+ if(!empty($_POST['wysija']['export']['filter']['list'])) $this->_filter_list = $_POST['wysija']['export']['filter']['list'];
29
+ if(!empty($_POST['wysija']['export']['filter']['confirmed'])) $this->_filter_confirmed = $_POST['wysija']['export']['filter']['confirmed'];
30
+ }
31
+
32
+ /**
33
+ * export the subscribers
34
+ * @return type
35
+ */
36
+ public function export_subscribers() {
37
+
38
+ //generate temp file
39
+ $helper_file = WYSIJA::get('file','helper');
40
+ $this->_prepare_headers();
41
+ $result_file = $helper_file->temp($this->_file_header,'export','.csv');
42
+
43
+ //open the created file in append mode
44
+ $this->_file_handle = fopen($result_file['path'], 'a');
45
+
46
+ //get a list of user_ids to export
47
+ if(!empty($this->_user_ids) && empty($this->batch_select)){
48
+
49
+ $this->_user_ids_rows = count($this->_user_ids);
50
+ $this->_push_data_to_export_file();
51
+
52
+ }else{
53
+
54
+ $this->_get_chunks_user_ids();
55
+ }
56
+
57
+ fclose( $this->_file_handle );
58
+ return $result_file['path'];
59
+ }
60
+
61
+ /**
62
+ * get the number of rows exported
63
+ * @return type
64
+ */
65
+ public function get_user_ids_rows(){
66
+ return $this->_user_ids_rows;
67
+ }
68
+
69
+ /**
70
+ * get an array of user_ids from the global $_POST
71
+ * @return type
72
+ */
73
+ private function _get_posted_user_ids(){
74
+ return unserialize(base64_decode($_POST['wysija']['export']['user_ids']));
75
+ }
76
+
77
+ /**
78
+ * get the query used to select a bung of ids
79
+ * @return string
80
+ */
81
+ private function _get_query_users_ids(){
82
+
83
+ // based on filters prepare a query to get a list of user_ids
84
+ if(!empty($this->batch_select)){ // batch select and export
85
+ $this->_user_ids_rows = $this->batch_select['count'];
86
+ $qry = $this->batch_select['original_query'];
87
+ }else{ // export all list
88
+
89
+ // prepare the filters
90
+ $filters = array();
91
+ if(!empty($this->_filter_list)){
92
+ if(!is_array($this->_filter_list)){
93
+ $this->_filter_list = array($this->_filter_list);
94
+ }
95
+ }
96
+ $filters['lists'] = $this->_filter_list;
97
+
98
+ // include also unsubscribed and unconfirmed
99
+ if(!empty($this->_filter_confirmed)){
100
+ $filters['status'] = 'subscribed';
101
+ }
102
+
103
+ $model_user = WYSIJA::get('user','model');
104
+ $select = array('A.user_id');
105
+ $qry = $model_user->get_subscribers( $select, $filters , '' , $return_query = true);
106
+ }
107
+
108
+ return $qry;
109
+ }
110
+
111
+ /**
112
+ * get chunks of subscribers ids and push them step by step to the export file
113
+ */
114
+ private function _get_chunks_user_ids(){
115
+
116
+ $model_user = WYSIJA::get('user','model');
117
+ $this->_user_ids = array();
118
+ $query_user_ids = $this->_get_query_users_ids();
119
+ $query_count = str_replace(array('DISTINCT(A.user_id)', 'DISTINCT(B.user_id)') , 'COUNT(DISTINCT(A.user_id))' , $query_user_ids);
120
+
121
+ if(empty($this->_user_ids_rows)){
122
+ $useridsrows_result = $model_user->getResults( $query_count , ARRAY_N);
123
+ $this->_user_ids_rows = (int)$useridsrows_result[0][0];
124
+ }
125
+
126
+ if($this->_user_ids_rows <= $this->_export_batch){
127
+ $user_ids_db = $model_user->getResults( $query_user_ids , ARRAY_N);
128
+
129
+ foreach($user_ids_db as $uarr){
130
+ $this->_user_ids[]=$uarr[0];
131
+ }
132
+
133
+ $this->_push_data_to_export_file();
134
+ }else{
135
+ $pages = ceil($this->_user_ids_rows / $this->_export_batch);//pagination
136
+ for ($i = 0; $i < $pages; $i++) {
137
+ $query_batch = $query_user_ids . ' ORDER BY user_id ASC LIMIT '.($i * $this->_export_batch) . ',' . $this->_export_batch;
138
+ $user_ids_db = $model_user->getResults( $query_batch , ARRAY_N );
139
+ foreach($user_ids_db as $uarr){
140
+ $this->_user_ids[]=$uarr[0];
141
+ }
142
+ $this->_push_data_to_export_file();
143
+
144
+ unset($user_ids_db);//free memory
145
+ }
146
+ }
147
+ }
148
+
149
+
150
+ /**
151
+ * split the user_ids array into chunks, load the fields of all the concerned
152
+ * users and push the data to the file
153
+ */
154
+ function _push_data_to_export_file(){
155
+ $user_ids_chunks = array(); // chunk rows into separated batchs, limit by $this->_export_batch
156
+ $user_ids_chunks = array_chunk($this->_user_ids, 200);
157
+ $this->_user_ids = null;// free memory
158
+
159
+ $model_user = WYSIJA::get('user','model');
160
+ foreach($user_ids_chunks as $user_id_chunk){
161
+ // get the full data for that specific chunk of ids
162
+ $data = $model_user->get( $this->_fields , array('user_id'=>$user_id_chunk) );
163
+
164
+ if(in_array('created_at' , $this->_fields)){
165
+ foreach($data as $key => $row){
166
+ $data[$key]['created_at'] = date_i18n( get_option('date_format') , $row['created_at'] );
167
+ }
168
+ }
169
+
170
+ // append content to the file
171
+ foreach($data as $row){
172
+ fwrite( $this->_file_handle , implode( $this->_fields_separator , $row ) . $this->_lines_separator);
173
+ }
174
+ }
175
+ }
176
+
177
+ /**
178
+ * simply prepare the header of the file based on the fields
179
+ */
180
+ private function _prepare_headers(){
181
+ $model_user = WYSIJA::get('user_field','model');
182
+ $database_fields = $model_user->getFields();
183
+
184
+ $name_fields = array();
185
+ //prepare the columns that need to be exported
186
+ foreach($this->_fields as $key_field){
187
+ $name_fields[] = $database_fields[$key_field];
188
+ }
189
+
190
+ //create the export file step by step
191
+ $this->_file_header = implode($this->_fields_separator , $name_fields) . $this->_lines_separator;
192
+ }
193
+
194
+ }
classes/WJ_Import.php ADDED
@@ -0,0 +1,689 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Import.
5
+ *
6
+ * Importing subscribers
7
+ */
8
+ class WJ_Import extends WYSIJA_object{
9
+
10
+ private $_header_row = array();
11
+ private $_csv_data = array();
12
+ private $_match = array();
13
+ private $_email_key = '';
14
+ private $_data_to_insert = array();
15
+ private $_number_list = 0;
16
+ private $_data_numbers = array();
17
+ private $_line_delimiter = "\n";
18
+ private $_duplicate_emails_count = array(); // detect the emails that are duplicates in the import file
19
+ private $_csv_array = array(); // containing the csv into an array
20
+ private $_ignored_row_count = 0; // the count of rows we ignore because there was no valid email present
21
+ private $_lines_count = 0; // count the number of valid lines inserted in the DB
22
+ private $_chunks_count = 0; // number of chunks we chopped from the csv
23
+ private $_first_row_is_data = false; // means that there is no header on that csv file
24
+ private $_emails_inserted_in_current_chunk = array(); // array of emails
25
+ private $_csv_file_string = '';
26
+ private $_data_result = array(); // used for importmatch refactor
27
+
28
+
29
+ function __construct() {
30
+ if(!empty($_POST['wysija']['match'])) $this->_match = $_POST['wysija']['match'];
31
+ if(!empty($_REQUEST['wysija']['user_list']['list'])) $this->_number_list = count($_REQUEST['wysija']['user_list']['list']);
32
+ if(!empty($_POST['firstrowisdata'])) $this->_first_row_is_data = true;
33
+ $this->_data_numbers = array( 'invalid'=>array() , 'inserted'=>0 , 'valid_email_processed'=>0 , 'list_added'=>0 , 'list_user_ids'=>0 , 'list_list_ids' => $this->_number_list , 'emails_queued'=>0 );
34
+ }
35
+
36
+ /**
37
+ * loading file data passed in a global variable
38
+ * @return type
39
+ */
40
+ private function _get_temp_file_info(){
41
+ if(!empty($_REQUEST['wysija']['dataImport'])) return unserialize(base64_decode($_REQUEST['wysija']['dataImport']));
42
+ }
43
+
44
+ /**
45
+ * loading the file based on global parameters
46
+ * @return string
47
+ */
48
+ private function _loading_file_content(){
49
+ // try to access the temporary file created in the previous step
50
+ $this->_csv_data = $this->_get_temp_file_info();
51
+
52
+ $helper_file = WYSIJA::get('file','helper');
53
+ $result_file = $helper_file->get( $this->_csv_data['csv'] , 'import' );
54
+
55
+ if(!$result_file){
56
+ $upload_dir = wp_upload_dir();
57
+ $this->error(sprintf(__('Cannot access CSV file. Verify access rights to this directory "%1$s"',WYSIJA), $upload_dir['basedir']),true);
58
+ return false;
59
+ }
60
+
61
+ // get the temp csv file
62
+ $this->_csv_file_string = file_get_contents($result_file);
63
+ }
64
+
65
+ /**
66
+ * try to match columns together with the csv data
67
+ */
68
+ private function _match_columns_to_insert(){
69
+
70
+ foreach($this->_match as $key => $val){
71
+ if($val != 'nomatch'){
72
+ $this->_data_to_insert[$key] = trim($val);
73
+ }
74
+ if($val == 'email'){
75
+ $this->_email_key = $key;
76
+ }
77
+ }
78
+
79
+ if(!in_array('status',$this->_data_to_insert)){
80
+ $this->_data_to_insert['status'] = 'status';
81
+ }
82
+ }
83
+
84
+ /**
85
+ * build the header of the import query
86
+ * @return type
87
+ */
88
+ private function _get_import_query_header(){
89
+ return 'INSERT IGNORE INTO [wysija]user (`'.implode('` ,`',$this->_data_to_insert).'`,`created_at`) VALUES ';
90
+ }
91
+
92
+ /**
93
+ *
94
+ * @param type $array_csv
95
+ */
96
+ private function _check_duplicate_emails($array_csv){
97
+ // look for duplicate emails
98
+ foreach($array_csv as $keyline => $csv_line){
99
+ if(isset($csv_line[$this->_email_key])){
100
+ if(isset($this->_duplicate_emails_count[$csv_line[$this->_email_key]])) {
101
+ $this->_duplicate_emails_count[$csv_line[$this->_email_key]]++;
102
+ //$arra[$keyline]
103
+ }else{
104
+ $this->_duplicate_emails_count[$csv_line[$this->_email_key]]=1;
105
+ }
106
+ }else{
107
+ //if the record doesn't have the attribute email then we just ignore it
108
+ $this->_ignored_row_count++;
109
+ unset($array_csv[$keyline]);
110
+ }
111
+ }
112
+ }
113
+
114
+ /**
115
+ * save new column/field match to improve usability the next time our admin
116
+ * import a field with similar headers/columns names
117
+ * @return boolean
118
+ */
119
+ private function _smart_column_match_recording(){
120
+ if($this->_first_row_is_data === false) {
121
+ //save the importing fields to be able to match them the next time
122
+ $import_fields = get_option('wysija_import_fields');
123
+ foreach($_POST['wysija']['match'] as $key => $val){
124
+ if($val != 'nomatch') {
125
+ $import_fields[$this->_header_row[$key]] = $val;
126
+ }
127
+ }
128
+ WYSIJA::update_option('wysija_import_fields' , $import_fields);
129
+ return true;
130
+ }
131
+ return false;
132
+ }
133
+
134
+ /**
135
+ * import a csv type into wysija's subscribers' table
136
+ * @return type
137
+ */
138
+ public function import_subscribers() {
139
+
140
+ // import the contacts
141
+ // 1-check that a list is selected and that there is a csv file pasted
142
+ // 2-save the list if necessary
143
+ // 3-save the contacts and record them for each list selected
144
+ $this->_loading_file_content();
145
+ // convert the csv file to an array
146
+ $this->_csv_array = $this->_csv_to_array( $this->_csv_file_string , 0 , $this->_csv_data['fsep'] , $this->_csv_data['fenc']);
147
+
148
+ // try to match columns together with the csv data
149
+ $this->_match_columns_to_insert();
150
+
151
+ $this->_header_row = $this->_csv_array[0];
152
+ // we process the sql insertion 200 by 200 so that we are safe with the server
153
+ $csv_chunks = array_chunk($this->_csv_array, 200);
154
+ $this->_csv_array = null;
155
+ $this->_chunks_count = 0;
156
+ $this->_lines_count = 0;
157
+
158
+ // to avoid timeout when importing a lot of data apparently.
159
+ global $wpdb;
160
+ $wpdb->query('set session wait_timeout=600');
161
+
162
+ // loop and insert the data chunks by chunks
163
+ foreach($csv_chunks as $key_chunk => $csv_chunk){
164
+
165
+ $this->_check_duplicate_emails( $csv_chunk );
166
+
167
+ $result = $this->_import_rows( $csv_chunk );
168
+
169
+ if($result !== false) $this->_chunks_count++;
170
+ else{
171
+ // there was an error we try 3 more times the same chunk and se how it goes
172
+ $try=0;
173
+ while($result === false && $try < 3){
174
+ $result = $this->_import_rows( $csv_chunk);
175
+ if($result !== false){
176
+ $this->_chunks_count++;
177
+ break;
178
+ }
179
+ $try++;
180
+ }
181
+
182
+ if($result === false ){
183
+ $this->error(__('There seems to be an error with the list you\'re trying to import.',WYSIJA),true);
184
+ return false;
185
+ }
186
+ }
187
+ // increment the lines count
188
+ $this->_lines_count += $result;
189
+ // free up some memory
190
+ unset($csv_chunks[$key_chunk]);
191
+ }
192
+
193
+ // useful the next time we import a file with the same format
194
+ $this->_smart_column_match_recording();
195
+
196
+ // refresh the total count of users in wysija
197
+ $helper_user=WYSIJA::get('user','helper');
198
+ $helper_user->refreshUsers();
199
+
200
+ // keep only the real duplicate emails unset the unique ones
201
+ // TODO check that this email duplicate function could be a memory sink hole
202
+ // especially that right now we don't use its value
203
+ foreach($this->_duplicate_emails_count as $email_address => $times_email_in_csv){
204
+ if($times_email_in_csv == 1) unset($this->_duplicate_emails_count[$email_address]);
205
+ }
206
+
207
+ // how come we need to do that sometimes? how a lines count could become negative?
208
+ if($this->_lines_count < 0) $this->_lines_count = 0;
209
+
210
+ // all of these numbers were useful at some point when we were showing more information after an import
211
+ $this->_data_numbers['ignored'] = ($this->_data_numbers['valid_email_processed'] - $this->_data_numbers['inserted']);
212
+ $this->_data_numbers['ignored_list'] = ( ($this->_data_numbers['list_user_ids']*$this->_data_numbers['list_list_ids']) - $this->_data_numbers['list_added'] );
213
+
214
+
215
+ return $this->_data_numbers;
216
+ }
217
+
218
+ public function get_duplicate_emails_count(){
219
+ return $this->_duplicate_emails_count;
220
+ }
221
+
222
+ /**
223
+ * convert a csv string to an array
224
+ * @param type $csv_file_content
225
+ * @param type $rows_to_read
226
+ * @param type $delimiter
227
+ * @param type $enclosure
228
+ * @param type $line_delimiter
229
+ * @return array
230
+ */
231
+ private function _csv_to_array($csv_file_content , $rows_to_read = 0 , $delimiter = ',' , $enclosure = '' ){
232
+ $data = array();
233
+
234
+ $csv_data_array = explode( $this->_line_delimiter , $csv_file_content );
235
+ $i=1;
236
+ foreach($csv_data_array as $csv_line){
237
+ if($rows_to_read!=0 && $i> $rows_to_read) return $data;
238
+
239
+ // str_getcsv only exists in php5 and is a faster and cleaner function than our csv_explode
240
+ if(!function_exists('str_getcsv')){
241
+ $data[]= $this->_lines_explode($csv_line, $delimiter,$enclosure);
242
+ }else{
243
+ $data[] = str_getcsv($csv_line, $delimiter,$enclosure);
244
+ }
245
+
246
+ $i++;
247
+ }
248
+
249
+ return $data;
250
+ }
251
+
252
+ /**
253
+ * explode lines to columns
254
+ * @param type $csv_line
255
+ * @param type $delimiter
256
+ * @param type $enclose
257
+ * @param type $preserve
258
+ * @return type
259
+ */
260
+ private function _lines_explode($csv_line , $delimiter , $enclose , $preserve=false){
261
+ $resArr = array();
262
+ $n = 0;
263
+ if(empty($enclose)){
264
+ $resArr = explode($delimiter, $csv_line);
265
+ }else{
266
+ $expEncArr = explode($enclose, $csv_line);
267
+ foreach($expEncArr as $EncItem){
268
+ if($n++%2){
269
+ array_push($resArr, array_pop($resArr) . ($preserve ? $enclose : '') . $EncItem.( $preserve ? $enclose : ''));
270
+ }else{
271
+ $expDelArr = explode($delimiter, $EncItem);
272
+ array_push($resArr, array_pop($resArr) . array_shift($expDelArr));
273
+ $resArr = array_merge($resArr, $expDelArr);
274
+ }
275
+ }
276
+ }
277
+
278
+ return $resArr;
279
+ }
280
+
281
+ /**
282
+ * function processing a chunk of a csv array to import it in the DB
283
+ * @global object $wpdb
284
+ * @param array $csv_chunk
285
+ * @return boolean|string
286
+ */
287
+ private function _import_rows( $csv_chunk ){
288
+
289
+ global $wpdb;
290
+
291
+ $this->_emails_inserted_in_current_chunk = array();
292
+ $time = time();
293
+ $lines_count = count($csv_chunk);
294
+ $columns_count = count($this->_data_to_insert);
295
+
296
+ $query = $this->_get_import_query_header();
297
+
298
+ // make sure that each line has the right numbers of columns if it doesn't then we can skip it
299
+ foreach($csv_chunk as $k => $line){
300
+ if(!(count($line) >= (count($this->_data_to_insert) - 1))){
301
+ unset($csv_chunk[$k]);
302
+ $lines_count--;
303
+ }
304
+ }
305
+
306
+ $valid_email_processed = 0;
307
+ $j = 1;
308
+
309
+ foreach($csv_chunk as $key_line => $line){
310
+
311
+ // if first row is not data but header then we just skip it only on the first chunk
312
+ if($this->_first_row_is_data === false && $j == 1 && $this->_chunks_count == 0) {
313
+ $j++;
314
+ continue;
315
+ }
316
+
317
+ $i=1;
318
+ $values='';
319
+
320
+ // TODO maybe we should check the value of the status column so that if we export a wysija's subscribers' list
321
+ // and import it again in another site then we keep the status
322
+ if(isset($this->_data_to_insert['status'])) $line['status']=1;
323
+
324
+ foreach($line as $key_column => &$value_column){
325
+
326
+ // make sure this column is a column we want to insert in our DB
327
+ if(isset($this->_data_to_insert[$key_column])){
328
+ $column_name = $this->_data_to_insert[$key_column];
329
+
330
+ $value_column = $this->_validate_value($column_name , $value_column);
331
+
332
+ // this kind of result invalidates the whole row
333
+ if($value_column === false){
334
+ // record the invalid row and continue with the loop
335
+ $this->_data_numbers['invalid'][] = $value_column;
336
+ unset($csv_chunk[$key_line]);
337
+ $lines_count--;
338
+ continue 2;
339
+ }else{
340
+ // only if this is the email row we record an entry in the recorded emails and the email processed count
341
+ if($this->_email_key === $key_column){
342
+ $this->_emails_inserted_in_current_chunk[] = $value_column;
343
+ $valid_email_processed++;
344
+ }
345
+ }
346
+
347
+
348
+ // prepare the query
349
+ $values.="'". mysql_real_escape_string($value_column,$wpdb->dbh)."'";
350
+ if($columns_count > $i) $values .= ',';
351
+ else $values.=','.$time;
352
+ $i++;
353
+ }
354
+ }
355
+
356
+ $query .= " ($values) ";
357
+ if($lines_count > $j) $query .= ',';
358
+ $j++;
359
+
360
+ }
361
+
362
+
363
+ // replace query to import the subscribers
364
+ $model_wysija = new WYSIJA_model();
365
+ $import_query = $model_wysija->query($query);
366
+
367
+ $lines_count = $wpdb->rows_affected;
368
+ $this->_data_numbers['inserted'] += $wpdb->rows_affected;
369
+ $this->_data_numbers['valid_email_processed'] += $valid_email_processed;
370
+
371
+ if($import_query === false) {
372
+ $this->error(__('Error when inserting emails.',WYSIJA),true);
373
+ return false;
374
+ }
375
+ $time_now = time();
376
+ $result_query_import_list = $this->_import_new_users_into_lists($time_now);
377
+
378
+ $this->_trigger_active_autoresponders($time_now);
379
+
380
+ if($result_query_import_list === false) {
381
+ $this->error(__('Error when inserting list.',WYSIJA),true);
382
+ return false;
383
+ }
384
+
385
+ if( $import_query == 0 ) return '0';
386
+
387
+ return $lines_count;
388
+ }
389
+
390
+ /**
391
+ * used to validate or cast values before importing
392
+ * TODO should we add a type for import of custom fields ?
393
+ * Comment : Marco, feel free to modify entirely
394
+ * @param type $column_name
395
+ * @param type $value
396
+ */
397
+ function _validate_value($column_name , $value){
398
+ $value = trim($value);
399
+ switch($column_name){
400
+ case 'email':
401
+ $helper_user = WYSIJA::get('user','helper');
402
+ if($helper_user->validEmail($value)){
403
+ return $value;
404
+ }else{
405
+ return false;
406
+ }
407
+ break;
408
+ case 'status':
409
+
410
+ if(in_array(strtolower($value),array('subscribed','confirmed',1,'1','true'))){
411
+ return 1;
412
+ }elseif(in_array(strtolower($value),array('unsubscribed',-1,'-1','false'))){
413
+ return -1;
414
+ }elseif(in_array(strtolower($value),array('unconfirmed',0,'0'))){
415
+ return 0;
416
+ }else return 1;
417
+ break;
418
+ default :
419
+ return $value;
420
+ }
421
+ }
422
+
423
+ /**
424
+ * take care of active autoresponders retro-activity
425
+ * @param type $time_now
426
+ * @return boolean
427
+ */
428
+ private function _trigger_active_autoresponders($time_now){
429
+ $helper_email = WYSIJA::get('email','helper');
430
+ $model_wysija = new WYSIJA_model();
431
+
432
+ // list the active auto responders emails
433
+ $active_autoresponders_per_list = $helper_email->get_active_follow_ups(array('email_id','params'),true);
434
+
435
+ if(!empty($active_autoresponders_per_list)){
436
+ foreach($_REQUEST['wysija']['user_list']['list'] as $list_id){
437
+ // checking if this list has a list of follow ups
438
+ if(isset($active_autoresponders_per_list[$list_id])){
439
+ // for each follow up of that list we queu an email
440
+ foreach($active_autoresponders_per_list[$list_id] as $key_queue => $follow_up){
441
+ // insert query per active followup
442
+ $query_queue = 'INSERT IGNORE INTO [wysija]queue (`email_id` ,`user_id`,`send_at`) ';
443
+ $query_queue .= ' SELECT '.$follow_up['email_id'].' , B.user_id , '.($time_now+$follow_up['delay']);
444
+ $query_queue .= ' FROM [wysija]user_list as B';
445
+ $query_queue .= ' WHERE B.list_id='.(int)$list_id.' AND sub_date='.$time_now;
446
+
447
+ $model_wysija->query($query_queue);
448
+
449
+ $this->_data_numbers['emails_queued'] += $wpdb->rows_affected;
450
+ }
451
+ }
452
+ }
453
+ return true;
454
+ }
455
+ return false;
456
+ }
457
+
458
+ /**
459
+ *
460
+ * @global type $wpdb
461
+ * @param type $time_now
462
+ * @return type
463
+ */
464
+ private function _import_new_users_into_lists($time_now){
465
+ global $wpdb;
466
+ $wpdb->rows_affected = 0;
467
+ $model_wysija = new WYSIJA_model();
468
+
469
+ $user_ids = $this->_get_imported_user_ids();
470
+
471
+ // insert query per list
472
+ $query = 'INSERT IGNORE INTO [wysija]user_list (`list_id` ,`user_id`,`sub_date`) VALUES ';
473
+
474
+ foreach($_REQUEST['wysija']['user_list']['list'] as $keyl=> $list_id){
475
+ if(empty($list_id)) continue;
476
+ // for each list pre selected go through that process
477
+ foreach($user_ids as $key => $user_data){
478
+
479
+ // inserting each user id to this list
480
+ $query.='('.$list_id.' , '.$user_data['user_id'].' , '.$time_now.')';
481
+
482
+ // if this is not the last row we put a comma for the next row
483
+ if(count($user_ids) > ($key+1)){
484
+ $query.=' , ';
485
+ }
486
+ }
487
+
488
+ // if this is not the last row we put a comma for the next row
489
+ if(count($_REQUEST['wysija']['user_list']['list'])>($keyl+1)){
490
+ $query.=',';
491
+ }
492
+ }
493
+
494
+ $result_query = $model_wysija->query($query);
495
+
496
+ $this->_data_numbers['list_added']+=$wpdb->rows_affected;
497
+ $this->_data_numbers['list_user_ids']+=count($user_ids);
498
+ return $result_query;
499
+ }
500
+
501
+ /**
502
+ * get a list of user_ids freshly imported
503
+ * @return type
504
+ */
505
+ private function _get_imported_user_ids(){
506
+ $model_user = WYSIJA::get('user','model');
507
+ // select query to get all of the ids of the emails that have just been inserted
508
+ return $model_user->get( array('user_id') , array('email'=>$this->_emails_inserted_in_current_chunk) );
509
+ }
510
+
511
+ private function _save_default_import_field_match(){
512
+ $import_fields = get_option('wysija_import_fields');
513
+ if(!$import_fields) {
514
+ $import_fields=array(
515
+ 'fname' => 'firstname',
516
+ 'firstname' => 'firstname',
517
+ 'prenom' => 'firstname',
518
+ 'nom' => 'lastname',
519
+ 'name' => 'lastname',
520
+ 'lastname' => 'lastname',
521
+ 'lname' => 'lastname',
522
+ 'ipaddress' => 'ip',
523
+ 'ip' => 'ip',
524
+ 'addresseip' => 'ip',
525
+ );
526
+ WYSIJA::update_option('wysija_import_fields',$import_fields);
527
+ }
528
+ }
529
+
530
+ private function _get_csv_file_cleanedup(){
531
+ //is it a text import or a file import?
532
+ if($_POST['wysija']['import']['type'] == 'copy'){
533
+ if(!isset($_POST['wysija']['user_list']['csv'])){
534
+ // memory limit has been reached
535
+ $this->error(__('The list you\'ve pasted is too big for the browser. <strong>Upload the file</strong> instead.',WYSIJA),true);
536
+ return false;
537
+ }
538
+ $this->_csv_file_string = trim(stripslashes($_POST['wysija']['user_list']['csv']));
539
+ }else{
540
+ //dbg($_FILES);
541
+ //move_uploaded_file($_importfile, $destination);
542
+ $this->_csv_file_string = trim(file_get_contents($_FILES['importfile']['tmp_name']));
543
+ }
544
+
545
+ $this->_csv_file_string = str_replace(array("\r","\n\n","\n\t\t\n\t\n\t\n\t\n","\n\t\t\n\t\n\t\n","\xEF\xBB\xBF","\n\t\n","\n(+1)"),array("\n","\n","\n ;","\n",'',';','') , $this->_csv_file_string);
546
+
547
+ //this might be gmail recipients rare paste ...
548
+ if(!preg_match_all('/<([a-z0-9_\'&\.\-\+])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,10})+>/i' , $this->_csv_file_string , $matches)){
549
+ //return false;
550
+ }else{
551
+
552
+ if(substr($this->_csv_file_string, -1)!=",") $this->_csv_file_string = trim($this->_csv_file_string).',';
553
+
554
+ $this->_csv_file_string = str_replace(array(">, \r",">, \n",">,\r",">,\n",'>, '),'>,' , $this->_csv_file_string);
555
+ $matchess = explode('>,' , $this->_csv_file_string);
556
+ array_pop($matchess);
557
+
558
+ if(count($matches[0]) == count($matchess)){
559
+ //this is gmail simple paste
560
+ $this->_csv_file_string = str_replace(array('>,','<'),array("\n" , ',') , $this->_csv_file_string);
561
+
562
+ }
563
+ $this->_csv_file_string = trim($this->_csv_file_string);
564
+ }
565
+ }
566
+
567
+ private function _run_test_on_csv_file(){
568
+ // try different set of enclosure and separator for the csv which can have different look depending on the data carried
569
+ $field_separators_to_test=array(',',';',"\t");
570
+ $field_enclosur_to_test=array('"','');
571
+ $this->_csv_data['fsep'] = false;
572
+ $this->_csv_data['fenc']='';
573
+ $helper_user = WYSIJA::get('user','helper');
574
+ foreach($field_enclosur_to_test as $enclosure){
575
+ foreach($field_separators_to_test as $fsep){
576
+
577
+ // testing different combinations of separator and encloser
578
+ $this->_csv_array = $this->_csv_to_array($this->_csv_file_string , 4 , $fsep , $enclosure);
579
+
580
+ if((count($this->_csv_array)>1 && count($this->_csv_array[0])==count($this->_csv_array[1]))){
581
+ if(count($this->_csv_array[0])>1 || $helper_user->validEmail(trim($this->_csv_array[0][0])) || $helper_user->validEmail(trim($this->_csv_array[1][0]))){
582
+ $this->_csv_data['fsep'] = $fsep;
583
+ $this->_csv_data['fenc'] = $enclosure;
584
+ break(2);
585
+ }
586
+
587
+ }
588
+ }
589
+ }
590
+
591
+ //if it is not a csv file we come out
592
+ if(empty($this->_csv_data['fsep'])){
593
+ $this->notice(str_replace(array('[link]','[/link]'),array('<a href="#">','</a>'),__('The data you are trying to import doesn\'t appear to be in the CSV format (Comma Separated Values). [link]Read more[/link].',WYSIJA)));
594
+ $this->notice(__('The first line of a CSV file should be the column headers : "email","lastname","firstname".',WYSIJA));
595
+ $this->notice(__('The second line of a CSV file should be a set of values : "joeeg@example.com","Average","Joe".',WYSIJA));
596
+
597
+ $this->notice(__('The two first lines of the file you\'ve uploaded are as follow:',WYSIJA));
598
+
599
+ $arraylines=explode("\n",$this->_csv_file_string);
600
+
601
+ if(empty($arraylines[0])) $text=__('Line is empty',WYSIJA);
602
+ else $text=$arraylines[0];
603
+ $this->notice('<strong>'.$text.'</strong>');
604
+
605
+ if(empty($arraylines[1])) $text=__('Line is empty',WYSIJA);
606
+ else $text=$arraylines[1];
607
+ $this->notice('<strong>'.$text.'</strong>');
608
+
609
+ return false;
610
+ }
611
+
612
+ // test the size of the file
613
+ $temp_csv_array = $this->_csv_to_array( $this->_csv_file_string , 0 , $this->_csv_data['fsep'] , $this->_csv_data['fenc']);
614
+
615
+ $this->_data_result['totalrows'] = count($temp_csv_array);
616
+ end($temp_csv_array);
617
+ $this->_data_result['lastrow'] = current($temp_csv_array);
618
+ }
619
+ private function _save_csv_file(){
620
+ // try to make a wysija dir to save the import file
621
+ $helper_file = WYSIJA::get('file','helper');
622
+ $result_dir = $helper_file->makeDir('import');
623
+ if(!$result_dir) {
624
+ return false;
625
+ }
626
+
627
+ $file_name = 'import-'.time().'.csv';
628
+ $handle = fopen($result_dir.$file_name, 'w');
629
+ fwrite($handle, $this->_csv_file_string);
630
+ fclose($handle);
631
+
632
+ return $file_name;
633
+ }
634
+
635
+ private function _test_csv_emails(){
636
+ $found_email = 0;
637
+ $this->_email_key = array();
638
+ $helper_user = WYSIJA::get('user','helper');
639
+ foreach($this->_csv_array as $csv_row){
640
+ foreach($csv_row as $key_column => $value_column){
641
+ if( $helper_user->validEmail( trim($value_column) )){
642
+ $found_email++;
643
+
644
+ $this->_email_key[$key_column] = $this->_csv_array[0][$key_column];
645
+ }
646
+ }
647
+ }
648
+
649
+ $this->_data_result['errormatch'] = false;
650
+ if((count($this->_csv_array)<2) || ((count($this->_csv_array) -1) > $found_email)){
651
+ $this->error(sprintf(__('There might be a problem with the list you are trying to import. We have identified %1$s emails out of %2$s rows.',WYSIJA),$found_email,count($this->_csv_array)),true);
652
+ $this->_data_result['errormatch'] = true;
653
+ }
654
+ }
655
+
656
+ public function scan_csv_file(){
657
+ $this->_data_result = array();
658
+
659
+ if( $this->_save_default_import_field_match() === false) return false;
660
+ if( $this->_get_csv_file_cleanedup() === false) return false;
661
+ if( $this->_run_test_on_csv_file() === false) return false;
662
+
663
+ $file_name = $this->_save_csv_file();
664
+ if($file_name === false) return false;
665
+
666
+ $this->_test_csv_emails();
667
+
668
+ $this->_data_result['csv'] = $this->_csv_array;
669
+ $dataImport=array(
670
+ 'csv'=>$file_name,
671
+ 'fsep'=>$this->_csv_data['fsep'],
672
+ 'fenc'=>$this->_csv_data['fenc']);
673
+ $this->_data_result['dataImport'] = base64_encode(serialize($dataImport));
674
+ $this->_data_result['keyemail'] = $this->_email_key;
675
+
676
+ //test if the first row is data or not
677
+ //test the email column
678
+ foreach($this->_data_result['keyemail'] as $k) $this->_email_key = $k;
679
+
680
+ $helper_user = WYSIJA::get('user','helper');
681
+ if($helper_user->validEmail( $this->_email_key )){
682
+ $this->_data_result['firstrowisdata']=true;
683
+ }else{
684
+ $this->_data_result['totalrows']--;
685
+ }
686
+
687
+ return $this->_data_result;
688
+ }
689
+ }
controllers/ajax/campaigns.php CHANGED
@@ -7,6 +7,15 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control{
7
  parent::WYSIJA_control();
8
  }
9
 
 
 
 
 
 
 
 
 
 
10
  function switch_theme() {
11
  if(isset($_POST['wysijaData'])) {
12
  $rawData = $_POST['wysijaData'];
@@ -436,13 +445,15 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control{
436
  $dummy_receiver->user_id = 0;
437
  $dummy_receiver->email = $receiver;
438
  $dummy_receiver->status = 1;
439
- $dummy_receiver->lastname = $dummy_receiver->firstname = '';
440
  }
441
-
442
  if($spamtest){
443
  $langextra = '';
444
  $dummy_receiver->firstname ='Mail Tester';
445
- if(defined('WPLANG') && WPLANG) $langextra ='&lang='.WPLANG;
 
 
446
  $resultarray['urlredirect']='http://www.mail-tester.com/check.php?id='.urlencode($dummy_receiver->email).$langextra;
447
  }
448
  $receivers[$key] = $dummy_receiver;
@@ -474,7 +485,7 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control{
474
 
475
  if(isset($email_child['params']['autonl']['articles']['count'])) $item_count = (int)$email_child['params']['autonl']['articles']['count'];
476
  if(isset($email_child['params']['autonl']['articles']['first_subject'])) $first_subject = $email_child['params']['autonl']['articles']['first_subject'];
477
- if(isset($email_clone['params']['autonl']['total_child'])) $total_count = (int)$email_clone['params']['autonl']['total_child'] + 1;
478
 
479
  if(empty($first_subject)) {
480
  $this->error(__('There are no articles to be sent in this email.',WYSIJA),1);
@@ -488,6 +499,11 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control{
488
 
489
  $successmsg = __('Your email preview has been sent to %1$s', WYSIJA);
490
 
 
 
 
 
 
491
  if(isset($email_object->params)) {
492
  $params['params']=$email_object->params;
493
 
@@ -686,9 +702,9 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control{
686
 
687
  $request='http://api.wysija.com/download/zip/'.$_REQUEST['theme_id'].'?domain='.$domain_name;
688
 
689
- $ZipfileResult = $httpHelp->request($request);
690
 
691
- if(!$ZipfileResult){
692
  $result=false;
693
  $this->error(__('We were unable to contact the API, the site may be down. Please try again later.',WYSIJA),true);
694
  }else{
7
  parent::WYSIJA_control();
8
  }
9
 
10
+ function save_poll(){
11
+ $model_config = WYSIJA::get('config','model');
12
+ $model_config->save(array('poll_origin' => $_REQUEST['how'] , 'poll_origin_url' => $_REQUEST['where']));
13
+
14
+ $res['result'] = true;
15
+ $res['msg'] = '<span><span class="checkmark">---</span>'. __('Thanks!',WYSIJA). '</span>';
16
+ return $res;
17
+ }
18
+
19
  function switch_theme() {
20
  if(isset($_POST['wysijaData'])) {
21
  $rawData = $_POST['wysijaData'];
445
  $dummy_receiver->user_id = 0;
446
  $dummy_receiver->email = $receiver;
447
  $dummy_receiver->status = 1;
448
+ $dummy_receiver->lastname = $dummy_receiver->firstname = '';
449
  }
450
+
451
  if($spamtest){
452
  $langextra = '';
453
  $dummy_receiver->firstname ='Mail Tester';
454
+
455
+ $wp_lang = get_locale();
456
+ if(!empty($wp_lang)) $langextra ='&lang='.$wp_lang;
457
  $resultarray['urlredirect']='http://www.mail-tester.com/check.php?id='.urlencode($dummy_receiver->email).$langextra;
458
  }
459
  $receivers[$key] = $dummy_receiver;
485
 
486
  if(isset($email_child['params']['autonl']['articles']['count'])) $item_count = (int)$email_child['params']['autonl']['articles']['count'];
487
  if(isset($email_child['params']['autonl']['articles']['first_subject'])) $first_subject = $email_child['params']['autonl']['articles']['first_subject'];
488
+ if(isset($email_child['params']['autonl']['total_child'])) $total_count = (int)$email_child['params']['autonl']['total_child'] + 1;
489
 
490
  if(empty($first_subject)) {
491
  $this->error(__('There are no articles to be sent in this email.',WYSIJA),1);
499
 
500
  $successmsg = __('Your email preview has been sent to %1$s', WYSIJA);
501
 
502
+ // correction added for post notifications with the tag [newsletter:post_title] failing to send
503
+ if(isset($email_object->params['autonl']) && isset($email_child['params']['autonl'])){
504
+ $email_object->params['autonl']=$email_child['params']['autonl'];
505
+ }
506
+
507
  if(isset($email_object->params)) {
508
  $params['params']=$email_object->params;
509
 
702
 
703
  $request='http://api.wysija.com/download/zip/'.$_REQUEST['theme_id'].'?domain='.$domain_name;
704
 
705
+ $ZipfileResult = $httpHelp->wp_request($request);
706
 
707
+ if($ZipfileResult === false){
708
  $result=false;
709
  $this->error(__('We were unable to contact the API, the site may be down. Please try again later.',WYSIJA),true);
710
  }else{
controllers/back.php CHANGED
@@ -249,7 +249,7 @@ class WYSIJA_control_back extends WYSIJA_control{
249
  $action =$datas['actionvar'];
250
  unset($datas['actionvar']);
251
  $this->action=$action;
252
-
253
  if(method_exists($this, $this->action)){
254
  $this->viewShow=$this->action;
255
  $this->$action($datas);
@@ -277,7 +277,7 @@ class WYSIJA_control_back extends WYSIJA_control{
277
  do_action('wysija_remove_action_check_total_subscribers');
278
  do_action('wysija_check_total_subscribers');
279
  }
280
-
281
  /**
282
  * Batch select process
283
  * - Currently, is for subscribers only
@@ -299,70 +299,19 @@ class WYSIJA_control_back extends WYSIJA_control{
299
  //
300
  //select all users which match to $_POST['wysija']['filter'] and create_at <= $_POST['wysija']['user']['timestamp']
301
  // - build query
302
- $this->filters = array();
303
- $config = WYSIJA::get('config','model');
304
- if(!empty($_REQUEST['search'])){
305
- $_REQUEST['wysija']['filter']['search'] = $_REQUEST['search'];
306
- }
307
 
308
- //link_fitler
309
- if (!empty($_REQUEST['wysija']['filter']['link_filter'])){
310
- switch($_REQUEST['wysija']['filter']['link_filter']){
311
- case 'unconfirmed':
312
- $this->filters['equal']['status'] = 0;
313
- break;
314
- case 'unsubscribed':
315
- $this->filters['equal']['status'] = -1;
316
- break;
317
- case 'subscribed':
318
- if($config->getValue('confirm_dbleoptin'))
319
- $this->filters['equal']['status'] = 1;
320
- else
321
- $this->filters['greater_eq']=array('status'=>0);
322
- break;
323
- case 'all':
324
- default:
325
- break;
326
- }
327
- }
328
- //filter_list
329
- $orphaned = $filter_join = false;
330
- if (!empty($_REQUEST['wysija']['filter']['filter_list'])){
331
- if ($_REQUEST['wysija']['filter']['filter_list'] == 'orphaned') {
332
- $this->filters['equal']['list_id'] = null;
333
- $orphaned = true;
334
- } elseif ((int)$_REQUEST['wysija']['filter']['filter_list']>0) {
335
- $this->filters['equal']['list_id'] = (int)$_REQUEST['wysija']['filter']['filter_list'];
336
- $filter_join = true;
337
- } else {
338
- // nothing to do
339
- }
340
- }
341
-
342
- if(!empty($_REQUEST['wysija']['filter']['search'])){
343
- $keyword = trim($_REQUEST['wysija']['filter']['search']);
344
- foreach(array('email','firstname', 'lastname') as $field)
345
- $this->filters['like'][$field] = $keyword;
346
- }
347
 
348
 
349
- //timestamp (max of create_at)
350
- $this->filters['less_eq']['created_at'] = $_REQUEST['wysija']['user']['timestamp'];
351
-
352
- $this->modelObj->noCheck = true; // force to not check column fields, just combine WHERE clause
353
- $this->modelObj->setConditions($this->filters);
354
  $this->_batch_select = array();
355
- $this->_batch_select['where'] = $this->modelObj->makeWhere();
356
- $from = 'FROM [wysija]user A';
357
- if($filter_join)
358
- $from .= ' JOIN [wysija]user_list B ON A.user_id = B.user_id';
359
- elseif($orphaned)
360
- $from .= ' LEFT JOIN [wysija]user_list B ON A.user_id = B.user_id';
361
- $this->_batch_select['from'] = $from;
362
- $this->_batch_select['select'] = 'SELECT DISTINCT A.user_id';
363
-
364
- $this->_batch_select['query'] = $this->_batch_select['select'] . ' ' . $this->_batch_select['from'] . ' ' . $this->_batch_select['where'];
365
-
366
  //Create a temporary table
367
  $temp_table_name = 'user'. time();
368
  $temp_table_create = 'CREATE TEMPORARY TABLE '.$temp_table_name . ' (user_id int (10) NOT NULL, PRIMARY KEY (user_id)) ENGINE=MyISAM';
@@ -370,15 +319,15 @@ class WYSIJA_control_back extends WYSIJA_control{
370
  $model_user = WYSIJA::get('user','model');
371
  $model_user->query($temp_table_create);
372
  $model_user->query($temp_table_insert);
373
-
374
  //Override the queres with temporary table
375
  unset($this->_batch_select['where']);
376
- $row_count = $model_user->query('get_row', 'SELECT ROW_COUNT() as row_count');
377
  $this->_batch_select['original_query'] = $this->_batch_select['query']; // useful for export feature; in this case, we don't use temporary table
378
  $this->_batch_select['select'] = 'SELECT DISTINCT user_id';
379
  $this->_batch_select['from'] = 'FROM '.$temp_table_name . ' A';
380
  $this->_batch_select['query'] = 'SELECT user_id FROM '.$temp_table_name;
381
- $this->_batch_select['count'] = $row_count['row_count'];
382
  return true;
383
  }
384
 
@@ -388,16 +337,19 @@ class WYSIJA_control_back extends WYSIJA_control{
388
 
389
  $config=WYSIJA::get('config','model');
390
  $totalSubscribers=$config->getValue('total_subscribers');
391
-
 
392
  if((int)$totalSubscribers>1900){
393
  if((int)$totalSubscribers>2000){
 
394
  $this->error(str_replace(array('[link]','[/link]'),
395
- array('<a title="'.__('Get Premium now',WYSIJA).'" class="premium-tab" href="javascript:;">','</a>'),
396
  sprintf(__('Yikes. You\'re over the limit of 2000 subscribers for the free version of Wysija (%1$s in total). Sending is disabled now. Please upgrade your version to [link]premium[/link] to send without limits.',WYSIJA)
397
  ,$totalSubscribers)),true);
398
  }else{
 
399
  $this->notice(str_replace(array('[link]','[/link]'),
400
- array('<a title="'.__('Get Premium now',WYSIJA).'" class="premium-tab" href="javascript:;">','</a>'),
401
  sprintf(__('Yikes! You\'re near the limit of %1$s subscribers for Wysija\'s free version. Upgrade to [link]Premium[/link] to send without limits, and more.',WYSIJA)
402
  ,"2000")));
403
  }
249
  $action =$datas['actionvar'];
250
  unset($datas['actionvar']);
251
  $this->action=$action;
252
+
253
  if(method_exists($this, $this->action)){
254
  $this->viewShow=$this->action;
255
  $this->$action($datas);
277
  do_action('wysija_remove_action_check_total_subscribers');
278
  do_action('wysija_check_total_subscribers');
279
  }
280
+
281
  /**
282
  * Batch select process
283
  * - Currently, is for subscribers only
299
  //
300
  //select all users which match to $_POST['wysija']['filter'] and create_at <= $_POST['wysija']['user']['timestamp']
301
  // - build query
 
 
 
 
 
302
 
303
+ $select = array( '[wysija]user.user_id');
304
+
305
+ // filters for unsubscribed
306
+ $filters = $this->modelObj->detect_filters();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
 
308
 
 
 
 
 
 
309
  $this->_batch_select = array();
310
+
311
+
312
+ $this->_batch_select['query'] = $this->modelObj->get_subscribers( $select, $filters, '', true );
313
+ $this->_batch_select['query_count'] = $this->modelObj->get_subscribers( array( 'COUNT(DISTINCT([wysija]user.user_id))'), $filters, '', true );
314
+
 
 
 
 
 
 
315
  //Create a temporary table
316
  $temp_table_name = 'user'. time();
317
  $temp_table_create = 'CREATE TEMPORARY TABLE '.$temp_table_name . ' (user_id int (10) NOT NULL, PRIMARY KEY (user_id)) ENGINE=MyISAM';
319
  $model_user = WYSIJA::get('user','model');
320
  $model_user->query($temp_table_create);
321
  $model_user->query($temp_table_insert);
322
+
323
  //Override the queres with temporary table
324
  unset($this->_batch_select['where']);
325
+ $row_count = $model_user->query('get_row', 'SELECT ROW_COUNT() as row_count');
326
  $this->_batch_select['original_query'] = $this->_batch_select['query']; // useful for export feature; in this case, we don't use temporary table
327
  $this->_batch_select['select'] = 'SELECT DISTINCT user_id';
328
  $this->_batch_select['from'] = 'FROM '.$temp_table_name . ' A';
329
  $this->_batch_select['query'] = 'SELECT user_id FROM '.$temp_table_name;
330
+ $this->_batch_select['count'] = $row_count['row_count'];
331
  return true;
332
  }
333
 
337
 
338
  $config=WYSIJA::get('config','model');
339
  $totalSubscribers=$config->getValue('total_subscribers');
340
+ $helper_licence = WYSIJA::get('licence','helper');
341
+
342
  if((int)$totalSubscribers>1900){
343
  if((int)$totalSubscribers>2000){
344
+ $url_checkout = $helper_licence->get_url_checkout('over200');
345
  $this->error(str_replace(array('[link]','[/link]'),
346
+ array('<a title="'.__('Get Premium now',WYSIJA).'" target="_blank" href="'.$url_checkout.'">','</a>'),
347
  sprintf(__('Yikes. You\'re over the limit of 2000 subscribers for the free version of Wysija (%1$s in total). Sending is disabled now. Please upgrade your version to [link]premium[/link] to send without limits.',WYSIJA)
348
  ,$totalSubscribers)),true);
349
  }else{
350
+ $url_checkout = $helper_licence->get_url_checkout('near200');
351
  $this->notice(str_replace(array('[link]','[/link]'),
352
+ array('<a title="'.__('Get Premium now',WYSIJA).'" target="_blank" href="'.$url_checkout.'">','</a>'),
353
  sprintf(__('Yikes! You\'re near the limit of %1$s subscribers for Wysija\'s free version. Upgrade to [link]Premium[/link] to send without limits, and more.',WYSIJA)
354
  ,"2000")));
355
  }
controllers/back/campaigns.php CHANGED
@@ -23,18 +23,18 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
23
  function welcome_new(){
24
  $this->title=$this->viewObj->title=__('Welcome Page!',WYSIJA);
25
  $this->jsTrans['instalwjp']=__('Installing Wysija Newsletter Premium plugin',WYSIJA);
26
- $hReadme=WYSIJA::get('readme','helper');
27
- $hReadme->scan();
28
  $this->data=array();
29
- $this->data['abouttext']=__('A Brand New Wysija. Let the Fun Begin.',WYSIJA);
30
 
31
- $mConfig=WYSIJA::get('config','model');
32
  $is_multisite=is_multisite();
33
  $is_network_admin=WYSIJA::current_user_can('manage_network');
34
  if($is_multisite && $is_network_admin){
35
- $mConfig->save(array('ms_wysija_whats_new'=>WYSIJA::get_version()));
36
  }else{
37
- $mConfig->save(array('wysija_whats_new'=>WYSIJA::get_version()));
38
  }
39
 
40
  //add a new language code with a new video
@@ -44,12 +44,39 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
44
  $video_language['sv_SE']='http://www.youtube.com/embed/O8_t_dekx74';
45
  $video_language['ar']='http://www.youtube.com/embed/cyDHlX_qgOo';
46
 
47
- if(defined('WPLANG') && WPLANG!='' && isset($video_language[WPLANG])){
48
- $welcome_video_link=$video_language[WPLANG];
 
49
  }else{
50
- $welcome_video_link=$video_language['en_EN'];
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  $this->data['sections'][]=array(
54
  'title'=>__('First Time? See it in Action',WYSIJA),
55
  'format'=>'normal',
@@ -65,22 +92,22 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
65
  array(
66
  'title'=>__('5 minute newbie guide',WYSIJA),
67
  'content'=>__('Your Wysija comes with an example newsletter. You\'ll see it when you close this welcome page. Edit it to start playing with it.',WYSIJA)
68
- ),
69
  array(
70
  'title'=>__('Share your data',WYSIJA),
71
  'content'=> str_replace(
72
  array('[link]', '[/link]', '[ajaxlink]', '[/ajaxlink]'),
73
  array('<a title="Anonymous Data" target="_blank" href="http://support.wysija.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=welcome_page">', '</a>', '<a id="share_analytics" href="javascript:;">', '</a>'),
74
  __("We know too little about our users. We're looking for [link]anonymous data[/link] to build a better plugin. [ajaxlink]Yes, count me in![/ajaxlink]",WYSIJA))
75
- ),
76
  array(
77
  'title'=>__('Help yourself. Or let us help you.',WYSIJA),
78
  'content'=> str_replace(
79
  array('[link]','[/link]'),
80
  array('<a href="http://support.wysija.com/" target="_blank" title="On our blog!">','</a>'),
81
  __('We got documentation and a ticket system on [link]support.wysija.com[/link]. We answer within 24h.',WYSIJA))
82
- )
83
- ),
84
  'format'=>'three-col',
85
  );
86
 
@@ -100,16 +127,6 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
100
  return true;
101
  }
102
 
103
- /**
104
- * Sometimes our users have a bug where not all of the users from their list are showing up when sending, this is the action to call to fix it
105
- * this is very rare.
106
- */
107
- function fix_lists(){
108
- $hUpdate=WYSIJA::get('update','helper');
109
- $hUpdate->customerRequestMissingSubscriber();
110
- exit;
111
- }
112
-
113
 
114
  /**
115
  * Welcome page for updaters
@@ -123,6 +140,8 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
123
  $helper_readme->scan();
124
  $this->data=array();
125
  $this->data['abouttext']=__('You updated! It\'s like having the next gadget, but better.',WYSIJA);
 
 
126
 
127
  $is_multisite=is_multisite();
128
  $is_network_admin=WYSIJA::current_user_can('manage_network');
@@ -138,6 +157,8 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
138
 
139
 
140
  $major_release=true;
 
 
141
  $except_version=array('2.4.1', '2.4.2');
142
  $wysija_version=WYSIJA::get_version();
143
  if(!in_array($wysija_version,$except_version) && count(explode('.', $wysija_version))>2) $major_release=false;
@@ -189,73 +210,82 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
189
  ),
190
  'format'=>'three-col',
191
  );
192
- }else{
193
- // list of polls from poll daddy
194
- $polls=array();
195
- $polls[7177099]=__('Where do you send your newsletters?', WYSIJA);
196
- $polls[7199642]=__('How many users on this site create and send newsletters?', WYSIJA);
197
- $polls[7199625]=__('You\'re installing this plugin for...', WYSIJA);
198
- $polls[7196766]=__('How would you feel if you could no longer use us?', WYSIJA);
199
- $polls[7196752]=__('Pick one improvement which is an absolute must', WYSIJA);
200
- $polls[7196784]=__('If our Premium was sold as a monthly payment, instead of a yearly payment, would you consider purchasing it?', WYSIJA);
201
- $polls[7196911]=__('On how many sites have you installed our plugin in the last year?', WYSIJA);
202
- $polls[7196646]=__('How many WordPress sites do you create every year?', WYSIJA);
203
- $polls[7196742]=__('When you installed our plugin, it was to...', WYSIJA);
204
- $polls[7196756]=__('How did you find out about Wysija?', WYSIJA);
205
- $polls[7196770]=__('How much money did you spend on Premium themes or plugins in the past year?', WYSIJA);
206
- $polls[7196783]=__('What other emailing solutions do you use?', WYSIJA);
207
- $polls[7196798]=__('What\'s the most annoying thing with our current version?', WYSIJA);
208
- $polls[7196805]=__('Have you had problems with your newsletters being marked as spam?', WYSIJA);
209
-
210
- // get the list of polls with the number of views for each
211
- $polls_views=get_option('wysija_polls_views');
212
- if(empty($polls_views)){
213
- $polls_views=array();
214
- // this one has been the first poll we've used so we consider that everyone viewed it already once
215
- $polls_views[7177099]=1;
216
- }
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
- // make sure that we record each poll
220
- foreach($polls as $poll_id => $poll_title){
221
- if(!isset($polls_views[$poll_id])) $polls_views[$poll_id]=0;
222
- }
223
 
224
- // group polls by total view
225
- $polls_grouped_by_total_view = array();
226
- foreach($polls_views as $pollid =>$views){
227
- $polls_grouped_by_total_view[$views][]=$pollid;
228
- }
229
- // order them
230
- ksort($polls_grouped_by_total_view);
231
 
232
- // get the series of polls that has been viewed the least
233
- $polls_with_least_views = array_shift($polls_grouped_by_total_view);
 
 
 
 
 
234
 
235
- // pull one poll out of that array
236
- $random_key = array_rand($polls_with_least_views);
237
- $poll_id_selected = $polls_with_least_views[$random_key];
238
- $polls_views[$poll_id_selected]++;
239
 
240
- WYSIJA::update_option('wysija_polls_views', $polls_views);
 
 
 
241
 
242
- $this->data['polls'][$poll_id_selected]= $polls[$poll_id_selected];
243
- // poll
244
- $this->data['sections'][] = array(
245
- 'title' => __('A new poll to get to know you better', WYSIJA),
246
- 'type' => 'poll'
247
- );
 
 
 
248
  }
249
 
250
  $msg=$model_config->getValue('ignore_msgs');
251
- if(!isset($msg['ctaupdate'])){
252
  $this->data['sections'][]=array(
253
  'title'=>__('Keep this plugin essentially free',WYSIJA),
254
  'review'=>array(
255
  'title'=>'1. '.__('Love kittens?',WYSIJA).' '.__('We love stars...',WYSIJA),
256
  'content'=>str_replace(
257
  array('[link]','[/link]'),
258
- array('<a href="http://wordpress.org/support/view/plugin-reviews/wysija-newsletters" target="_blank" title="On wordpress.org">','</a>'),
259
  __('Each time one of our users forgets to write a review, a kitten dies. It\'s sad and breaks our hearts. [link]Add your own review[/link] and save a kitten today.',WYSIJA))
260
 
261
 
@@ -364,10 +394,11 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
364
  $helper_bounce->record_bounce_ms();
365
 
366
  // then we take actions from what has been returned by the bounce
367
- return $helper_bounce->process_bounce_ms();
368
  }else{
369
- return $helper_bounce->process_bounce();
370
  }
 
371
  }
372
 
373
  function add($dataPost=false){
@@ -712,17 +743,16 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
712
  }
713
 
714
  function immediateWarning(){
715
- $mConfig=WYSIJA::get('config','model');
716
-
717
- $is_multisite=is_multisite();
718
 
719
  //$is_multisite=true;//PROD comment that line
720
- if($is_multisite && $mConfig->getValue('sending_method')=='network'){
721
- $sending_emails_each=$mConfig->getValue('ms_sending_emails_each');
722
- $number=$mConfig->getValue('ms_sending_emails_number');
723
  }else{
724
- $sending_emails_each=$mConfig->getValue('sending_emails_each');
725
- $number=$mConfig->getValue('sending_emails_number');
726
  }
727
 
728
  $formsHelp=WYSIJA::get('forms','helper');
@@ -1383,16 +1413,12 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
1383
  $this->jsTrans['processqueue']=__('Sending batch of emails...',WYSIJA);
1384
  $this->jsTrans['viewnews']=__('View newsletter',WYSIJA);
1385
  $this->jsTrans['confirmpauseedit']=__('The newsletter will be deactivated, you will need to reactivate it once you\'re over editing it. Do you want to proceed?',WYSIJA);
1386
- //make sure that there is no late scheduled or automatic newsletter
1387
- $autoNL=WYSIJA::get('autonews','helper');
1388
- $autoNL->checkPostNotif();
1389
- $autoNL->checkScheduled();
1390
- $config=WYSIJA::get('config','model');
1391
  //get the filters
1392
  if(isset($_REQUEST['search']) && $_REQUEST['search']){
1393
- $this->filters["like"]=array();
1394
  foreach($this->searchable as $field)
1395
- $this->filters["like"][$field]=$_REQUEST['search'];
1396
  }
1397
 
1398
  if(isset($_REQUEST['filter-list']) && $_REQUEST['filter-list']){
@@ -1400,10 +1426,13 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
1400
  }
1401
 
1402
  if(isset($_REQUEST['filter-date']) && $_REQUEST['filter-date']){
1403
- $this->filters["greater_eq"]=array('created_at'=>$_REQUEST['filter-date']);
1404
- $this->filters["less_eq"]=array('created_at'=>strtotime("+1 month",$_REQUEST['filter-date']));
1405
  }
1406
 
 
 
 
1407
  if(isset($_REQUEST['link_filter']) && $_REQUEST['link_filter']){
1408
  $linkfilters=explode('-',$_REQUEST['link_filter']);
1409
 
@@ -1412,7 +1441,6 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
1412
  }else{
1413
  $this->_addLinkFilter($_REQUEST['link_filter']);
1414
  }
1415
-
1416
  }
1417
 
1418
  $this->modelObj->noCheck=true;
@@ -2212,9 +2240,10 @@ class WYSIJA_control_back_campaigns extends WYSIJA_control_back{
2212
  else $this->jsTrans['ispremium']=0;
2213
 
2214
  $this->jsTrans['premiumfiles']=__('Photoshop file available as part of [link]Premium features[/link].',WYSIJA);
2215
- $helper_licence=WYSIJA::get('licence','helper');
2216
 
2217
- $this->jsTrans['premiumfiles']=str_replace(array('[link]','[/link]'),array('<a class="premium-tab ispopup" href="javascript:;" >','</a>'),$this->jsTrans['premiumfiles']);
 
 
2218
 
2219
  $this->jsTrans['showallthemes']=__('Show all themes',WYSIJA);
2220
  $this->jsTrans['totalvotes']=__('(%1$s votes)',WYSIJA);
23
  function welcome_new(){
24
  $this->title=$this->viewObj->title=__('Welcome Page!',WYSIJA);
25
  $this->jsTrans['instalwjp']=__('Installing Wysija Newsletter Premium plugin',WYSIJA);
26
+ $helper_readme=WYSIJA::get('readme','helper');
27
+ $helper_readme->scan();
28
  $this->data=array();
29
+ $this->data['abouttext'] = __('A Brand New Wysija. Let the Fun Begin.',WYSIJA);
30
 
31
+ $model_config=WYSIJA::get('config','model');
32
  $is_multisite=is_multisite();
33
  $is_network_admin=WYSIJA::current_user_can('manage_network');
34
  if($is_multisite && $is_network_admin){
35
+ $model_config->save(array('ms_wysija_whats_new'=>WYSIJA::get_version()));
36
  }else{
37
+ $model_config->save(array('wysija_whats_new'=>WYSIJA::get_version()));
38
  }
39
 
40
  //add a new language code with a new video
44
  $video_language['sv_SE']='http://www.youtube.com/embed/O8_t_dekx74';
45
  $video_language['ar']='http://www.youtube.com/embed/cyDHlX_qgOo';
46
 
47
+ $wp_lang = get_locale();
48
+ if(!empty($wp_lang) && isset($video_language[$wp_lang])){
49
+ $welcome_video_link = $video_language[$wp_lang];
50
  }else{
51
+ $welcome_video_link = $video_language['en_EN'];
52
  }
53
 
54
+ $this->data['sections'][]=array(
55
+ 'title'=>__('Hey, we\'re curious! How did you find out about us?',WYSIJA).'<span id="poll_result"></span>',
56
+ 'format'=>'normal',
57
+ 'paragraphs'=>array(
58
+ '<ul class="welcome_poll">
59
+ <li>
60
+ <input type="radio" id="how_did_you_find_us_1" value="repository" name="how_did_you_find_us">
61
+ <label value="lab1" for="how_did_you_find_us_1">'.__('WordPress.org plugin repository',WYSIJA).'</label>
62
+ </li>
63
+ <li>
64
+ <input type="radio" id="how_did_you_find_us_2" value="search_engine" name="how_did_you_find_us">
65
+ <label value="lab2" for="how_did_you_find_us_2">'.__('Google or other search engine',WYSIJA).'</label>
66
+ </li>
67
+ <li>
68
+ <input type="radio" id="how_did_you_find_us_3" value="friend" name="how_did_you_find_us">
69
+ <label value="lab3" for="how_did_you_find_us_3">'.__('Friend recommendation',WYSIJA).'</label>
70
+ </li>
71
+ <li>
72
+ <input type="radio" id="how_did_you_find_us_4" value="url" name="how_did_you_find_us">
73
+ <label value="lab4" for="how_did_you_find_us_4">'.__('Blog post, online review, forum:',WYSIJA).'</label>
74
+ <input type="text" id="how_did_you_find_us_4_url" name="how_did_you_find_us_url" placeholder="'.__('Please enter the address where you\'ve found out about us',WYSIJA).'">
75
+ </li>
76
+ </ul>'
77
+ )
78
+ );
79
+
80
  $this->data['sections'][]=array(
81
  'title'=>__('First Time? See it in Action',WYSIJA),
82
  'format'=>'normal',
92
  array(
93
  'title'=>__('5 minute newbie guide',WYSIJA),
94
  'content'=>__('Your Wysija comes with an example newsletter. You\'ll see it when you close this welcome page. Edit it to start playing with it.',WYSIJA)
95
+ ),
96
  array(
97
  'title'=>__('Share your data',WYSIJA),
98
  'content'=> str_replace(
99
  array('[link]', '[/link]', '[ajaxlink]', '[/ajaxlink]'),
100
  array('<a title="Anonymous Data" target="_blank" href="http://support.wysija.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=welcome_page">', '</a>', '<a id="share_analytics" href="javascript:;">', '</a>'),
101
  __("We know too little about our users. We're looking for [link]anonymous data[/link] to build a better plugin. [ajaxlink]Yes, count me in![/ajaxlink]",WYSIJA))
102
+ ),
103
  array(
104
  'title'=>__('Help yourself. Or let us help you.',WYSIJA),
105
  'content'=> str_replace(
106
  array('[link]','[/link]'),
107
  array('<a href="http://support.wysija.com/" target="_blank" title="On our blog!">','</a>'),
108
  __('We got documentation and a ticket system on [link]support.wysija.com[/link]. We answer within 24h.',WYSIJA))
109
+ )
110
+ ),
111
  'format'=>'three-col',
112
  );
113
 
127
  return true;
128
  }
129
 
 
 
 
 
 
 
 
 
 
 
130
 
131
  /**
132
  * Welcome page for updaters
140
  $helper_readme->scan();
141
  $this->data=array();
142
  $this->data['abouttext']=__('You updated! It\'s like having the next gadget, but better.',WYSIJA);
143
+ // this is a flag to have a pretty clean update page where teh only call to action is our survey
144
+ $show_survey=false;
145
 
146
  $is_multisite=is_multisite();
147
  $is_network_admin=WYSIJA::current_user_can('manage_network');
157
 
158
 
159
  $major_release=true;
160
+
161
+ // those are point release exceptions for which we were advertising the features. we probably can remove that now
162
  $except_version=array('2.4.1', '2.4.2');
163
  $wysija_version=WYSIJA::get_version();
164
  if(!in_array($wysija_version,$except_version) && count(explode('.', $wysija_version))>2) $major_release=false;
210
  ),
211
  'format'=>'three-col',
212
  );
213
+ }elseif($show_no_survey_or_poll = false){ //turn that into a simple else when you want to use the survey or polls again
214
+ $show_survey=true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
 
216
+ if($show_survey){
217
+ $this->data['sections'][] = array(
218
+ 'title' => __('4 min survey to better understand what you need',WYSIJA),
219
+ 'type' => 'survey'
220
+ );
221
+ }else{ // this is the part about the survey
222
+ // list of polls from poll daddy
223
+ $polls=array();
224
+ $polls[7177099]=__('Where do you send your newsletters?', WYSIJA);
225
+ $polls[7199642]=__('How many users on this site create and send newsletters?', WYSIJA);
226
+ $polls[7199625]=__('You\'re installing this plugin for...', WYSIJA);
227
+ $polls[7196766]=__('How would you feel if you could no longer use us?', WYSIJA);
228
+ $polls[7196752]=__('Pick one improvement which is an absolute must', WYSIJA);
229
+ $polls[7196784]=__('If our Premium was sold as a monthly payment, instead of a yearly payment, would you consider purchasing it?', WYSIJA);
230
+ $polls[7196911]=__('On how many sites have you installed our plugin in the last year?', WYSIJA);
231
+ $polls[7196646]=__('How many WordPress sites do you create every year?', WYSIJA);
232
+ $polls[7196742]=__('When you installed our plugin, it was to...', WYSIJA);
233
+ $polls[7196756]=__('How did you find out about Wysija?', WYSIJA);
234
+ $polls[7196770]=__('How much money did you spend on Premium themes or plugins in the past year?', WYSIJA);
235
+ $polls[7196783]=__('What other emailing solutions do you use?', WYSIJA);
236
+ $polls[7196798]=__('What\'s the most annoying thing with our current version?', WYSIJA);
237
+ $polls[7196805]=__('Have you had problems with your newsletters being marked as spam?', WYSIJA);
238
+
239
+ // get the list of polls with the number of views for each
240
+ $polls_views=get_option('wysija_polls_views');
241
+ if(empty($polls_views)){
242
+ $polls_views=array();
243
+ // this one has been the first poll we've used so we consider that everyone viewed it already once
244
+ $polls_views[7177099]=1;
245
+ }
246
 
 
 
 
 
247
 
248
+ // make sure that we record each poll
249
+ foreach($polls as $poll_id => $poll_title){
250
+ if(!isset($polls_views[$poll_id])) $polls_views[$poll_id]=0;
251
+ }
 
 
 
252
 
253
+ // group polls by total view
254
+ $polls_grouped_by_total_view = array();
255
+ foreach($polls_views as $pollid =>$views){
256
+ $polls_grouped_by_total_view[$views][]=$pollid;
257
+ }
258
+ // order them
259
+ ksort($polls_grouped_by_total_view);
260
 
261
+ // get the series of polls that has been viewed the least
262
+ $polls_with_least_views = array_shift($polls_grouped_by_total_view);
 
 
263
 
264
+ // pull one poll out of that array
265
+ $random_key = array_rand($polls_with_least_views);
266
+ $poll_id_selected = $polls_with_least_views[$random_key];
267
+ $polls_views[$poll_id_selected]++;
268
 
269
+ WYSIJA::update_option('wysija_polls_views', $polls_views);
270
+
271
+ $this->data['polls'][$poll_id_selected]= $polls[$poll_id_selected];
272
+ // poll
273
+ $this->data['sections'][] = array(
274
+ 'title' => __('A new poll to get to know you better', WYSIJA),
275
+ 'type' => 'poll'
276
+ );
277
+ }
278
  }
279
 
280
  $msg=$model_config->getValue('ignore_msgs');
281
+ if(!isset($msg['ctaupdate']) && !$show_survey){
282
  $this->data['sections'][]=array(
283
  'title'=>__('Keep this plugin essentially free',WYSIJA),
284
  'review'=>array(
285
  'title'=>'1. '.__('Love kittens?',WYSIJA).' '.__('We love stars...',WYSIJA),
286
  'content'=>str_replace(
287
  array('[link]','[/link]'),
288
+ array('<a href="http://goo.gl/D52CBL" target="_blank" title="On wordpress.org">','</a>'),
289
  __('Each time one of our users forgets to write a review, a kitten dies. It\'s sad and breaks our hearts. [link]Add your own review[/link] and save a kitten today.',WYSIJA))
290
 
291
 
394
  $helper_bounce->record_bounce_ms();
395
 
396
  // then we take actions from what has been returned by the bounce
397
+ $helper_bounce->process_bounce_ms();
398
  }else{
399
+ $helper_bounce->process_bounce();
400
  }
401
+ exit;
402
  }
403
 
404
  function add($dataPost=false){
743
  }
744
 
745
  function immediateWarning(){
746
+ $model_config = WYSIJA::get('config','model');
747
+ $is_multisite = is_multisite();
 
748
 
749
  //$is_multisite=true;//PROD comment that line
750
+ if($is_multisite && $model_config->getValue('sending_method') == 'network'){
751
+ $sending_emails_each = $model_config->getValue('ms_sending_emails_each');
752
+ $number = $model_config->getValue('ms_sending_emails_number');
753
  }else{
754
+ $sending_emails_each = $model_config->getValue('sending_emails_each');
755
+ $number = $model_config->getValue('sending_emails_number');
756
  }
757
 
758
  $formsHelp=WYSIJA::get('forms','helper');
1413
  $this->jsTrans['processqueue']=__('Sending batch of emails...',WYSIJA);
1414
  $this->jsTrans['viewnews']=__('View newsletter',WYSIJA);
1415
  $this->jsTrans['confirmpauseedit']=__('The newsletter will be deactivated, you will need to reactivate it once you\'re over editing it. Do you want to proceed?',WYSIJA);
1416
+
 
 
 
 
1417
  //get the filters
1418
  if(isset($_REQUEST['search']) && $_REQUEST['search']){
1419
+ $this->filters['like']=array();
1420
  foreach($this->searchable as $field)
1421
+ $this->filters['like'][$field]=$_REQUEST['search'];
1422
  }
1423
 
1424
  if(isset($_REQUEST['filter-list']) && $_REQUEST['filter-list']){
1426
  }
1427
 
1428
  if(isset($_REQUEST['filter-date']) && $_REQUEST['filter-date']){
1429
+ $this->filters['greater_eq']=array('created_at'=>$_REQUEST['filter-date']);
1430
+ $this->filters['less_eq']=array('created_at'=>strtotime('+1 month',$_REQUEST['filter-date']));
1431
  }
1432
 
1433
+ $this->filters['is'] = array('type'=>'IS NOT NULL');
1434
+
1435
+
1436
  if(isset($_REQUEST['link_filter']) && $_REQUEST['link_filter']){
1437
  $linkfilters=explode('-',$_REQUEST['link_filter']);
1438
 
1441
  }else{
1442
  $this->_addLinkFilter($_REQUEST['link_filter']);
1443
  }
 
1444
  }
1445
 
1446
  $this->modelObj->noCheck=true;
2240
  else $this->jsTrans['ispremium']=0;
2241
 
2242
  $this->jsTrans['premiumfiles']=__('Photoshop file available as part of [link]Premium features[/link].',WYSIJA);
 
2243
 
2244
+ $helper_licence = WYSIJA::get('licence','helper');
2245
+ $url_checkout = $helper_licence->get_url_checkout('themes');
2246
+ $this->jsTrans['premiumfiles']=str_replace(array('[link]','[/link]'),array('<a href="'.$url_checkout.'" target="_blank" >','</a>'),$this->jsTrans['premiumfiles']);
2247
 
2248
  $this->jsTrans['showallthemes']=__('Show all themes',WYSIJA);
2249
  $this->jsTrans['totalvotes']=__('(%1$s votes)',WYSIJA);
controllers/back/config.php CHANGED
@@ -1,379 +1,379 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
- class WYSIJA_control_back_config extends WYSIJA_control_back{
4
- var $view='config';
5
- var $model='config';
6
-
7
- function WYSIJA_control_back_config(){
8
-
9
- }
10
-
11
- function main() {
12
- parent::WYSIJA_control_back();
13
- wp_enqueue_style('thickbox');
14
-
15
- if(!isset($_REQUEST['action'])) $this->action='main';
16
- else $this->action=$_REQUEST['action'];
17
-
18
- $this->jsTrans['testemail'] = __('Sending a test email', WYSIJA);
19
- $this->jsTrans['bounceconnect'] = __('Bounce handling connection test', WYSIJA);
20
- $this->jsTrans['processbounceT'] = __('Bounce handling processing', WYSIJA);
21
- $this->jsTrans['doubleoptinon'] = __('Subscribers will now need to activate their subscription by email in order to receive your newsletters. This is recommended.', WYSIJA);
22
- $this->jsTrans['doubleoptinoff'] = __('Unconfirmed subscribers will receive your newslettters from now on without the need to activate their subscriptions.', WYSIJA);
23
- $this->jsTrans['processbounce'] = __('Process bounce handling now!', WYSIJA);
24
- $this->jsTrans['errorbounceforward'] = __('When setting up the bounce system, you need to have a different address for the bounce email and the forward to address', WYSIJA);
25
-
26
- // form list
27
- $this->jsTrans['suredelete'] = __('Are you sure you want to delete this form?', WYSIJA);
28
-
29
- switch($this->action) {
30
- case 'log':
31
- case 'save':
32
- case 'clearlog':
33
- wp_enqueue_script('wysija-config-settings', WYSIJA_URL.'js/admin-config-settings.js', array('wysija-admin-js-global'), WYSIJA::get_version());
34
- case 'form_add':
35
- case 'form_edit':
36
- case 'form_duplicate':
37
- case 'form_delete':
38
- case 'form_widget_settings':
39
- return $this->{$this->action}();
40
- break;
41
- case 'reinstall':
42
- $this->reinstall();
43
- return;
44
- break;
45
- case 'dkimcheck':
46
- $this->dkimcheck();
47
- if(defined('WYSIJA_REDIRECT')) $this->redirectProcess();
48
- return;
49
- break;
50
- case 'doreinstall':
51
- $this->doreinstall();
52
- if(defined('WYSIJA_REDIRECT')){
53
- global $wysi_location;
54
- $wysi_location='admin.php?page=wysija_campaigns';
55
- $this->redirectProcess();
56
- }
57
- return;
58
- break;
59
- default:
60
- wp_enqueue_script('wysija-config-settings', WYSIJA_URL.'js/admin-config-settings.js', array('wysija-admin-js-global'), WYSIJA::get_version());
61
- wp_enqueue_script('jquery-cookie', WYSIJA_URL.'js/jquery/jquery.cookie.js', array('jquery'), WYSIJA::get_version());
62
- }
63
-
64
- if(WYSIJA_DBG > 1) {
65
- $this->viewObj->arrayMenus = array('log' => 'View log');
66
- }
67
-
68
- $this->data=array();
69
- $this->action='main';
70
-
71
- if(isset($_REQUEST['validate'])){
72
- $this->notice(str_replace(array('[link]','[/link]'),
73
- array('<a title="'.__('Get Premium now',WYSIJA).'" class="premium-tab" href="javascript:;">','</a>'),
74
- __('You\'re almost there. Click this [link]link[/link] to activate the licence you have just purchased.',WYSIJA)));
75
-
76
- }
77
-
78
- }
79
-
80
- function dkimcheck(){
81
-
82
- if(isset($_POST['xtz'])){
83
-
84
- $dataconf=json_decode(base64_decode($_POST['xtz']));
85
- if(isset($dataconf->dkim_pubk->key) && isset($dataconf->dkim_privk)){
86
- $modelConf=WYSIJA::get('config','model');
87
- $dataconfsave=array('dkim_pubk'=>$dataconf->dkim_pubk->key, 'dkim_privk'=>$dataconf->dkim_privk,'dkim_1024'=>1);
88
-
89
- $modelConf->save($dataconfsave);
90
- WYSIJA::update_option('dkim_autosetup',false);
91
- }
92
- }
93
-
94
- $this->redirect('admin.php?page=wysija_config');
95
- return true;
96
- }
97
-
98
- function save(){
99
- $_REQUEST = stripslashes_deep($_REQUEST);
100
- $_POST = stripslashes_deep($_POST);
101
- $this->requireSecurity();
102
- $this->modelObj->save($_REQUEST['wysija']['config'],true);
103
-
104
- //wp_redirect('admin.php?page=wysija_config'.$_REQUEST['redirecttab']);
105
-
106
- }
107
-
108
- function reinstall(){
109
- $this->viewObj->title=__('Reinstall Wysija?',WYSIJA);
110
- return true;
111
- }
112
-
113
- function changeMode(){
114
- $helperFile=WYSIJA::get('file','helper');
115
- $helperFile->chmodr(WYSIJA_UPLOADS_DIR, 0666, 0777);
116
- $this->redirect('admin.php?page=wysija_config');
117
- return true;
118
- }
119
-
120
- function doreinstall(){
121
-
122
- if(isset($_REQUEST['postedfrom']) && $_REQUEST['postedfrom'] === 'reinstall') {
123
- $uninstaller=WYSIJA::get('uninstall','helper');
124
- $uninstaller->reinstall();
125
- }
126
- $this->redirect('admin.php?page=wysija_config');
127
- return true;
128
- }
129
-
130
- function render(){
131
- $this->checkTotalSubscribers();
132
- $this->viewObj->render($this->action,$this->data);
133
- }
134
-
135
- function log(){
136
- $this->viewObj->arrayMenus=array('clearlog'=>'Clear log');
137
- $this->viewObj->title='Wysija\'s log';
138
- return true;
139
- }
140
-
141
- function clearlog(){
142
- update_option('wysija_log', array());
143
- $this->redirect('admin.php?page=wysija_config&action=log');
144
- return true;
145
- }
146
-
147
- // WYSIJA Form Editor
148
- function form_add() {
149
- $helper_form_engine = WYSIJA::get('form_engine', 'helper');
150
- // set default form data
151
- $helper_form_engine->set_data();
152
-
153
- // create form in database with default data
154
- $form = array(
155
- 'name' => __('New Form', WYSIJA),
156
- 'data' => $helper_form_engine->get_encoded('data')
157
- );
158
-
159
- // insert into form table
160
- $model_forms = WYSIJA::get('forms', 'model');
161
- $form_id = $model_forms->insert($form);
162
-
163
- if($form_id !== null && (int)$form_id > 0) {
164
- // redirect to form editor, passing along the newly created form id
165
- //$this->redirect('admin.php?page=wysija_config&action=form_edit&id='.$form_id);
166
- WYSIJA::redirect('admin.php?page=wysija_config&action=form_edit&id='.$form_id);
167
- } else {
168
- WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
169
- }
170
- return true;
171
- }
172
-
173
- function form_duplicate() {
174
-
175
- if(isset($_GET['id']) && (int)$_GET['id'] > 0) {
176
- $form_id = (int)$_GET['id'];
177
-
178
- $model_forms = WYSIJA::get('forms', 'model');
179
-
180
- // get form data
181
- $form = $model_forms->getOne(array('name', 'data', 'styles'), array('form_id' => $form_id));
182
-
183
- if(empty($form)) {
184
- $this->error(__('This form does not exist', WYSIJA), true);
185
- } else {
186
- // reset model forms
187
- $model_forms->reset();
188
-
189
- // add "copy" to the name
190
- $form['name'] = $form['name'].' - '.__('Copy', WYSIJA);
191
-
192
- // insert form (duplicated)
193
- $model_forms->insert($form);
194
-
195
- // display notice
196
- $this->notice(sprintf(__('The form named "%1$s" has been created.', WYSIJA), $form['name']));
197
- }
198
- }
199
-
200
- WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
201
- }
202
-
203
- function form_delete() {
204
-
205
- $this->requireSecurity();
206
-
207
- if(isset($_GET['id']) && (int)$_GET['id'] > 0) {
208
- $form_id = (int)$_GET['id'];
209
-
210
- $model_forms = WYSIJA::get('forms', 'model');
211
-
212
- // get form data
213
- $form = $model_forms->getOne(array('name'), array('form_id' => $form_id));
214
-
215
- if(empty($form)) {
216
- $this->error(__('This form has already been deleted.', WYSIJA), true);
217
- } else {
218
- // delete the form in the database
219
- $model_forms->reset();
220
- $model_forms->delete(array('form_id' => $form_id));
221
-
222
- // display notice
223
- $this->notice(sprintf(__('The form named "%1$s" has been deleted.', WYSIJA), $form['name']));
224
- }
225
- }
226
-
227
- WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
228
- }
229
-
230
- function form_edit() {
231
- // wysija form editor javascript files
232
- $this->js[]='wysija-form-editor';
233
- $this->js[]='wysija-admin-ajax-proto';
234
- $this->js[]='wysija-admin-ajax';
235
- $this->js[]='wysija-base-script-64';
236
-
237
- // make sure the editor content is not cached
238
- //header('Cache-Control: no-cache, max-age=0, must-revalidate, no-store'); // HTTP/1.1
239
- //header('Expires: Fri, 9 Mar 1984 00:00:00 GMT');
240
-
241
- // get form id
242
- $form_id = (isset($_REQUEST['id']) && (int)$_REQUEST['id'] > 0) ? (int)$_REQUEST['id'] : null;
243
- $form = array('name' => __('New form', WYSIJA));
244
-
245
- // if no form id was specified, then it's a new form
246
- if($form_id !== null) {
247
- // try to get form data based on form id
248
- $model_forms = WYSIJA::get('forms', 'model');
249
- $form = $model_forms->getOne($form_id);
250
-
251
- // if the form does not exist
252
- if(empty($form)) {
253
- // redirect to forms list
254
- $this->error(__('This form does not exist.', WYSIJA), true);
255
- WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
256
- } else {
257
- // pass form id to the view
258
- $this->data['form_id'] = (int)$form['form_id'];
259
- }
260
- }
261
- // pass form to the view
262
- $this->data['form'] = $form;
263
-
264
- $helper_form_engine = WYSIJA::get('form_engine', 'helper');
265
- $lists = $helper_form_engine->get_lists();
266
-
267
- // select default list
268
- $default_list = array();
269
- if(!empty($lists)) {
270
- $default_list[] = array(
271
- 'list_id' => $lists[0]['list_id'],
272
- 'is_checked' => 0
273
- );
274
- }
275
-
276
- $this->data['lists'] = $lists;
277
-
278
- // get available custom fields
279
- $model_user_field = WYSIJA::get('user_field', 'model');
280
- $model_user_field->orderBy('field_id');
281
- $custom_fields = $model_user_field->getRows(false);
282
-
283
- // extra widgets that can be added more than once
284
- $extra_fields = array(
285
- array(
286
- 'name' => __('List selection', WYSIJA),
287
- 'column_name' => 'list',
288
- 'column_type' => 'list',
289
- 'params' => array(
290
- 'label' => __('Select list(s):', WYSIJA),
291
- 'values' => $default_list
292
- )
293
- ),
294
- array(
295
- 'name' => __('Random text or HTML', WYSIJA),
296
- 'column_name' => 'html',
297
- 'column_type' => 'html',
298
- 'params' => array(
299
- 'text' => __('Random text or HTML', WYSIJA)
300
- )
301
- ),
302
- array(
303
- 'name' => __('Divider', WYSIJA),
304
- 'column_name' => 'divider',
305
- 'column_type' => 'divider'
306
- )
307
- // array(
308
- // 'name' => __('HTML code', WYSIJA),
309
- // 'column_name' => 'html',
310
- // 'column_type' => 'html',
311
- // 'params' => array(
312
- // 'text' => __('HTML code', WYSIJA)
313
- // )
314
- );
315
-
316
- // set data to be passed to the view
317
- $this->data['custom_fields'] = array_merge($custom_fields, $extra_fields);
318
-
319
- // translations
320
- $this->jsTrans = array_merge($this->jsTrans, $helper_form_engine->get_translations());
321
-
322
- // This should be the title of the page but I don't know how to make it happen...
323
- // __('Edit', WYSIJA).' '.$this->data['form']['name'];
324
- }
325
-
326
- /*
327
- * Handles the settings popup of wysija form widgets
328
- */
329
- function form_widget_settings() {
330
- $this->iframeTabs = array('form_widget_settings' => __('Widget Settings', WYSIJA));
331
- $this->js[] = 'wysija-admin-ajax';
332
- $this->js[] = 'wysija-base-script-64';
333
- $this->js[] = 'wysija-form-widget-settings';
334
-
335
- $_GET['tab'] = 'form_widget_settings';
336
-
337
- // extract parameters from url
338
- $params = array();
339
- foreach(explode('|', $_REQUEST['params']) as $pair) {
340
- // extract both key and value
341
- list($key, $value) = explode(':', $pair);
342
-
343
- // decode value
344
- $value = base64_decode($value);
345
- // unserialize if necessary (using is_serialized from WordPress)
346
- if(is_serialized($value) === true) {
347
- $value = unserialize($value);
348
- }
349
- $params[$key] = $value;
350
- }
351
-
352
- // common widget data
353
- $this->data['name'] = $_REQUEST['name'];
354
- $this->data['type'] = $_REQUEST['type'];
355
- $this->data['field'] = $_REQUEST['field'];
356
-
357
- // widget params
358
- $this->data['params'] = $params;
359
-
360
- // extra data that needs to be fetched for some widget
361
- $extra = array();
362
-
363
- switch($this->data['type']) {
364
- // in case of the list widget, we need to pass an array of all available lists
365
- case 'list':
366
- $model_list = WYSIJA::get('list', 'model');
367
-
368
- // get lists users can subscribe to (aka "enabled list")
369
- $extra['lists'] = $model_list->get(array('name', 'list_id', 'is_public'), array('is_enabled' => 1));
370
- break;
371
- }
372
-
373
- $this->data['extra'] = $extra;
374
-
375
- return $this->popupContent();
376
- exit;
377
- }
378
- // End: WYSIJA Form Editor
379
  }
1
+ <?php
2
+ defined('WYSIJA') or die('Restricted access');
3
+ class WYSIJA_control_back_config extends WYSIJA_control_back{
4
+ var $view='config';
5
+ var $model='config';
6
+
7
+ function WYSIJA_control_back_config(){
8
+
9
+ }
10
+
11
+ function main() {
12
+ parent::WYSIJA_control_back();
13
+ wp_enqueue_style('thickbox');
14
+
15
+ if(!isset($_REQUEST['action'])) $this->action='main';
16
+ else $this->action=$_REQUEST['action'];
17
+
18
+ $this->jsTrans['testemail'] = __('Sending a test email', WYSIJA);
19
+ $this->jsTrans['bounceconnect'] = __('Bounce handling connection test', WYSIJA);
20
+ $this->jsTrans['processbounceT'] = __('Bounce handling processing', WYSIJA);
21
+ $this->jsTrans['doubleoptinon'] = __('Subscribers will now need to activate their subscription by email in order to receive your newsletters. This is recommended.', WYSIJA);
22
+ $this->jsTrans['doubleoptinoff'] = __('Unconfirmed subscribers will receive your newslettters from now on without the need to activate their subscriptions.', WYSIJA);
23
+ $this->jsTrans['processbounce'] = __('Process bounce handling now!', WYSIJA);
24
+ $this->jsTrans['errorbounceforward'] = __('When setting up the bounce system, you need to have a different address for the bounce email and the forward to address', WYSIJA);
25
+
26
+ // form list
27
+ $this->jsTrans['suredelete'] = __('Are you sure you want to delete this form?', WYSIJA);
28
+
29
+ switch($this->action) {
30
+ case 'log':
31
+ case 'save':
32
+ case 'clearlog':
33
+ wp_enqueue_script('wysija-config-settings', WYSIJA_URL.'js/admin-config-settings.js', array('wysija-admin-js-global'), WYSIJA::get_version());
34
+ case 'form_add':
35
+ case 'form_edit':
36
+ case 'form_duplicate':
37
+ case 'form_delete':
38
+ case 'form_widget_settings':
39
+ return $this->{$this->action}();
40
+ break;
41
+ case 'reinstall':
42
+ $this->reinstall();
43
+ return;
44
+ break;
45
+ case 'dkimcheck':
46
+ $this->dkimcheck();
47
+ if(defined('WYSIJA_REDIRECT')) $this->redirectProcess();
48
+ return;
49
+ break;
50
+ case 'doreinstall':
51
+ $this->doreinstall();
52
+ if(defined('WYSIJA_REDIRECT')){
53
+ global $wysi_location;
54
+ $wysi_location='admin.php?page=wysija_campaigns';
55
+ $this->redirectProcess();
56
+ }
57
+ return;
58
+ break;
59
+ default:
60
+ wp_enqueue_script('wysija-config-settings', WYSIJA_URL.'js/admin-config-settings.js', array('wysija-admin-js-global'), WYSIJA::get_version());
61
+ wp_enqueue_script('jquery-cookie', WYSIJA_URL.'js/jquery/jquery.cookie.js', array('jquery'), WYSIJA::get_version());
62
+ }
63
+
64
+ if(WYSIJA_DBG > 1) {
65
+ $this->viewObj->arrayMenus = array('log' => 'View log');
66
+ }
67
+
68
+ $this->data=array();
69
+ $this->action='main';
70
+
71
+ if(isset($_REQUEST['validate'])){
72
+ $this->notice(str_replace(array('[link]','[/link]'),
73
+ array('<a title="'.__('Get Premium now',WYSIJA).'" class="premium-activate" href="javascript:;">','</a>'),
74
+ __('You\'re almost there. Click this [link]link[/link] to activate the licence you have just purchased.',WYSIJA)));
75
+
76
+ }
77
+
78
+ }
79
+
80
+ function dkimcheck(){
81
+
82
+ if(isset($_POST['xtz'])){
83
+
84
+ $dataconf=json_decode(base64_decode($_POST['xtz']));
85
+ if(isset($dataconf->dkim_pubk->key) && isset($dataconf->dkim_privk)){
86
+ $modelConf=WYSIJA::get('config','model');
87
+ $dataconfsave=array('dkim_pubk'=>$dataconf->dkim_pubk->key, 'dkim_privk'=>$dataconf->dkim_privk,'dkim_1024'=>1);
88
+
89
+ $modelConf->save($dataconfsave);
90
+ WYSIJA::update_option('dkim_autosetup',false);
91
+ }
92
+ }
93
+
94
+ $this->redirect('admin.php?page=wysija_config');
95
+ return true;
96
+ }
97
+
98
+ function save(){
99
+ $_REQUEST = stripslashes_deep($_REQUEST);
100
+ $_POST = stripslashes_deep($_POST);
101
+ $this->requireSecurity();
102
+ $this->modelObj->save($_REQUEST['wysija']['config'],true);
103
+
104
+ //wp_redirect('admin.php?page=wysija_config'.$_REQUEST['redirecttab']);
105
+
106
+ }
107
+
108
+ function reinstall(){
109
+ $this->viewObj->title=__('Reinstall Wysija?',WYSIJA);
110
+ return true;
111
+ }
112
+
113
+ function changeMode(){
114
+ $helperFile=WYSIJA::get('file','helper');
115
+ $helperFile->chmodr(WYSIJA_UPLOADS_DIR, 0666, 0777);
116
+ $this->redirect('admin.php?page=wysija_config');
117
+ return true;
118
+ }
119
+
120
+ function doreinstall(){
121
+
122
+ if(isset($_REQUEST['postedfrom']) && $_REQUEST['postedfrom'] === 'reinstall') {
123
+ $uninstaller=WYSIJA::get('uninstall','helper');
124
+ $uninstaller->reinstall();
125
+ }
126
+ $this->redirect('admin.php?page=wysija_config');
127
+ return true;
128
+ }
129
+
130
+ function render(){
131
+ $this->checkTotalSubscribers();
132
+ $this->viewObj->render($this->action,$this->data);
133
+ }
134
+
135
+ function log(){
136
+ $this->viewObj->arrayMenus=array('clearlog'=>'Clear log');
137
+ $this->viewObj->title='Wysija\'s log';
138
+ return true;
139
+ }
140
+
141
+ function clearlog(){
142
+ update_option('wysija_log', array());
143
+ $this->redirect('admin.php?page=wysija_config&action=log');
144
+ return true;
145
+ }
146
+
147
+ // WYSIJA Form Editor
148
+ function form_add() {
149
+ $helper_form_engine = WYSIJA::get('form_engine', 'helper');
150
+ // set default form data
151
+ $helper_form_engine->set_data();
152
+
153
+ // create form in database with default data
154
+ $form = array(
155
+ 'name' => __('New Form', WYSIJA),
156
+ 'data' => $helper_form_engine->get_encoded('data')
157
+ );
158
+
159
+ // insert into form table
160
+ $model_forms = WYSIJA::get('forms', 'model');
161
+ $form_id = $model_forms->insert($form);
162
+
163
+ if($form_id !== null && (int)$form_id > 0) {
164
+ // redirect to form editor, passing along the newly created form id
165
+ //$this->redirect('admin.php?page=wysija_config&action=form_edit&id='.$form_id);
166
+ WYSIJA::redirect('admin.php?page=wysija_config&action=form_edit&id='.$form_id);
167
+ } else {
168
+ WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
169
+ }
170
+ return true;
171
+ }
172
+
173
+ function form_duplicate() {
174
+
175
+ if(isset($_GET['id']) && (int)$_GET['id'] > 0) {
176
+ $form_id = (int)$_GET['id'];
177
+
178
+ $model_forms = WYSIJA::get('forms', 'model');
179
+
180
+ // get form data
181
+ $form = $model_forms->getOne(array('name', 'data', 'styles'), array('form_id' => $form_id));
182
+
183
+ if(empty($form)) {
184
+ $this->error(__('This form does not exist', WYSIJA), true);
185
+ } else {
186
+ // reset model forms
187
+ $model_forms->reset();
188
+
189
+ // add "copy" to the name
190
+ $form['name'] = $form['name'].' - '.__('Copy', WYSIJA);
191
+
192
+ // insert form (duplicated)
193
+ $model_forms->insert($form);
194
+
195
+ // display notice
196
+ $this->notice(sprintf(__('The form named "%1$s" has been created.', WYSIJA), $form['name']));
197
+ }
198
+ }
199
+
200
+ WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
201
+ }
202
+
203
+ function form_delete() {
204
+
205
+ $this->requireSecurity();
206
+
207
+ if(isset($_GET['id']) && (int)$_GET['id'] > 0) {
208
+ $form_id = (int)$_GET['id'];
209
+
210
+ $model_forms = WYSIJA::get('forms', 'model');
211
+
212
+ // get form data
213
+ $form = $model_forms->getOne(array('name'), array('form_id' => $form_id));
214
+
215
+ if(empty($form)) {
216
+ $this->error(__('This form has already been deleted.', WYSIJA), true);
217
+ } else {
218
+ // delete the form in the database
219
+ $model_forms->reset();
220
+ $model_forms->delete(array('form_id' => $form_id));
221
+
222
+ // display notice
223
+ $this->notice(sprintf(__('The form named "%1$s" has been deleted.', WYSIJA), $form['name']));
224
+ }
225
+ }
226
+
227
+ WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
228
+ }
229
+
230
+ function form_edit() {
231
+ // wysija form editor javascript files
232
+ $this->js[]='wysija-form-editor';
233
+ $this->js[]='wysija-admin-ajax-proto';
234
+ $this->js[]='wysija-admin-ajax';
235
+ $this->js[]='wysija-base-script-64';
236
+
237
+ // make sure the editor content is not cached
238
+ //header('Cache-Control: no-cache, max-age=0, must-revalidate, no-store'); // HTTP/1.1
239
+ //header('Expires: Fri, 9 Mar 1984 00:00:00 GMT');
240
+
241
+ // get form id
242
+ $form_id = (isset($_REQUEST['id']) && (int)$_REQUEST['id'] > 0) ? (int)$_REQUEST['id'] : null;
243
+ $form = array('name' => __('New form', WYSIJA));
244
+
245
+ // if no form id was specified, then it's a new form
246
+ if($form_id !== null) {
247
+ // try to get form data based on form id
248
+ $model_forms = WYSIJA::get('forms', 'model');
249
+ $form = $model_forms->getOne($form_id);
250
+
251
+ // if the form does not exist
252
+ if(empty($form)) {
253
+ // redirect to forms list
254
+ $this->error(__('This form does not exist.', WYSIJA), true);
255
+ WYSIJA::redirect('admin.php?page=wysija_config#tab-forms');
256
+ } else {
257
+ // pass form id to the view
258
+ $this->data['form_id'] = (int)$form['form_id'];
259
+ }
260
+ }
261
+ // pass form to the view
262
+ $this->data['form'] = $form;
263
+
264
+ $helper_form_engine = WYSIJA::get('form_engine', 'helper');
265
+ $lists = $helper_form_engine->get_lists();
266
+
267
+ // select default list
268
+ $default_list = array();
269
+ if(!empty($lists)) {
270
+ $default_list[] = array(
271
+ 'list_id' => $lists[0]['list_id'],
272
+ 'is_checked' => 0
273
+ );
274
+ }
275
+
276
+ $this->data['lists'] = $lists;
277
+
278
+ // get available custom fields
279
+ $model_user_field = WYSIJA::get('user_field', 'model');
280
+ $model_user_field->orderBy('field_id');
281
+ $custom_fields = $model_user_field->getRows(false);
282
+
283
+ // extra widgets that can be added more than once
284
+ $extra_fields = array(
285
+ array(
286
+ 'name' => __('List selection', WYSIJA),
287
+ 'column_name' => 'list',
288
+ 'column_type' => 'list',
289
+ 'params' => array(
290
+ 'label' => __('Select list(s):', WYSIJA),
291
+ 'values' => $default_list
292
+ )
293
+ ),
294
+ array(
295
+ 'name' => __('Random text or HTML', WYSIJA),
296
+ 'column_name' => 'html',
297
+ 'column_type' => 'html',
298
+ 'params' => array(
299
+ 'text' => __('Random text or HTML', WYSIJA)
300
+ )
301
+ ),
302
+ array(
303
+ 'name' => __('Divider', WYSIJA),
304
+ 'column_name' => 'divider',
305
+ 'column_type' => 'divider'
306
+ )
307
+ // array(
308
+ // 'name' => __('HTML code', WYSIJA),
309
+ // 'column_name' => 'html',
310
+ // 'column_type' => 'html',
311
+ // 'params' => array(
312
+ // 'text' => __('HTML code', WYSIJA)
313
+ // )
314
+ );
315
+
316
+ // set data to be passed to the view
317
+ $this->data['custom_fields'] = array_merge($custom_fields, $extra_fields);
318
+
319
+ // translations
320
+ $this->jsTrans = array_merge($this->jsTrans, $helper_form_engine->get_translations());
321
+
322
+ // This should be the title of the page but I don't know how to make it happen...
323
+ // __('Edit', WYSIJA).' '.$this->data['form']['name'];
324
+ }
325
+
326
+ /*
327
+ * Handles the settings popup of wysija form widgets
328
+ */
329
+ function form_widget_settings() {
330
+ $this->iframeTabs = array('form_widget_settings' => __('Widget Settings', WYSIJA));
331
+ $this->js[] = 'wysija-admin-ajax';
332
+ $this->js[] = 'wysija-base-script-64';
333
+ $this->js[] = 'wysija-form-widget-settings';
334
+
335
+ $_GET['tab'] = 'form_widget_settings';
336
+
337
+ // extract parameters from url
338
+ $params = array();
339
+ foreach(explode('|', $_REQUEST['params']) as $pair) {
340
+ // extract both key and value
341
+ list($key, $value) = explode(':', $pair);
342
+
343
+ // decode value
344
+ $value = base64_decode($value);
345
+ // unserialize if necessary (using is_serialized from WordPress)
346
+ if(is_serialized($value) === true) {
347
+ $value = unserialize($value);
348
+ }
349
+ $params[$key] = $value;
350
+ }
351
+
352
+ // common widget data
353
+ $this->data['name'] = $_REQUEST['name'];
354
+ $this->data['type'] = $_REQUEST['type'];
355
+ $this->data['field'] = $_REQUEST['field'];
356
+
357
+ // widget params
358
+ $this->data['params'] = $params;
359
+
360
+ // extra data that needs to be fetched for some widget
361
+ $extra = array();
362
+
363
+ switch($this->data['type']) {
364
+ // in case of the list widget, we need to pass an array of all available lists
365
+ case 'list':
366
+ $model_list = WYSIJA::get('list', 'model');
367
+
368
+ // get lists users can subscribe to (aka "enabled list")
369
+ $extra['lists'] = $model_list->get(array('name', 'list_id', 'is_public'), array('is_enabled' => 1));
370
+ break;
371
+ }
372
+
373
+ $this->data['extra'] = $extra;
374
+
375
+ return $this->popupContent();
376
+ exit;
377
+ }
378
+ // End: WYSIJA Form Editor
379
  }
controllers/back/subscribers.php CHANGED
@@ -1,11 +1,10 @@
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
4
- var $model="user";
5
- var $view="subscribers";
6
- var $list_columns=array("user_id","firstname", "lastname","email","created_at");
7
  var $searchable=array('email','firstname', 'lastname');
8
- var $_export_batch = 2000; //set batch of records, useful when retrieving the list of user Ids to export
9
  var $_separators = array(',', ';'); // csv separator; comma is for standard csv, semi-colon is good for Excel
10
  var $_default_separator = ';';
11
 
@@ -68,6 +67,10 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
68
  }
69
  }
70
 
 
 
 
 
71
  }
72
 
73
  //if a confirmation email needs to be sent then we send it
@@ -111,186 +114,65 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
111
  return true;
112
  }
113
 
 
 
114
  function defaultDisplay(){
115
  $this->viewShow=$this->action='main';
116
  $this->js[]='wysija-admin-list';
117
- $this->viewObj->msgPerPage=__('Subscribers per page:',WYSIJA);
118
-
119
- $this->jsTrans['selecmiss']=__('Select at least 1 subscriber!',WYSIJA);
120
- $orphaned=$filterJoin=false;
121
- //get the filters
122
- if(isset($_REQUEST['search']) && $_REQUEST['search']){
123
- $this->filters['like']=array();
124
- $_REQUEST['search']=trim($_REQUEST['search']);
125
- foreach($this->searchable as $field)
126
- $this->filters['like'][$field]=trim($_REQUEST['search']);
127
- }
128
-
129
- // Lists filters
130
- // - override wysija[filter][filter-list] if this is empty
131
- if(
132
- !empty($_REQUEST['redirect'])
133
- && (!empty($_REQUEST['filter_list']) || !empty($_REQUEST['filter-list']))
134
- && empty($_REQUEST['wysija']['filter']['filter_list'])
135
- )
136
- $_REQUEST['wysija']['filter']['filter_list'] = !empty ($_REQUEST['filter_list']) ? $_REQUEST['filter_list'] : $_REQUEST['filter-list'];
137
-
138
- if(isset($_REQUEST['wysija']['filter']['filter_list']) && $_REQUEST['wysija']['filter']['filter_list']){
139
- if ($_REQUEST['wysija']['filter']['filter_list'] == 'orphaned') {
140
- $this->filters['equal']['list_id'] = null;
141
- $orphaned = true;
142
- } else {
143
- //we only get subscribed or unconfirmed users
144
- $this->filters['equal']['list_id'] = $_REQUEST['wysija']['filter']['filter_list'];
145
- $filterJoin=true;
146
- }
147
- }
148
-
149
- $config=WYSIJA::get('config','model');
150
- if(isset($_REQUEST['link_filter']) && $_REQUEST['link_filter']){
151
- switch($_REQUEST['link_filter']){
152
- case 'unconfirmed':
153
- $this->filters['equal']['status'] = 0;
154
- break;
155
- case 'unsubscribed':
156
- $this->filters['equal']['status'] = -1;
157
- break;
158
- case 'subscribed':
159
- if($config->getValue('confirm_dbleoptin')) $this->filters['equal']['status'] = 1;
160
- else $this->filters['greater_eq']=array('status'=>0);
161
- break;
162
- }
163
- }
164
-
165
- $this->modelObj->noCheck=true;
166
-
167
-
168
- //0 - counting request */
169
- if($filterJoin){
170
- $queryCmmonStart='SELECT count(distinct A.user_id) as users, max(A.created_at) as max_create_at FROM `[wysija]user_list` as B';
171
- $queryCmmonStart.=' JOIN `[wysija]'.$this->modelObj->table_name.'` as A on A.user_id=B.user_id';
172
- } elseif($orphaned) {
173
- $queryCmmonStart='SELECT count(distinct A.user_id) as users, max(A.created_at) as max_create_at FROM `[wysija]user` as A';
174
- $queryCmmonStart.=' LEFT JOIN `[wysija]user_list` as B on A.user_id=B.user_id';
175
- } else {
176
- $queryCmmonStart='SELECT count(distinct A.user_id) as users, max(A.created_at) as max_create_at FROM `[wysija]'.$this->modelObj->table_name.'` as A';
177
- }
178
-
179
-
180
- //all the counts query */
181
- $query='SELECT count(user_id) as users, status, max(created_at) as max_create_at FROM `[wysija]'.$this->modelObj->table_name.'` GROUP BY status';
182
- $countss=$this->modelObj->query('get_res',$query,ARRAY_A);
183
- $counts=array();
184
- $total=0;
185
-
186
- $arr_max_create_at = array();
187
- foreach($countss as $count){
188
- switch($count['status']){
189
- case '0':
190
- $type='unconfirmed';
191
- break;
192
- case '-1':
193
- $type='unsubscribed';
194
- break;
195
- case '1':
196
- $type='subscribed';
197
- break;
198
- }
199
- $arr_max_create_at[] = $count['max_create_at'];
200
- $total=$total+$count['users'];
201
- $counts[$type]=$count['users'];
202
- }
203
- //if(!isset($counts["unconfirmed"])) $counts["unconfirmed"]=0;
204
- if(!$config->getValue('confirm_dbleoptin')) {
205
- if(isset($counts['subscribed'])) {
206
- if(isset($counts['unconfirmed'])) $counts['subscribed']=$counts['subscribed']+$counts['unconfirmed'];
207
- else $counts['subscribed']=$counts['subscribed'];
208
-
209
- }else{
210
- $counts['subscribed']=$counts['unconfirmed'];
211
- }
212
- unset($counts['unconfirmed']);
213
- }
214
-
215
- $counts['all']=$total;
216
-
217
- $this->modelObj->reset();
218
-
219
- if($this->filters) $this->modelObj->setConditions($this->filters);
220
-
221
-
222
- //1 - user request
223
-
224
- if($filterJoin){
225
-
226
- $query="SELECT distinct(A.user_id), A.firstname, A.lastname,A.status , A.email, A.created_at FROM `[wysija]user_list` as B";
227
- $query.=" JOIN `[wysija]".$this->modelObj->table_name."` as A on A.user_id=B.user_id";
228
-
229
- }elseif($orphaned) {
230
-
231
- $query="SELECT distinct(A.user_id), A.firstname, A.lastname,A.status , A.email, A.created_at FROM `[wysija]user` as A";
232
- $query.=" LEFT JOIN `[wysija]user_list` as B on B.user_id=A.user_id";
233
-
234
- } else {
235
- $query="SELECT distinct(A.user_id), A.firstname, A.lastname,A.status , A.email, A.created_at FROM `[wysija]".$this->modelObj->table_name."` as A";
236
  }
237
 
238
- $queryFinal=$this->modelObj->makeWhere();
239
-
240
- /* without filter we already have the total number of subscribers */
241
- $max_create_at = null; //max value of create_at field of current list of users
242
 
243
- if($this->filters){
244
- $count_rows = $this->modelObj->getResults($queryCmmonStart.$queryFinal);
245
- $count_rows = $count_rows[0];
246
- $this->modelObj->countRows = $count_rows['users'];
247
- $max_create_at = $count_rows['max_create_at'];
248
- }
249
- else{
250
- $max_create_at = !empty($arr_max_create_at) ? max($arr_max_create_at) : 0;
251
- $this->modelObj->countRows=$counts['all'];
252
- }
253
 
254
- $orderby=' ORDER BY ';
255
- if(isset($_REQUEST['orderby'])){
256
- $orderby.=$_REQUEST['orderby'].' '.$_REQUEST['ordert'];
257
- }else{
258
- $orderby.=$this->modelObj->pk.' desc';
259
- }
260
- $this->data['max_create_at'] = $max_create_at;
261
- $this->data['subscribers']=$this->modelObj->getResults($query.$queryFinal." ".$orderby.$this->modelObj->setLimit());
262
  $this->data['current_counts'] = $this->modelObj->countRows;
263
  $this->data['show_batch_select'] = ($this->modelObj->limit >= $this->modelObj->countRows) ? false : true;
264
  $this->modelObj->reset();
265
 
266
- /*make the data object for the listing view*/
267
- $modelList=WYSIJA::get('list','model');
268
- $modelList->reset();
269
- $listsAll=$modelList->getRows(false);
270
- /* 2 - list request */
271
 
272
- /*$query="SELECT A.list_id, A.name, count( B.user_id ) AS users FROM `".$modelList->getPrefix().$modelList->table_name."` as A";
273
- $query.=" JOIN `".$modelList->getPrefix()."user_list` as B on A.list_id = B.list_id";
274
- $query.=" GROUP BY A.list_id";
275
 
276
-
277
- $listsDB=$modelList->getResults($query); */
278
- $listsDB=$modelList->getLists();
279
  $lists=array();
280
- foreach($listsAll as $listobje){
281
- $lists[$listobje['list_id']]=$listobje;
282
- }
283
- foreach($listsDB as $listobj){
284
- if($listobj['subscribers']) $lists[$listobj['list_id']]['users']=$listobj['subscribers'];
285
  }
286
- $listsDB=null;
287
 
288
  $user_ids=array();
289
  foreach($this->data['subscribers'] as $subscriber){
290
  $user_ids[]=$subscriber['user_id'];
291
  }
292
 
293
- /* 3 - user_list request */
294
  if($user_ids){
295
  $modeluList=WYSIJA::get('user_list','model');
296
  $userlists=$modeluList->get(array('list_id','user_id','unsub_date'),array('user_id'=>$user_ids));
@@ -299,11 +181,9 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
299
  $this->data['lists']=$lists;
300
  $this->data['counts']=array_reverse($counts);
301
 
302
-
303
-
304
- /* regrouping all the data in the same array */
305
  foreach($this->data['subscribers'] as $keysus=>$subscriber){
306
- /* default key while we don't have the data*/
307
  //TODO add data for stats about emails opened clicked etc
308
  $this->data['subscribers'][$keysus]['emails']=0;
309
  $this->data['subscribers'][$keysus]['opened']=0;
@@ -326,9 +206,7 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
326
  }else{
327
  $this->data['subscribers'][$keysus]['lists'].=', '.$this->data['lists'][$userlist['list_id']]['name'];
328
  }
329
-
330
  }
331
-
332
  }
333
  }
334
  }
@@ -580,26 +458,26 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
580
  $this->notice(__('No subscriber found, most probably because he was deleted.',WYSIJA));
581
  return $this->redirect();
582
  }
583
- $modelList=WYSIJA::get('list','model');
584
- $modelList->limitON=false;
585
- $modelList->orderBy('is_enabled','DESC');
586
- $this->data['list']=$modelList->get(false,array('greater'=>array('is_enabled'=>'-1') ));
587
 
588
- //we prepare the data to be pased to the charts script
589
  $this->data['charts']['title']=' ';
590
  $this->data['charts']['stats']=array();
591
 
592
  //group email user stats by status where userid
593
- $modelEUS=WYSIJA::get('email_user_stat','model');
594
- $modelEUS->setConditions(array('equal'=>array('user_id'=>$id)));
595
- $query='SELECT count(email_id) as emails, status FROM `[wysija]'.$modelEUS->table_name."`";
596
- $query.=$modelEUS->makeWhere();
597
  $query.=' GROUP BY status';
598
- $countss=$modelEUS->query('get_res',$query,ARRAY_A);
599
 
600
  //-2 is an automatic unsubscribed made through bounce processing
601
  $statuses=array('-1'=>__('Bounced',WYSIJA),'0'=>__('Unopened',WYSIJA),'1'=>__('Opened',WYSIJA),'2'=>__('Clicked',WYSIJA),'3'=>__('Unsubscribed',WYSIJA) ,'-2'=>__('Unsubscribed',WYSIJA));
602
- foreach($countss as $count){
603
  $this->data['charts']['stats'][]=array('name'=>$statuses[$count['status']],'number'=>$count['emails']);
604
  }
605
 
@@ -607,9 +485,9 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
607
  $modelEUU=WYSIJA::get('email_user_url','model');
608
  $modelEUU->setConditions(array('equal'=>array('user_id'=>$id)));
609
  $query='SELECT A.*,B.*,C.subject as name FROM `[wysija]'.$modelEUU->table_name."` as A JOIN `[wysija]url` as B on A.url_id=B.url_id JOIN `[wysija]email` as C on C.email_id=A.email_id ";
610
- $query.=$modelEUS->makeWhere();
611
  $query.=' ORDER BY A.number_clicked DESC ';
612
- $this->data['clicks']=$modelEUS->query('get_res',$query,ARRAY_A);
613
 
614
  foreach($this->data['clicks'] as $k => &$v){
615
  $v['url']=urldecode(utf8_encode($v['url']));
@@ -635,23 +513,20 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
635
  * 2 delete the list campaigns references
636
  * 4 delete the list
637
  */
638
- $model=WYSIJA::get('list','model');
639
- $data=$model->getOne(array('name','namekey','welcome_mail_id'),array('list_id'=>(int)$_REQUEST['id']));
640
 
641
  if($data && isset($data['namekey']) && ($data['namekey']!='users')){
642
 
643
  //there is no welcome email per list that's old stuff
644
- //$modelRECYCLE=WYSIJA::get('email','model');
645
- //$modelRECYCLE->delete(array('email_id'=>$data['welcome_mail_id']));
646
-
647
- $modelRECYCLE=WYSIJA::get('user_list','model');
648
- $modelRECYCLE->delete(array('list_id'=>$_REQUEST['id']));
649
 
650
- $modelRECYCLE=WYSIJA::get('campaign_list','model');
651
- $modelRECYCLE->delete(array('list_id'=>$_REQUEST['id']));
652
 
653
- $model->reset();
654
- $model->delete(array('list_id'=>$_REQUEST['id']));
655
 
656
  $this->notice(sprintf(__('List "%1$s" has been deleted.',WYSIJA),$data['name']));
657
  }else{
@@ -666,8 +541,8 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
666
  function synchlist(){
667
  $this->requireSecurity();
668
 
669
- $helperU=WYSIJA::get('user','helper');
670
- $helperU->synchList($_REQUEST['id']);
671
 
672
  $this->redirect('admin.php?page=wysija_subscribers&action=lists');
673
  }
@@ -678,8 +553,8 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
678
  global $current_user;
679
 
680
  if(is_multisite() && is_super_admin( $current_user->ID )){
681
- $helperU=WYSIJA::get('user','helper');
682
- $helperU->synchList($_REQUEST['id'],true);
683
  }
684
 
685
  $this->redirect('admin.php?page=wysija_subscribers&action=lists');
@@ -721,17 +596,17 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
721
  function importpluginsave($id=false){
722
  $this->requireSecurity();
723
  $this->_resetGlobMsg();
724
- $modelConfig=WYSIJA::get('config','model');
725
- $importHelper=WYSIJA::get('import','helper');
726
- $pluginsImportable=$modelConfig->getValue('pluginsImportableEgg');
727
- $pluginsImported=array();
728
  foreach($_REQUEST['wysija']['import'] as $table_name =>$result){
729
- $connection_info=$importHelper->getPluginsInfo($table_name);
730
 
731
  if($result){
732
- $pluginsImported[]=$table_name;
733
- if(!$connection_info) $connection_info=$pluginsImportable[$table_name];
734
- $importHelper->import($table_name,$connection_info);
735
  sleep(2);
736
  $this->notice(sprintf(__('Import from plugin %1$s has been completed.',WYSIJA),"<strong>'".$connection_info['name']."'</strong>"));
737
  }else{
@@ -740,7 +615,7 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
740
 
741
  }
742
 
743
- $modelConfig->save(array('pluginsImportedEgg'=>$pluginsImported));
744
 
745
  $this->redirect('admin.php?page=wysija_subscribers&action=lists');
746
  }
@@ -750,14 +625,14 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
750
 
751
  $this->viewObj->title=__('Import subscribers from plugins',WYSIJA);
752
 
753
- $modelConfig=WYSIJA::get('config','model');
754
 
755
  $this->data=array();
756
- $this->data['plugins']=$modelConfig->getValue('pluginsImportableEgg');
757
- $importedOnes=$modelConfig->getValue('pluginsImportedEgg');
758
 
759
- if($importedOnes){
760
- foreach($importedOnes as $tablename){
761
  unset( $this->data['plugins'][$tablename]);
762
  }
763
  }
@@ -778,188 +653,82 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
778
  }
779
 
780
  function importmatch(){
781
- $this->js[]='wysija-validator';
782
- $helperNumbers=WYSIJA::get('numbers','helper');
783
- $bytes=$helperNumbers->get_max_file_upload();
784
 
785
  if(isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH']>$bytes['maxbytes']){
786
  if(isset($_FILES['importfile']['name']) && $_FILES['importfile']['name']){
787
- $filename=$_FILES['importfile']['name'];
788
  }else{
789
- $filename=__("which you have pasted",WYSIJA);
790
  }
791
 
792
- $this->error(sprintf(__('Upload error, file %1$s is too large! (MAX:%2$s)',WYSIJA),$filename,$bytes['maxmegas']),true);
793
  $this->redirect('admin.php?page=wysija_subscribers&action=import');
794
  return false;
795
  }
796
 
797
- $importfields=get_option("wysija_import_fields");
798
- if(!$importfields) {
799
- $importfields=array(
800
- "fname"=>"firstname",
801
- "firstname"=>"firstname",
802
- "prenom"=>"firstname",
803
- "nom"=>"lastname",
804
- "name"=>"lastname",
805
- "lastname"=>"lastname",
806
- "lname"=>"lastname",
807
- "ipaddress"=>"ip",
808
- "ip"=>"ip",
809
- "addresseip"=>"ip",
810
- );
811
- }
812
-
813
- WYSIJA::update_option('wysija_import_fields',$importfields);
814
-
815
- $this->data=array();
816
-
817
- //is it a text import or a file import?*/
818
- if($_POST['wysija']['import']['type']=="copy"){
819
- if(!isset($_POST['wysija']['user_list']['csv'])){
820
- /* memory limit has been reached*/
821
- $this->error(__("The list you've pasted is too big for the browser. <strong>Upload the file</strong> instead.",WYSIJA),true);
822
- $this->redirect('admin.php?page=wysija_subscribers&action=import');
823
- return false;
824
- }
825
- $csv=trim(stripslashes($_POST['wysija']['user_list']['csv']));
826
- }else{
827
- //dbg($_FILES);
828
- //move_uploaded_file($_importfile, $destination);
829
- $csv=trim(file_get_contents($_FILES['importfile']['tmp_name']));
830
- }
831
-
832
- $csv=str_replace(array("\r","\n\n","\n\t\t\n\t\n\t\n\t\n","\n\t\t\n\t\n\t\n","\xEF\xBB\xBF","\n\t\n","\n(+1)"),array("\n","\n","\n ;","\n","",";",""),$csv);
833
-
834
- //this might be gmail recipients rare paste ...
835
- if(!preg_match_all('/<([a-z0-9_\'&\.\-\+])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,10})+>/i',$csv,$matches)){
836
- //return false;
837
- }else{
838
-
839
- if(substr($csv, -1)!=",") $csv=trim($csv).",";
840
 
841
- $csv=str_replace(array(">, \r",">, \n",">,\r",">,\n",">, "),">,",$csv);
842
- $matchess=explode(">,",$csv);
843
- array_pop($matchess);
844
 
845
- if(count($matches[0])==count($matchess)){
846
- //this is gmail simple paste
847
- $csv=str_replace(array(">,","<"),array("\n",","),$csv);
848
-
849
- }
850
- $csv=trim($csv);
851
- }
852
 
 
853
 
854
- // try different set of enclosure and separator for the csv which can have different look depending on the data carried
855
- $fieldseparatorToTry=array(',',';',"\t");
856
- $fieldenclosurToTry=array('"','');
857
- $foundtheseparator=false;
858
- $foundtheenclosure='';
859
- $userHelper = WYSIJA::get("user","helper");
860
- foreach($fieldenclosurToTry as $enclosure){
861
- foreach($fieldseparatorToTry as $fsep){
862
- $csvArr = $this->_csvToArray($csv,4,$fsep,$enclosure);
 
 
 
863
 
864
- if((count($csvArr)>1 && count($csvArr[0])==count($csvArr[1]))){
865
- if(count($csvArr[0])>1 || $userHelper->validEmail(trim($csvArr[0][0])) || $userHelper->validEmail(trim($csvArr[1][0]))){
866
- $foundtheseparator=$fsep;
867
- $foundtheenclosure=$enclosure;
868
- break(2);
869
- }
870
 
871
- }
 
 
 
 
872
  }
873
- }
874
-
875
- //if it is not a csv file we come out
876
- if(!$foundtheseparator){
877
- $this->notice(str_replace(array('[link]','[/link]'),array('<a href="#">','</a>'),__("The data you are trying to import doesn't appear to be in the CSV format (Comma Separated Values). [link]Read more[/link].",WYSIJA)));
878
- $this->notice(__('The first line of a CSV file should be the column headers : "email","lastname","firstname".',WYSIJA));
879
- $this->notice(__('The second line of a CSV file should be a set of values : "joeeg@example.com","Average","Joe".',WYSIJA));
880
-
881
- $this->notice(__("The two first lines of the file you've uploaded are as follow:",WYSIJA));
882
-
883
- $arraylines=explode("\n",$csv);
884
-
885
- if(empty($arraylines[0])) $text=__("Line is empty",WYSIJA);
886
- else $text=$arraylines[0];
887
- $this->notice("<strong>".$text."</strong>");
888
 
889
- if(empty($arraylines[1])) $text=__("Line is empty",WYSIJA);
890
- else $text=$arraylines[1];
891
- $this->notice("<strong>".$text."</strong>");
892
-
893
- $this->redirect('admin.php?page=wysija_subscribers&action=import');
894
- return false;
895
- }
896
-
897
- $csvArrMax = $this->_csvToArray($csv,0,$foundtheseparator,$foundtheenclosure);
898
-
899
-
900
- $this->data['totalrows']=count($csvArrMax);
901
- end($csvArrMax);
902
- $this->data['lastrow']=current($csvArrMax);
903
- $csvArrMax=null;
904
-
905
- $upload_dir = wp_upload_dir();
906
-
907
- //try to make a wysija dir to save the import file
908
- $fileHelp=WYSIJA::get('file','helper');
909
- $resultdir=$fileHelp->makeDir('import');
910
- if(!$resultdir) {
911
- $this->redirect('admin.php?page=wysija_subscribers&action=import');
912
- return false;
913
  }
914
 
915
- $filename='import-'.time().'.csv';
916
- $handle=fopen($resultdir.$filename, 'w');
917
- fwrite($handle, $csv);
918
- fclose($handle);
919
-
920
- $foundEmail=0;
921
- $keyemail=array();
922
-
923
- foreach($csvArr as $key => $csvrow){
924
- foreach($csvrow as $keyfield =>$val){
925
- if($userHelper->validEmail(trim($val))){
926
- $foundEmail++;
927
 
928
- $keyemail[$keyfield]=$csvArr[0][$keyfield];
929
- }
 
 
 
 
 
 
 
 
 
 
 
 
930
  }
931
- }
932
-
933
- $this->data['errormatch'] = false;
934
- if((count($csvArr)<2) || ((count($csvArr) -1) > $foundEmail)){
935
- $this->error(sprintf(__('There might be a problem with the list you are trying to import. We have identified %1$s emails out of %2$s rows.',WYSIJA),$foundEmail,count($csvArr)),true);
936
- $this->data['errormatch'] = true;
937
- }
938
-
939
- $this->data['csv'] = $csvArr;
940
- $dataImport=array(
941
- 'csv'=>$filename,
942
- 'fsep'=>$foundtheseparator,
943
- 'fenc'=>$foundtheenclosure);
944
- $this->data['dataImport'] = base64_encode(serialize($dataImport));
945
- $this->data['keyemail'] = $keyemail;
946
-
947
- //test if the first row is data or not
948
- //test the email column
949
- foreach($this->data['keyemail'] as $k) $keyemail=$k;
950
-
951
- $userHelper = WYSIJA::get("user","helper");
952
-
953
-
954
- if($userHelper->validEmail($keyemail)){
955
- $this->data['firstrowisdata']=true;
956
- }else{
957
- $this->data['totalrows']--;
958
- }
959
-
960
- $this->viewObj->title=__('Import Subscribers',WYSIJA);
961
- $this->viewShow='importmatch';
962
 
 
963
  }
964
 
965
 
@@ -969,121 +738,27 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
969
  $this->requireSecurity();
970
  $this->_resetGlobMsg();
971
 
972
- //to avoid timeout when importing a lot of data apparently.
973
- global $wpdb;
974
- $wpdb->query('set session wait_timeout=600');
975
-
976
- //import the contacts
977
- //1-check that a list is selected and that there is a csv file pasted
978
- //2-save the list if necessary
979
- //3-save the contacts and record them for each list selected
980
-
981
  //we need to save a new list in that situation
982
- if(isset($_REQUEST['wysija']['list'])){
983
- $model=WYSIJA::get('list','model');
984
- $data=array();
985
- $data['is_enabled']=1;
986
- $data['name']=$_REQUEST['wysija']['list']['newlistname'];
987
- $_REQUEST['wysija']['user_list']['list'][]=$model->insert($data);
988
  }
989
 
 
990
  if(!isset($_REQUEST['wysija']['user_list']['list']) || !$_REQUEST['wysija']['user_list']['list']){
991
  $this->error(__('You need to select at least one list.',WYSIJA),true);
992
  return $this->importmatch();
993
  }
994
 
995
- //is it a new list or not
996
- //try to make a wysija dir
997
- $csvData=unserialize(base64_decode($_REQUEST['wysija']['dataImport']));
998
- $csvfilename=$csvData['csv'];
999
-
1000
- $fileHelp=WYSIJA::get('file','helper');
1001
- $resultFile=$fileHelp->get($csvfilename,'import');
1002
- if(!$resultFile){
1003
- $upload_dir = wp_upload_dir();
1004
- $this->error(sprintf(__('Cannot access CSV file. Verify access rights to this directory "%1$s"',WYSIJA),$upload_dir['basedir']),true);
1005
- return $this->import();
1006
- }
1007
-
1008
- //get the temp csv file
1009
- $csvdata=file_get_contents($resultFile);
1010
-
1011
- $csvArr = $this->_csvToArray($csvdata,0,$csvData['fsep'],$csvData['fenc']);
1012
- $datatoinsert=array();
1013
- $emailKey='';
1014
- foreach($_POST['wysija']['match'] as $key=> $val){
1015
- if($val!='nomatch'){
1016
- $datatoinsert[$key]=trim($val);
1017
- }
1018
- if($val == 'email'){
1019
- $emailKey= $key;
1020
- }
1021
- }
1022
- //dbg($datatoinsert);
1023
- if(!in_array('status',$datatoinsert)){
1024
- $datatoinsert['status']='status';
1025
- }
1026
-
1027
- $queryStart='INSERT IGNORE INTO [wysija]user (`'.implode('` ,`',$datatoinsert).'`,`created_at`) VALUES ';
1028
-
1029
- //$linescount=count($csvArr);
1030
- //detect the emails that are duplicate in the import file
1031
- $emailsCount=array();
1032
-
1033
- $header_row=$csvArr[0];
1034
- //we process the sql insertion 200 by 200 so that we are safe with the server
1035
- $csvChunks=array_chunk($csvArr, 200);
1036
- $csvArr=null;
1037
- $j=0;
1038
- $linescount=0;
1039
- $dataNumbers=array('invalid'=>array(),'inserted'=>0,'outof'=>0,'list_added'=>0,'list_user_ids'=>0,'list_list_ids'=>count($_REQUEST['wysija']['user_list']['list']),'emails_queued'=>0);
1040
- $ignored_row_count=0;
1041
- foreach($csvChunks as $keyChunk =>$arra){
1042
- foreach($arra as $keyline=> $emailline){
1043
- if(isset($emailline[$emailKey])){
1044
- if(isset($emailsCount[$emailline[$emailKey]])) {
1045
- $emailsCount[$emailline[$emailKey]]++;
1046
- //$arra[$keyline]
1047
- }else{
1048
- $emailsCount[$emailline[$emailKey]]=1;
1049
- }
1050
- }else{
1051
- //if the record doesn't have the attribute email then we just ignore it
1052
- $ignored_row_count++;
1053
- unset($arra[$keyline]);
1054
- }
1055
- }
1056
-
1057
- $result=$this->_importRows($queryStart,$arra,$j,$datatoinsert,$emailKey,$dataNumbers);
1058
-
1059
- if($result!==false) $j++;
1060
- else{
1061
- $try=0;
1062
- while($result===false && $try<3){
1063
- $result=$this->_importRows($queryStart,$arra,$j,$datatoinsert,$emailKey,$dataNumbers);
1064
- $try++;
1065
- }
1066
- if($result){
1067
- $j++;
1068
- }else{
1069
-
1070
- $this->error(__('There seems to be an error with the list you\'re trying to import.',WYSIJA),true);
1071
- $this->redirect('admin.php?page=wysija_subscribers&action=import');
1072
- return false;
1073
- }
1074
- }
1075
- $linescount=$linescount+$result;
1076
- }
1077
 
1078
- if(!isset($_POST['firstrowisdata'])) {
1079
- //save the importing fields to be able to match them the next time
1080
- $importfields=get_option('wysija_import_fields');
1081
- foreach($_POST['wysija']['match'] as $key=> $val){
1082
- if($val!='nomatch') {
1083
- $importfields[$header_row[$key]]=$val;
1084
- }
1085
- }
1086
- WYSIJA::update_option('wysija_import_fields',$importfields);
1087
  }
1088
 
1089
  //get a list of list name
@@ -1093,187 +768,47 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
1093
  $listnames=array();
1094
  foreach($results as $k =>$v) $listnames[]=$v['name'];
1095
 
1096
- $helper_user=WYSIJA::get('user','helper');
1097
- $helper_user->refreshUsers();
1098
-
1099
- foreach($emailsCount as $emailkeycount =>$countemailfile){
1100
- if($countemailfile==1) unset($emailsCount[$emailkeycount]);
1101
- }
1102
-
1103
- if($linescount<0) $linescount=0;
1104
-
1105
- $dataNumbers['ignored']=($dataNumbers['outof']-$dataNumbers['inserted']);
1106
- $dataNumbers['ignored_list']=(($dataNumbers['list_user_ids']*$dataNumbers['list_list_ids'])-$dataNumbers['list_added']);
1107
- // $this->notice(sprintf(__('%1$s subscribers have been added to database. (%2$s were ignored)',WYSIJA),$dataNumbers['inserted'],$dataNumbers['ignored']));
1108
-
1109
- $ignored_row_count;//this contain some ignored row because the email attribute was not detected. I say there should be a message for those
1110
-
1111
  $this->notice(sprintf(__('%1$s subscribers added to %2$s.', WYSIJA),
1112
- $dataNumbers['list_user_ids'],
1113
  '"'.implode('", "',$listnames).'"'
1114
  ));
1115
 
1116
- if(count($emailsCount)>0){
1117
- $listemails='';
1118
- $m=0;
1119
- foreach($emailsCount as $emailkeyalready => $occurences){
1120
- if($m>0)$listemails.=', ';
1121
- $listemails.= $emailkeyalready.' ('.$occurences.')';
1122
- $m++;
1123
  }
1124
  //$emailsalreadyinserted=array_keys($emailsCount);
1125
- $this->notice(sprintf(__('%1$s emails appear more than once in your file : %2$s.',WYSIJA),count($emailsCount),$listemails),0);
1126
  }
1127
 
1128
- if(count($dataNumbers['invalid'])>0){
1129
- $this->notice(sprintf(__('%1$s emails are not valid : %2$s.',WYSIJA),count($dataNumbers['invalid']),implode(', ',$dataNumbers['invalid'])),0);
1130
  }
1131
 
1132
  $this->redirect();
1133
  }
1134
 
1135
- function _importRows($query,$csvArr,$count,$datatoinsert,$emailKey,&$dataNumbers){
1136
- $allEmails=array();
1137
- $time=time();
1138
- $linescount=count($csvArr);
1139
- $nbfields=count($datatoinsert);
1140
-
1141
- foreach($csvArr as $k=> $line){
1142
- if(!(count($line)>=(count($datatoinsert)-1))){
1143
-
1144
- unset($csvArr[$k]);
1145
- $linescount--;
1146
- }
1147
- }
1148
-
1149
- $outof=0;
1150
- $j=1;
1151
- $helperUser=WYSIJA::get('user','helper');
1152
- global $wpdb;
1153
- foreach($csvArr as $kline=> $line){
1154
- //dbg($csvArr,0);
1155
- if(!isset($_POST['firstrowisdata']) && $j==1 && $count==0) {
1156
- $j++;
1157
- continue;
1158
- }
1159
- $i=1;
1160
- $values='';
1161
- if(isset($datatoinsert['status'])) $line['status']=1;
1162
- foreach($line as $kl => &$vl){
1163
- if(isset($datatoinsert[$kl])){
1164
- if($emailKey===$kl){
1165
- $vl=trim($vl);
1166
- if($helperUser->validEmail($vl)){
1167
- $allEmails[]=$vl;
1168
- $outof++;
1169
- }else{
1170
- $dataNumbers['invalid'][]=$vl;
1171
-
1172
- unset($csvArr[$kline]);
1173
- $linescount--;
1174
- continue 2;
1175
- }
1176
- }
1177
- $values.="'". mysql_real_escape_string($vl,$wpdb->dbh)."'";
1178
- if($nbfields>$i) $values.=',';
1179
- else $values.=','.$time;
1180
- $i++;
1181
- }
1182
- }
1183
-
1184
- $query.=" ($values) ";
1185
- if($linescount>$j) $query.=',';
1186
- $j++;
1187
-
1188
- }
1189
-
1190
- //replace query to import the subscribers
1191
- $modelWysija=new WYSIJA_model();
1192
- $resultqry=$modelWysija->query($query);
1193
-
1194
- //$outof=$linescount;
1195
- global $wpdb;
1196
-
1197
- $linescount=$wpdb->rows_affected;
1198
- $dataNumbers['inserted']+=$wpdb->rows_affected;
1199
- $dataNumbers['outof']+=$outof;
1200
-
1201
- if($resultqry===false) {
1202
- $this->error(__('Error when inserting emails.',WYSIJA),true);
1203
- return false;
1204
- }
1205
-
1206
-
1207
- //select query to get all of there ids
1208
- $user_ids=$this->modelObj->get(array('user_id'),array('email'=>$allEmails));
1209
- $wpdb->rows_affected=0;
1210
-
1211
- //insert query per list
1212
- $query='INSERT IGNORE INTO [wysija]user_list (`list_id` ,`user_id`,`sub_date`) VALUES ';
1213
- $time_now=time();
1214
- foreach($_REQUEST['wysija']['user_list']['list'] as $keyl=> $list_id){
1215
-
1216
- //for each list pre selected go through that process
1217
- foreach($user_ids as $key=> $userid){
1218
-
1219
- //inserting each user id to this list
1220
- $query.="($list_id,".$userid['user_id'].', '.$time_now.')';
1221
-
1222
- //if this is not the last row we put a comma for the next row
1223
- if(count($user_ids)>($key+1)){
1224
- $query.=',';
1225
- }
1226
- }
1227
-
1228
- //if this is not the last row we put a comma for the next row
1229
- if(count($_REQUEST['wysija']['user_list']['list'])>($keyl+1)){
1230
- $query.=',';
1231
- }
1232
- }
1233
- $resultqry2=$modelWysija->query($query);
1234
-
1235
- $dataNumbers['list_added']+=$wpdb->rows_affected;
1236
- $dataNumbers['list_user_ids']+=count($user_ids);
1237
-
1238
- // take care of active follow ups retro-activity
1239
- $helper_email=WYSIJA::get('email','helper');
1240
- $follow_ups_per_list=$helper_email->get_active_follow_ups(array('email_id','params'),true);
1241
-
1242
- if(!empty($follow_ups_per_list)){
1243
- foreach($_REQUEST['wysija']['user_list']['list'] as $list_id){
1244
- //checking if this list has a list of follow ups
1245
- if(isset($follow_ups_per_list[$list_id])){
1246
-
1247
- //for each follow up of that list we queu an email
1248
- foreach($follow_ups_per_list[$list_id] as $key_queue=>$follow_up){
1249
- //insert query per active followup
1250
- $query_queue='INSERT IGNORE INTO [wysija]queue (`email_id` ,`user_id`,`send_at`) ';
1251
- $query_queue.=' SELECT '.$follow_up['email_id'].' , B.user_id , '.($time_now+$follow_up['delay']);
1252
- $query_queue.=' FROM [wysija]user_list as B';
1253
- $query_queue.=' WHERE B.list_id='.(int)$list_id.' AND sub_date='.$time_now;
1254
-
1255
- $resultqry3=$modelWysija->query($query_queue);
1256
-
1257
- $dataNumbers['emails_queued']+=$wpdb->rows_affected;
1258
- }
1259
- }
1260
- }
1261
- }
1262
-
1263
- if($resultqry2===false) {
1264
- $this->error(__('Error when inserting list.',WYSIJA),true);
1265
- return false;
1266
- }
1267
- if($resultqry==0) return '0';
1268
- return $linescount;
1269
- }
1270
 
1271
  function export(){
1272
  $this->js[]='wysija-validator';
1273
 
1274
  $this->viewObj->title=__('Export Subscribers',WYSIJA);
1275
  $this->data=array();
1276
- $this->data['lists']=$this->_getLists(false);
 
 
 
 
 
 
 
 
 
 
1277
  $this->viewShow='export';
1278
  }
1279
 
@@ -1288,13 +823,33 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
1288
  }
1289
 
1290
  function exportlist(){
1291
- $number=count($_REQUEST['wysija']['user']['user_id']);
1292
- $this->viewObj->title=sprintf(__('Exporting %1$s subscribers',WYSIJA),$number);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1293
  $this->data=array();
 
1294
  $this->data['subscribers'] = $_REQUEST['wysija']['user']['user_id'];
1295
  $this->data['user'] = $_REQUEST['wysija']['user'];//for batch-selecting
 
 
 
1296
  $this->data['filter'] = $_REQUEST['wysija']['filter'];//for batch-selecting
1297
- $this->viewShow='export';
1298
  }
1299
 
1300
 
@@ -1324,143 +879,31 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
1324
  $this->redirect();
1325
  }
1326
 
1327
- /**
1328
- * function generating an export file based on an array of user_ids
1329
- */
1330
  /**
1331
  * function generating an export file based on an array of user_ids
1332
  */
1333
  function export_get(){
1334
  @ini_set('max_execution_time',0);
1335
 
1336
- //prepare the columns that need to be exported
1337
- $model=WYSIJA::get('user_field','model');
1338
- $fields=$model->getFields();
1339
- $namefields=array();
1340
- foreach($_POST['wysija']['export']['fields'] as $keyfield){
1341
- $namefields[]=$fields[$keyfield];
1342
- }
1343
 
1344
- //create the export file step by step
1345
- $file_header=implode(';',$namefields)."\n";
1346
- //generate temp file
1347
- $fileHelp=WYSIJA::get('file','helper');
1348
- $resultFile=$fileHelp->temp($file_header,'export','.csv');
1349
-
1350
- //open the created file in append mode
1351
- $handle=fopen($resultFile['path'], 'a');
1352
-
1353
- //get a list of user_ids to export
1354
- if(isset($_POST['wysija']['export']['user_ids'])
1355
- && $_POST['wysija']['export']['user_ids']
1356
- && empty($this->_batch_select)){
1357
- $userids=unserialize(base64_decode($_POST['wysija']['export']['user_ids']));
1358
- $this->write_data_to_export_file($handle,$userids);
1359
- $useridsrows = count($userids);
1360
- $userids = null;// free memory
1361
- }else{
1362
- //based on filters get a list of user_ids
1363
- $userids = array();
1364
- $useridsrows = 0;
1365
- if(!empty($this->_batch_select)){ // batch select and export
1366
- $useridsrows = $this->_batch_select['count'];
1367
- $qry = $this->_batch_select['original_query'];
1368
- }elseif(isset($_POST['wysija']['export']['filter']['list']) && $_POST['wysija']['export']['filter']['list']){ // select list(s) and export
1369
- $where='';
1370
- if(!is_array($_POST['wysija']['export']['filter']['list']))
1371
- $_POST['wysija']['export']['filter']['list'] = array($_POST['wysija']['export']['filter']['list']);
1372
- if(isset($_POST['wysija']['export']['filter']['confirmed'])){
1373
- $where=' AND B.status>0 ';
1374
- }
1375
- $from = ' `[wysija]user_list` as A
1376
- JOIN `[wysija]user` as B on A.user_id=B.user_id';
1377
- $where = ' A.list_id IN ('.implode(',',$_POST['wysija']['export']['filter']['list']).')'.$where;
1378
- $qry='SELECT B.user_id FROM '.$from . ' WHERE ' .$where;
1379
- $qry_count='SELECT COUNT(DISTINCT A.user_id) FROM '.$from . ' WHERE ' .$where;
1380
- }else{ // export all list
1381
- $from = '`[wysija]user` as A';
1382
- $where = '1';
1383
- if(isset($_POST['wysija']['export']['filter']['confirmed'])){
1384
- $where ='A.status>0';
1385
- }
1386
- $qry='SELECT A.user_id FROM '. $from . ' WHERE '. $where;
1387
- $qry_count='SELECT COUNT(DISTINCT A.user_id) FROM '. $from . ' WHERE '. $where . ' ';
1388
- }
1389
- $user_ids_chunks = array(); // chunk rows into separated batchs, limit by $this->_export_batch
1390
- $qry_batchs = array(); // store all batched queries
1391
- if(empty($useridsrows)){
1392
- $useridsrows_result = $this->modelObj->getResults($qry_count, ARRAY_N);
1393
- $useridsrows = (int)$useridsrows_result[0][0];
1394
- }
1395
-
1396
- if($useridsrows <= $this->_export_batch){
1397
- $useridsdb=$this->modelObj->getResults($qry,ARRAY_N);
1398
- foreach($useridsdb as $uarr){
1399
- $userids[]=$uarr[0];
1400
- }
1401
- $this->write_data_to_export_file($handle,$userids);
1402
- $userids = null;// free memory
1403
- }
1404
- else{
1405
- $pages = ceil($useridsrows / $this->_export_batch);//pagination
1406
- for ($i = 0; $i < $pages; $i++) {
1407
- $qrybatch = $qry. ' ORDER BY user_id ASC LIMIT '.($i*$this->_export_batch) . ',' . $this->_export_batch;
1408
- $useridsdb=$this->modelObj->getResults($qrybatch,ARRAY_N);
1409
- foreach($useridsdb as $uarr){
1410
- $userids[]=$uarr[0];
1411
- }
1412
- $this->write_data_to_export_file($handle,$userids);
1413
- unset($userids);// free memory
1414
- unset($useridsdb);//free memory
1415
- }
1416
- }
1417
- }
1418
 
 
1419
 
1420
-
1421
-
1422
-
1423
- fclose($handle);
1424
-
1425
- $url=get_bloginfo('wpurl').'/wp-admin/admin.php?page=wysija_subscribers&action=exportedFileGet&file='.base64_encode($resultFile['path']);
1426
  $this->notice(str_replace(
1427
  array('[link]','[/link]'),
1428
  array('<a href="'.$url.'" target="_blank" class="exported-file" >','</a>'),
1429
- sprintf(__('%1$s subscribers were exported. Get the exported file [link]here[/link].',WYSIJA),$useridsrows)));
1430
 
1431
  if(isset($_REQUEST['camp_id'])){
1432
  $this->redirect('admin.php?page=wysija_campaigns&action=viewstats&id='.$_REQUEST['camp_id']);
1433
  }else{
1434
- $this->redirect();
1435
  }
1436
  }
1437
 
1438
- function write_data_to_export_file(&$handle, $userids){
1439
- $user_ids_chunks=array_chunk($userids, 200);
1440
- $userids = null;// free memory
1441
-
1442
-
1443
- $modelUser=WYSIJA::get('user','model');
1444
- foreach($user_ids_chunks as $userid_chunk){
1445
- //get the full data for that specific chunk of ids
1446
- $data=$modelUser->get($_POST['wysija']['export']['fields'],array('user_id'=>$userid_chunk));
1447
-
1448
- if(in_array('created_at', $_POST['wysija']['export']['fields'])){
1449
- foreach($data as $key=>$row){
1450
- $data[$key]['created_at']=date_i18n(get_option('date_format'),$row['created_at']);
1451
- }
1452
- }
1453
-
1454
- //append content to the file
1455
- foreach($data as $row){
1456
- fwrite($handle, implode(';',$row)."\n");
1457
- }
1458
- }
1459
-
1460
-
1461
- }
1462
-
1463
-
1464
  function exportedFileGet(){
1465
  if(isset($_REQUEST['file'])){
1466
  $helper=WYSIJA::get('file','helper');
@@ -1468,57 +911,8 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
1468
  }
1469
  }
1470
 
1471
- /**
1472
- *
1473
- * @param type $input
1474
- * @param type $rowstoread
1475
- * @param type $delimiter
1476
- * @param type $enclosure
1477
- * @param type $linedelimiter
1478
- * @return array
1479
- */
1480
- function _csvToArray($input,$rowstoread=0 , $delimiter=',',$enclosure='',$linedelimiter="\n"){
1481
- $header = null;
1482
- $data = array();
1483
 
1484
- $csvData = explode($linedelimiter,$input);
1485
- $i=1;
1486
- foreach($csvData as $csvLine){
1487
- if($rowstoread!=0 && $i>$rowstoread) return $data;
1488
-
1489
- /* str_getcsv only exists in php5 ...*/
1490
- if(!function_exists("str_getcsv")){
1491
- $data[]= $this->csv_explode($csvLine, $delimiter,$enclosure);
1492
- }else{
1493
- $data[] = str_getcsv($csvLine, $delimiter,$enclosure);
1494
- }
1495
-
1496
- $i++;
1497
- }
1498
-
1499
- return $data;
1500
- }
1501
-
1502
- function csv_explode($str,$delim, $enclose, $preserve=false){
1503
- $resArr = array();
1504
- $n = 0;
1505
- if(empty($enclose)){
1506
- $resArr = explode($delim, $str);
1507
- }else{
1508
- $expEncArr = explode($enclose, $str);
1509
- foreach($expEncArr as $EncItem){
1510
- if($n++%2){
1511
- array_push($resArr, array_pop($resArr) . ($preserve?$enclose:'') . $EncItem.($preserve?$enclose:''));
1512
- }else{
1513
- $expDelArr = explode($delim, $EncItem);
1514
- array_push($resArr, array_pop($resArr) . array_shift($expDelArr));
1515
- $resArr = array_merge($resArr, $expDelArr);
1516
- }
1517
- }
1518
- }
1519
 
1520
- return $resArr;
1521
- }
1522
 
1523
 
1524
 
@@ -1543,40 +937,13 @@ class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
1543
 
1544
  function _getForm($id=false){
1545
  if($id){
1546
- $modelList=WYSIJA::get('list','model');
1547
 
1548
- return $modelList->getLists($id);
1549
  }else{
1550
  $array=array('name'=>'','list_id'=>'','description'=>'','is_public'=>true,'is_enabled'=>true);
1551
  return $array;
1552
  }
1553
 
1554
  }
1555
-
1556
- function cleanQueueFromAlreadySent(){
1557
- $model_queue=WYSIJA::get('queue','model');
1558
- $model_email=WYSIJA::get('email','model');
1559
- $model_email->setConditions(array('type'=>2));
1560
- $autonewsletter=$model_email->getRows(array('email_id','params'));
1561
- $rows_affected=0;
1562
- foreach ($autonewsletter as $data){
1563
- $model_email->getParams($data);
1564
- global $wpdb;
1565
- if(isset($data['params']['autonl']['event']) && $data['params']['autonl']['event']=='subs-2-nl'){
1566
- $query_queue='DELETE FROM [wysija]queue';
1567
- $query_queue.=' WHERE email_id='.(int)$data['email_id'].' AND user_id ';
1568
- $query_queue.='IN (SELECT B.user_id FROM [wysija]email_user_stat as B WHERE B.email_id='.(int)$data['email_id'].')';
1569
- $result=$model_queue->query($query_queue);
1570
- $rows_affected+=$wpdb->rows_affected;
1571
- }
1572
-
1573
- }
1574
-
1575
- if($result){
1576
-
1577
- echo 'query successfully run<br/>';
1578
- echo $rows_affected.' rows in the queue table have been deleted';
1579
- }
1580
- exit;
1581
- }
1582
  }
1
  <?php
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_control_back_subscribers extends WYSIJA_control_back{
4
+ var $model='user';
5
+ var $view='subscribers';
6
+ var $list_columns=array('user_id','firstname', 'lastname','email','created_at');
7
  var $searchable=array('email','firstname', 'lastname');
 
8
  var $_separators = array(',', ';'); // csv separator; comma is for standard csv, semi-colon is good for Excel
9
  var $_default_separator = ';';
10
 
67
  }
68
  }
69
 
70
+ }else{
71
+ // if no list is selected we unsubscribe them all
72
+ $modelUL->reset();
73
+ $modelUL->update(array('unsub_date'=>time(),'sub_date'=>0),array('user_id'=>$id));
74
  }
75
 
76
  //if a confirmation email needs to be sent then we send it
114
  return true;
115
  }
116
 
117
+
118
+
119
  function defaultDisplay(){
120
  $this->viewShow=$this->action='main';
121
  $this->js[]='wysija-admin-list';
122
+ $this->viewObj->msgPerPage = __('Subscribers per page:',WYSIJA);
123
+
124
+ $this->jsTrans['selecmiss'] = __('Select at least 1 subscriber!',WYSIJA);
125
+
126
+ // get the total count for subscribed, unsubscribed and unconfirmed users
127
+ $select = array( 'count(user_id) as users' , 'status' , 'max(created_at) as max_create_at');
128
+ $count_group_by = 'status';
129
+ $count_by_status = $this->modelObj->get_subscribers( $select , array() , $count_group_by );
130
+
131
+ $counts = $this->modelObj->structure_user_status_count_array($count_by_status);
132
+ $arr_max_create_at = $this->modelObj->get_max_create($count_by_status);
133
+
134
+ // count the rows based on the filters
135
+ $filters = $this->modelObj->detect_filters();
136
+ $select = array( 'COUNT(DISTINCT([wysija]user.user_id)) as total_users', 'MAX([wysija]user.created_at) as max_create_at');
137
+ $count_rows = $this->modelObj->get_subscribers( $select, $filters );
138
+
139
+ // without filter we already have the total number of subscribers
140
+ $this->data['max_create_at'] = null; //max value of create_at field of current list of users
141
+ if(!empty($filters)){
142
+ // used for pagination
143
+ $this->modelObj->countRows = $count_rows['total_users'];
144
+ // used for
145
+ $this->data['max_create_at'] = $count_rows['max_create_at'];
146
+ }else{
147
+ $this->data['max_create_at'] = !empty($arr_max_create_at) ? max($arr_max_create_at) : 0;
148
+ $this->modelObj->countRows=$counts['all'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  }
150
 
151
+ $select = array( '[wysija]user.firstname', '[wysija]user.lastname', '[wysija]user.status', '[wysija]user.email', '[wysija]user.created_at', '[wysija]user_list.user_id' );
 
 
 
152
 
153
+ $this->data['subscribers'] = $this->modelObj->get_subscribers($select , $filters);
 
 
 
 
 
 
 
 
 
154
 
 
 
 
 
 
 
 
 
155
  $this->data['current_counts'] = $this->modelObj->countRows;
156
  $this->data['show_batch_select'] = ($this->modelObj->limit >= $this->modelObj->countRows) ? false : true;
157
  $this->modelObj->reset();
158
 
 
 
 
 
 
159
 
160
+ // make the data object for the listing view
161
+ $model_list = WYSIJA::get('list','model');
162
+ $lists_db = $model_list->getLists();
163
 
 
 
 
164
  $lists=array();
165
+
166
+ foreach($lists_db as $listobj){
167
+ $lists[$listobj['list_id']]=$listobj;
 
 
168
  }
 
169
 
170
  $user_ids=array();
171
  foreach($this->data['subscribers'] as $subscriber){
172
  $user_ids[]=$subscriber['user_id'];
173
  }
174
 
175
+ // 3 - user_list request
176
  if($user_ids){
177
  $modeluList=WYSIJA::get('user_list','model');
178
  $userlists=$modeluList->get(array('list_id','user_id','unsub_date'),array('user_id'=>$user_ids));
181
  $this->data['lists']=$lists;
182
  $this->data['counts']=array_reverse($counts);
183
 
184
+ // regrouping all the data in the same array
 
 
185
  foreach($this->data['subscribers'] as $keysus=>$subscriber){
186
+ // default key while we don't have the data
187
  //TODO add data for stats about emails opened clicked etc
188
  $this->data['subscribers'][$keysus]['emails']=0;
189
  $this->data['subscribers'][$keysus]['opened']=0;
206
  }else{
207
  $this->data['subscribers'][$keysus]['lists'].=', '.$this->data['lists'][$userlist['list_id']]['name'];
208
  }
 
209
  }
 
210
  }
211
  }
212
  }
458
  $this->notice(__('No subscriber found, most probably because he was deleted.',WYSIJA));
459
  return $this->redirect();
460
  }
461
+ $model_list=WYSIJA::get('list','model');
462
+ $model_list->limitON=false;
463
+ $model_list->orderBy('is_enabled','DESC');
464
+ $this->data['list']=$model_list->get(false,array('greater'=>array('is_enabled'=>'-1') ));
465
 
466
+ //we prepare the data to be passed to the charts script
467
  $this->data['charts']['title']=' ';
468
  $this->data['charts']['stats']=array();
469
 
470
  //group email user stats by status where userid
471
+ $model_email_user_stat=WYSIJA::get('email_user_stat','model');
472
+ $model_email_user_stat->setConditions(array('equal'=>array('user_id'=>$id)));
473
+ $query='SELECT count(email_id) as emails, status FROM `[wysija]'.$model_email_user_stat->table_name."`";
474
+ $query.=$model_email_user_stat->makeWhere();
475
  $query.=' GROUP BY status';
476
+ $grouped_counts=$model_email_user_stat->query('get_res',$query,ARRAY_A);
477
 
478
  //-2 is an automatic unsubscribed made through bounce processing
479
  $statuses=array('-1'=>__('Bounced',WYSIJA),'0'=>__('Unopened',WYSIJA),'1'=>__('Opened',WYSIJA),'2'=>__('Clicked',WYSIJA),'3'=>__('Unsubscribed',WYSIJA) ,'-2'=>__('Unsubscribed',WYSIJA));
480
+ foreach($grouped_counts as $count){
481
  $this->data['charts']['stats'][]=array('name'=>$statuses[$count['status']],'number'=>$count['emails']);
482
  }
483
 
485
  $modelEUU=WYSIJA::get('email_user_url','model');
486
  $modelEUU->setConditions(array('equal'=>array('user_id'=>$id)));
487
  $query='SELECT A.*,B.*,C.subject as name FROM `[wysija]'.$modelEUU->table_name."` as A JOIN `[wysija]url` as B on A.url_id=B.url_id JOIN `[wysija]email` as C on C.email_id=A.email_id ";
488
+ $query.=$model_email_user_stat->makeWhere();
489
  $query.=' ORDER BY A.number_clicked DESC ';
490
+ $this->data['clicks']=$model_email_user_stat->query('get_res',$query,ARRAY_A);
491
 
492
  foreach($this->data['clicks'] as $k => &$v){
493
  $v['url']=urldecode(utf8_encode($v['url']));
513
  * 2 delete the list campaigns references
514
  * 4 delete the list
515
  */
516
+ $model_list=WYSIJA::get('list','model');
517
+ $data=$model_list->getOne(array('name','namekey','welcome_mail_id'),array('list_id'=>(int)$_REQUEST['id']));
518
 
519
  if($data && isset($data['namekey']) && ($data['namekey']!='users')){
520
 
521
  //there is no welcome email per list that's old stuff
522
+ $model_user_list=WYSIJA::get('user_list','model');
523
+ $model_user_list->delete(array('list_id'=>$_REQUEST['id']));
 
 
 
524
 
525
+ $model_campaign_list=WYSIJA::get('campaign_list','model');
526
+ $model_campaign_list->delete(array('list_id'=>$_REQUEST['id']));
527
 
528
+ $model_list->reset();
529
+ $model_list->delete(array('list_id'=>$_REQUEST['id']));
530
 
531
  $this->notice(sprintf(__('List "%1$s" has been deleted.',WYSIJA),$data['name']));
532
  }else{
541
  function synchlist(){
542
  $this->requireSecurity();
543
 
544
+ $helper_user=WYSIJA::get('user','helper');
545
+ $helper_user->synchList($_REQUEST['id']);
546
 
547
  $this->redirect('admin.php?page=wysija_subscribers&action=lists');
548
  }
553
  global $current_user;
554
 
555
  if(is_multisite() && is_super_admin( $current_user->ID )){
556
+ $helper_user=WYSIJA::get('user','helper');
557
+ $helper_user->synchList($_REQUEST['id'],true);
558
  }
559
 
560
  $this->redirect('admin.php?page=wysija_subscribers&action=lists');
596
  function importpluginsave($id=false){
597
  $this->requireSecurity();
598
  $this->_resetGlobMsg();
599
+ $model_config=WYSIJA::get('config','model');
600
+ $helper_import=WYSIJA::get('import','helper');
601
+ $plugins_importable=$model_config->getValue('pluginsImportableEgg');
602
+ $plugins_imported=array();
603
  foreach($_REQUEST['wysija']['import'] as $table_name =>$result){
604
+ $connection_info=$helper_import->getPluginsInfo($table_name);
605
 
606
  if($result){
607
+ $plugins_imported[]=$table_name;
608
+ if(!$connection_info) $connection_info=$plugins_importable[$table_name];
609
+ $helper_import->import($table_name,$connection_info);
610
  sleep(2);
611
  $this->notice(sprintf(__('Import from plugin %1$s has been completed.',WYSIJA),"<strong>'".$connection_info['name']."'</strong>"));
612
  }else{
615
 
616
  }
617
 
618
+ $model_config->save(array('pluginsImportedEgg'=>$plugins_imported));
619
 
620
  $this->redirect('admin.php?page=wysija_subscribers&action=lists');
621
  }
625
 
626
  $this->viewObj->title=__('Import subscribers from plugins',WYSIJA);
627
 
628
+ $model_config=WYSIJA::get('config','model');
629
 
630
  $this->data=array();
631
+ $this->data['plugins']=$model_config->getValue('pluginsImportableEgg');
632
+ $imported_plugins=$model_config->getValue('pluginsImportedEgg');
633
 
634
+ if($imported_plugins){
635
+ foreach($imported_plugins as $tablename){
636
  unset( $this->data['plugins'][$tablename]);
637
  }
638
  }
653
  }
654
 
655
  function importmatch(){
656
+ $this->js[] = 'wysija-validator';
657
+ $helper_numbers = WYSIJA::get('numbers','helper');
658
+ $bytes = $helper_numbers->get_max_file_upload();
659
 
660
  if(isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH']>$bytes['maxbytes']){
661
  if(isset($_FILES['importfile']['name']) && $_FILES['importfile']['name']){
662
+ $file_name = $_FILES['importfile']['name'];
663
  }else{
664
+ $file_name = __('which you have pasted',WYSIJA);
665
  }
666
 
667
+ $this->error(sprintf(__('Upload error, file %1$s is too large! (MAX:%2$s)',WYSIJA) , $file_name , $bytes['maxmegas']),true);
668
  $this->redirect('admin.php?page=wysija_subscribers&action=import');
669
  return false;
670
  }
671
 
672
+ $import = new WJ_Import();
673
+ $this->data = $import->scan_csv_file();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
 
675
+ if($this->data === false) $this->redirect('admin.php?page=wysija_subscribers&action=import');
 
 
676
 
677
+ $this->viewObj->title=__('Import Subscribers',WYSIJA);
678
+ $this->viewShow='importmatch';
 
 
 
 
 
679
 
680
+ }
681
 
682
+ /**
683
+ *
684
+ * @param type $input
685
+ * @param type $rowstoread
686
+ * @param type $delimiter
687
+ * @param type $enclosure
688
+ * @param type $linedelimiter
689
+ * @return array
690
+ */
691
+ function _csvToArray($input,$rowstoread=0 , $delimiter=',',$enclosure='',$linedelimiter="\n"){
692
+ $header = null;
693
+ $data = array();
694
 
695
+ $csvData = explode($linedelimiter,$input);
696
+ $i=1;
697
+ foreach($csvData as $csvLine){
698
+ if($rowstoread!=0 && $i>$rowstoread) return $data;
 
 
699
 
700
+ /* str_getcsv only exists in php5 ...*/
701
+ if(!function_exists("str_getcsv")){
702
+ $data[]= $this->csv_explode($csvLine, $delimiter,$enclosure);
703
+ }else{
704
+ $data[] = str_getcsv($csvLine, $delimiter,$enclosure);
705
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
706
 
707
+ $i++;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708
  }
709
 
710
+ return $data;
711
+ }
 
 
 
 
 
 
 
 
 
 
712
 
713
+ function csv_explode($str,$delim, $enclose, $preserve=false){
714
+ $resArr = array();
715
+ $n = 0;
716
+ if(empty($enclose)){
717
+ $resArr = explode($delim, $str);
718
+ }else{
719
+ $expEncArr = explode($enclose, $str);
720
+ foreach($expEncArr as $EncItem){
721
+ if($n++%2){
722
+ array_push($resArr, array_pop($resArr) . ($preserve?$enclose:'') . $EncItem.($preserve?$enclose:''));
723
+ }else{
724
+ $expDelArr = explode($delim, $EncItem);
725
+ array_push($resArr, array_pop($resArr) . array_shift($expDelArr));
726
+ $resArr = array_merge($resArr, $expDelArr);
727
  }
728
+ }
729
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
730
 
731
+ return $resArr;
732
  }
733
 
734
 
738
  $this->requireSecurity();
739
  $this->_resetGlobMsg();
740
 
 
 
 
 
 
 
 
 
 
741
  //we need to save a new list in that situation
742
+ if(!empty($_REQUEST['wysija']['list']['newlistname'])){
743
+ $model_list = WYSIJA::get('list','model');
744
+ $data_list = array();
745
+ $data_list['is_enabled'] = 1;
746
+ $data_list['name'] = $_REQUEST['wysija']['list']['newlistname'];
747
+ $_REQUEST['wysija']['user_list']['list'][] = $model_list->insert($data_list);
748
  }
749
 
750
+ //if there is no list selected, we return to the same form prompting the user to take action
751
  if(!isset($_REQUEST['wysija']['user_list']['list']) || !$_REQUEST['wysija']['user_list']['list']){
752
  $this->error(__('You need to select at least one list.',WYSIJA),true);
753
  return $this->importmatch();
754
  }
755
 
756
+ $import = new WJ_Import();
757
+ $data_numbers = $import->import_subscribers();
758
+ $duplicate_emails_count = $import->get_duplicate_emails_count();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
759
 
760
+ if($data_numbers === false){
761
+ return $this->redirect('admin.php?page=wysija_subscribers&action=import');
 
 
 
 
 
 
 
762
  }
763
 
764
  //get a list of list name
768
  $listnames=array();
769
  foreach($results as $k =>$v) $listnames[]=$v['name'];
770
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
771
  $this->notice(sprintf(__('%1$s subscribers added to %2$s.', WYSIJA),
772
+ $data_numbers['list_user_ids'],
773
  '"'.implode('", "',$listnames).'"'
774
  ));
775
 
776
+ if(count($duplicate_emails_count)>0){
777
+ $list_emails = '';
778
+ $i = 0;
779
+ foreach($duplicate_emails_count as $email_address => $occurences){
780
+ if( $i > 0 )$list_emails.=', ';
781
+ $list_emails.= $email_address.' ('.$occurences.')';
782
+ $i++;
783
  }
784
  //$emailsalreadyinserted=array_keys($emailsCount);
785
+ $this->notice(sprintf(__('%1$s emails appear more than once in your file : %2$s.',WYSIJA),count($duplicate_emails_count),$list_emails),0);
786
  }
787
 
788
+ if(count($data_numbers['invalid'])>0){
789
+ $this->notice(sprintf(__('%1$s emails are not valid : %2$s.',WYSIJA),count($data_numbers['invalid']),implode(', ',$data_numbers['invalid'])),0);
790
  }
791
 
792
  $this->redirect();
793
  }
794
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
795
 
796
  function export(){
797
  $this->js[]='wysija-validator';
798
 
799
  $this->viewObj->title=__('Export Subscribers',WYSIJA);
800
  $this->data=array();
801
+ //$this->data['lists']=$this->_getLists();
802
+ $this->data['lists']=$modelList=WYSIJA::get('list','model');
803
+ $listsDB=$modelList->getLists();
804
+
805
+ $lists=array();
806
+
807
+ foreach($listsDB as $listobj){
808
+ $lists[$listobj['list_id']]=$listobj;
809
+ }
810
+ $this->data['lists']=$lists;
811
+
812
  $this->viewShow='export';
813
  }
814
 
823
  }
824
 
825
  function exportlist(){
826
+
827
+ if(!empty($_REQUEST['wysija']['user']['force_select_all'])){
828
+
829
+ $select = array( 'COUNT(DISTINCT([wysija]user.user_id)) as total_users');
830
+ if(!empty($_REQUEST['wysija']['filter']['filter_list'])){
831
+ $select[] = '[wysija]user_list.list_id';
832
+ }
833
+
834
+ // filters for unsubscribed
835
+ $filters = $this->modelObj->detect_filters();
836
+
837
+ $count = $this->modelObj->get_subscribers( $select, $filters );
838
+ $number = $count['total_users'];
839
+ } else {
840
+ $number = count($_REQUEST['wysija']['user']['user_id']);
841
+ }
842
+
843
+ $this->viewObj->title = sprintf(__('Exporting %1$s subscribers',WYSIJA),$number);
844
  $this->data=array();
845
+
846
  $this->data['subscribers'] = $_REQUEST['wysija']['user']['user_id'];
847
  $this->data['user'] = $_REQUEST['wysija']['user'];//for batch-selecting
848
+
849
+ if(!empty($_REQUEST['search'])) $_REQUEST['wysija']['filter']['search'] = $_REQUEST['search'];
850
+
851
  $this->data['filter'] = $_REQUEST['wysija']['filter'];//for batch-selecting
852
+ $this->viewShow = 'export';
853
  }
854
 
855
 
879
  $this->redirect();
880
  }
881
 
 
 
 
882
  /**
883
  * function generating an export file based on an array of user_ids
884
  */
885
  function export_get(){
886
  @ini_set('max_execution_time',0);
887
 
888
+ $export = new WJ_Export();
 
 
 
 
 
 
889
 
890
+ if(!empty($this->_batch_select)) $export->batch_select = $this->_batch_select;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
891
 
892
+ $file_path_result = $export->export_subscribers();
893
 
894
+ $url=get_bloginfo('wpurl').'/wp-admin/admin.php?page=wysija_subscribers&action=exportedFileGet&file='.base64_encode($file_path_result);
 
 
 
 
 
895
  $this->notice(str_replace(
896
  array('[link]','[/link]'),
897
  array('<a href="'.$url.'" target="_blank" class="exported-file" >','</a>'),
898
+ sprintf(__('%1$s subscribers were exported. Get the exported file [link]here[/link].',WYSIJA),$export->get_user_ids_rows())));
899
 
900
  if(isset($_REQUEST['camp_id'])){
901
  $this->redirect('admin.php?page=wysija_campaigns&action=viewstats&id='.$_REQUEST['camp_id']);
902
  }else{
903
+ $this->redirect();
904
  }
905
  }
906
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
907
  function exportedFileGet(){
908
  if(isset($_REQUEST['file'])){
909
  $helper=WYSIJA::get('file','helper');
911
  }
912
  }
913
 
 
 
 
 
 
 
 
 
 
 
 
 
914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
915
 
 
 
916
 
917
 
918
 
937
 
938
  function _getForm($id=false){
939
  if($id){
940
+ $model_list=WYSIJA::get('list','model');
941
 
942
+ return $model_list->get_one_list($id);
943
  }else{
944
  $array=array('name'=>'','list_id'=>'','description'=>'','is_public'=>true,'is_enabled'=>true);
945
  return $array;
946
  }
947
 
948
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
949
  }
controllers/front/confirm.php CHANGED
@@ -29,65 +29,12 @@ class WYSIJA_control_front_confirm extends WYSIJA_control_front{
29
  * return boolean
30
  */
31
  function subscribe(){
32
- $list_ids=array();
33
- if(isset($_REQUEST['wysiconf'])) $list_ids= unserialize(base64_decode($_REQUEST['wysiconf']));
34
- $model_list=WYSIJA::get('list','model');
35
- $lists_names_res=$model_list->get(array('name'),array('list_id'=>$list_ids));
36
- $names=array();
37
- foreach($lists_names_res as $nameob) $names[]=$nameob['name'];
38
-
39
- $model_config=WYSIJA::get('config','model');
40
- // we need to call the translation otherwise it will not be loaded and translated
41
- $model_config->add_translated_default();
42
-
43
- $this->title=$model_config->getValue('subscribed_title');
44
- if(!isset($model_config->values['subscribed_title'])) $this->title=__('You\'ve subscribed to: %1$s',WYSIJA);
45
- $this->title=sprintf($this->title, implode(', ', $names));
46
-
47
- $this->subtitle=$model_config->getValue('subscribed_subtitle');
48
- if(!isset($model_config->values['subscribed_subtitle'])) $this->subtitle=__("Yup, we've added you to our list. You'll hear from us shortly.",WYSIJA);
49
-
50
  if(!isset($_REQUEST['demo'])){
51
- if($this->_testKeyuser()){
52
- //user is not confirmed yet
53
-
54
- if((int)$this->userData['details']['status']<1){
55
- $this->helperUser->subscribe($this->userData['details']['user_id'],true, false,$list_ids);
56
- $this->helperUser->uid=$this->userData['details']['user_id'];
57
- // send a notification to the email specified in the settings if required to
58
- if($model_config->getValue('emails_notified') && $model_config->getValue('emails_notified_when_sub')){
59
- $this->helperUser->_notify($this->userData['details']['email']);
60
- }
61
- return true;
62
- }else{
63
- if(isset($_REQUEST['wysiconf'])){
64
- $needs_subscription=false;
65
- foreach($this->userData['lists'] as $list){
66
- if(in_array($list['list_id'],$list_ids) && (int)$list['sub_date']<1){
67
- $needs_subscription=true;
68
- }
69
- }
70
-
71
- if($needs_subscription){
72
- $this->helperUser->subscribe($this->userData['details']['user_id'],true,false,$list_ids);
73
- $this->title=sprintf($model_config->getValue('subscribed_title'), implode(', ', $names));
74
- $this->subtitle=$model_config->getValue('subscribed_subtitle');
75
- // send a notification to the email specified in the settings if required to
76
- if($model_config->getValue('emails_notified') && $model_config->getValue('emails_notified_when_sub')){
77
- $this->helperUser->_notify($this->userData['details']['email'], true, $list_ids);
78
- }
79
-
80
- }else{
81
- $this->title=sprintf(__('You are already subscribed to : %1$s',WYSIJA), implode(', ', $names));
82
- }
83
- }else{
84
- $this->title=__('You are already subscribed.',WYSIJA);
85
- }
86
- return true;
87
- }
88
 
89
-
90
- }
91
  }
92
 
93
  return true;
@@ -269,7 +216,7 @@ class WYSIJA_control_front_confirm extends WYSIJA_control_front{
269
  $config=WYSIJA::get('config','model');
270
  $dbloptin=$config->getValue('confirm_dbleoptin');
271
  //1 - insert new user_list
272
- if(isset($_POST['wysija']['user_list']) && $_POST['wysija']['user_list']){
273
  $modelUL->reset();
274
  $modelUL->update(array('sub_date'=>time()),array('user_id'=>$id));
275
  foreach($_POST['wysija']['user_list']['list_id'] as $list_id){
29
  * return boolean
30
  */
31
  function subscribe(){
32
+ $helper_user = WYSIJA::get('user','helper');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  if(!isset($_REQUEST['demo'])){
34
+ $helper_user->confirm_user();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
+ if(!empty($helper_user->title)) $this->title = $helper_user->title;
37
+ if(!empty($helper_user->subtitle)) $this->subtitle = $helper_user->subtitle;
38
  }
39
 
40
  return true;
216
  $config=WYSIJA::get('config','model');
217
  $dbloptin=$config->getValue('confirm_dbleoptin');
218
  //1 - insert new user_list
219
+ if(isset($_POST['wysija']['user_list']['list_id']) && $_POST['wysija']['user_list']['list_id']){
220
  $modelUL->reset();
221
  $modelUL->update(array('sub_date'=>time()),array('user_id'=>$id));
222
  foreach($_POST['wysija']['user_list']['list_id'] as $list_id){
controllers/front/stats.php CHANGED
@@ -145,7 +145,7 @@ class WYSIJA_control_front_stats extends WYSIJA_control_front{
145
  }else{
146
  //link is not valid anymore
147
  //propose to resend the newsletter with good links ?
148
- $link=$this->subscriberClass->getResendLink($user_id,$email_id);
149
  }
150
 
151
 
145
  }else{
146
  //link is not valid anymore
147
  //propose to resend the newsletter with good links ?
148
+ $link=$this->subscriberClass->old_get_new_link_for_expired_links($user_id,$email_id);
149
  }
150
 
151
 
core/base.php CHANGED
@@ -202,15 +202,11 @@ class WYSIJA_help extends WYSIJA_object{
202
  }
203
 
204
  function register_scripts(){
205
- if(defined('WPLANG') && WPLANG!=''){
206
- $locale=explode('_',WPLANG);
207
- $wplang=$locale[0];
208
- }else{
209
- $wplang='en';
210
- }
211
 
212
- if(file_exists(WYSIJA_DIR.'js'.DS.'validate'.DS.'languages'.DS.'jquery.validationEngine-'.$wplang.'.js')){
213
- wp_register_script('wysija-validator-lang',WYSIJA_URL.'js/validate/languages/jquery.validationEngine-'.$wplang.'.js', array( 'jquery' ),WYSIJA::get_version(),true );
214
  }else{
215
  wp_register_script('wysija-validator-lang',WYSIJA_URL.'js/validate/languages/jquery.validationEngine-en.js', array( 'jquery' ),WYSIJA::get_version(),true );
216
  }
@@ -561,22 +557,38 @@ class WYSIJA extends WYSIJA_object{
561
  /**
562
  * scheduled task for sending the emails in the queue, the frequency is set in the settings
563
  */
564
- public static function croned_queue() {
565
- //create the automatic post notifications email if there is any
566
- $autoNL=WYSIJA::get('autonews','helper');
567
- $autoNL->checkPostNotif();
568
 
569
- //queue the scheduled newsletter also if there are any
570
- $autoNL->checkScheduled();
571
- $config=WYSIJA::get('config','model');
572
- if((int)$config->getValue('total_subscribers')<2000 ){
573
- $helperQ=WYSIJA::get('queue','helper');
574
- $helperQ->report=false;
 
 
 
575
  WYSIJA::log('croned_queue process',true,'cron');
576
- $helperQ->process();
577
  }
578
  }
579
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
580
 
581
  /**
582
  * everyday we make sure not to leave any trash files
@@ -740,30 +752,30 @@ class WYSIJA extends WYSIJA_object{
740
 
741
 
742
  //check first if a subscribers exists if it doesn't then let's insert it
743
- $modelC=WYSIJA::get('config','model');
744
- $modelUser=WYSIJA::get('user','model');
745
- $modelUser->getFormat=ARRAY_A; // there is one case where we were getting an object instead of an array
746
- $subscriber_exists=$modelUser->getOne(array('user_id'),array('email'=>$data->user_email));
747
- $modelUser->reset();
748
- if($subscriber_exists){
749
- $uid=$subscriber_exists['user_id'];
750
-
751
- }else{
752
- $modelUser->noCheck=true;
753
-
754
- $firstname=$data->first_name;
755
- $lastname=$data->last_name;
756
- if(!$data->first_name && !$data->last_name) $firstname=$data->display_name;
757
 
758
- $uid=$modelUser->insert(array('email'=>$data->user_email,'wpuser_id'=>$data->ID,'firstname'=>$firstname,'lastname'=>$lastname,'status'=>$modelC->getValue('confirm_dbleoptin')));
 
 
759
 
 
 
 
 
 
 
 
 
760
  }
761
 
762
- $modelUL=WYSIJA::get('user_list','model');
763
- $modelUL->insert(array('user_id'=>$uid,'list_id'=>$modelC->getValue('importwp_list_id'),'sub_date'=>time()),true);
764
 
765
- $helperUser=WYSIJA::get('user','helper');
766
- $helperUser->sendAutoNl($uid,$data,'new-user');
767
  return true;
768
  }
769
 
@@ -776,44 +788,44 @@ class WYSIJA extends WYSIJA_object{
776
  $data=get_userdata($user_id);
777
 
778
  //check first if a subscribers exists if it doesn't then let's insert it
779
- $modelUser=WYSIJA::get('user','model');
780
- $modelC=WYSIJA::get('config','model');
781
- $modelUL=WYSIJA::get('user_list','model');
782
-
783
- $subscriber_exists=$modelUser->getOne(array('user_id'),array('email'=>$data->user_email));
784
 
785
- $modelUser->reset();
786
 
787
- $firstname=$data->first_name;
788
- $lastname=$data->last_name;
789
- if(!$data->first_name && !$data->last_name) $firstname=$data->display_name;
790
 
791
  if($subscriber_exists){
792
- $uid=$subscriber_exists['user_id'];
793
 
794
- $modelUser->update(array('email'=>$data->user_email,'firstname'=>$firstname,'lastname'=>$lastname),array('wpuser_id'=>$data->ID));
795
 
796
- $result=$modelUL->getOne(false,array('user_id'=>$uid,'list_id'=>$modelC->getValue('importwp_list_id')));
797
- $modelUL->reset();
798
  if(!$result)
799
- $modelUL->insert(array('user_id'=>$uid,'list_id'=>$modelC->getValue('importwp_list_id'),'sub_date'=>time()));
800
  }else{
801
  //chck that we didnt update the email
802
- $subscriber_exists=$modelUser->getOne(false,array('wpuser_id'=>$data->ID));
803
 
804
  if($subscriber_exists){
805
- $uid=$subscriber_exists['user_id'];
806
 
807
- $modelUser->update(array('email'=>$data->user_email,'firstname'=>$firstname,'lastname'=>$lastname),array('wpuser_id'=>$data->ID));
808
 
809
- $result=$modelUL->getOne(false,array('user_id'=>$uid,'list_id'=>$modelC->getValue('importwp_list_id')));
810
- $modelUL->reset();
811
  if(!$result)
812
- $modelUL->insert(array('user_id'=>$uid,'list_id'=>$modelC->getValue('importwp_list_id'),'sub_date'=>time()));
813
  }else{
814
- $modelUser->noCheck=true;
815
- $uid=$modelUser->insert(array('email'=>$data->user_email,'wpuser_id'=>$data->ID,'firstname'=>$firstname,'lastname'=>$lastname,'status'=>$modelC->getValue('confirm_dbleoptin')));
816
- $modelUL->insert(array('user_id'=>$uid,'list_id'=>$modelC->getValue('importwp_list_id'),'sub_date'=>time()));
817
  }
818
  }
819
  return true;
@@ -824,12 +836,12 @@ class WYSIJA extends WYSIJA_object{
824
  * @param type $user_id
825
  */
826
  public static function hook_del_WP_subscriber($user_id) {
827
- $modelConf=WYSIJA::get('config','model');
828
- $modelUser=WYSIJA::get('user','model');
829
- $data=$modelUser->getOne(array('email','user_id'),array('wpuser_id'=>$user_id));
830
- $modelUser->delete(array('email'=>$data['email']));
831
- $modelUser=WYSIJA::get('user_list','model');
832
- $modelUser->delete(array('user_id'=>$data['user_id'],'list_id'=>$modelConf->getValue('importwp_list_id')));
833
  }
834
 
835
  /**
@@ -842,16 +854,16 @@ class WYSIJA extends WYSIJA_object{
842
  public static function hook_postNotification_transition($new_status, $old_status, $post) {
843
  //we run some process only if the status of the post changes from something to publish
844
  if( $new_status=='publish' && $old_status!=$new_status){
845
- $modelEmail = WYSIJA::get('email', 'model');
846
- $emails = $modelEmail->get(false, array('type' => 2, 'status' => array(1, 3, 99)));
847
  if(!empty($emails)){
848
  //we loop through all of the automatic emails
849
  foreach($emails as $key => $email) {
850
  //we will try to give birth to a child email only if the automatic newsletter is a post notification email and in immediate mode
851
  if(is_array($email) && $email['params']['autonl']['event'] === 'new-articles' && $email['params']['autonl']['when-article'] === 'immediate') {
852
  WYSIJA::log('post_transition_hook_give_birth',array('postID'=>$post->ID,'postID'=>$post->post_title,'old_status'=>$old_status,'new_status'=>$new_status),'post_notif');
853
- $modelEmail->reset();
854
- $modelEmail->give_birth($email, $post->ID);
855
  }
856
  }
857
  }
@@ -991,18 +1003,20 @@ class WYSIJA extends WYSIJA_object{
991
  * @return type an array of frequencies
992
  */
993
  public static function get_cron_frequencies(){
994
- $mConfig=WYSIJA::get('config','model');
995
- $fHelper=WYSIJA::get('forms','helper');
996
 
997
- if(is_multisite() && $mConfig->getValue('sending_method')=='network'){
998
- $sending_emails_each=$mConfig->getValue('ms_sending_emails_each');
999
  }else{
1000
- $sending_emails_each=$mConfig->getValue('sending_emails_each');
1001
  }
1002
 
1003
- $queue_frequency=$fHelper->eachValuesSec[$sending_emails_each];
1004
- $bounce_frequency=99999999999999;
1005
- if(isset($fHelper->eachValuesSec[$mConfig->getValue('bouncing_emails_each')])) $bounce_frequency=$fHelper->eachValuesSec[$mConfig->getValue('bouncing_emails_each')];
 
 
1006
  return array('queue'=>$queue_frequency,'bounce'=>$bounce_frequency,'daily'=>86400,'weekly'=>604800,'monthly'=>2419200);
1007
  }
1008
 
@@ -1010,44 +1024,52 @@ class WYSIJA extends WYSIJA_object{
1010
  * set the next cron schedule
1011
  * TODO : needs probably to make the difference of running process for the next schedule, so that there is no delay(this is only problematic on some slow servers)
1012
  * @param string $schedule
1013
- * @param int $lastsaved
1014
  * @param boolean $set_running
1015
  * @return boolean
1016
  */
1017
- public static function set_cron_schedule($schedule=false,$lastsaved=0,$set_running=false){
1018
- $cron_schedules=array();
1019
 
1020
- $start_time=$lastsaved;
1021
- if(!$start_time) $start_time=time();
1022
- $processes=WYSIJA::get_cron_frequencies();
1023
  if(!$schedule){
1024
  foreach($processes as $process => $frequency){
1025
- $next_schedule=$start_time+$frequency;
1026
- $prev_schedule=0;
1027
  if(isset($cron_schedules[$process]['running']) && $cron_schedules[$process]['running']) $prev_schedule=$cron_schedules[$process]['running'];
1028
  $cron_schedules[$process]=array(
1029
- 'next_schedule'=>$next_schedule,
1030
- 'prev_schedule'=>$prev_schedule,
1031
- 'running'=>false);
1032
  }
1033
  }else{
1034
- $cron_schedules=WYSIJA::get_cron_schedule('all');
1035
  if($set_running){
1036
- $cron_schedules[$schedule]['running']=$set_running;
1037
  }else{
1038
- $running=0;
1039
- if(isset($cron_schedules[$schedule]['running'])) $running=$cron_schedules[$schedule]['running'];
1040
- //if the process is not running or has been running for more than 15 minutes then we set the next_schedule date
1041
- if(!$running || time()>$running+900){
1042
- $next_schedule=$start_time+$processes[$schedule];
1043
- $cron_schedules[$schedule]=array(
1044
- 'next_schedule'=>$next_schedule,
1045
- 'prev_schedule'=>$running,
1046
- 'running'=>false);
 
 
 
 
 
 
 
 
1047
  }
1048
  }
1049
  }
1050
- WYSIJA::update_option('wysija_schedules',$cron_schedules,'yes');
1051
  return true;
1052
  }
1053
 
@@ -1057,50 +1079,61 @@ class WYSIJA extends WYSIJA_object{
1057
  */
1058
  public static function cron_check() {
1059
 
1060
- $cron_schedules=WYSIJA::get_cron_schedule('all');
1061
  if(empty($cron_schedules)) return;
1062
  else{
1063
- $processes=WYSIJA::get_cron_frequencies();
1064
- $updatedsched=false;
1065
- foreach($cron_schedules as $proc => &$params){
1066
- $running=0;
1067
- if(isset($params['running'])) $running=$params['running'];
 
 
1068
  //if the process has timedout we reschedule the next execution
1069
- if($running && time()>$running+900){
1070
  //WYSIJA::setInfo('error','modifying next schedule for '.$proc);
1071
- $next_schedule=time()+$processes[$proc];
 
 
 
 
 
 
1072
  $params=array(
1073
- 'next_schedule'=>$next_schedule,
1074
- 'prev_schedule'=>$running,
1075
- 'running'=>false);
1076
- $updatedsched=true;
1077
  }
1078
  }
1079
- if($updatedsched){
1080
  //WYSIJA::setInfo('error','updating scheds');
1081
- WYSIJA::update_option('wysija_schedules',$cron_schedules,'yes');
1082
  }
1083
 
1084
  }
1085
 
1086
- $timenow=time();
1087
- $processesToRun=array();
1088
- foreach($cron_schedules as $process =>$scheduled_times){
1089
- if((!$scheduled_times['running'] || (int)$scheduled_times['running']+900<$timenow) && $scheduled_times['next_schedule']<$timenow){
1090
- $processesToRun[]=$process;
 
1091
  }
1092
  }
1093
 
1094
- $model_config=WYSIJA::get('config','model');
1095
- $page_view_trigger=(int)$model_config->getValue('cron_page_hit_trigger');
1096
- if(!empty($processesToRun) && $page_view_trigger===1){
1097
  //call the cron url
1098
 
1099
- $cron_url=site_url( 'wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process='.implode(',',$processesToRun).'&silent=1';
 
 
 
 
1100
 
1101
- //TODO we should use the http class there
1102
- $hHTTP=WYSIJA::get('http','helper');
1103
- $hHTTP->request_timeout($cron_url);
1104
 
1105
  }
1106
  }
@@ -1142,7 +1175,11 @@ class WYSIJA extends WYSIJA_object{
1142
  add_action('user_register', array('WYSIJA', 'hook_add_WP_subscriber'), 1);
1143
  add_action('added_existing_user', array('WYSIJA', 'hook_add_WP_subscriber'), 1);
1144
  add_action('profile_update', array('WYSIJA', 'hook_edit_WP_subscriber'), 1);
 
1145
  add_action('delete_user', array('WYSIJA', 'hook_del_WP_subscriber'), 1);
 
 
 
1146
 
1147
  // post notif trigger
1148
  add_action('transition_post_status', array('WYSIJA', 'hook_postNotification_transition'), 1, 3);
202
  }
203
 
204
  function register_scripts(){
205
+ $helper_toolbox = WYSIJA::get('toolbox','helper');
206
+ $wp_language_code = $helper_toolbox->get_language_code();
 
 
 
 
207
 
208
+ if(file_exists(WYSIJA_DIR.'js'.DS.'validate'.DS.'languages'.DS.'jquery.validationEngine-'.$wp_language_code.'.js')){
209
+ wp_register_script('wysija-validator-lang',WYSIJA_URL.'js/validate/languages/jquery.validationEngine-'.$wp_language_code.'.js', array( 'jquery' ),WYSIJA::get_version(),true );
210
  }else{
211
  wp_register_script('wysija-validator-lang',WYSIJA_URL.'js/validate/languages/jquery.validationEngine-en.js', array( 'jquery' ),WYSIJA::get_version(),true );
212
  }
557
  /**
558
  * scheduled task for sending the emails in the queue, the frequency is set in the settings
559
  */
560
+ public static function croned_queue( $check_scheduled_newsletter = true) {
 
 
 
561
 
562
+ // check the scheduled tasks only if it's a standard WP scheduled task free only
563
+ if($check_scheduled_newsletter){
564
+ WYSIJA::check_scheduled_newsletters();
565
+ }
566
+
567
+ $model_config = WYSIJA::get('config','model');
568
+ if((int)$model_config->getValue('total_subscribers') < 2000 ){
569
+ $helper_queue = WYSIJA::get('queue','helper');
570
+ $helper_queue->report=false;
571
  WYSIJA::log('croned_queue process',true,'cron');
572
+ $helper_queue->process();
573
  }
574
  }
575
 
576
+ public static function check_scheduled_newsletters(){
577
+ $last_scheduled_check = get_option('wysija_last_scheduled_check');
578
+
579
+ // if the latest post notification check was done more than five minutes ago let's check it again
580
+ if(empty($last_scheduled_check) || ( $last_scheduled_check + 300 > time())){
581
+ // create the scheduled automatic post notifications email if there are any
582
+ $helper_autonews = WYSIJA::get('autonews','helper');
583
+ $helper_autonews->checkPostNotif();
584
+
585
+ // queue the scheduled newsletter also if there are any
586
+ $helper_autonews->checkScheduled();
587
+ WYSIJA::update_option('wysija_last_scheduled_check', time());
588
+ }
589
+
590
+ }
591
+
592
 
593
  /**
594
  * everyday we make sure not to leave any trash files
752
 
753
 
754
  //check first if a subscribers exists if it doesn't then let's insert it
755
+ $model_config=WYSIJA::get('config','model');
756
+ $model_user=WYSIJA::get('user','model');
757
+ $model_user->getFormat=ARRAY_A; // there is one case where we were getting an object instead of an array
758
+ $subscriber_exists=$model_user->getOne(array('user_id'),array('email'=>$data->user_email));
 
 
 
 
 
 
 
 
 
 
759
 
760
+ $first_name=$data->first_name;
761
+ $last_name=$data->last_name;
762
+ if(!$data->first_name && !$data->last_name) $first_name=$data->display_name;
763
 
764
+ $model_user->reset();
765
+ if($subscriber_exists){
766
+ $user_id=$subscriber_exists['user_id'];
767
+ // we need to update the current subscriber using it's id
768
+ $model_user->update(array('wpuser_id'=>$data->ID,'firstname'=>$first_name,'lastname'=>$last_name),array('user_id'=>$user_id));
769
+ }else{
770
+ $model_user->noCheck=true;
771
+ $user_id=$model_user->insert(array('email'=>$data->user_email,'wpuser_id'=>$data->ID,'firstname'=>$first_name,'lastname'=>$last_name,'status'=>$model_config->getValue('confirm_dbleoptin')));
772
  }
773
 
774
+ $model_user_list=WYSIJA::get('user_list','model');
775
+ $model_user_list->insert(array('user_id'=>$user_id,'list_id'=>$model_config->getValue('importwp_list_id'),'sub_date'=>time()),true);
776
 
777
+ $helper_user=WYSIJA::get('user','helper');
778
+ $helper_user->sendAutoNl($user_id,$data,'new-user');
779
  return true;
780
  }
781
 
788
  $data=get_userdata($user_id);
789
 
790
  //check first if a subscribers exists if it doesn't then let's insert it
791
+ $model_user=WYSIJA::get('user','model');
792
+ $model_config=WYSIJA::get('config','model');
793
+ $model_user_list=WYSIJA::get('user_list','model');
794
+ $model_user->getFormat = ARRAY_A;
795
+ $subscriber_exists=$model_user->getOne(array('user_id'),array('email'=>$data->user_email));
796
 
797
+ $model_user->reset();
798
 
799
+ $first_name=$data->first_name;
800
+ $last_name=$data->last_name;
801
+ if(!$data->first_name && !$data->last_name) $first_name=$data->display_name;
802
 
803
  if($subscriber_exists){
804
+ $user_id=$subscriber_exists['user_id'];
805
 
806
+ $model_user->update(array('wpuser_id'=>$data->ID, 'email'=>$data->user_email,'firstname'=>$first_name,'lastname'=>$last_name),array('user_id'=>$user_id));
807
 
808
+ $result=$model_user_list->getOne(false,array('user_id'=>$user_id,'list_id'=>$model_config->getValue('importwp_list_id')));
809
+ $model_user_list->reset();
810
  if(!$result)
811
+ $model_user_list->insert(array('user_id'=>$user_id,'list_id'=>$model_config->getValue('importwp_list_id'),'sub_date'=>time()));
812
  }else{
813
  //chck that we didnt update the email
814
+ $subscriber_exists=$model_user->getOne(false,array('wpuser_id'=>$data->ID));
815
 
816
  if($subscriber_exists){
817
+ $user_id=$subscriber_exists['user_id'];
818
 
819
+ $model_user->update(array('email'=>$data->user_email,'firstname'=>$first_name,'lastname'=>$last_name),array('wpuser_id'=>$data->ID));
820
 
821
+ $result=$model_user_list->getOne(false,array('user_id'=>$user_id,'list_id'=>$model_config->getValue('importwp_list_id')));
822
+ $model_user_list->reset();
823
  if(!$result)
824
+ $model_user_list->insert(array('user_id'=>$user_id,'list_id'=>$model_config->getValue('importwp_list_id'),'sub_date'=>time()));
825
  }else{
826
+ $model_user->noCheck=true;
827
+ $user_id=$model_user->insert(array('email'=>$data->user_email,'wpuser_id'=>$data->ID,'firstname'=>$first_name,'lastname'=>$last_name,'status'=>$model_config->getValue('confirm_dbleoptin')));
828
+ $model_user_list->insert(array('user_id'=>$user_id,'list_id'=>$model_config->getValue('importwp_list_id'),'sub_date'=>time()));
829
  }
830
  }
831
  return true;
836
  * @param type $user_id
837
  */
838
  public static function hook_del_WP_subscriber($user_id) {
839
+ $model_config=WYSIJA::get('config','model');
840
+ $model_user=WYSIJA::get('user','model');
841
+ $data = $model_user->getOne(array('email','user_id'),array('wpuser_id'=>$user_id));
842
+ $model_user->delete(array('email'=>$data['email']));
843
+ $model_user=WYSIJA::get('user_list','model');
844
+ $model_user->delete(array('user_id'=>$data['user_id'],'list_id'=>$model_config->getValue('importwp_list_id')));
845
  }
846
 
847
  /**
854
  public static function hook_postNotification_transition($new_status, $old_status, $post) {
855
  //we run some process only if the status of the post changes from something to publish
856
  if( $new_status=='publish' && $old_status!=$new_status){
857
+ $model_email = WYSIJA::get('email', 'model');
858
+ $emails = $model_email->get(false, array('type' => 2, 'status' => array(1, 3, 99)));
859
  if(!empty($emails)){
860
  //we loop through all of the automatic emails
861
  foreach($emails as $key => $email) {
862
  //we will try to give birth to a child email only if the automatic newsletter is a post notification email and in immediate mode
863
  if(is_array($email) && $email['params']['autonl']['event'] === 'new-articles' && $email['params']['autonl']['when-article'] === 'immediate') {
864
  WYSIJA::log('post_transition_hook_give_birth',array('postID'=>$post->ID,'postID'=>$post->post_title,'old_status'=>$old_status,'new_status'=>$new_status),'post_notif');
865
+ $model_email->reset();
866
+ $model_email->give_birth($email, $post->ID);
867
  }
868
  }
869
  }
1003
  * @return type an array of frequencies
1004
  */
1005
  public static function get_cron_frequencies(){
1006
+ $model_config = WYSIJA::get('config','model');
1007
+ $helper_forms = WYSIJA::get('forms','helper');
1008
 
1009
+ if(is_multisite() && $model_config->getValue('sending_method')=='network'){
1010
+ $sending_emails_each = $model_config->getValue('ms_sending_emails_each');
1011
  }else{
1012
+ $sending_emails_each = $model_config->getValue('sending_emails_each');
1013
  }
1014
 
1015
+ $queue_frequency = $helper_forms->eachValuesSec[$sending_emails_each];
1016
+ $bounce_frequency = 99999999999999;
1017
+ if(isset($helper_forms->eachValuesSec[$model_config->getValue('bouncing_emails_each')])){
1018
+ $bounce_frequency = $helper_forms->eachValuesSec[$model_config->getValue('bouncing_emails_each')];
1019
+ }
1020
  return array('queue'=>$queue_frequency,'bounce'=>$bounce_frequency,'daily'=>86400,'weekly'=>604800,'monthly'=>2419200);
1021
  }
1022
 
1024
  * set the next cron schedule
1025
  * TODO : needs probably to make the difference of running process for the next schedule, so that there is no delay(this is only problematic on some slow servers)
1026
  * @param string $schedule
1027
+ * @param int $last_saved
1028
  * @param boolean $set_running
1029
  * @return boolean
1030
  */
1031
+ public static function set_cron_schedule($schedule = false , $last_saved = 0 , $set_running = false){
1032
+ $cron_schedules = array();
1033
 
1034
+ $start_time = $last_saved;
1035
+ if(!$start_time) $start_time = time();
1036
+ $processes = WYSIJA::get_cron_frequencies();
1037
  if(!$schedule){
1038
  foreach($processes as $process => $frequency){
1039
+ $next_schedule = $start_time + $frequency;
1040
+ $prev_schedule = 0;
1041
  if(isset($cron_schedules[$process]['running']) && $cron_schedules[$process]['running']) $prev_schedule=$cron_schedules[$process]['running'];
1042
  $cron_schedules[$process]=array(
1043
+ 'next_schedule' => $next_schedule,
1044
+ 'prev_schedule' => $prev_schedule,
1045
+ 'running' => false);
1046
  }
1047
  }else{
1048
+ $cron_schedules = WYSIJA::get_cron_schedule('all');
1049
  if($set_running){
1050
+ $cron_schedules[$schedule]['running'] = $set_running;
1051
  }else{
1052
+ $running = 0;
1053
+ if(isset($cron_schedules[$schedule]['running'])) $running = $cron_schedules[$schedule]['running'];
1054
+ // if the process is not running or has been running for more than 15 minutes then we set the next_schedule date
1055
+ $process_frequency = $processes[$schedule];
1056
+
1057
+ if(!$running || ( time() > ($running + $process_frequency) ) ){
1058
+
1059
+ $next_schedule = $start_time + $process_frequency;
1060
+ // if the next schedule is already behind, we give it 30 seconds before it can triggers again
1061
+ if( $next_schedule < $start_time ){
1062
+ $next_schedule = $start_time + 30;
1063
+ }
1064
+
1065
+ $cron_schedules[$schedule] = array(
1066
+ 'next_schedule' => $next_schedule,
1067
+ 'prev_schedule' => $running,
1068
+ 'running' => false);
1069
  }
1070
  }
1071
  }
1072
+ WYSIJA::update_option( 'wysija_schedules' , $cron_schedules , 'yes' );
1073
  return true;
1074
  }
1075
 
1079
  */
1080
  public static function cron_check() {
1081
 
1082
+ $cron_schedules = WYSIJA::get_cron_schedule('all');
1083
  if(empty($cron_schedules)) return;
1084
  else{
1085
+ $processes = WYSIJA::get_cron_frequencies();
1086
+
1087
+ $updated_sched = false;
1088
+ foreach($cron_schedules as $schedule => &$params){
1089
+ $running = 0;
1090
+ $time_now = time();
1091
+ if(isset($params['running'])) $running = $params['running'];
1092
  //if the process has timedout we reschedule the next execution
1093
+ if($running && ( $time_now> ($running + $processes[$schedule]) ) ){
1094
  //WYSIJA::setInfo('error','modifying next schedule for '.$proc);
1095
+ $process_frequency = $processes[$schedule];
1096
+
1097
+ $next_schedule = $running + $process_frequency;
1098
+ // if the next schedule is already behind, we give it 30 seconds before it can trigger again
1099
+ if( $next_schedule < $time_now ){
1100
+ $next_schedule = $time_now + 30;
1101
+ }
1102
  $params=array(
1103
+ 'next_schedule' => $next_schedule,
1104
+ 'prev_schedule' => $running,
1105
+ 'running' => false);
1106
+ $updated_sched=true;
1107
  }
1108
  }
1109
+ if($updated_sched){
1110
  //WYSIJA::setInfo('error','updating scheds');
1111
+ WYSIJA::update_option( 'wysija_schedules' , $cron_schedules , 'yes' );
1112
  }
1113
 
1114
  }
1115
 
1116
+ $time_now = time();
1117
+ $processesToRun = array();
1118
+ foreach($cron_schedules as $schedule => $scheduled_times){
1119
+ $process_frequency = $processes[$schedule];
1120
+ if( ( !$scheduled_times['running'] || (int)$scheduled_times['running'] + $process_frequency < $time_now ) && $scheduled_times['next_schedule'] < $time_now){
1121
+ $processesToRun[] = $schedule;
1122
  }
1123
  }
1124
 
1125
+ $model_config = WYSIJA::get('config','model');
1126
+ $page_view_trigger = (int)$model_config->getValue('cron_page_hit_trigger');
1127
+ if(!empty($processesToRun) && $page_view_trigger === 1){
1128
  //call the cron url
1129
 
1130
+ $cron_url = site_url( 'wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process='.implode(',',$processesToRun).'&silent=1';
1131
+ $cron_request = apply_filters( 'cron_request', array(
1132
+ 'url' => $cron_url,
1133
+ 'args' => array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) )
1134
+ ) );
1135
 
1136
+ wp_remote_post( $cron_url, $cron_request['args'] );
 
 
1137
 
1138
  }
1139
  }
1175
  add_action('user_register', array('WYSIJA', 'hook_add_WP_subscriber'), 1);
1176
  add_action('added_existing_user', array('WYSIJA', 'hook_add_WP_subscriber'), 1);
1177
  add_action('profile_update', array('WYSIJA', 'hook_edit_WP_subscriber'), 1);
1178
+ // for standard blog
1179
  add_action('delete_user', array('WYSIJA', 'hook_del_WP_subscriber'), 1);
1180
+ // for multisite
1181
+ add_action('deleted_user', array('WYSIJA', 'hook_del_WP_subscriber'), 1);
1182
+
1183
 
1184
  // post notif trigger
1185
  add_action('transition_post_status', array('WYSIJA', 'hook_postNotification_transition'), 1, 3);
core/controller.php CHANGED
@@ -27,20 +27,20 @@ class WYSIJA_control extends WYSIJA_object{
27
  }
28
 
29
  //test for security, some actions require security some others don't
30
- if(isset($_REQUEST['_wpnonce'])){
31
  $_REQUEST['wpnonceback']=$_REQUEST['_wpnonce'];
32
 
33
  if($_REQUEST['action']=='wysija_ajax'){
34
  $actionnonce='wysija_ajax';
35
  }else{
36
  //backend case
37
- if(isset($_REQUEST['page'])){
38
  $actionnonce=$_REQUEST['page'].'-action_'.$_REQUEST['action'];
39
- if(isset($_REQUEST['id'])) $actionnonce.='-id_'.$_REQUEST['id'];
40
  //frontend case
41
- }elseif(isset($_REQUEST['controller'])){
42
  $actionnonce=$_REQUEST['controller'].'-action_'.$_REQUEST['action'];
43
- if(isset($_REQUEST['id'])) $actionnonce.='-id_'.$_REQUEST['id'];
44
  }
45
  }
46
 
@@ -49,8 +49,12 @@ class WYSIJA_control extends WYSIJA_object{
49
  //if the wp_nonce has been set up then we test it against the one here if it fails we just die
50
  $nonce=$_REQUEST['_wpnonce'];
51
 
52
- if(!function_exists('wp_verify_nonce')) include(ABSPATH.'wp-includes'.DS.'pluggable.php');
53
- if(!wp_verify_nonce($nonce, $actionnonce) ) die('Security failure during request.');
 
 
 
 
54
  }
55
  }
56
 
27
  }
28
 
29
  //test for security, some actions require security some others don't
30
+ if(!empty($_REQUEST['_wpnonce'])){
31
  $_REQUEST['wpnonceback']=$_REQUEST['_wpnonce'];
32
 
33
  if($_REQUEST['action']=='wysija_ajax'){
34
  $actionnonce='wysija_ajax';
35
  }else{
36
  //backend case
37
+ if(!empty($_REQUEST['page'])){
38
  $actionnonce=$_REQUEST['page'].'-action_'.$_REQUEST['action'];
39
+ if(!empty($_REQUEST['id'])) $actionnonce.='-id_'.$_REQUEST['id'];
40
  //frontend case
41
+ }elseif(!empty($_REQUEST['controller'])){
42
  $actionnonce=$_REQUEST['controller'].'-action_'.$_REQUEST['action'];
43
+ if(!empty($_REQUEST['id'])) $actionnonce.='-id_'.$_REQUEST['id'];
44
  }
45
  }
46
 
49
  //if the wp_nonce has been set up then we test it against the one here if it fails we just die
50
  $nonce=$_REQUEST['_wpnonce'];
51
 
52
+ if(!function_exists('wp_verify_nonce')){
53
+ include(ABSPATH.'wp-includes'.DS.'pluggable.php');
54
+ }
55
+ if(!wp_verify_nonce($nonce, $actionnonce) ){
56
+ die('Security failure during request.');
57
+ }
58
  }
59
  }
60
 
core/model.php CHANGED
@@ -25,7 +25,9 @@ class WYSIJA_model extends WYSIJA_object{
25
  var $joins=array();
26
  var $ignore = false;
27
  var $sql_error=false;
28
- var $comparisonKeys = array('equal', 'notequal', 'like', 'greater', 'less', 'greater_eq', 'less_eq');
 
 
29
 
30
  function WYSIJA_model($extensions=''){
31
  if(defined('WYSIJA_DBG') && WYSIJA_DBG>0) $this->dbg=true;
@@ -204,10 +206,19 @@ class WYSIJA_model extends WYSIJA_object{
204
  $query.=$groupBy;
205
  }
206
 
207
- if($this->dbg) $this->keepQry($query,'count');
208
 
 
 
 
 
209
  $results=$this->query('get_res',$query,$this->getFormat);
210
 
 
 
 
 
 
 
211
  if(!$results || count($results)>1) return $results;
212
  else {
213
  if($keygetcount) return $results[0][$keygetcount];
@@ -305,10 +316,15 @@ class WYSIJA_model extends WYSIJA_object{
305
  if(is_numeric($condVal) === false) $condVal = '"'.$condVal.'"';
306
  $conditions[]=$condK.' <= '.$condVal;
307
  break;
 
 
 
 
308
  }
309
  }
310
 
311
  }
 
312
  $query.=' WHERE '.implode(' AND ',$conditions);
313
  }
314
 
@@ -608,6 +624,11 @@ class WYSIJA_model extends WYSIJA_object{
608
 
609
  global $wpdb;
610
 
 
 
 
 
 
611
  if($update){
612
 
613
  if( $this->specialUpdate || isset($this->conditions['equal']) || isset($this->conditions['notequal']) || isset($this->conditions['like'])){
@@ -635,8 +656,11 @@ class WYSIJA_model extends WYSIJA_object{
635
  }
636
 
637
  }
 
 
638
  if($this->dbg){
639
- $this->keepQry();
 
640
  }
641
 
642
  if(!$resultSave){
@@ -809,7 +833,7 @@ class WYSIJA_model extends WYSIJA_object{
809
  }
810
  } else {
811
  foreach($conditions as $key => $cond) {
812
- if(!in_array($key, array('like','equal','notequal','greater','less','greater_eq','less_eq'))){
813
  if($this->colCheck && !$this->checkAreColumns($conditions)) return false;
814
  if(array_key_exists('equal', $this->conditions) === false) $this->conditions['equal'] = array();
815
  $this->conditions['equal'][$key] = $cond;
@@ -845,36 +869,51 @@ class WYSIJA_model extends WYSIJA_object{
845
  return true;
846
  }
847
 
848
- function query($query,$arg2="",$arg3=ARRAY_A){
 
 
 
 
 
 
 
 
 
 
849
  global $wpdb;
850
- $this->sql_error=false;
851
- if(!$arg2) $query=str_replace(array('[wysija]','[wp]'),array($this->getPrefix(),$wpdb->prefix),$query);
852
- else $arg2=str_replace(array('[wysija]','[wp]'),array($this->getPrefix(),$wpdb->prefix),$arg2);
 
 
 
 
 
853
 
854
  switch($query){
855
  case 'get_row':
856
- if($this->dbg) $this->keepQry($arg2,'query');
857
-
858
- $resultss=$wpdb->get_row($arg2,$arg3);
859
  $this->logError();
860
- return $resultss;
861
  break;
862
  case 'get_res':
863
- if($this->dbg) $this->keepQry($arg2,'query');
864
- $results=$wpdb->get_results($arg2,$arg3);
865
  //$this->escapeQuotesFromRes($results);
866
  $this->logError();
867
- return $results;
868
  break;
869
  default:
870
- if($this->dbg) $this->keepQry($query,'query');
871
-
872
- $result=$wpdb->query($query);
873
  $this->logError();
874
- if(substr($query, 0, 6)=='INSERT') return $wpdb->insert_id;
875
- else return $result;
876
- }
877
 
 
 
 
 
 
 
 
 
 
 
878
  }
879
 
880
  function logError(){
@@ -893,10 +932,12 @@ class WYSIJA_model extends WYSIJA_object{
893
 
894
  }
895
 
896
- function keepQry($qry=false,$from='wpdb'){
897
  global $wpdb,$wysija_queries;
898
- if($qry) $wysija_queries[]='[FROM '.$from.']'.$qry;
899
- else $wysija_queries[$from][]='[FROM '.$from.']'.$wpdb->last_query;
 
 
900
  }
901
 
902
  function getAffectedRows(){
25
  var $joins=array();
26
  var $ignore = false;
27
  var $sql_error=false;
28
+ var $comparisonKeys = array('equal', 'notequal', 'like', 'greater', 'less', 'greater_eq', 'less_eq', 'is');
29
+ var $time_start = 0;
30
+ var $query_duration = 0;
31
 
32
  function WYSIJA_model($extensions=''){
33
  if(defined('WYSIJA_DBG') && WYSIJA_DBG>0) $this->dbg=true;
206
  $query.=$groupBy;
207
  }
208
 
 
209
 
210
+ // if dbg is on we track the duration of the query
211
+ if($this->dbg){
212
+ $this->timer_start();
213
+ }
214
  $results=$this->query('get_res',$query,$this->getFormat);
215
 
216
+ // if dbg is on we track the duration of the query
217
+ if($this->dbg){
218
+ $this->timer_stop();
219
+ $this->keepQry('count');
220
+ }
221
+
222
  if(!$results || count($results)>1) return $results;
223
  else {
224
  if($keygetcount) return $results[0][$keygetcount];
316
  if(is_numeric($condVal) === false) $condVal = '"'.$condVal.'"';
317
  $conditions[]=$condK.' <= '.$condVal;
318
  break;
319
+ case 'is':
320
+
321
+ $conditions[]=$condK.' '.$condVal;
322
+ break;
323
  }
324
  }
325
 
326
  }
327
+
328
  $query.=' WHERE '.implode(' AND ',$conditions);
329
  }
330
 
624
 
625
  global $wpdb;
626
 
627
+ // if dbg is on we track the duration of the query
628
+ if($this->dbg){
629
+ $this->timer_start();
630
+ }
631
+
632
  if($update){
633
 
634
  if( $this->specialUpdate || isset($this->conditions['equal']) || isset($this->conditions['notequal']) || isset($this->conditions['like'])){
656
  }
657
 
658
  }
659
+
660
+ // if dbg is on we track the duration of the query
661
  if($this->dbg){
662
+ $this->timer_stop();
663
+ $this->keepQry('save');
664
  }
665
 
666
  if(!$resultSave){
833
  }
834
  } else {
835
  foreach($conditions as $key => $cond) {
836
+ if(!in_array($key, $this->comparisonKeys /*array('like','equal','notequal','greater','less','greater_eq','less_eq')*/)){
837
  if($this->colCheck && !$this->checkAreColumns($conditions)) return false;
838
  if(array_key_exists('equal', $this->conditions) === false) $this->conditions['equal'] = array();
839
  $this->conditions['equal'][$key] = $cond;
869
  return true;
870
  }
871
 
872
+ function timer_start() {
873
+ $this->query_duration = 0;
874
+ $this->time_start = microtime( true );
875
+ return true;
876
+ }
877
+
878
+ function timer_stop() {
879
+ $this->query_duration = ( microtime( true ) - $this->time_start );
880
+ }
881
+
882
+ function query($query,$arg2='',$arg3=ARRAY_A){
883
  global $wpdb;
884
+ $this->sql_error = false;
885
+ if(!$arg2) $query = str_replace(array('[wysija]','[wp]'),array($this->getPrefix(),$wpdb->prefix),$query);
886
+ else $arg2 = str_replace(array('[wysija]','[wp]'),array($this->getPrefix(),$wpdb->prefix),$arg2);
887
+
888
+ // if dbg is on we track the duration of the query
889
+ if($this->dbg){
890
+ $this->timer_start();
891
+ }
892
 
893
  switch($query){
894
  case 'get_row':
895
+ $result = $wpdb->get_row($arg2,$arg3);
 
 
896
  $this->logError();
 
897
  break;
898
  case 'get_res':
899
+ $result = $wpdb->get_results($arg2,$arg3);
 
900
  //$this->escapeQuotesFromRes($results);
901
  $this->logError();
 
902
  break;
903
  default:
904
+ $result = $wpdb->query($query);
 
 
905
  $this->logError();
 
 
 
906
 
907
+ // get the last insert id if it's an insert query
908
+ if(substr($query, 0, 6) == 'INSERT') $result = $wpdb->insert_id;
909
+
910
+ }
911
+ // if dbg is on we track the duration of the query
912
+ if($this->dbg){
913
+ $this->timer_stop();
914
+ $this->keepQry('query');
915
+ }
916
+ return $result;
917
  }
918
 
919
  function logError(){
932
 
933
  }
934
 
935
+ function keepQry($from='wpdb'){
936
  global $wpdb,$wysija_queries;
937
+
938
+ //if($qry) $wysija_queries['[FROM '.$from.']'] = array('duration' => $this->query_duration , 'query' => $qry);
939
+ //else
940
+ $wysija_queries[$from][] = array('duration' => $this->query_duration , 'query' => $wpdb->last_query);
941
  }
942
 
943
  function getAffectedRows(){
core/view.php CHANGED
@@ -39,7 +39,7 @@ class WYSIJA_view extends WYSIJA_object{
39
  * @global type $wysija_msg
40
  */
41
  function messages($noglobal=false){
42
- $wysija_msg=$this->getMsgs();
43
 
44
  if(isset($wysija_msg['g-updated'])) {
45
  if(!$noglobal) {
@@ -56,12 +56,22 @@ class WYSIJA_view extends WYSIJA_object{
56
  unset($wysija_msg['g-error']);
57
  }
58
 
59
- $wpnonce='<input type="hidden" value="'.wp_create_nonce("wysija_ajax").'" id="wysijax" />';
60
  if(!$wysija_msg) return '<div class="wysija-msg ajax"></div>'.$wpnonce;
61
  $html='<div class="wysija-msg">';
62
 
63
  foreach($wysija_msg as $level =>$messages){
64
- $html.='<div class="'.$level.'">';
 
 
 
 
 
 
 
 
 
 
65
  $html.='<ul>';
66
 
67
  if(count($messages)>0){
@@ -76,6 +86,7 @@ class WYSIJA_view extends WYSIJA_object{
76
  }
77
 
78
  $html.='</div><div class="wysija-msg ajax"></div>'.$wpnonce;
 
79
  return $html;
80
  }
81
 
39
  * @global type $wysija_msg
40
  */
41
  function messages($noglobal=false){
42
+ $wysija_msg = $this->getMsgs();
43
 
44
  if(isset($wysija_msg['g-updated'])) {
45
  if(!$noglobal) {
56
  unset($wysija_msg['g-error']);
57
  }
58
 
59
+ $wpnonce='<input type="hidden" value="'.wp_create_nonce('wysija_ajax').'" id="wysijax" />';
60
  if(!$wysija_msg) return '<div class="wysija-msg ajax"></div>'.$wpnonce;
61
  $html='<div class="wysija-msg">';
62
 
63
  foreach($wysija_msg as $level =>$messages){
64
+ $msg_class = '';
65
+ switch($level){
66
+ case 'updated':
67
+ $msg_class = 'notice-msg';
68
+ break;
69
+ case 'error':
70
+ $msg_class = 'error-msg';
71
+ break;
72
+ }
73
+
74
+ $html.='<div class="'.$msg_class.'">';
75
  $html.='<ul>';
76
 
77
  if(count($messages)>0){
86
  }
87
 
88
  $html.='</div><div class="wysija-msg ajax"></div>'.$wpnonce;
89
+
90
  return $html;
91
  }
92
 
css/admin-campaigns-welcome_new.css ADDED
@@ -0,0 +1 @@
 
1
+ #wysija-app .welcome_poll li{list-style:none outside none;margin:10px 0;font-size:14px;line-height:20px}#wysija-app .welcome_poll li input{margin:0 10px 0 0}#how_did_you_find_us_4_url{width:50%}#poll_result{font-weight:bold;padding-left:5px}#poll_result span.checkmark{background:url("../img/controls/icons.png") no-repeat scroll -260px -20px transparent;display:inline-block;text-indent:-9999px;width:20px}
css/admin-campaigns.css CHANGED
@@ -1 +1 @@
1
- #icon-edit-news{background:url(../img/mail-big.png) no-repeat scroll 0 8px transparent}#TB_window{display:block}.moredetails{display:none}.sending,.scheduled{background-color:#d5f0e6}.autonl.sending{background-color:#D7E6F2}#wysija-campaign .listmissing{background-color:#EFD5D5}#preview-receiver{width:230px;vertical-align:middle;margin:0 5px 0 0}.ml-submit{margin:15px 15px 0 15px}.automatic-nl{display:none}#titlediv .titlebox{font-size:1.7em;background-color:#FFFFFF;border-color:#CCCCCC;line-height:100%;outline:medium none;padding:3px 8px;width:100%}label .description{cursor:auto}.about-wrap .feature-section.three-col div{float:left;margin-right:5%;width:28%}#socials-block div{float:none;margin:5px 5px 2px 0;width:100%}.progress_bar{padding-bottom:10px}.progress_bar .bar{display:block;width:200px;height:22px;float:left;margin-right:10px;background:#eef6fc;border:1px solid #bbbbbb;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;line-height:22px;position:relative}.progress_bar .progress{display:block;background:#69b1e9;height:100%}.progress_bar .percent{height:100%;position:absolute;top:0px;left:10px}#wysija-badge{position:absolute;top:0;right:0;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,0.3);padding-top:91px;height:50px;width:173px;font-weight:bold;font-size:14px;text-align:center;margin:0 -5px;background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/wysija-badge.png") no-repeat}#review-follow{position:relative;height:177px}#review-follow div{float:left;top:0}#review-follow .review-left{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/save-the-kitten.jpg") no-repeat;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef;padding-right:10px}#review-follow h4{margin:0 !important}#review-follow .review-left.small{width:450px}#review-follow .review-left.medium{width:490px}#review-follow .review-left.large{width:540px}#review-follow .small .description{margin-top:24px}#review-follow .medium .description{margin-top:20px}#review-follow .large .description{margin-top:18px}#review-follow .review-left p{margin-left:20px}#review-follow .review-right{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow_middle.jpg") no-repeat;width:62px;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef}#review-follow .socials{margin-left:30px}#review-follow .follow-left{width:300px;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef}#review-follow .follow-right{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow_right.jpg") no-repeat;width:100px;height:175px}#review-follow .review-left .description{margin-left:146px}#review-follow .link-cat-review{height:140px;left:20px;position:absolute;top:21px;width:120px;outline:medium none}a.ctaupdate,span.ctaupdate{font-size:12px}.pds-links,.pds-totalvotes-outer{display:none !important}
1
+ #icon-edit-news{background:url(../img/mail-big.png) no-repeat scroll 0 8px transparent}#TB_window{display:block}.moredetails{display:none}.sending,.scheduled{background-color:#d5f0e6}.autonl.sending{background-color:#D7E6F2}#wysija-campaign .listmissing{background-color:#EFD5D5}#preview-receiver{width:230px;vertical-align:middle;margin:0 5px 0 0}.ml-submit{margin:15px 15px 0 15px}.automatic-nl{display:none}#titlediv .titlebox{font-size:1.7em;background-color:#FFFFFF;border-color:#CCCCCC;line-height:100%;outline:medium none;padding:3px 8px;width:100%}label .description{cursor:auto}.about-wrap .feature-section.three-col div{float:left;margin-right:5%;width:28%}#socials-block div{float:none;margin:5px 5px 2px 0;width:100%}.progress_bar{padding-bottom:10px}.progress_bar .bar{display:block;width:200px;height:22px;float:left;margin-right:10px;background:#eef6fc;border:1px solid #bbbbbb;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;line-height:22px;position:relative}.progress_bar .progress{display:block;background:#69b1e9;height:100%}.progress_bar .percent{height:100%;position:absolute;top:0px;left:10px}#wysija-badge{position:absolute;top:0;right:0;color:#fff;text-shadow:0 1px 0 rgba(0,0,0,0.3);padding-top:91px;height:50px;width:173px;font-weight:bold;font-size:14px;text-align:center;margin:0 -5px;background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/wysija-badge.png") no-repeat}#review-follow{position:relative;height:177px}#review-follow div{float:left;top:0}#review-follow .review-left{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/save-the-kitten.jpg") no-repeat;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef;padding-right:10px}#review-follow h4{margin:0 !important}#review-follow .review-left.small{width:450px}#review-follow .review-left.medium{width:490px}#review-follow .review-left.large{width:540px}#review-follow .small .description{margin-top:24px}#review-follow .medium .description{margin-top:20px}#review-follow .large .description{margin-top:18px}#review-follow .review-left p{margin-left:20px}#review-follow .review-right{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow_middle.jpg") no-repeat;width:62px;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef}#review-follow .socials{margin-left:30px}#review-follow .follow-left{width:300px;height:175px;background-color:#f8f8f8;border-top:1px solid #efefef;border-bottom:1px solid #efefef}#review-follow .follow-right{background:url("http://s-plugins.wordpress.org/wysija-newsletters/assets/update_page/arrow_right.jpg") no-repeat;width:100px;height:175px}#review-follow .review-left .description{margin-left:146px}#review-follow .link-cat-review{height:140px;left:20px;position:absolute;top:21px;width:120px;outline:medium none}a.ctaupdate,span.ctaupdate{font-size:12px}.pds-links,.pds-totalvotes-outer{display:none !important}#polldaddy_embed_0{width:680px;margin-left:-30px}span.local_time{margin-left:10px}
css/admin-config.css CHANGED
@@ -1 +1 @@
1
- #wysija-tabs a{font-size:14px}#wysija-tabs a.tab-premium{background-color:#d7e6f2;font-weight:bold}p.submit{padding:1em 1.4em 1em 0}span.title{font-size:16px;margin:0;color:#000}.choice-under15{float:right;display:block;width:360px}#wysija-settings input[type="checkbox"],#wysija-settings input[type="radio"]{margin-right:6px;vertical-align:baseline}#wysija-settings label input[type="checkbox"],#cron_page_hit_trigger-1{margin-left:0}#wysija-settings .button-secondary{margin-left:6px}#wysija-settings .form-table th{width:300px}#wysija-settings .form-table th.row{border:1px solid #AAAAAA}#warning-msg-frequency{background-color:#FFFFE0;border-color:#E6DB55}#warning-msg-frequency{border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;margin:5px 15px 2px;padding:0 0.6em}#warning-msg-frequency ul{margin:0}#mainmenu .premium{background:url(../img/ui-bg_glass_premium_1x400.png) repeat-x scroll 50% 50% #e6e6e6;border:1px solid #a9abc3}#mainmenu .premium:hover{background:url(../img/ui-bg_glass_premium_hover_1x400.png) repeat-x scroll 50% 50% #e6e6e6;border:1px solid #9c9eb2}#mainmenu .premium a{font-weight:700;color:#5d5e76}#mainmenu .premium a:hover{color:#4b4d69}#mainmenu .ui-state-active{background:white !important;border:1px solid #d8d9e6}#premium-content{margin-bottom:30px}#premium-content h2{font-size:35px;color:#4b4d69;font-family:sans-serif;font-size:2.8em;font-weight:200;line-height:1.2em;margin:0.5em}.wysija-premium-wrapper{margin:0 0 20px 0}.bulletium{font-size:16px;line-height:28px;width:676px}.bulletium a{color:#0b6373}#premium-content .left-part{float:left}#premium-content .bullet-hold{width:600px;margin:15px 30px 15px 5px}#premium-content div.feat-thumb{background:url(../img/rocket-small.png) no-repeat scroll 0 0 transparent;float:left;height:65px;margin-right:10px;width:30px;margin-top:6px}#premium-content .description{float:left;width:550px}#premium-content div.description h3{margin:5px 0 4px 0;font-family:"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size:20px;font-weight:normal;color:black}#premium-content div.description p{margin:0}#wysija-settings .form-table th.rolestitle{padding:3px 3px 3px 0;text-align:left;vertical-align:middle;width:220px}#wysija-settings .form-table th.rolestable{padding:3px;text-align:center;vertical-align:middle;width:90px;word-wrap:break-word}#wysija-settings .form-table td.rolestable{padding:6px 0;text-align:center}#wysija-settings .form-table td.title{padding:2px 0 2px 5px;text-align:left;vertical-align:middle}#wysija-settings .form-table tr.alternate{background-color:#ececec}#wysija-settings #bounce .intro{margin:10px 0 20px 10px}#wysija-settings #bounce #bounce-process-auto,#wysija-settings #bounce #bounce-connector{margin-left:0 !important}#wysija-settings #sendingmethod .methods{border-bottom:1px solid #000}#wysija-settings #sendingmethod .choice-sending-method-site{border-top:1px solid #cccccc}#wysija-settings #sendingmethod .choice-sending-method-site th,#wysija-settings #sendingmethod .choice-sending-method-site td{padding-top:18px}label.dkim{margin-right:20px}.cronleft,.cronright{float:left}.cronleft{width:20px;margin-right:10px}#cron_manual_linkname p{margin:0}.labelcheck{float:left;margin-right:15px}.linknamecboxes{float:left;width:500px}#smtp-rest-label{display:none;margin-left:10px}#wysija-settings #multisite #form-ms-config th{width:455px}#wysija-settings .msfromemail{width:180px}#wysija-settings #multisite #ms-sendingmethod th{width:300px}#wysija-settings #multisite .intro{margin:0 0 0 10px}#wysija-settings #sendingmethod .methods input,#wysija-settings #multisite .methods input{margin:0 5px 0 0;float:left}#wysija-settings #sendingmethod .methods h3,#wysija-settings #multisite .methods p.title{float:left;margin:0 !important}#wysija-settings #multisite .choice-one-for-all{display:none}#wysija-settings a.view_all{font-style:italic}#wysija-settings .cronright label{display:block;margin-bottom:10px}#wysija-settings .cronright label span{margin-left:36px}span.icon{display:block;height:20px;width:20px;cursor:pointer}.geeky-option a,.geeky-option span{float:left}.show-more-geeky-options span{background:url(../img/controls/icons.png) no-repeat -200px 0}.show-more-geeky-options:hover span{background:url(../img/controls/icons.png) no-repeat -200px -20px}.hide-geeky-options span{background:url(../img/controls/icons.png) no-repeat -220px 0}.hide-geeky-options:hover span{background:url(../img/controls/icons.png) no-repeat -220px -20px}
1
+ #wysija-tabs a{font-size:14px}#wysija-tabs a.tab-premium{background-color:#d7e6f2;font-weight:bold}p.submit{padding:1em 1.4em 1em 0}span.title{font-size:16px;margin:0;color:#000}.choice-under15{float:right;display:block;width:360px}#wysija-settings input[type="checkbox"],#wysija-settings input[type="radio"]{margin-right:6px;vertical-align:baseline}#wysija-settings label input[type="checkbox"],#cron_page_hit_trigger-1{margin-left:0}#wysija-settings .button-secondary{margin-left:6px}#wysija-settings .form-table th{width:300px}#wysija-settings .form-table th.row{border:1px solid #AAAAAA}#warning-msg-frequency{background-color:#FFFFE0;border-color:#E6DB55}#warning-msg-frequency{border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;margin:5px 15px 2px;padding:0 0.6em}#warning-msg-frequency ul{margin:0}#mainmenu .premium{background:url(../img/ui-bg_glass_premium_1x400.png) repeat-x scroll 50% 50% #e6e6e6;border:1px solid #a9abc3}#mainmenu .premium:hover{background:url(../img/ui-bg_glass_premium_hover_1x400.png) repeat-x scroll 50% 50% #e6e6e6;border:1px solid #9c9eb2}#mainmenu .premium a{font-weight:700;color:#5d5e76}#mainmenu .premium a:hover{color:#4b4d69}#mainmenu .ui-state-active{background:white !important;border:1px solid #d8d9e6}#premium-content{margin-bottom:30px}#premium-content h2{font-size:35px;color:#4b4d69;font-family:sans-serif;font-size:2.8em;font-weight:200;line-height:1.2em;margin:0.5em}.wysija-premium-wrapper{margin:0 0 20px 0}.bulletium{font-size:16px;line-height:28px;width:676px}.bulletium a{color:#0b6373}#premium-content .left-part{float:left}#premium-content .bullet-hold{width:600px;margin:15px 30px 15px 5px}#premium-content div.feat-thumb{background:url(../img/rocket-small.png) no-repeat scroll 0 0 transparent;float:left;height:65px;margin-right:10px;width:30px;margin-top:6px}#premium-content .description{float:left;width:550px}#premium-content div.description h3{margin:5px 0 4px 0;font-family:"HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue",sans-serif;font-size:20px;font-weight:normal;color:black}#premium-content div.description p{margin:0}#wysija-settings .form-table th.rolestitle{padding:3px 3px 3px 0;text-align:left;vertical-align:middle;width:220px}#wysija-settings .form-table th.rolestable{padding:3px;text-align:center;vertical-align:middle;width:90px;word-wrap:break-word}#wysija-settings .form-table td.rolestable{padding:6px 0;text-align:center}#wysija-settings .form-table td.title{padding:2px 0 2px 5px;text-align:left;vertical-align:middle}#wysija-settings .form-table tr.alternate{background-color:#ececec}#wysija-settings #bounce .intro{margin:10px 0 20px 10px}#wysija-settings #bounce #bounce-process-auto,#wysija-settings #bounce #bounce-connector{margin-left:0 !important}#wysija-settings #sendingmethod .methods{border-bottom:1px solid #000}#wysija-settings #sendingmethod .choice-sending-method-site{border-top:1px solid #cccccc}#wysija-settings #sendingmethod .choice-sending-method-site th,#wysija-settings #sendingmethod .choice-sending-method-site td{padding-top:18px}label.dkim{margin-right:20px}.cronleft,.cronright{float:left}.cronleft{width:20px;margin-right:10px}#cron_manual_linkname p{margin:0}.labelcheck{float:left;margin-right:15px}.linknamecboxes{float:left;width:500px}#smtp-rest-label{display:none;margin-left:10px}#wysija-settings #multisite #form-ms-config th{width:455px}#wysija-settings #multisite #ms-sendingmethod th{width:300px}#wysija-settings #multisite .intro{margin:0 0 0 10px}#wysija-settings #sendingmethod .methods input,#wysija-settings #multisite .methods input{margin:0 5px 0 0;float:left}#wysija-settings #sendingmethod .methods h3,#wysija-settings #multisite .methods p.title{float:left;margin:0 !important}#wysija-settings #multisite .choice-one-for-all{display:none}#wysija-settings a.view_all{font-style:italic}#wysija-settings .cronright label{display:block;margin-bottom:10px}#wysija-settings .cronright label span{margin-left:36px}span.icon{display:block;height:20px;width:20px;cursor:pointer}.geeky-option a,.geeky-option span{float:left}.show-more-geeky-options span{background:url(../img/controls/icons.png) no-repeat -200px 0}.show-more-geeky-options:hover span{background:url(../img/controls/icons.png) no-repeat -200px -20px}.hide-geeky-options span{background:url(../img/controls/icons.png) no-repeat -220px 0}.hide-geeky-options:hover span{background:url(../img/controls/icons.png) no-repeat -220px -20px}
css/admin-global.css CHANGED
@@ -1 +1 @@
1
- .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}.wysija-footer,.wysija-version{margin:0 20px 0 165px;padding-bottom:45px}.wysija-footer h2{color:#21759B;cursor:pointer}.wysija-footer h2:hover{text-decoration:underline}.wysija-version{font-size:12px;color:#777777;height:65px;border-top:1px solid #DFDFDF}.wysija-version .social-foot div{float:left;margin-right:10px}.social-foot .fb{width:80px}.wysija-version .version{float:left}.wysija-version .help{float:left;margin-left:20px}.wysija-version .social-foot .textsocial{margin-left:8px;margin-top:3px;padding-top:0}.wysija-version .social-foot{clear:both;display:inline-block;float:left;margin-top:2px;padding:6px 13px}.wysija-version .social-foot .socials div{margin-left:20px}.wysija-version .social-foot .socials{margin-left:0px}.wysija-version .social-foot .socials .fb,.wysija-version .social-foot .socials .fb div{margin-left:0px}.wysija-version .version{float:left;margin-bottom:5px}.wysija-version .socials{padding-top:9px}#hidesocials{margin-top:2px;font-size:12px}.social-foot .gplus{width:70px}#upperfoot{display:block;float:none}#wysija-app .form-table td{vertical-align:top}
1
+ .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}.wysija-footer,.wysija-version{margin:0 20px 0 165px;padding-bottom:45px}.wysija-footer h2{color:#21759B;cursor:pointer}.wysija-footer h2:hover{text-decoration:underline}.wysija-version{font-size:12px;color:#777777;height:65px;border-top:1px solid #DFDFDF}.wysija-version .social-foot div{float:left;margin-right:10px}.social-foot .fb{width:80px}.wysija-version .version{float:left}.wysija-version .help{float:left;margin-left:20px}.wysija-version .social-foot .textsocial{margin-left:8px;margin-top:3px;padding-top:0}.wysija-version .social-foot{clear:both;display:inline-block;float:left;margin-top:2px;padding:6px 13px}.wysija-version .social-foot .socials div{margin-left:20px}.wysija-version .social-foot .socials{margin-left:0px}.wysija-version .social-foot .socials .fb,.wysija-version .social-foot .socials .fb div{margin-left:0px}.wysija-version .version{float:left;margin-bottom:5px}.wysija-version .socials{padding-top:9px}#hidesocials{margin-top:2px;font-size:12px}.social-foot .gplus{width:70px}#upperfoot{display:block;float:none}#wysija-app .form-table td{vertical-align:top}#submitexport label input[type="checkbox"]{margin-left:0px !important}.toplevel_page_wysija_campaigns .ui-button-icon-only .ui-icon-closethick{left:0;top:0;background-position:-97px -130px}
css/admin.css CHANGED
@@ -1 +1 @@
1
- .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}#wysija-app .column-date{width:125px}#wysija-app .column-clic,#wysija-app .column-opened,#wysija-app .column-emails{width:80px}#wysija-app .column-list-names{width:120px}#wysija-app .menuslinks{margin:20px 0}#statscontainer{height:200px;width:400px}#wysistats1{width:400px}#wysistats1 h3{text-align:center}#wysistats2,#wysistats3{width:200px;padding:30px 0 0 20px}#wysistats3{height:200px;overflow:auto}.left{float:left}#wysistats2 ul li,#wysistats .title{font-weight:bold;font-size:14px;margin-top:0}#wysistats3 ol li{font-style:italic;font-size:10px;color:#444}#wysistats3 ol li em{font-size:11px;font-weight:bold}th.sorted,th.sortable{cursor:pointer}div#wysija-app .xdetailed-updated li,div#wysija-app .xdetailed-errors li,div#wysija-app .updated li,div#wysija-app .error li{margin:6px 0}.xdetailed-errors,.xdetailed-updated{border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;margin:5px 15px 2px;padding:0 0.6em}.xdetailed-updated{background-color:#FFFFE0;border-color:#E6DB55;color:#000;font-weight:bold;display:none}.xdetailed-errors{background-color:#FFEBE8;border-color:#888888;color:#000;display:none}label input[type="checkbox"],label input[type="radio"]{margin:0 5px 0 15px}label:first-child input[type="checkbox"],label:first-child input[type="radio"]{margin-left:0}label.title{font-weight:bold;font-size:14px}.wrap .button-secondary2{background-color:#6697BF;font-family:sans-serif;font-size:12px;color:#FFFFFF;text-decoration:none;text-shadow:0 1px 0 #777777;box-shadow:1px 1px 0 #AAAAAA;margin-left:4px;padding:3px 8px;position:relative;top:-3px;border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px}.wrap .button-secondary2:hover,.wrap .wcurrent{background-color:#1C73B5}.wrap #theme-view .button-secondary2{top:2px}.dots{margin:0 4px}#wysija-pagination{text-align:center}.tablenav .tablenav-pages a,.tablenav-pages span.current{margin:0 2px}.total-pages{padding:0px 3px}input.searchbox{width:225px}.wysija-premium img{display:none}.wysija-footer,.wysija-version{margin:0 20px 0 165px;padding-bottom:45px}.wysija-footer h2{color:#21759B;cursor:pointer}.wysija-footer h2:hover{text-decoration:underline}.wysija-version{font-size:12px;color:#777777}#TB_load,#TB_window,#TB_overlay,.ui-dialog{z-index:100000 !important}.ui-widget-overlay{z-index:9998 !important;background-image:none !important}p.label{font-size:13px}.wysija_popup_content{padding:10px 20px 0 20px}.wysija_popup_content h3{margin:0 0 20px 0}a.linkignore{color:#BC0B0B}a.linkignore:hover,a.submitsynch:hover{color:#FF0000}a.submitsynch{color:#52aa05}body{min-width:0 !important}.warning-msg{background-color:#FFFFE0;border-color:#E6DB55}.warning-msg{border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;margin:5px 15px 2px;padding:0 0.6em}.warning-msg ul{margin:0}span.warning-msg{padding:7px}a.wysija-premium-btns{background-color:#FFB30D;background:-webkit-gradient(linear, left top, left bottom, from(#fecb19), to(#ff9c00));background:-webkit-linear-gradient(#fecb19, #ff9c00);background:-moz-linear-gradient(center top, #fecb19 0%, #ff9c00 100%);background:-moz-gradient(center top, #fecb19 0%, #ff9c00 100%);border:1px solid #ff9c00;color:#ffffff;font-family:"Amaranth", Arial, sans-serif;font-style:italic;font-size:20px;font-weight:normal;letter-spacing:1px;text-decoration:none;text-shadow:0 1px 0 #434343;padding:10px 30px;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;-moz-box-shadow:0px 2px 3px rgba(0,0,0,0.3);-webkit-box-shadow:0px 2px 3px rgba(0,0,0,0.3);text-shadow:0px 2px 1px rgba(0,0,0,0.3)}a.wysija-premium-btns:hover,a.wysija-premium-btns:active{text-decoration:none !important;background:#ffd547;background:-webkit-gradient(linear, left top, left bottom, from(#ffd648), to(#ffbe38));background:-webkit-linear-gradient(#ffd648, #ffbe38);background:-moz-linear-gradient(center top, #ffd648 20%, #ffbe38 100%);background:-moz-gradient(center top, #ffd648 20%, #ffbe38 100%)}a.wysija-support{display:inline-block;text-align:center;width:auto}.about-wrap h3{padding-top:0px}.about-text{margin-bottom:1em;margin-top:0;min-height:20px}.wysija-unsubscribed-on{color:#bbb}.clear_select_all,.force_to_select_all_link{text-align:center}.clear_select_all a:hover,.force_to_select_all_link a:hover{text-decoration:underline;cursor:pointer !important}
1
+ .clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}.clearfix{display:inline-table}* html .clearfix{height:1%}.clearfix{display:block}#wysija-app .column-date{width:125px}#wysija-app .column-clic,#wysija-app .column-opened,#wysija-app .column-emails{width:80px}#wysija-app .column-list-names{width:120px}#wysija-app .menuslinks{margin:20px 0}#statscontainer{height:200px;width:400px}#wysistats1{width:400px}#wysistats1 h3{text-align:center}#wysistats2,#wysistats3{width:200px;padding:30px 0 0 20px}#wysistats3{height:200px;overflow:auto}.left{float:left}#wysistats2 ul li,#wysistats .title{font-weight:bold;font-size:14px;margin-top:0}#wysistats3 ol li{font-style:italic;font-size:10px;color:#444}#wysistats3 ol li em{font-size:11px;font-weight:bold}th.sorted,th.sortable{cursor:pointer}div#wysija-app .xdetailed-updated li,div#wysija-app .xdetailed-errors li,div#wysija-app .updated li,div#wysija-app .error li{margin:6px 0}.xdetailed-errors,.xdetailed-updated{border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;margin:5px 15px 2px;padding:0 0.6em}.xdetailed-updated{background-color:#FFFFE0;border-color:#E6DB55;color:#000;font-weight:bold;display:none}.xdetailed-errors{background-color:#FFEBE8;border-color:#888888;color:#000;display:none}label input[type="checkbox"],label input[type="radio"]{margin:0 5px 0 15px}label:first-child input[type="checkbox"],label:first-child input[type="radio"]{margin-left:0}label.title{font-weight:bold;font-size:14px}.wrap .button-secondary2{background-color:#6697BF;font-family:sans-serif;font-size:12px;color:#FFFFFF;text-decoration:none;text-shadow:0 1px 0 #777777;box-shadow:1px 1px 0 #AAAAAA;margin-left:4px;padding:3px 8px;position:relative;top:-3px;border-radius:3px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px}.wrap .button-secondary2:hover,.wrap .wcurrent{background-color:#1C73B5}.wrap #theme-view .button-secondary2{top:2px}.dots{margin:0 4px}#wysija-pagination{text-align:center}.tablenav .tablenav-pages a,.tablenav-pages span.current{margin:0 2px}.total-pages{padding:0px 3px}input.searchbox{width:225px}.wysija-premium img{display:none}.wysija-footer,.wysija-version{margin:0 20px 0 165px;padding-bottom:45px}.wysija-footer h2{color:#21759B;cursor:pointer}.wysija-footer h2:hover{text-decoration:underline}.wysija-version{font-size:12px;color:#777777}#TB_load,#TB_window,#TB_overlay,.ui-dialog{z-index:100000 !important}.ui-widget-overlay{z-index:9998 !important;background-image:none !important}p.label{font-size:13px}.wysija_popup_content{padding:10px 20px 0 20px}.wysija_popup_content h3{margin:0 0 20px 0}a.linkignore{color:#BC0B0B}a.linkignore:hover,a.submitsynch:hover{color:#FF0000}a.submitsynch{color:#52aa05}body{min-width:0 !important}.warning-msg{background-color:#FFFFE0;border-color:#E6DB55}.warning-msg{border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;margin:5px 15px 2px;padding:0 0.6em}.warning-msg ul{margin:0}span.warning-msg{padding:7px}a.wysija-premium-btns{background-color:#FFB30D;background:-webkit-gradient(linear, left top, left bottom, from(#fecb19), to(#ff9c00));background:-webkit-linear-gradient(#fecb19, #ff9c00);background:-moz-linear-gradient(center top, #fecb19 0%, #ff9c00 100%);background:-moz-gradient(center top, #fecb19 0%, #ff9c00 100%);border:1px solid #ff9c00;color:#ffffff;font-family:"Amaranth", Arial, sans-serif;font-style:italic;font-size:20px;font-weight:normal;letter-spacing:1px;text-decoration:none;text-shadow:0 1px 0 #434343;padding:10px 30px;border-radius:7px;-moz-border-radius:7px;-webkit-border-radius:7px;-moz-box-shadow:0px 2px 3px rgba(0,0,0,0.3);-webkit-box-shadow:0px 2px 3px rgba(0,0,0,0.3);text-shadow:0px 2px 1px rgba(0,0,0,0.3)}a.wysija-premium-btns:hover,a.wysija-premium-btns:active{text-decoration:none !important;background:#ffd547;background:-webkit-gradient(linear, left top, left bottom, from(#ffd648), to(#ffbe38));background:-webkit-linear-gradient(#ffd648, #ffbe38);background:-moz-linear-gradient(center top, #ffd648 20%, #ffbe38 100%);background:-moz-gradient(center top, #ffd648 20%, #ffbe38 100%)}a.wysija-support{display:inline-block;text-align:center;width:auto}.about-wrap h3{padding-top:0px}.about-text{margin-bottom:1em;margin-top:0;min-height:20px}.wysija-unsubscribed-on{color:#bbb}.clear_select_all,.force_to_select_all_link{text-align:center}.clear_select_all a:hover,.force_to_select_all_link a:hover{text-decoration:underline;cursor:pointer !important}#wysija-app .updated,#wysija-app .error{display:none}#wysija-app .notice-msg{background-color:#FFFFE0;border-color:#E6DB55}#wysija-app .error-msg{background-color:#FFEBE8;border-color:#CC0000}#wysija-app .wysija-msg .notice-msg,#wysija-app .wysija-msg .error-msg{border-radius:3px 3px 3px 3px;border-style:solid;border-width:1px;margin:5px 0 15px;padding:0 0.6em}
helpers/back.php CHANGED
@@ -30,7 +30,7 @@ class WYSIJA_help_back extends WYSIJA_help{
30
  define('WYSIJA_ITF',FALSE);
31
  }
32
 
33
- if(WYSIJA_DBG>0) include_once(WYSIJA_INC.'debug.php');
34
 
35
  if(!function_exists('dbg')) {
36
  function dbg($mixed,$exit=true){}
@@ -471,7 +471,7 @@ class WYSIJA_help_back extends WYSIJA_help{
471
  $message.=' | '.str_replace(
472
  array('[stars]','[link]','[/link]'),
473
 
474
- array('<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wysija-newsletters" >&#9733;&#9733;&#9733;&#9733;&#9733;</a>','<a target="_blank" href="http://wordpress.org/support/view/plugin-reviews/wysija-newsletters" >','</a>'),
475
 
476
  __('Add your [stars] on [link]wordpress.org[/link] and keep this plugin essentially free.',WYSIJA)
477
  );
30
  define('WYSIJA_ITF',FALSE);
31
  }
32
 
33
+ if( WYSIJA_DBG>0 ) include_once(WYSIJA_INC.'debug.php');
34
 
35
  if(!function_exists('dbg')) {
36
  function dbg($mixed,$exit=true){}
471
  $message.=' | '.str_replace(
472
  array('[stars]','[link]','[/link]'),
473
 
474
+ array('<a target="_blank" href="http://goo.gl/LVsvys" >&#9733;&#9733;&#9733;&#9733;&#9733;</a>','<a target="_blank" href="http://goo.gl/PFGphH" >','</a>'),
475
 
476
  __('Add your [stars] on [link]wordpress.org[/link] and keep this plugin essentially free.',WYSIJA)
477
  );
helpers/bounce.php CHANGED
@@ -62,7 +62,7 @@ class WYSIJA_help_bounce extends WYSIJA_help {
62
  //This method could cause a fatal error, but we will still display some messages in that case.
63
  dl($EXTENSION);
64
  $warnings = str_replace($fatalMessage, '', ob_get_clean());
65
- if (extension_loaded("imap") OR function_exists('imap_open'))
66
  return true;
67
  }
68
 
@@ -425,6 +425,7 @@ class WYSIJA_help_bounce extends WYSIJA_help {
425
  break;
426
  }
427
 
 
428
  if ($msgNB % 50 == 0){
429
  if(!$this->record_ms_bounce) $this->_sub_actions();
430
  }
@@ -936,7 +937,7 @@ class WYSIJA_help_bounce extends WYSIJA_help {
936
  // we will delete one by one all of the data from the users that need to be removed
937
  $tables = array(
938
  'user_history',
939
- 'user_url',
940
  'email_user_stat',
941
  'user_list',
942
  'queue',
@@ -1071,7 +1072,7 @@ class WYSIJA_help_bounce extends WYSIJA_help {
1071
 
1072
  $main_site_prefix=$this->subClass->get_site_prefix();
1073
  $query_insert_bounce_ms='INSERT INTO `'.$main_site_prefix.'bounce` (`email`,`site_id`,`user_id`,`email_id`,`action_taken`,`case`,`message`,`created_at`)';
1074
- $query_insert_bounce_ms.= " VALUES ('".$result_subscriber->email."','".(int)$this->_message->site_id."','".(int)$this->_message->user_id."','".(int)$this->_message->email_id."','".$action_taken."', '".$one_rule['key']."', '".$email_copy."', '".time()."')";
1075
 
1076
  $this->subClass->query($query_insert_bounce_ms);
1077
 
62
  //This method could cause a fatal error, but we will still display some messages in that case.
63
  dl($EXTENSION);
64
  $warnings = str_replace($fatalMessage, '', ob_get_clean());
65
+ if (extension_loaded('imap') OR function_exists('imap_open'))
66
  return true;
67
  }
68
 
425
  break;
426
  }
427
 
428
+
429
  if ($msgNB % 50 == 0){
430
  if(!$this->record_ms_bounce) $this->_sub_actions();
431
  }
937
  // we will delete one by one all of the data from the users that need to be removed
938
  $tables = array(
939
  'user_history',
940
+ 'email_user_url',
941
  'email_user_stat',
942
  'user_list',
943
  'queue',
1072
 
1073
  $main_site_prefix=$this->subClass->get_site_prefix();
1074
  $query_insert_bounce_ms='INSERT INTO `'.$main_site_prefix.'bounce` (`email`,`site_id`,`user_id`,`email_id`,`action_taken`,`case`,`message`,`created_at`)';
1075
+ $query_insert_bounce_ms.= " VALUES ('".$result_subscriber->email."','".(int)$this->_message->site_id."','".(int)$this->_message->user_id."','".(int)$this->_message->email_id."','".$action_taken."', '".$one_rule['key']."', '". mysql_real_escape_string($email_copy)."', '".time()."')";
1076
 
1077
  $this->subClass->query($query_insert_bounce_ms);
1078
 
helpers/cron.php CHANGED
@@ -1,146 +1,156 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
- class WYSIJA_help_cron extends WYSIJA_object{
4
- var $report=false;
5
- function WYSIJA_help_cron(){
6
-
7
- }
8
-
9
- /**
10
- * the cron tasks are being run for a certain number of processes (all queue, bounce etc..)
11
- * @return void
12
- */
13
- function run() {
14
- @ini_set('max_execution_time',0);
15
- $modelC=WYSIJA::get('config','model');
16
- $running=false;
17
- if(!$modelC->getValue('cron_manual')){
18
- return;
19
- }
20
- //get the param from where you want
21
- $report=$process=false;
22
- if(isset($_REQUEST['process']) && $_REQUEST['process']){
23
- $process=$_REQUEST['process'];
24
- }elseif(!isset($_SERVER['REQUEST_URI']) && isset($_SERVER['SHELL']) && isset($_SERVER['argv'][2]) && $_SERVER['argv'][2]){
25
- $process=$_SERVER['argv'][2];
26
- }
27
-
28
- if(isset($_REQUEST['report']) && $_REQUEST['report']){
29
- $this->report=$_REQUEST['report'];
30
- }elseif(!isset($_SERVER['REQUEST_URI']) && isset($_SERVER['SHELL']) && isset($_SERVER['argv'][3]) && $_SERVER['argv'][3]){
31
- $this->report=$_SERVER['argv'][3];
32
- }
33
-
34
- if($process){
35
- //include the needed parts of wp plus wysija
36
- if(isset($_REQUEST[WYSIJA_CRON]) || ( isset($_SERVER['argv'][1]) && $_SERVER['argv'][1]==WYSIJA_CRON )) echo '';
37
- else exit;
38
- $cron_schedules=get_option('wysija_schedules');
39
-
40
- $processes=array();
41
- if(strpos($process, ',')!==false){
42
- $processes=explode(',', $process);
43
- }else $processes[]=$process;
44
-
45
- foreach($processes as $scheduleprocess){
46
- if($scheduleprocess!='all'){
47
- $this->check_scheduled_task($cron_schedules,$scheduleprocess);
48
- }else{
49
- $allProcesses=array('queue','bounce','daily','weekly','monthly');
50
- foreach($allProcesses as $processNK){
51
- $this->check_scheduled_task($cron_schedules,$processNK);
52
- }
53
- if($this->report) echo 'processed : All<br/>';
54
- if(!isset($_REQUEST['silent'])) echo 'Wysija\'s cron is ready. Simply setup a CRON job on your server (cpanel or other) to trigger this page.';
55
- exit;
56
- }
57
- }
58
- }
59
- if(!isset($_REQUEST['silent'])) echo '"Wysija\'s cron is ready. Simply setup a CRON job on your server (cpanel or other) to trigger this page.' ;
60
- if($process) exit;
61
- }
62
-
63
- /**
64
- * check that one scheduled task is ready to be executed
65
- * @param type $cron_schedules list of recorded cron schedules
66
- * @param type $processNK what to process all, queue, bounce etc...
67
- */
68
- function check_scheduled_task($cron_schedules,$processNK){
69
- $toolboxH=WYSIJA::get('toolbox','helper');
70
- $timepassed=$timeleft=0;
71
- if($cron_schedules[$processNK]['running']){
72
- $timepassed=time()-$cron_schedules[$processNK]['running'];
73
- $timepassed=$toolboxH->duration($timepassed,true,2);
74
- }else{
75
- $timeleft=$cron_schedules[$processNK]['next_schedule']-time();
76
- $timeleft=$toolboxH->duration($timeleft,true,2);
77
- }
78
-
79
- if($cron_schedules[$processNK]['next_schedule']<time() && !$cron_schedules[$processNK]['running']){
80
- if($this->report) echo 'exec process '.$processNK.'<br/>';
81
- $this->run_scheduled_task($processNK);
82
- }else{
83
- if($this->report){
84
- if($timepassed) $texttime=' running since : '.$timepassed;
85
- else $texttime=' next run : '.$timeleft;
86
- echo 'skip process <strong>'.$processNK.'</strong>'.$texttime.'<br/>';
87
- }
88
- }
89
- }
90
-
91
- /**
92
- * run process if it's not detected as already running
93
- * @param type $process
94
- * @return type
95
- */
96
- function run_scheduled_task($process='queue'){
97
-
98
- //first let's make sure that the process asked to be run is not already running
99
- $scheduled_times=WYSIJA::get_cron_schedule($process);
100
- if(isset($scheduled_times['running']) && $scheduled_times['running'] && $scheduled_times['running']+900>time()){
101
- if($this->report) echo 'already running : '.$process.'<br/>';
102
- return;
103
- }
104
-
105
- //set schedule as running
106
- WYSIJA::set_cron_schedule($process,0,time());
107
-
108
- //execute schedule
109
- switch($process){
110
- case 'queue':
111
- //run the standard queue process
112
- WYSIJA::croned_queue($process);
113
-
114
- //if premium is activated we execute the premium cron process
115
- if(defined('WYSIJANLP')){
116
- $hPremium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
117
- $hPremium->croned_queue_process();
118
- }
119
- break;
120
- case 'bounce':
121
- //if premium is activated we launch the premium function
122
- if(defined('WYSIJANLP')){
123
- $hPremium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
124
- $hPremium->croned_bounce();
125
- }
126
- break;
127
- case 'daily':
128
- WYSIJA::croned_daily();
129
- break;
130
- case 'weekly':
131
- if(defined('WYSIJANLP')){
132
- $hPremium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
133
- $hPremium->croned_weekly();
134
- }
135
- WYSIJA::croned_weekly();
136
- break;
137
- case 'monthly':
138
- WYSIJA::croned_monthly();
139
- break;
140
- }
141
- //set next_schedule details
142
- WYSIJA::set_cron_schedule($process);
143
- if($this->report) echo 'processed : '.$process.'<br/>';
144
- }
145
-
146
- }
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('WYSIJA') or die('Restricted access');
3
+ class WYSIJA_help_cron extends WYSIJA_object{
4
+
5
+ var $report=false;
6
+
7
+ function WYSIJA_help_cron(){
8
+
9
+ }
10
+
11
+ /**
12
+ * the cron tasks are being run for a certain number of processes (all queue, bounce etc..)
13
+ * @return void
14
+ */
15
+ function run() {
16
+ @ini_set('max_execution_time',0);
17
+ $model_config = WYSIJA::get('config','model');
18
+ $running = false;
19
+ if(!$model_config->getValue('cron_manual')){
20
+ return;
21
+ }
22
+ // get the param from where you want
23
+ $report = $process = false;
24
+ if(isset($_REQUEST['process']) && $_REQUEST['process']){
25
+ $process = $_REQUEST['process'];
26
+ }elseif(!isset($_SERVER['REQUEST_URI']) && isset($_SERVER['SHELL']) && isset($_SERVER['argv'][2]) && $_SERVER['argv'][2]){
27
+ $process = $_SERVER['argv'][2];
28
+ }
29
+
30
+ if(isset($_REQUEST['report']) && $_REQUEST['report']){
31
+ $this->report = $_REQUEST['report'];
32
+ }elseif(!isset($_SERVER['REQUEST_URI']) && isset($_SERVER['SHELL']) && isset($_SERVER['argv'][3]) && $_SERVER['argv'][3]){
33
+ $this->report = $_SERVER['argv'][3];
34
+ }
35
+
36
+ if($process){
37
+ //include the needed parts of wp plus wysija
38
+ if(isset($_REQUEST[WYSIJA_CRON]) || ( isset($_SERVER['argv'][1]) && $_SERVER['argv'][1]==WYSIJA_CRON )) echo '';
39
+ else exit;
40
+ $cron_schedules = get_option('wysija_schedules');
41
+
42
+ $processes = array();
43
+ if(strpos($process, ',')!==false){
44
+ $processes = explode(',', $process);
45
+ }else $processes[] = $process;
46
+
47
+ foreach($processes as $scheduleprocess){
48
+ if($scheduleprocess!='all'){
49
+ $this->check_scheduled_task($cron_schedules,$scheduleprocess);
50
+ }else{
51
+ $allProcesses = array('queue','bounce','daily','weekly','monthly');
52
+ foreach($allProcesses as $processNK){
53
+ $this->check_scheduled_task($cron_schedules,$processNK);
54
+ }
55
+ if($this->report) echo 'processed : All<br/>';
56
+ if(!isset($_REQUEST['silent'])) echo 'Wysija\'s cron is ready. Simply setup a CRON job on your server (cpanel or other) to trigger this page.';
57
+ exit;
58
+ }
59
+ }
60
+ }
61
+ if(!isset($_REQUEST['silent'])) echo '"Wysija\'s cron is ready. Simply setup a CRON job on your server (cpanel or other) to trigger this page.' ;
62
+ if($process) exit;
63
+ }
64
+
65
+ /**
66
+ * check that one scheduled task is ready to be executed
67
+ * @param type $cron_schedules list of recorded cron schedules
68
+ * @param type $processNK what to process queue, bounce etc...
69
+ */
70
+ function check_scheduled_task($cron_schedules,$processNK){
71
+ $helper_toolbox = WYSIJA::get('toolbox','helper');
72
+ $time_passed = $time_left = 0;
73
+
74
+ // calculate the time passed processing a scheduled task
75
+ if(!empty($cron_schedules[$processNK]['running'])){
76
+ $time_passed = time()- $cron_schedules[$processNK]['running'];
77
+ $time_passed = $helper_toolbox->duration($time_passed,true,2);
78
+ }else{
79
+ $time_left = $cron_schedules[$processNK]['next_schedule'] - time();
80
+ $time_left = $helper_toolbox->duration($time_left,true,2);
81
+ }
82
+
83
+ if($cron_schedules[$processNK]['next_schedule'] < time() && !$cron_schedules[$processNK]['running']){
84
+ if($this->report) echo 'exec process '.$processNK.'<br/>';
85
+ $this->run_scheduled_task($processNK);
86
+ }else{
87
+ if($this->report){
88
+ if($time_passed) $texttime = ' running since : '.$time_passed;
89
+ else $texttime = ' next run : '.$time_left;
90
+ echo 'skip process <strong>'.$processNK.'</strong>'.$texttime.'<br/>';
91
+ }
92
+ }
93
+ }
94
+
95
+ /**
96
+ * run process if it's not detected as already running
97
+ * @param type $process
98
+ * @return type
99
+ */
100
+ function run_scheduled_task($process = 'queue'){
101
+ //first let's make sure that the process asked to be run is not already running
102
+ $scheduled_times = WYSIJA::get_cron_schedule($process);
103
+ $processes = WYSIJA::get_cron_frequencies();
104
+ $process_frequency = $processes[$process];
105
+
106
+ // check if the scheduled task is already being processed,
107
+ // we consider it timed out once the started running time plus the frequency has been passed
108
+ if(!empty($scheduled_times['running']) && ($scheduled_times['running'] + $process_frequency) > time()){
109
+ if($this->report) echo 'already running : '.$process.'<br/>';
110
+ return;
111
+ }
112
+
113
+ // set schedule as running
114
+ WYSIJA::set_cron_schedule($process,0,time());
115
+
116
+ // execute schedule
117
+ switch($process){
118
+ case 'queue':
119
+ // check if there are any scheduled newsletters ready for action
120
+ WYSIJA::check_scheduled_newsletters();
121
+
122
+ // if premium is activated we execute the premium cron process
123
+ if(defined('WYSIJANLP')){
124
+ $helper_premium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
125
+ $helper_premium->croned_queue_process();
126
+ }else{
127
+ // run the standard queue process no scheduled tasks will be check since it has already been checked above
128
+ WYSIJA::croned_queue(false);
129
+ }
130
+ break;
131
+ case 'bounce':
132
+ // if premium is activated we launch the premium function
133
+ if(defined('WYSIJANLP')){
134
+ $helper_premium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
135
+ $helper_premium->croned_bounce();
136
+ }
137
+ break;
138
+ case 'daily':
139
+ WYSIJA::croned_daily();
140
+ break;
141
+ case 'weekly':
142
+ if(defined('WYSIJANLP')){
143
+ $helper_premium = WYSIJA::get('premium', 'helper', false, WYSIJANLP);
144
+ $helper_premium->croned_weekly();
145
+ }
146
+ WYSIJA::croned_weekly();
147
+ break;
148
+ case 'monthly':
149
+ WYSIJA::croned_monthly();
150
+ break;
151
+ }
152
+ // set next_schedule details
153
+ WYSIJA::set_cron_schedule($process);
154
+ if($this->report) echo 'processed : '.$process.'<br/>';
155
+ }
156
+ }
helpers/file.php CHANGED
@@ -54,7 +54,8 @@ class WYSIJA_help_file extends WYSIJA_object{
54
  }
55
  if(!file_exists($dirname)){
56
  if(!mkdir($dirname, $mode,true)){
57
- $dirname=false;
 
58
  }
59
  chmod($dirname,$mode);
60
  }
54
  }
55
  if(!file_exists($dirname)){
56
  if(!mkdir($dirname, $mode,true)){
57
+ $this->error('Cannot create folder '.$dirname.' try to create the folder manually');
58
+ return false;
59
  }
60
  chmod($dirname,$mode);
61
  }
helpers/form_engine.php CHANGED
@@ -501,18 +501,14 @@ class WYSIJA_help_form_engine extends WYSIJA_object {
501
  break;
502
  case 'html':
503
  //need some language for the validation
504
- if(defined('WPLANG') && WPLANG!=''){
505
- $locale=explode('_',WPLANG);
506
- $wp_lang=$locale[0];
507
- }else{
508
- $wp_lang='en';
509
- }
510
 
511
  $wysija_version=WYSIJA::get_version();
512
  $scripts_to_include='<!--START Scripts : this is the script part you can add to the header of your theme-->'."\n";
513
  $scripts_to_include.='<script type="text/javascript" src="'.includes_url().'js/jquery/jquery.js'.'?ver='.$wysija_version.'"></script>'."\n";
514
- if(file_exists(WYSIJA_DIR.'js'.DS.'validate'.DS.'languages'.DS.'jquery.validationEngine-'.$wp_lang.'.js')){
515
- $scripts_to_include.='<script type="text/javascript" src="'.WYSIJA_URL.'js/validate/languages/jquery.validationEngine-'.$wp_lang.'.js'.'?ver='.$wysija_version.'"></script>'."\n";
516
  }else{
517
  $scripts_to_include.='<script type="text/javascript" src="'.WYSIJA_URL.'js/validate/languages/jquery.validationEngine-en.js'.'?ver='.$wysija_version.'"></script>'."\n";
518
  }
501
  break;
502
  case 'html':
503
  //need some language for the validation
504
+ $helper_toolbox = WYSIJA::get('toolbox','helper');
505
+ $wp_language_code = $helper_toolbox->get_language_code();
 
 
 
 
506
 
507
  $wysija_version=WYSIJA::get_version();
508
  $scripts_to_include='<!--START Scripts : this is the script part you can add to the header of your theme-->'."\n";
509
  $scripts_to_include.='<script type="text/javascript" src="'.includes_url().'js/jquery/jquery.js'.'?ver='.$wysija_version.'"></script>'."\n";
510
+ if(file_exists(WYSIJA_DIR.'js'.DS.'validate'.DS.'languages'.DS.'jquery.validationEngine-'.$wp_language_code.'.js')){
511
+ $scripts_to_include.='<script type="text/javascript" src="'.WYSIJA_URL.'js/validate/languages/jquery.validationEngine-'.$wp_language_code.'.js'.'?ver='.$wysija_version.'"></script>'."\n";
512
  }else{
513
  $scripts_to_include.='<script type="text/javascript" src="'.WYSIJA_URL.'js/validate/languages/jquery.validationEngine-en.js'.'?ver='.$wysija_version.'"></script>'."\n";
514
  }
helpers/forms.php CHANGED
@@ -25,9 +25,9 @@ class WYSIJA_help_forms{
25
  'fifteen_min'=> '900',
26
  'thirty_min'=> '1800',
27
  'hourly'=> '3600',
28
- 'two_hours'=>'7200'
29
- //'twicedaily'=> '43200',
30
- //'daily'=> '86400'
31
  );
32
  }
33
 
@@ -58,7 +58,7 @@ class WYSIJA_help_forms{
58
  unset($data['value']);
59
  }
60
 
61
- return "<textarea ".$this->setAttrib($data, $defaults).$extra.">".$val."</textarea>";
62
  }
63
 
64
 
25
  'fifteen_min'=> '900',
26
  'thirty_min'=> '1800',
27
  'hourly'=> '3600',
28
+ 'two_hours'=>'7200',
29
+ 'twicedaily'=> '43200',
30
+ 'daily'=> '86400'
31
  );
32
  }
33
 
58
  unset($data['value']);
59
  }
60
 
61
+ return '<textarea '.$this->setAttrib($data, $defaults).$extra.'>'.$val.'</textarea>';
62
  }
63
 
64
 
helpers/front.php CHANGED
@@ -1,246 +1,272 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
- /**
4
- * class managing the admin vital part to integrate
5
- */
6
- class WYSIJA_help_front extends WYSIJA_help{
7
-
8
- function WYSIJA_help_front(){
9
- parent::WYSIJA_help();
10
-
11
-
12
- /*if(defined('WYSIJA_DBG_ALL')){
13
- $config=WYSIJA::get('config','model');
14
- define('WYSIJA_DBG',(int)$config->getValue('debug_new'));
15
-
16
- if(WYSIJA_DBG>0) include_once(WYSIJA_INC.'debug.php');
17
-
18
- if(!function_exists('dbg')) {
19
- function dbg($mixed,$exit=true){}
20
- }
21
- }*/
22
- /* the controller is frontend if there is any wysija data requested */
23
-
24
- /*$config=WYSIJA::get("config","model");
25
- if($config->getValue("debug_on")) include_once(WYSIJA_INC."debug.php");*/
26
- //include_once(WYSIJA_INC."debug.php");
27
-
28
- // wysija form shortcode
29
- add_shortcode('wysija_form', array($this,'scan_form_shortcode'));
30
- // wysija total of subscribers shortcode
31
- add_shortcode('wysija_subscribers_count', array($this,'scan_subscribers_count_shortcode'));
32
-
33
- /* We try to process the least possible code */
34
- if(isset($_REQUEST['wysija-page']) || isset($_REQUEST['wysija-launch'])){
35
-
36
- if(defined('DOING_AJAX')){
37
- add_action('wp_ajax_nopriv_wysija_ajax', array($this, 'ajax'));
38
- }else{
39
- $paramscontroller=$_REQUEST['controller'];
40
- //this is an exception on one server this params stats was not accepted
41
- if($paramscontroller=='stat') $paramscontroller='stats';
42
-
43
- $this->controller=WYSIJA::get($paramscontroller,'controller');
44
- if(method_exists($this->controller, $_REQUEST['action'])){
45
- add_action('init',array($this->controller,$_REQUEST['action']));
46
- //$this->controller->$_REQUEST['action']();
47
- }else $this->error('Action does not exist.');
48
-
49
- if(isset($_REQUEST['wysija-page'])){
50
- /* set the content filter to replace the shortcode */
51
- add_filter('wp_title', array($this,'meta_page_title'));
52
- add_filter( 'the_title', array($this,'scan_title'));
53
- add_filter( 'the_content', array($this,'scan_content'),98);
54
- if(isset($_REQUEST['message_success'])){
55
- add_filter( 'the_content', array($this,'scan_content_NLform'),99 );
56
- }
57
- }
58
-
59
- if(isset($_REQUEST['wysija-page'])){
60
- /* set the content filter to replace the shortcode */
61
- add_filter('wp_title', array($this,'meta_page_title'));
62
- add_filter( 'the_title', array($this,'scan_title'));
63
- add_filter( 'the_content', array($this,'scan_content'),98);
64
- if(isset($_REQUEST['message_success'])){
65
- add_filter( 'the_content', array($this,'scan_content_NLform'),99 );
66
- }
67
- }
68
- }
69
- }else{
70
- add_filter('the_content', array($this,'scan_content_NLform'),99 );
71
- //if the comment form checkbox option is activated we add some hooks to process it
72
- $mConfig=WYSIJA::get('config','model');
73
- if($mConfig->getValue('commentform')){
74
- add_action('comment_form', array($this,'comment_form_extend'));
75
- add_action('comment_post', array($this,'comment_posted'), 60,2);
76
- }
77
-
78
- //if the register form checkbox option is activated we add some hooks to process it
79
- if($mConfig->getValue('registerform')){
80
- if(is_multisite()){
81
- add_action('signup_extra_fields', array($this,'register_form_extend'));
82
- add_filter('wpmu_validate_user_signup', array($this,'registerms_posted'), 60,3);
83
- }else{
84
- add_action('register_form', array($this,'register_form_extend'));
85
- add_action('register_post', array($this,'register_posted'), 60,3);
86
- }
87
-
88
- if(WYSIJA::is_plugin_active('buddypress/bp-loader.php')){
89
- add_action('bp_after_signup_profile_fields', array($this,'register_form_bp_extend'));
90
- add_action('bp_signup_validate', array($this,'register_bp'),60,3);
91
- }
92
- }
93
- }
94
- }
95
-
96
- function meta_page_title(){
97
- //Here I can echo the result and see that it's actually triggered
98
- return $this->controller->title;
99
- }
100
-
101
-
102
-
103
- function register_form_bp_extend(){
104
- if ( !is_user_logged_in()){
105
- $this->register_form_extend();
106
- }
107
- }
108
-
109
- function register_form_extend(){
110
- $checkbox= '<p class="wysija-after-register">';
111
- $checkbox.='<label for="wysija-box-after-register">';
112
- $checkbox.='<input type="checkbox" id="wysija-box-after-register" value="1" name="wysija[register_subscribe]">';
113
- $mConfig=WYSIJA::get('config','model');
114
- $checkbox.=$mConfig->getValue('registerform_linkname').'</label></p>';
115
-
116
- echo '<div class="register-section" id="profile-details-section-wysija"><div class="editfield">'.$checkbox.'</div></div>';
117
- }
118
-
119
-
120
- function register_bp(){
121
- global $bp;
122
-
123
- if ( !isset($bp->signup->errors) && isset($_POST['wysija']['register_subscribe']) && $_POST['wysija']['register_subscribe'] ) {
124
- $mConfig=WYSIJA::get('config','model');
125
- $userHelper=WYSIJA::get('user','helper');
126
- $data=array('user'=>array('email'=>$bp->signup->email),'user_list'=>array('list_ids'=>$mConfig->getValue('registerform_lists')));
127
- $userHelper->addSubscriber($data);
128
- }
129
- }
130
-
131
- function registerms_posted($result){
132
- if ( empty($result['errors']->errors) && isset($_POST['wysija']['register_subscribe']) && $_POST['wysija']['register_subscribe']) {
133
- $mConfig=WYSIJA::get('config','model');
134
- $userHelper=WYSIJA::get('user','helper');
135
- $data=array('user'=>array('email'=>$result['user_email']),'user_list'=>array('list_ids'=>$mConfig->getValue('registerform_lists')));
136
- $userHelper->addSubscriber($data);
137
- }
138
-
139
- return $result;
140
- }
141
-
142
- function register_posted($login,$email,$errors){
143
-
144
- if ( empty($errors->errors) && isset($_POST['wysija']['register_subscribe']) && $_POST['wysija']['register_subscribe']) {
145
- $mConfig=WYSIJA::get('config','model');
146
- $userHelper=WYSIJA::get('user','helper');
147
- $data=array('user'=>array('email'=>$email),'user_list'=>array('list_ids'=>$mConfig->getValue('registerform_lists')));
148
- $userHelper->addSubscriber($data);
149
- }
150
- }
151
-
152
-
153
- function comment_form_extend(){
154
- echo '<p class="wysija-after-comment">';
155
- echo '<label for="wysija-box-after-comment">';
156
- echo '<input type="checkbox" id="wysija-box-after-comment" value="1" name="wysija[comment_subscribe]">';
157
- $mConfig=WYSIJA::get('config','model');
158
- echo $mConfig->getValue('commentform_linkname').'</label></p>';
159
- }
160
-
161
- function comment_posted($cid,$comment){
162
- $cid = (int) $cid;
163
- if ( !is_object($comment) )
164
- $comment = get_comment($cid);
165
-
166
- //before recording the subscriber, make sure that it is not a spam comment or it needs to be approved first
167
- if($comment->comment_approved=='spam') return;
168
-
169
- if(isset($_POST['wysija']['comment_subscribe']) && $_POST['wysija']['comment_subscribe']) {
170
- if($comment->comment_approved=='0') add_comment_meta($cid, 'wysija_comment_subscribe', 1);
171
- else{
172
- $mConfig=WYSIJA::get('config','model');
173
- $userHelper=WYSIJA::get('user','helper');
174
- $data=array('user'=>array('email'=>$comment->comment_author_email,'firstname'=>$comment->comment_author),'user_list'=>array('list_ids'=>$mConfig->getValue('commentform_lists')));
175
- $userHelper->addSubscriber($data);
176
- }
177
- }
178
- }
179
-
180
- function scan_title($title){
181
- /*careful WordPress global*/
182
- global $post;
183
-
184
- if(trim($title)==trim(single_post_title( '', false )) && !empty($this->controller->title)){
185
- $post->comment_status='close';
186
- $post->post_password='';
187
- return $this->controller->title;
188
- }else{
189
- return $title;
190
- }
191
- }
192
-
193
- function scan_content($content){
194
- $wysija_content='';
195
- if(isset($this->controller->subtitle) && !empty($this->controller->subtitle)) $wysija_content=$this->controller->subtitle;
196
- return str_replace('[wysija_page]',$wysija_content,$content);
197
- }
198
-
199
- /**
200
- * this is for the new kind of shortcodes [wysija_form form="1"]
201
- * @param array $attributes
202
- * @return string html
203
- */
204
- function scan_form_shortcode($attributes) {
205
-
206
- if(isset($attributes['id']) && (int)$attributes['id']>0){
207
- $widget_data=array();
208
- $widget_data['form']=(int)$attributes['id'];
209
- $widget_data['form_type'] = 'shortcode';
210
-
211
- $widget_NL=new WYSIJA_NL_Widget(true);
212
- return $widget_NL->widget($widget_data);
213
-
214
- }
215
- return '';
216
- }
217
-
218
-
219
- /**
220
- * this is for the new kind of shortcodes [wysija_form form="1"]
221
- * @param array $attributes
222
- * @return string html
223
- */
224
- function scan_subscribers_count_shortcode($attributes) {
225
- $user = WYSIJA::get('user','model');
226
- $list_ids = !empty($attributes['list_id']) ? explode(',', $attributes['list_id']) : array();
227
- $confirmed_subscribers = !empty($attributes['confirmed_subscribers']) ? (bool)$attributes['confirmed_subscribers'] : true;
228
- return $user->countSubscribers($list_ids, $confirmed_subscribers);
229
-
230
- }
231
-
232
- function scan_content_NLform($content){
233
- preg_match_all('/\<div class="wysija-register">(.*?)\<\/div>/i',$content,$matches);
234
- if(!empty($matches[1]) && count($matches[1])>0) require_once(WYSIJA_WIDGETS.'wysija_nl.php');
235
- foreach($matches[1] as $key => $mymatch){
236
- if($mymatch){
237
- $widgetdata=unserialize(base64_decode($mymatch));
238
- $widgetNL=new WYSIJA_NL_Widget(true);
239
- $contentTABLE= $widgetNL->widget($widgetdata,$widgetdata);
240
- $content=str_replace($matches[0][$key],$contentTABLE,$content);
241
- }//endif
242
- }//endforeach
243
- return $content;
244
- }
245
-
246
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('WYSIJA') or die('Restricted access');
3
+ /**
4
+ * class managing the admin vital part to integrate
5
+ */
6
+ class WYSIJA_help_front extends WYSIJA_help{
7
+
8
+ function WYSIJA_help_front(){
9
+ parent::WYSIJA_help();
10
+
11
+
12
+ /*if(defined('WYSIJA_DBG_ALL')){
13
+ $config=WYSIJA::get('config','model');
14
+ define('WYSIJA_DBG',(int)$config->getValue('debug_new'));
15
+
16
+ if(WYSIJA_DBG>0) include_once(WYSIJA_INC.'debug.php');
17
+
18
+ if(!function_exists('dbg')) {
19
+ function dbg($mixed,$exit=true){}
20
+ }
21
+ }*/
22
+ /* the controller is frontend if there is any wysija data requested */
23
+
24
+ /*$config=WYSIJA::get("config","model");
25
+ if($config->getValue("debug_on")) include_once(WYSIJA_INC."debug.php");*/
26
+ //include_once(WYSIJA_INC."debug.php");
27
+
28
+ // wysija form shortcode
29
+ add_shortcode('wysija_form', array($this,'scan_form_shortcode'));
30
+ // wysija total of subscribers shortcode
31
+ add_shortcode('wysija_subscribers_count', array($this,'scan_subscribers_count_shortcode'));
32
+
33
+ /* We try to process the least possible code */
34
+ if(isset($_REQUEST['wysija-page']) || isset($_REQUEST['wysija-launch'])){
35
+
36
+ if(defined('DOING_AJAX')){
37
+ add_action('wp_ajax_nopriv_wysija_ajax', array($this, 'ajax'));
38
+ }else{
39
+ $paramscontroller=$_REQUEST['controller'];
40
+ //this is an exception on one server this params stats was not accepted
41
+ if($paramscontroller=='stat') $paramscontroller='stats';
42
+
43
+ $this->controller=WYSIJA::get($paramscontroller,'controller');
44
+ if(method_exists($this->controller, $_REQUEST['action'])){
45
+ add_action('init',array($this->controller,$_REQUEST['action']));
46
+ //$this->controller->$_REQUEST['action']();
47
+ }else $this->error('Action does not exist.');
48
+
49
+ if(isset($_REQUEST['wysija-page'])){
50
+ /* set the content filter to replace the shortcode */
51
+ add_filter('wp_title', array($this,'meta_page_title'));
52
+ add_filter( 'the_title', array($this,'scan_title'));
53
+ add_filter( 'the_content', array($this,'scan_content'),98);
54
+ if(isset($_REQUEST['message_success'])){
55
+ add_filter( 'the_content', array($this,'scan_content_NLform'),99 );
56
+ }
57
+ }
58
+
59
+ if(isset($_REQUEST['wysija-page'])){
60
+ /* set the content filter to replace the shortcode */
61
+ add_filter('wp_title', array($this,'meta_page_title'));
62
+ add_filter( 'the_title', array($this,'scan_title'));
63
+ add_filter( 'the_content', array($this,'scan_content'),98);
64
+ if(isset($_REQUEST['message_success'])){
65
+ add_filter( 'the_content', array($this,'scan_content_NLform'),99 );
66
+ }
67
+ }
68
+ }
69
+ }else{
70
+ add_filter('the_content', array($this,'scan_content_NLform'),99 );
71
+ //if the comment form checkbox option is activated we add some hooks to process it
72
+ $mConfig=WYSIJA::get('config','model');
73
+ if($mConfig->getValue('commentform')){
74
+ add_action('comment_form', array($this,'comment_form_extend'));
75
+ add_action('comment_post', array($this,'comment_posted'), 60,2);
76
+ }
77
+
78
+ //if the register form checkbox option is activated we add some hooks to process it
79
+ if($mConfig->getValue('registerform')){
80
+ if(is_multisite()){
81
+ add_action('signup_extra_fields', array($this,'register_form_extend'));
82
+ // we need this condition otherwise we will send two confirmation emails when on ms with buddypress
83
+ if(!WYSIJA::is_plugin_active('buddypress/bp-loader.php')){
84
+ add_filter('wpmu_validate_user_signup', array($this,'registerms_posted'), 60,3);
85
+ }
86
+
87
+ }else{
88
+ add_action('register_form', array($this,'register_form_extend'));
89
+ add_action('register_post', array($this,'register_posted'), 60,3);
90
+ }
91
+
92
+ if(WYSIJA::is_plugin_active('buddypress/bp-loader.php')){
93
+ add_action('bp_after_signup_profile_fields', array($this,'register_form_bp_extend'));
94
+ add_action('bp_signup_validate', array($this,'register_bp'),60,3);
95
+
96
+ // we can have just one activation for the wp user and the wysija confirmation when bp and multisite are activated
97
+ if(is_multisite()){
98
+ add_action('wpmu_activate_user', array($this,'wpmu_activate_user'));
99
+ }
100
+ }
101
+ }
102
+ }
103
+ }
104
+ function wpmu_activate_user($wpuser_id){
105
+ if((int)$wpuser_id>0){
106
+ $model_user = WYSIJA::get('user','model');
107
+ $result_subscriber = $model_user->getOne(false , array('wpuser_id'=>$wpuser_id));
108
+
109
+ if(!empty($result_subscriber)){
110
+ $helper_user = WYSIJA::get('user','helper');
111
+ $helper_user->confirm_user($result_subscriber['user_id']);
112
+ }
113
+ }
114
+ return true;
115
+ }
116
+
117
+ function meta_page_title(){
118
+ //Here I can echo the result and see that it's actually triggered
119
+ return $this->controller->title;
120
+ }
121
+
122
+
123
+
124
+ function register_form_bp_extend(){
125
+ if ( !is_user_logged_in()){
126
+ $this->register_form_extend();
127
+ }
128
+ }
129
+
130
+ function register_form_extend(){
131
+ $checkbox= '<p class="wysija-after-register">';
132
+ $checkbox.='<label for="wysija-box-after-register">';
133
+ $checkbox.='<input type="checkbox" id="wysija-box-after-register" value="1" name="wysija[register_subscribe]">';
134
+ $mConfig=WYSIJA::get('config','model');
135
+ $checkbox.=$mConfig->getValue('registerform_linkname').'</label></p>';
136
+
137
+ echo '<div class="register-section" id="profile-details-section-wysija"><div class="editfield">'.$checkbox.'</div></div>';
138
+ }
139
+
140
+
141
+ function register_bp(){
142
+ global $bp;
143
+
144
+ if ( !isset($bp->signup->errors) && isset($_POST['wysija']['register_subscribe']) && $_POST['wysija']['register_subscribe'] ) {
145
+ $model_config=WYSIJA::get('config','model');
146
+ $helper_user=WYSIJA::get('user','helper');
147
+ $data=array('user'=>array('email'=>$bp->signup->email),'user_list'=>array('list_ids'=>$model_config->getValue('registerform_lists')));
148
+
149
+ if(is_multisite()){
150
+ $helper_user->no_confirmation_email=true;
151
+ }
152
+
153
+ $helper_user->addSubscriber($data);
154
+ }
155
+ }
156
+
157
+ function registerms_posted($result){
158
+ if ( empty($result['errors']->errors) && isset($_POST['wysija']['register_subscribe']) && $_POST['wysija']['register_subscribe']) {
159
+ $mConfig=WYSIJA::get('config','model');
160
+ $userHelper=WYSIJA::get('user','helper');
161
+ $data=array('user'=>array('email'=>$result['user_email']),'user_list'=>array('list_ids'=>$mConfig->getValue('registerform_lists')));
162
+ $userHelper->addSubscriber($data);
163
+ }
164
+
165
+ return $result;
166
+ }
167
+
168
+ function register_posted($login,$email,$errors){
169
+
170
+ if ( empty($errors->errors) && isset($_POST['wysija']['register_subscribe']) && $_POST['wysija']['register_subscribe']) {
171
+ $mConfig=WYSIJA::get('config','model');
172
+ $userHelper=WYSIJA::get('user','helper');
173
+ $data=array('user'=>array('email'=>$email),'user_list'=>array('list_ids'=>$mConfig->getValue('registerform_lists')));
174
+ $userHelper->addSubscriber($data);
175
+ }
176
+ }
177
+
178
+
179
+ function comment_form_extend(){
180
+ echo '<p class="wysija-after-comment">';
181
+ echo '<label for="wysija-box-after-comment">';
182
+ echo '<input type="checkbox" id="wysija-box-after-comment" value="1" name="wysija[comment_subscribe]">';
183
+ $mConfig=WYSIJA::get('config','model');
184
+ echo $mConfig->getValue('commentform_linkname').'</label></p>';
185
+ }
186
+
187
+ function comment_posted($cid,$comment){
188
+ $cid = (int) $cid;
189
+ if ( !is_object($comment) )
190
+ $comment = get_comment($cid);
191
+
192
+ //before recording the subscriber, make sure that it is not a spam comment or it needs to be approved first
193
+ if($comment->comment_approved=='spam') return;
194
+
195
+ if(isset($_POST['wysija']['comment_subscribe']) && $_POST['wysija']['comment_subscribe']) {
196
+ if($comment->comment_approved=='0') add_comment_meta($cid, 'wysija_comment_subscribe', 1);
197
+ else{
198
+ $mConfig=WYSIJA::get('config','model');
199
+ $userHelper=WYSIJA::get('user','helper');
200
+ $data=array('user'=>array('email'=>$comment->comment_author_email,'firstname'=>$comment->comment_author),'user_list'=>array('list_ids'=>$mConfig->getValue('commentform_lists')));
201
+ $userHelper->addSubscriber($data);
202
+ }
203
+ }
204
+ }
205
+
206
+ function scan_title($title){
207
+ /*careful WordPress global*/
208
+ global $post;
209
+
210
+ if(trim($title)==trim(single_post_title( '', false )) && !empty($this->controller->title)){
211
+ $post->comment_status='close';
212
+ $post->post_password='';
213
+ return $this->controller->title;
214
+ }else{
215
+ return $title;
216
+ }
217
+ }
218
+
219
+ function scan_content($content){
220
+ $wysija_content='';
221
+ if(isset($this->controller->subtitle) && !empty($this->controller->subtitle)) $wysija_content=$this->controller->subtitle;
222
+ return str_replace('[wysija_page]',$wysija_content,$content);
223
+ }
224
+
225
+ /**
226
+ * this is for the new kind of shortcodes [wysija_form form="1"]
227
+ * @param array $attributes
228
+ * @return string html
229
+ */
230
+ function scan_form_shortcode($attributes) {
231
+
232
+ if(isset($attributes['id']) && (int)$attributes['id']>0){
233
+ $widget_data=array();
234
+ $widget_data['form']=(int)$attributes['id'];
235
+ $widget_data['form_type'] = 'shortcode';
236
+
237
+ $widget_NL=new WYSIJA_NL_Widget(true);
238
+ return $widget_NL->widget($widget_data);
239
+
240
+ }
241
+ return '';
242
+ }
243
+
244
+
245
+ /**
246
+ * this is for the new kind of shortcodes [wysija_form form="1"]
247
+ * @param array $attributes
248
+ * @return string html
249
+ */
250
+ function scan_subscribers_count_shortcode($attributes) {
251
+ $user = WYSIJA::get('user','model');
252
+ $list_ids = !empty($attributes['list_id']) ? explode(',', $attributes['list_id']) : array();
253
+ $confirmed_subscribers = !empty($attributes['confirmed_subscribers']) ? (bool)$attributes['confirmed_subscribers'] : true;
254
+ return $user->countSubscribers($list_ids, $confirmed_subscribers);
255
+
256
+ }
257
+
258
+ function scan_content_NLform($content){
259
+ preg_match_all('/\<div class="wysija-register">(.*?)\<\/div>/i',$content,$matches);
260
+ if(!empty($matches[1]) && count($matches[1])>0) require_once(WYSIJA_WIDGETS.'wysija_nl.php');
261
+ foreach($matches[1] as $key => $mymatch){
262
+ if($mymatch){
263
+ $widgetdata=unserialize(base64_decode($mymatch));
264
+ $widgetNL=new WYSIJA_NL_Widget(true);
265
+ $contentTABLE= $widgetNL->widget($widgetdata,$widgetdata);
266
+ $content=str_replace($matches[0][$key],$contentTABLE,$content);
267
+ }//endif
268
+ }//endforeach
269
+ return $content;
270
+ }
271
+
272
+ }
helpers/http.php CHANGED
@@ -38,6 +38,28 @@ class WYSIJA_help_http extends WYSIJA_object{
38
  }
39
  }
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  function request_timeout($url,$timeout='3'){
42
  if(function_exists('curl_init')) {
43
 
38
  }
39
  }
40
 
41
+ function wp_request($url){
42
+ global $wp_version;
43
+
44
+ $active = get_option( 'active_plugins', array() );
45
+ $to_send = (object) compact('plugins', 'active');
46
+
47
+ $options = array(
48
+ 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
49
+ 'body' => array( 'plugins' => serialize( $to_send ) ),
50
+ 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
51
+ );
52
+
53
+ $raw_response = wp_remote_post($url, $options);
54
+
55
+ if ( is_wp_error( $raw_response ) || 200 != wp_remote_retrieve_response_code( $raw_response ) ){
56
+ $this->error($raw_response->get_error_messages());
57
+ return false;
58
+ }
59
+
60
+ return maybe_unserialize( wp_remote_retrieve_body( $raw_response ) );
61
+ }
62
+
63
  function request_timeout($url,$timeout='3'){
64
  if(function_exists('curl_init')) {
65
 
helpers/import.php CHANGED
@@ -290,13 +290,13 @@ class WYSIJA_help_import extends WYSIJA_object{
290
 
291
  // in case of a multisite by default we want to import the wp users from the site on which we are running that script
292
  if(!$is_main_site){
293
- $query_select.=' INNER JOIN '.$wpdb->base_prefix.'usermeta ON ( '.$wpdb->base_prefix.$table_name.'.ID = '.$wpdb->base_prefix.'usermeta.user_id )';
294
- $query_select.=' WHERE '.$wpdb->base_prefix."usermeta.meta_key = '".$model->wpprefix."capabilities'";
295
  }
296
 
297
 
298
 
299
  $query="INSERT IGNORE INTO `[wysija]user` $fields ".$query_select;
 
300
  }else {
301
  /* query to save the external plugins subscribers into wysija subsribers*/
302
  $where=$this->generateWhere($connection_info['where']);
290
 
291
  // in case of a multisite by default we want to import the wp users from the site on which we are running that script
292
  if(!$is_main_site){
293
+ $query_select.=' JOIN '.$wpdb->base_prefix.'usermeta as m3 ON ( u1.ID = m3.user_id AND m3.meta_key = \''.$model->wpprefix.'capabilities\' )';
 
294
  }
295
 
296
 
297
 
298
  $query="INSERT IGNORE INTO `[wysija]user` $fields ".$query_select;
299
+
300
  }else {
301
  /* query to save the external plugins subscribers into wysija subsribers*/
302
  $where=$this->generateWhere($connection_info['where']);
helpers/licence.php CHANGED
@@ -6,12 +6,24 @@ defined('WYSIJA') or die('Restricted access');
6
  class WYSIJA_help_licence extends WYSIJA_help{
7
 
8
  function WYSIJA_help_licence(){
9
-
10
  parent::WYSIJA_help();
 
11
 
 
 
 
 
 
 
 
12
  }
13
 
14
- function getDomainInfo(){
 
 
 
 
 
15
  $domain_data = array();
16
 
17
  $url = admin_url('admin.php');
@@ -25,6 +37,23 @@ class WYSIJA_help_licence extends WYSIJA_help{
25
  $domain_data['url'] = $url;
26
  $domain_data['cron_url'] = site_url( 'wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process=all&silent=1';
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  return base64_encode(serialize($domain_data));
29
  }
30
 
@@ -45,11 +74,11 @@ class WYSIJA_help_licence extends WYSIJA_help{
45
  $json_result=false;
46
  }else{
47
  $helper_http = WYSIJA::get('http','helper');
48
- $json_result = $helper_http->request('http://www.wysija.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=checkDomain&data='.$domain_data);
49
  }
50
 
51
 
52
- if($json_result) {
53
  $decoded = json_decode($json_result, true);
54
 
55
  if(isset($decoded['result']) === false) {
@@ -161,10 +190,10 @@ class WYSIJA_help_licence extends WYSIJA_help{
161
  $domainData=$this->getDomainInfo();
162
  $hHTTP = WYSIJA::get('http','helper');
163
 
164
- $jsonResult = $hHTTP->request('http://www.wysija.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=checkDkimNew&data='.$domainData);
165
 
166
  //remotely connect to host
167
- if($jsonResult){
168
  $decoded=json_decode($jsonResult);
169
 
170
  $configData=array('dkim_domain'=>$dkim_domain,'dkim_privk'=>$decoded->dkim_privk,'dkim_pubk'=>$decoded->dkim_pubk->key,'dkim_1024'=>1);
6
  class WYSIJA_help_licence extends WYSIJA_help{
7
 
8
  function WYSIJA_help_licence(){
 
9
  parent::WYSIJA_help();
10
+ }
11
 
12
+ /**
13
+ *
14
+ * @param string $source
15
+ * @return string
16
+ */
17
+ function get_url_checkout($source = 'not_specified'){
18
+ return 'http://www.wysija.com/checkout/?wysijadomain='.$this->getDomainInfo(true).'&nc=1&utm_source=wpadmin&utm_campaign='.$source;
19
  }
20
 
21
+ /**
22
+ *
23
+ * @param boolean $checkout_data
24
+ * @return string
25
+ */
26
+ function getDomainInfo($checkout_data = false){
27
  $domain_data = array();
28
 
29
  $url = admin_url('admin.php');
37
  $domain_data['url'] = $url;
38
  $domain_data['cron_url'] = site_url( 'wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process=all&silent=1';
39
 
40
+ if($checkout_data){
41
+ $model_config = WYSIJA::get('config' , 'model');
42
+ if(!$model_config->getValue('poll_origin')){
43
+ $domain_data['poll_origin'] = 'unidentified';
44
+ }else{
45
+ $domain_data['poll_origin'] = $model_config->getValue('poll_origin');
46
+ $domain_data['poll_origin_url'] = $model_config->getValue('poll_origin_url');
47
+ }
48
+
49
+ $domain_data['installed_time'] = $model_config->getValue('installed_time');
50
+
51
+ $over = array(1900, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000);
52
+ foreach($over as $value_over){
53
+ if($model_config->getValue('total_subscribers') > $value_over) $domain_data['over'] = $value_over;
54
+ }
55
+ }
56
+
57
  return base64_encode(serialize($domain_data));
58
  }
59
 
74
  $json_result=false;
75
  }else{
76
  $helper_http = WYSIJA::get('http','helper');
77
+ $json_result = $helper_http->wp_request('http://www.wysija.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=checkDomain&data='.$domain_data);
78
  }
79
 
80
 
81
+ if($json_result!==false) {
82
  $decoded = json_decode($json_result, true);
83
 
84
  if(isset($decoded['result']) === false) {
190
  $domainData=$this->getDomainInfo();
191
  $hHTTP = WYSIJA::get('http','helper');
192
 
193
+ $jsonResult = $hHTTP->wp_request('http://www.wysija.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=checkDkimNew&data='.$domainData);
194
 
195
  //remotely connect to host
196
+ if($jsonResult!==false){
197
  $decoded=json_decode($jsonResult);
198
 
199
  $configData=array('dkim_domain'=>$dkim_domain,'dkim_privk'=>$decoded->dkim_privk,'dkim_pubk'=>$decoded->dkim_pubk->key,'dkim_1024'=>1);
helpers/mailer.php CHANGED
@@ -46,7 +46,13 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
46
  //override the config with the one passed as parameter above in the constructor
47
  $optionsMsOverride=array();
48
  if(!empty($config)){
49
- $optionsMsOverride=array('sending_method','sendmail_path','smtp_rest','smtp_host','smtp_port','smtp_secure','smtp_auth','smtp_login','smtp_password');
 
 
 
 
 
 
50
  //unset($this->config->values);
51
  foreach($config as $key => $val){
52
  if($multisiteTest && in_array($key, $optionsMsOverride) && isset($config['ms_'.$key])){
@@ -57,14 +63,14 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
57
  }
58
  }
59
 
60
- $is_multisite=is_multisite();
61
 
62
  //$is_multisite=true;//PROD comment that line
63
  //if we are in a multisite situation and there is one sending method set for all the sites then we just force all of the multisites settings
64
- if($is_multisite && $this->config->getValue('ms_sending_config')=='one-for-all' && ($this->config->getValue('sending_method')=='network' || $multisiteTest)){
65
 
66
  //if we use the network method or we send a test multisite email then we ovverride the from_email and the rest of the option
67
- $optionsMsOverride=array('from_email','sendmail_path','smtp_rest','smtp_host','smtp_port','smtp_secure','smtp_auth','smtp_login','smtp_password');
68
  foreach($optionsMsOverride as $key){
69
  if(isset($this->config->values['ms_'.$key])) $this->config->values[$key]=$this->config->values['ms_'.$key];
70
  }
@@ -72,7 +78,7 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
72
 
73
  // this distinction is important somehow the network sending method needs to be overriden after we pass that condfition above
74
  $sending_method = $this->config->getValue('sending_method');
75
- if(is_multisite()) $sending_method = $this->config->getValue('ms_sending_method');
76
 
77
 
78
  $this->setFrom($this->config->getValue('from_email'),$this->config->getValue('from_name'));
@@ -155,8 +161,12 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
155
  $this->WordWrap = 150;
156
 
157
  if($this->config->getValue('dkim_active') && $this->config->getValue('dkim_pubk') && !$this->isElasticRest && !$this->isSendGridRest){
158
- $this->DKIM_domain = $this->config->getValue('dkim_domain');
159
- $this->DKIM_private = trim($this->config->getValue('dkim_privk'));
 
 
 
 
160
  }
161
 
162
  $this->DKIM_selector = 'wys';
@@ -172,8 +182,8 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
172
 
173
 
174
  if(empty($this->ReplyTo)){
175
- $replyToName = $this->config->getValue('reply_name');
176
- $this->AddReplyTo($this->config->getValue('reply_email'),$replyToName);
177
  }
178
 
179
  //Embed images if there is images to embed...
@@ -802,12 +812,13 @@ class WYSIJA_help_mailer extends acymailingPHPMailer {
802
  $email->subject = $shortcodesH->replace_subject($email, $receiver);
803
  $email->body = $shortcodesH->replace_body($email, $receiver);
804
 
805
- //dbg($values_user,0);
806
  $arrayfind[]='[subscriptions_links]';
807
  if(!empty($receiver)) $subscriptions_links='<div>'.$this->subscriberClass->getUnsubLink($receiver).'</div>';
808
  else $subscriptions_links='';
809
 
810
  $arrayreplace[]=$subscriptions_links;
 
811
 
812
  if($email->email_id == $this->config->getValue('confirm_email_id')){
813
  $this->subscriberClass->reset();
46
  //override the config with the one passed as parameter above in the constructor
47
  $optionsMsOverride=array();
48
  if(!empty($config)){
49
+
50
+ $optionsMsOverride = array('sendmail_path' , 'smtp_rest' , 'smtp_host' , 'smtp_port' , 'smtp_secure' , 'smtp_auth' , 'smtp_login' , 'smtp_password');
51
+
52
+ if($this->config->getValue('sending_method') === 'network'){
53
+ $optionsMsOverride[] = 'sending_method';
54
+ }
55
+
56
  //unset($this->config->values);
57
  foreach($config as $key => $val){
58
  if($multisiteTest && in_array($key, $optionsMsOverride) && isset($config['ms_'.$key])){
63
  }
64
  }
65
 
66
+ $is_multisite = is_multisite();
67
 
68
  //$is_multisite=true;//PROD comment that line
69
  //if we are in a multisite situation and there is one sending method set for all the sites then we just force all of the multisites settings
70
+ if($is_multisite && ( ( $this->config->getValue('sending_method') == 'network' && $this->config->getValue('ms_sending_config')=='one-for-all' ) || $multisiteTest )){
71
 
72
  //if we use the network method or we send a test multisite email then we ovverride the from_email and the rest of the option
73
+ $optionsMsOverride = array( 'sending_method', 'from_email' , 'sendmail_path' , 'smtp_rest' , 'smtp_host' , 'smtp_port' , 'smtp_secure' , 'smtp_auth' , 'smtp_login' , 'smtp_password');
74
  foreach($optionsMsOverride as $key){
75
  if(isset($this->config->values['ms_'.$key])) $this->config->values[$key]=$this->config->values['ms_'.$key];
76
  }
78
 
79
  // this distinction is important somehow the network sending method needs to be overriden after we pass that condfition above
80
  $sending_method = $this->config->getValue('sending_method');
81
+ //if(is_multisite()) $sending_method = $this->config->getValue('ms_sending_method');
82
 
83
 
84
  $this->setFrom($this->config->getValue('from_email'),$this->config->getValue('from_name'));
161
  $this->WordWrap = 150;
162
 
163
  if($this->config->getValue('dkim_active') && $this->config->getValue('dkim_pubk') && !$this->isElasticRest && !$this->isSendGridRest){
164
+ if(!function_exists('openssl_sign')){
165
+ $this->error(__('You cannot use the DKIM signature option...',WYSIJA).' '.__('The PHP Extension openssl is not enabled on your server. Ask your host to enable it if you want to use an SSL connection.',WYSIJA));
166
+ }else{
167
+ $this->DKIM_domain = $this->config->getValue('dkim_domain');
168
+ $this->DKIM_private = trim($this->config->getValue('dkim_privk'));
169
+ }
170
  }
171
 
172
  $this->DKIM_selector = 'wys';
182
 
183
 
184
  if(empty($this->ReplyTo)){
185
+ $replyToName = $this->config->getValue('replyto_name');
186
+ $this->AddReplyTo($this->config->getValue('replyto_email'),$replyToName);
187
  }
188
 
189
  //Embed images if there is images to embed...
812
  $email->subject = $shortcodesH->replace_subject($email, $receiver);
813
  $email->body = $shortcodesH->replace_body($email, $receiver);
814
 
815
+ // TODO I think we can remove that subscriptions_links tag
816
  $arrayfind[]='[subscriptions_links]';
817
  if(!empty($receiver)) $subscriptions_links='<div>'.$this->subscriberClass->getUnsubLink($receiver).'</div>';
818
  else $subscriptions_links='';
819
 
820
  $arrayreplace[]=$subscriptions_links;
821
+ // end TODO
822
 
823
  if($email->email_id == $this->config->getValue('confirm_email_id')){
824
  $this->subscriberClass->reset();
helpers/package.php CHANGED
@@ -79,7 +79,8 @@ class WYSIJA_help_package extends WYSIJA_object{
79
  */
80
  function _check_request($url_check, $plugin_path, $plugin_key){
81
  $helper_http = WYSIJA::get('http','helper');
82
- $content = trim( $helper_http->request($url_check) );
 
83
 
84
  if($content && strlen($content)>2 && strlen($content)<10){
85
  $version_number = explode('.', $content);
79
  */
80
  function _check_request($url_check, $plugin_path, $plugin_key){
81
  $helper_http = WYSIJA::get('http','helper');
82
+
83
+ $content = trim( $helper_http->wp_request($url_check) );
84
 
85
  if($content && strlen($content)>2 && strlen($content)<10){
86
  $version_number = explode('.', $content);
helpers/stats.php CHANGED
@@ -53,7 +53,7 @@ class WYSIJA_help_stats extends WYSIJA_object{
53
  $html.='<h2>'.sprintf(__('Here is the list of bounced emails.',WYSIJA),$total).'</h2>';
54
 
55
  foreach($details as $email){
56
- $html.='<h4>'.$email['email'].'</h4>';
57
  }
58
  }
59
  $html.='<p>'.__('Cheers, your Wysija Newsletter Plugin',WYSIJA).'</p>';
@@ -105,19 +105,4 @@ class WYSIJA_help_stats extends WYSIJA_object{
105
  return $data;
106
  }
107
 
108
- function share(){
109
- $data=$this->getDomainStats();
110
-
111
- if(!$js) {
112
- WYSIJA::update_option('wysijey',$data);
113
- }
114
- $res['domain_name']=$data;
115
- $res['nocontact']=false;
116
-
117
- $httpHelp=WYSIJA::get('http','helper');
118
- $jsonResult = $httpHelp->request('http://www.wysija.com/?wysijap=checkout&wysijashop-page=1&controller=customer&action=shareData&data='.$data);
119
- if($jsonResult){
120
-
121
- }
122
- }
123
  }
53
  $html.='<h2>'.sprintf(__('Here is the list of bounced emails.',WYSIJA),$total).'</h2>';
54
 
55
  foreach($details as $email){
56
+ $html.='<p>'.$email['email'].'</p>';
57
  }
58
  }
59
  $html.='<p>'.__('Cheers, your Wysija Newsletter Plugin',WYSIJA).'</p>';
105
  return $data;
106
  }
107
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
helpers/toolbox.php CHANGED
@@ -1,319 +1,364 @@
1
- <?php
2
- defined('WYSIJA') or die('Restricted access');
3
- class WYSIJA_help_toolbox extends WYSIJA_object{
4
-
5
- function WYSIJA_help_toolbox(){
6
-
7
- }
8
-
9
-
10
- /**
11
- * make a temporary file
12
- * @param type $content
13
- * @param type $key
14
- * @param type $format
15
- * @return type
16
- */
17
- function temp($content,$key='temp',$format='.tmp'){
18
- $helperF=WYSIJA::get('file','helper');
19
- $tempDir=$helperF->makeDir();
20
-
21
-
22
- $filename=$key.'-'.time().$format;
23
- $handle=fopen($tempDir.$filename, 'w');
24
- fwrite($handle, $content);
25
- fclose($handle);
26
-
27
- return array('path'=>$tempDir.$filename,'name'=>$filename, 'url'=>$this->url($filename,'temp'));
28
- }
29
-
30
- /**
31
- * Get the url of a wysija file based on the filename and the wysija folder
32
- * @param type $filename
33
- * @param type $folder
34
- * @return string
35
- */
36
- function url($filename,$folder='temp'){
37
- $upload_dir = wp_upload_dir();
38
-
39
- if(file_exists($upload_dir['basedir'].DS.'wysija')){
40
- $url=$upload_dir['baseurl'].'/wysija/'.$folder.'/'.$filename;
41
- }else{
42
- $url=$upload_dir['baseurl'].'/'.$filename;
43
- }
44
- return $url;
45
- }
46
-
47
- /**
48
- * send file to be downloaded
49
- * @param type $path
50
- */
51
- function send($path){
52
- /* submit the file to the admin */
53
- if(file_exists($path)){
54
- header('Content-type: application/csv');
55
- header('Content-Disposition: attachment; filename="export_wysija.csv"');
56
- readfile($path);
57
- exit();
58
- }else $this->error(__('Yikes! We couldn\'t export. Make sure that your folder permissions for /wp-content/uploads/wysija/temp is set to 755.',WYSIJA),true);
59
-
60
- }
61
-
62
- /**
63
- * clear upload folders from things we don't need anymore
64
- */
65
- function clear(){
66
- $foldersToclear=array('import','temp');
67
- $filenameRemoval=array('import-','export-');
68
- $deleted=array();
69
- $helperF=WYSIJA::get('file','helper');
70
- foreach($foldersToclear as $folder){
71
- $path=$helperF->getUploadDir($folder);
72
- /* get a list of files from this folder and clear them */
73
-
74
- $files = scandir($path);
75
- foreach($files as $filename){
76
- if(!in_array($filename, array('.','..','.DS_Store','Thumbs.db'))){
77
- if(preg_match('/('.implode($filenameRemoval,'|').')[0-9]*\.csv/',$filename,$match)){
78
- $deleted[]=$path.$filename;
79
- }
80
- }
81
- }
82
- }
83
- foreach($deleted as $filename){
84
- if(file_exists($filename)){
85
- unlink($filename);
86
- }
87
- }
88
-
89
- }
90
-
91
- function closetags($html) {
92
- #put all opened tags into an array
93
- preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);
94
- $openedtags = $result[1]; #put all closed tags into an array
95
- preg_match_all('#</([a-z]+)>#iU', $html, $result);
96
- $closedtags = $result[1];
97
- $len_opened = count($openedtags);
98
- # all tags are closed
99
- if(count($closedtags) === $len_opened) {
100
- return $html;
101
- }
102
-
103
- $openedtags = array_reverse($openedtags);
104
- # close tags
105
- for($i=0; $i < $len_opened; $i++) {
106
- if(!in_array($openedtags[$i], $closedtags)){
107
- $html .= '</'.$openedtags[$i].'>';
108
- } else {
109
- unset($closedtags[array_search($openedtags[$i], $closedtags)]);
110
- }
111
- }
112
- return $html;
113
- }
114
-
115
- /**
116
- * make an excerpt with a certain number of words
117
- * @param type $text
118
- * @param type $num_words
119
- * @param type $more
120
- * @return type
121
- */
122
- function excerpt($text,$num_words=8,$more=' ...'){
123
-
124
- $words_array = preg_split('/[\r\t ]+/', $text, $num_words + 1, PREG_SPLIT_NO_EMPTY);
125
- if(count($words_array) > $num_words) {
126
- array_pop($words_array);
127
- $text = implode(' ', $words_array);
128
- $text = $text . $more;
129
- } else {
130
- $text = implode( ' ', $words_array );
131
- }
132
-
133
- return $this->closetags($text);
134
- }
135
-
136
- /**
137
- * make a domain name out of a url
138
- * @param type $url
139
- * @return type
140
- */
141
- function _make_domain_name($url=false){
142
- if(!$url) $url=admin_url('admin.php');
143
-
144
- $domain_name=str_replace(array('https://','http://','www.'),'',strtolower($url));
145
- //$domain_name=preg_replace(array('#^https?://(www\.)*#i','#^www\.#'),'',$url);
146
- $domain_name=explode('/',$domain_name);
147
- return $domain_name[0];
148
- }
149
-
150
- /**
151
- * creates a duration string to tell when is the next batch to be processed for instance
152
- * @param type $s
153
- * @param type $durationin
154
- * @param type $level
155
- * @return string
156
- */
157
- function duration($s,$durationin=false,$level=1){
158
- $t=time();
159
- if($durationin){
160
- $e=$t+$s;
161
- $s=$t;
162
- //Find out the seconds between each dates
163
- $timestamp = $e - $s;
164
- }else{
165
- $timestamp = $t - $s;
166
- }
167
-
168
- //Clever Maths
169
- $years=floor($timestamp/(60*60*24*365));$timestamp%=60*60*24*365;
170
- $weeks=floor($timestamp/(60*60*24*7));$timestamp%=60*60*24*7;
171
- $days=floor($timestamp/(60*60*24));$timestamp%=60*60*24;
172
- $hrs=floor($timestamp/(60*60));$timestamp%=60*60;
173
- $mins=floor($timestamp/60);
174
- if($timestamp>60)$secs=$timestamp%60;
175
- else $secs=$timestamp;
176
-
177
-
178
- //Display for date, can be modified more to take the S off
179
- $str='';
180
- $mylevel=0;
181
- if ($mylevel<$level && $years >= 1) { $str.= sprintf(_n( '%1$s year', '%1$s years', $years, WYSIJA ),$years).' ';$mylevel++; }
182
- if ($mylevel<$level && $weeks >= 1) { $str.= sprintf(_n( '%1$s week', '%1$s weeks', $weeks, WYSIJA ),$weeks).' ';$mylevel++; }
183
- if ($mylevel<$level && $days >= 1) { $str.=sprintf(_n( '%1$s day', '%1$s days', $days, WYSIJA ),$days).' ';$mylevel++; }
184
- if ($mylevel<$level && $hrs >= 1) { $str.=sprintf(_n( '%1$s hour', '%1$s hours', $hrs, WYSIJA ),$hrs).' ';$mylevel++; }
185
- if ($mylevel<$level && $mins >= 1) { $str.=sprintf(_n( '%1$s minute', '%1$s minutes', $mins, WYSIJA ),$mins).' ';$mylevel++; }
186
- if ($mylevel<$level && $secs >= 1) { $str.=sprintf(_n( '%1$s second', '%1$s seconds', $secs, WYSIJA ),$secs).' ';$mylevel++; }
187
-
188
- return $str;
189
-
190
- }
191
-
192
- /**
193
- *
194
- * @param type $time
195
- * @param type $justtime
196
- * @return type
197
- */
198
- function localtime($time,$justtime=false){
199
- if($justtime) $time=strtotime($time);
200
- return date(get_option('time_format'),$time);
201
- }
202
-
203
- /**
204
- * return the offseted time formated(used in post notifications)
205
- * @param type $val
206
- * @return string
207
- */
208
- function time_tzed($val=false){
209
- return gmdate( 'Y-m-d H:i:s', $this->servertime_to_localtime($val) );
210
- }
211
-
212
- /**
213
- * specify a unix server time int and it will convert it to the local time if you don't specify any unixTime value it will convert the current time
214
- * @param type $unixTime
215
- * @return int
216
- */
217
- function servertime_to_localtime($unixTime=false){
218
-
219
- //this should get GMT-0 time in int date('Z') is the server's time offset compared to GMT-0
220
- $current_server_time = time();
221
- $gmt_time = $current_server_time - date('Z');
222
-
223
- //this is the local time on this site : current time at GMT-0 + the offset chosen in WP settings
224
- $current_local_time = $gmt_time + ( get_option( 'gmt_offset' ) * 3600 );
225
-
226
- if(!$unixTime) return $current_local_time;
227
- else{
228
- //if we've specified a time value in the function, we calculate the difference between the current servertime and the offseted current time
229
- $time_difference = $current_local_time - $current_server_time;
230
- //unix time was recorded non offseted so it's the server's time we add the timedifference to it to get the local time
231
- return $unixTime + $time_difference;
232
- }
233
- }
234
-
235
- /**
236
- * specify a local time int and we will convert it to the server time
237
- * mostly used with values produced with strtotime() strtotime converts Monday 5pm to the server time's 5pm
238
- * and if we want to get Monday 5pm of the local time in the server time we need to do a conversion of that value from local to server
239
- * @param int $server_time time value recorded in the past using time() or strtotime()
240
- * @return int
241
- */
242
- function localtime_to_servertime($server_time){
243
- //this should get GMT-0 time in int date('Z') is the server's time offset compared to GMT-0
244
- $current_server_time = time();
245
- $gmt_time = $current_server_time - date('Z');
246
-
247
- //this is the local time on this site : current time at GMT-0 + the offset chosen in WP settings
248
- $current_local_time = $gmt_time + ( get_option( 'gmt_offset' ) * 3600 );
249
-
250
- //this is the time difference between the t
251
- $time_difference = $current_local_time - $current_server_time;
252
- //unix time was recorded as local time we substract to it the time difference
253
- return $server_time - $time_difference;
254
- }
255
-
256
- /**
257
- * get the translated day name based on a lowercase day namekey
258
- * @param type $day if specified we return only one value otherwise we return the entire array
259
- * @return mixed
260
- */
261
- function getday($day=false){
262
-
263
- $days=array('monday'=>__('Monday',WYSIJA),
264
- 'tuesday'=>__('Tuesday',WYSIJA),
265
- 'wednesday'=>__('Wednesday',WYSIJA),
266
- 'thursday'=>__('Thursday',WYSIJA),
267
- 'friday'=>__('Friday',WYSIJA),
268
- 'saturday'=>__('Saturday',WYSIJA),
269
- 'sunday'=>__('Sunday',WYSIJA));
270
- if(!$day || !isset($days[$day])) return $days;
271
- else return $days[$day];
272
- }
273
-
274
- /**
275
- * get the translated day name based on a lowercase day namekey
276
- * @param type $week if specified we return only one, otherwise we return the entire array
277
- * @return mixed
278
- */
279
- function getweeksnumber($week=false){
280
- $weeks=array(
281
- '1'=>__('1st',WYSIJA),
282
- '2'=>__('2nd',WYSIJA),
283
- '3'=>__('3rd',WYSIJA),
284
- '4'=>__('Last',WYSIJA),
285
- );
286
- if(!$week || !isset($weeks[$week])) return $weeks;
287
- else return $weeks[$week];
288
- }
289
-
290
- /**
291
- * get the translated day number based on the number in the month until 29th
292
- * @param type $day if specified we just return one otherwise we return the entire array
293
- * @return mixed
294
- */
295
- function getdaynumber($day=false){
296
- $daynumbers=array();
297
- //prepare an array of numbers
298
- for($i = 1;$i < 29;$i++) {
299
- switch($i){
300
- case 1:
301
- $number=__('1st',WYSIJA);
302
- break;
303
- case 2:
304
- $number=__('2nd',WYSIJA);
305
- break;
306
- case 3:
307
- $number=__('3rd',WYSIJA);
308
- break;
309
- default:
310
- $number=sprintf(__('%1$sth',WYSIJA),$i);
311
- }
312
-
313
- $daynumbers[$i] = $number;
314
- }
315
-
316
- if(!$day || !isset($daynumbers[$day])) return $daynumbers;
317
- else return $daynumbers[$day];
318
- }
319
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('WYSIJA') or die('Restricted access');
3
+ class WYSIJA_help_toolbox extends WYSIJA_object{
4
+
5
+ function WYSIJA_help_toolbox(){
6
+
7
+ }
8
+
9
+
10
+ /**
11
+ * make a temporary file
12
+ * @param type $content
13
+ * @param type $key
14
+ * @param type $format
15
+ * @return type
16
+ */
17
+ function temp($content,$key='temp',$format='.tmp'){
18
+ $helperF=WYSIJA::get('file','helper');
19
+ $tempDir=$helperF->makeDir();
20
+
21
+
22
+ $filename=$key.'-'.time().$format;
23
+ $handle=fopen($tempDir.$filename, 'w');
24
+ fwrite($handle, $content);
25
+ fclose($handle);
26
+
27
+ return array('path'=>$tempDir.$filename,'name'=>$filename, 'url'=>$this->url($filename,'temp'));
28
+ }
29
+
30
+ /**
31
+ * Get the url of a wysija file based on the filename and the wysija folder
32
+ * @param type $filename
33
+ * @param type $folder
34
+ * @return string
35
+ */
36
+ function url($filename,$folder='temp'){
37
+ $upload_dir = wp_upload_dir();
38
+
39
+ if(file_exists($upload_dir['basedir'].DS.'wysija')){
40
+ $url=$upload_dir['baseurl'].'/wysija/'.$folder.'/'.$filename;
41
+ }else{
42
+ $url=$upload_dir['baseurl'].'/'.$filename;
43
+ }
44
+ return $url;
45
+ }
46
+
47
+ /**
48
+ * send file to be downloaded
49
+ * @param type $path
50
+ */
51
+ function send($path){
52
+ /* submit the file to the admin */
53
+ if(file_exists($path)){
54
+ header('Content-type: application/csv');
55
+ header('Content-Disposition: attachment; filename="export_wysija.csv"');
56
+ readfile($path);
57
+ exit();
58
+ }else $this->error(__('Yikes! We couldn\'t export. Make sure that your folder permissions for /wp-content/uploads/wysija/temp is set to 755.',WYSIJA),true);
59
+
60
+ }
61
+
62
+ /**
63
+ * clear upload folders from things we don't need anymore
64
+ */
65
+ function clear(){
66
+ $foldersToclear=array('import','temp');
67
+ $filenameRemoval=array('import-','export-');
68
+ $deleted=array();
69
+ $helperF=WYSIJA::get('file','helper');
70
+ foreach($foldersToclear as $folder){
71
+ $path=$helperF->getUploadDir($folder);
72
+ /* get a list of files from this folder and clear them */
73
+
74
+ $files = scandir($path);
75
+ foreach($files as $filename){
76
+ if(!in_array($filename, array('.','..','.DS_Store','Thumbs.db'))){
77
+ if(preg_match('/('.implode($filenameRemoval,'|').')[0-9]*\.csv/',$filename,$match)){
78
+ $deleted[]=$path.$filename;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ foreach($deleted as $filename){
84
+ if(file_exists($filename)){
85
+ unlink($filename);
86
+ }
87
+ }
88
+
89
+ }
90
+
91
+ function closetags($html) {
92
+ #put all opened tags into an array
93
+ preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);
94
+ $openedtags = $result[1]; #put all closed tags into an array
95
+ preg_match_all('#</([a-z]+)>#iU', $html, $result);
96
+ $closedtags = $result[1];
97
+ $len_opened = count($openedtags);
98
+ # all tags are closed
99
+ if(count($closedtags) === $len_opened) {
100
+ return $html;
101
+ }
102
+
103
+ $openedtags = array_reverse($openedtags);
104
+ # close tags
105
+ for($i=0; $i < $len_opened; $i++) {
106
+ if(!in_array($openedtags[$i], $closedtags)){
107
+ $html .= '</'.$openedtags[$i].'>';
108
+ } else {
109
+ unset($closedtags[array_search($openedtags[$i], $closedtags)]);
110
+ }
111
+ }
112
+ return $html;
113
+ }
114
+
115
+ /**
116
+ * make an excerpt with a certain number of words
117
+ * @param type $text
118
+ * @param type $num_words
119
+ * @param type $more
120
+ * @return type
121
+ */
122
+ function excerpt($text,$num_words=8,$more=' ...'){
123
+
124
+ $words_array = preg_split('/[\r\t ]+/', $text, $num_words + 1, PREG_SPLIT_NO_EMPTY);
125
+ if(count($words_array) > $num_words) {
126
+ array_pop($words_array);
127
+ $text = implode(' ', $words_array);
128
+ $text = $text . $more;
129
+ } else {
130
+ $text = implode( ' ', $words_array );
131
+ }
132
+
133
+ return $this->closetags($text);
134
+ }
135
+
136
+ /**
137
+ * make a domain name out of a url
138
+ * @param type $url
139
+ * @return type
140
+ */
141
+ function _make_domain_name($url=false){
142
+ if(!$url) $url=admin_url('admin.php');
143
+
144
+ $domain_name=str_replace(array('https://','http://','www.'),'',strtolower($url));
145
+ //$domain_name=preg_replace(array('#^https?://(www\.)*#i','#^www\.#'),'',$url);
146
+ $domain_name=explode('/',$domain_name);
147
+ return $domain_name[0];
148
+ }
149
+
150
+ /**
151
+ * creates a duration string to tell when is the next batch to be processed for instance
152
+ * @param type $s
153
+ * @param type $durationin
154
+ * @param type $level
155
+ * @return string
156
+ */
157
+ function duration($s,$durationin=false,$level=1){
158
+ $t=time();
159
+ if($durationin){
160
+ $e=$t+$s;
161
+ $s=$t;
162
+ //Find out the seconds between each dates
163
+ $timestamp = $e - $s;
164
+ }else{
165
+ $timestamp = $t - $s;
166
+ }
167
+
168
+ //Clever Maths
169
+ $years=floor($timestamp/(60*60*24*365));$timestamp%=60*60*24*365;
170
+ $weeks=floor($timestamp/(60*60*24*7));$timestamp%=60*60*24*7;
171
+ $days=floor($timestamp/(60*60*24));$timestamp%=60*60*24;
172
+ $hrs=floor($timestamp/(60*60));$timestamp%=60*60;
173
+ $mins=floor($timestamp/60);
174
+ if($timestamp>60)$secs=$timestamp%60;
175
+ else $secs=$timestamp;
176
+
177
+
178
+ //Display for date, can be modified more to take the S off
179
+ $str='';
180
+ $mylevel=0;
181
+ if ($mylevel<$level && $years >= 1) { $str.= sprintf(_n( '%1$s year', '%1$s years', $years, WYSIJA ),$years).' ';$mylevel++; }
182
+ if ($mylevel<$level && $weeks >= 1) { $str.= sprintf(_n( '%1$s week', '%1$s weeks', $weeks, WYSIJA ),$weeks).' ';$mylevel++; }
183
+ if ($mylevel<$level && $days >= 1) { $str.=sprintf(_n( '%1$s day', '%1$s days', $days, WYSIJA ),$days).' ';$mylevel++; }
184
+ if ($mylevel<$level && $hrs >= 1) { $str.=sprintf(_n( '%1$s hour', '%1$s hours', $hrs, WYSIJA ),$hrs).' ';$mylevel++; }
185
+ if ($mylevel<$level && $mins >= 1) { $str.=sprintf(_n( '%1$s minute', '%1$s minutes', $mins, WYSIJA ),$mins).' ';$mylevel++; }
186
+ if ($mylevel<$level && $secs >= 1) { $str.=sprintf(_n( '%1$s second', '%1$s seconds', $secs, WYSIJA ),$secs).' ';$mylevel++; }
187
+
188
+ return $str;
189
+
190
+ }
191
+
192
+ /**
193
+ *
194
+ * @param type $time
195
+ * @param type $justtime
196
+ * @return type
197
+ */
198
+ function localtime($time,$justtime=false){
199
+ if($justtime) $time=strtotime($time);
200
+ return date(get_option('time_format'),$time);
201
+ }
202
+
203
+ /**
204
+ * return the offseted time formated(used in post notifications)
205
+ * @param type $val
206
+ * @return string
207
+ */
208
+ function time_tzed($val=false){
209
+ return gmdate( 'Y-m-d H:i:s', $this->servertime_to_localtime($val) );
210
+ }
211
+
212
+ /**
213
+ * specify a unix server time int and it will convert it to the local time if you don't specify any unixTime value it will convert the current time
214
+ * @param type $unixTime
215
+ * @return int
216
+ */
217
+ function servertime_to_localtime($unixTime=false){
218
+
219
+ //this should get GMT-0 time in int date('Z') is the server's time offset compared to GMT-0
220
+ $current_server_time = time();
221
+ $gmt_time = $current_server_time - date('Z');
222
+
223
+ //this is the local time on this site : current time at GMT-0 + the offset chosen in WP settings
224
+ $current_local_time = $gmt_time + ( get_option( 'gmt_offset' ) * 3600 );
225
+
226
+ if(!$unixTime) return $current_local_time;
227
+ else{
228
+ //if we've specified a time value in the function, we calculate the difference between the current servertime and the offseted current time
229
+ $time_difference = $current_local_time - $current_server_time;
230
+ //unix time was recorded non offseted so it's the server's time we add the timedifference to it to get the local time
231
+ return $unixTime + $time_difference;
232
+ }
233
+ }
234
+
235
+ /**
236
+ * specify a local time int and we will convert it to the server time
237
+ * mostly used with values produced with strtotime() strtotime converts Monday 5pm to the server time's 5pm
238
+ * and if we want to get Monday 5pm of the local time in the server time we need to do a conversion of that value from local to server
239
+ * @param int $server_time time value recorded in the past using time() or strtotime()
240
+ * @return int
241
+ */
242
+ function localtime_to_servertime($server_time){
243
+ //this should get GMT-0 time in int date('Z') is the server's time offset compared to GMT-0
244
+ $current_server_time = time();
245
+ $gmt_time = $current_server_time - date('Z');
246
+
247
+ //this is the local time on this site : current time at GMT-0 + the offset chosen in WP settings
248
+ $current_local_time = $gmt_time + ( get_option( 'gmt_offset' ) * 3600 );
249
+
250
+ //this is the time difference between the t
251
+ $time_difference = $current_local_time - $current_server_time;
252
+ //unix time was recorded as local time we substract to it the time difference
253
+ return $server_time - $time_difference;
254
+ }
255
+
256
+ function site_current_time($date_format = 'H:i:s'){
257
+ // display the current time
258
+ $current_server_time = time();
259
+ $gmt_time = $current_server_time - date('Z');
260
+
261
+ //this is the local time on this site : current time at GMT-0 + the offset chosen in WP settings
262
+ $current_local_time = $gmt_time + ( get_option( 'gmt_offset' ) * 3600 );
263
+ return date($date_format , $current_local_time);
264
+ }
265
+
266
+ /**
267
+ * get the translated day name based on a lowercase day namekey
268
+ * @param type $day if specified we return only one value otherwise we return the entire array
269
+ * @return mixed
270
+ */
271
+ function getday($day=false){
272
+
273
+ $days=array('monday'=>__('Monday',WYSIJA),
274
+ 'tuesday'=>__('Tuesday',WYSIJA),
275
+ 'wednesday'=>__('Wednesday',WYSIJA),
276
+ 'thursday'=>__('Thursday',WYSIJA),
277
+ 'friday'=>__('Friday',WYSIJA),
278
+ 'saturday'=>__('Saturday',WYSIJA),
279
+ 'sunday'=>__('Sunday',WYSIJA));
280
+ if(!$day || !isset($days[$day])) return $days;
281
+ else return $days[$day];
282
+ }
283
+
284
+ /**
285
+ * get the translated day name based on a lowercase day namekey
286
+ * @param type $week if specified we return only one, otherwise we return the entire array
287
+ * @return mixed
288
+ */
289
+ function getweeksnumber($week=false){
290
+ $weeks=array(
291
+ '1'=>__('1st',WYSIJA),
292
+ '2'=>__('2nd',WYSIJA),
293
+ '3'=>__('3rd',WYSIJA),
294
+ '4'=>__('Last',WYSIJA),
295
+ );
296
+ if(!$week || !isset($weeks[$week])) return $weeks;
297
+ else return $weeks[$week];
298
+ }
299
+
300
+ /**
301
+ * get the translated day number based on the number in the month until 29th
302
+ * @param type $day if specified we just return one otherwise we return the entire array
303
+ * @return mixed
304
+ */
305
+ function getdaynumber($day=false){
306
+ $daynumbers=array();
307
+ //prepare an array of numbers
308
+ for($i = 1;$i < 29;$i++) {
309
+ switch($i){
310
+ case 1:
311
+ $number=__('1st',WYSIJA);
312
+ break;
313
+ case 2:
314
+ $number=__('2nd',WYSIJA);
315
+ break;
316
+ case 3:
317
+ $number=__('3rd',WYSIJA);
318
+ break;
319
+ default:
320
+ $number=sprintf(__('%1$sth',WYSIJA),$i);
321
+ }
322
+
323
+ $daynumbers[$i] = $number;
324
+ }
325
+
326
+ if(!$day || !isset($daynumbers[$day])) return $daynumbers;
327
+ else return $daynumbers[$day];
328
+ }
329
+
330
+ /**
331
+ * we use to deal with the WPLANG constant but that's silly considering there are plugins like
332
+ * WPML which needs to alter that value
333
+ * @return string
334
+ */
335
+ function get_language_code(){
336
+
337
+ // in WP Multisite if we have a WPLANG defined in the wp-config,
338
+ // it won't be used each site needs to have a WPLANG option defined and if it's not defined it will be empty and default to en_US
339
+ if ( is_multisite() ) {
340
+ // Don't check blog option when installing.
341
+ if ( defined( 'WP_INSTALLING' ) || ( false === $ms_locale = get_option( 'WPLANG' ) ) )
342
+ $ms_locale = get_site_option('WPLANG');
343
+
344
+ if ( $ms_locale !== false )
345
+ $locale = $ms_locale;
346
+ // make sure we don't default to en_US if we have an empty locale and a WPLANG defined
347
+ if(empty($locale)) $locale = WPLANG;
348
+ }else{
349
+ $locale = get_locale();
350
+ }
351
+
352
+ if($locale!=''){
353
+ if(strpos($locale, '_')!==false){
354
+ $locale = explode('_',$locale);
355
+ $language_code = $locale[0];
356
+ }else{
357
+ $language_code = $locale;
358
+ }
359
+ }else{
360
+ $language_code = 'en';
361
+ }
362
+ return $language_code;
363
+ }
364
+ }
helpers/update.php CHANGED
@@ -5,7 +5,7 @@ class WYSIJA_help_update extends WYSIJA_object{
5
  function WYSIJA_help_update(){
6
  $this->modelWysija=new WYSIJA_model();
7
  //IMPORTANT when making db updated or running update processes, add the version and in the big switch below in the runUpdate() method
8
- $this->updates=array('1.1','2.0','2.1','2.1.6','2.1.7','2.1.8','2.2','2.2.1','2.3.3','2.3.4', '2.4', '2.4.1', '2.4.3','2.4.4','2.5');
9
  }
10
 
11
 
@@ -15,12 +15,12 @@ class WYSIJA_help_update extends WYSIJA_object{
15
  switch($version){
16
  case '1.1':
17
  //add column namekey to
18
- $modelconfig=WYSIJA::get('config','model');
19
  if(!$this->modelWysija->query("SHOW COLUMNS FROM `[wysija]list` LIKE 'namekey';")){
20
  $querys[]='ALTER TABLE `[wysija]list` ADD `namekey` VARCHAR( 255 ) NULL;';
21
  }
22
 
23
- $querys[]="UPDATE `[wysija]list` SET `namekey` = 'users' WHERE `list_id` =".$modelconfig->getValue('importwp_list_id').";";
24
  $errors=$this->runUpdateQueries($querys);
25
 
26
  $importHelp=WYSIJA::get('import','helper');
@@ -40,11 +40,11 @@ class WYSIJA_help_update extends WYSIJA_object{
40
  break;
41
  case '2.0':
42
  //add column namekey to
43
- $modelconfig=WYSIJA::get('config','model');
44
  if(!$this->modelWysija->query("SHOW COLUMNS FROM `[wysija]email` LIKE 'modified_at';")){
45
  $querys[]="ALTER TABLE `[wysija]email` ADD `modified_at` INT UNSIGNED NOT NULL DEFAULT '0';";
46
  }
47
- if(!$modelconfig->getValue('update_error_20')){
48
  $querys[]="UPDATE `[wysija]email` SET `modified_at` = `sent_at` WHERE `sent_at`>=0;";
49
  $querys[]="UPDATE `[wysija]email` SET `modified_at` = `created_at` WHERE `modified_at`='0';";
50
  $querys[]="UPDATE `[wysija]email` SET `status` = '99' WHERE `status` ='1';";//change sending status from 1 to 99
@@ -54,15 +54,15 @@ class WYSIJA_help_update extends WYSIJA_object{
54
  $errors=$this->runUpdateQueries($querys);
55
 
56
  if($errors){
57
- $modelconfig->save(array('update_error_20'=>true));
58
  $this->error(implode($errors,"\n"));
59
  return false;
60
  }
61
  return true;
62
  break;
63
  case '2.1':
64
- $modelconfig=WYSIJA::get('config','model');
65
- if(!$modelconfig->getValue('update_error_21')){
66
  $modelEmails=WYSIJA::get('email','model');
67
  $modelEmails->reset();
68
  $emailsLoaded=$modelEmails->get(array('subject','email_id'),array('status'=>2,'type'=>1));
@@ -77,7 +77,7 @@ class WYSIJA_help_update extends WYSIJA_object{
77
  $minimumroles=array('role_campaign'=>'wysija_newsletters','role_subscribers'=>'wysija_subscribers');
78
 
79
  foreach($minimumroles as $rolename=>$capability){
80
- $rolesetting=$modelconfig->getValue($rolename);
81
  switch($rolesetting){
82
  case 'switch_themes':
83
  $keyrole=1;
@@ -119,14 +119,14 @@ class WYSIJA_help_update extends WYSIJA_object{
119
  }
120
  }
121
  $wptoolboxs = WYSIJA::get('toolbox', 'helper');
122
- $modelconfig->save(array('dkim_domain'=>$wptoolboxs->_make_domain_name()));
123
  }
124
 
125
  if(!$this->modelWysija->query("SHOW COLUMNS FROM `[wysija]list` LIKE 'is_public';")){
126
  $querys[]="ALTER TABLE `[wysija]list` ADD `is_public` TINYINT UNSIGNED NOT NULL DEFAULT 0;";
127
  $errors=$this->runUpdateQueries($querys);
128
  if($errors){
129
- $modelconfig->save(array('update_error_21'=>true));
130
  $this->error(implode($errors,"\n"));
131
  return false;
132
  }
@@ -366,23 +366,21 @@ class WYSIJA_help_update extends WYSIJA_object{
366
  }
367
  return true;
368
  break;
 
 
 
 
 
 
 
 
369
  default:
370
  return false;
371
  }
372
  return false;
373
  }
374
 
375
- function customerRequestMissingSubscriber(){
376
- $mConfig=WYSIJA::get('config','model');
377
-
378
- $querys[]='UPDATE `[wysija]user_list` as A set A.sub_date= '.time().' where A.sub_date=0;';
379
- $errors=$this->runUpdateQueries($querys);
380
 
381
- if($errors){
382
- $this->error(implode($errors,"\n"));
383
- return false;
384
- }
385
- }
386
  /**
387
  * check for a wordpress plugin new version
388
  * @return type
5
  function WYSIJA_help_update(){
6
  $this->modelWysija=new WYSIJA_model();
7
  //IMPORTANT when making db updated or running update processes, add the version and in the big switch below in the runUpdate() method
8
+ $this->updates=array('1.1','2.0','2.1','2.1.6','2.1.7','2.1.8','2.2','2.2.1','2.3.3','2.3.4', '2.4', '2.4.1', '2.4.3','2.4.4','2.5','2.5.2','2.5.5');
9
  }
10
 
11
 
15
  switch($version){
16
  case '1.1':
17
  //add column namekey to
18
+ $model_config=WYSIJA::get('config','model');
19
  if(!$this->modelWysija->query("SHOW COLUMNS FROM `[wysija]list` LIKE 'namekey';")){
20
  $querys[]='ALTER TABLE `[wysija]list` ADD `namekey` VARCHAR( 255 ) NULL;';
21
  }
22
 
23
+ $querys[]="UPDATE `[wysija]list` SET `namekey` = 'users' WHERE `list_id` =".$model_config->getValue('importwp_list_id').";";
24
  $errors=$this->runUpdateQueries($querys);
25
 
26
  $importHelp=WYSIJA::get('import','helper');
40
  break;
41
  case '2.0':
42
  //add column namekey to
43
+ $model_config=WYSIJA::get('config','model');
44
  if(!$this->modelWysija->query("SHOW COLUMNS FROM `[wysija]email` LIKE 'modified_at';")){
45
  $querys[]="ALTER TABLE `[wysija]email` ADD `modified_at` INT UNSIGNED NOT NULL DEFAULT '0';";
46
  }
47
+ if(!$model_config->getValue('update_error_20')){
48
  $querys[]="UPDATE `[wysija]email` SET `modified_at` = `sent_at` WHERE `sent_at`>=0;";
49
  $querys[]="UPDATE `[wysija]email` SET `modified_at` = `created_at` WHERE `modified_at`='0';";
50
  $querys[]="UPDATE `[wysija]email` SET `status` = '99' WHERE `status` ='1';";//change sending status from 1 to 99
54
  $errors=$this->runUpdateQueries($querys);
55
 
56
  if($errors){
57
+ $model_config->save(array('update_error_20'=>true));
58
  $this->error(implode($errors,"\n"));
59
  return false;
60
  }
61
  return true;
62
  break;
63
  case '2.1':
64
+ $model_config=WYSIJA::get('config','model');
65
+ if(!$model_config->getValue('update_error_21')){
66
  $modelEmails=WYSIJA::get('email','model');
67
  $modelEmails->reset();
68
  $emailsLoaded=$modelEmails->get(array('subject','email_id'),array('status'=>2,'type'=>1));
77
  $minimumroles=array('role_campaign'=>'wysija_newsletters','role_subscribers'=>'wysija_subscribers');
78
 
79
  foreach($minimumroles as $rolename=>$capability){
80
+ $rolesetting=$model_config->getValue($rolename);
81
  switch($rolesetting){
82
  case 'switch_themes':
83
  $keyrole=1;
119
  }
120
  }
121
  $wptoolboxs = WYSIJA::get('toolbox', 'helper');
122
+ $model_config->save(array('dkim_domain'=>$wptoolboxs->_make_domain_name()));
123
  }
124
 
125
  if(!$this->modelWysija->query("SHOW COLUMNS FROM `[wysija]list` LIKE 'is_public';")){
126
  $querys[]="ALTER TABLE `[wysija]list` ADD `is_public` TINYINT UNSIGNED NOT NULL DEFAULT 0;";
127
  $errors=$this->runUpdateQueries($querys);
128
  if($errors){
129
+ $model_config->save(array('update_error_21'=>true));
130
  $this->error(implode($errors,"\n"));
131
  return false;
132
  }
366
  }
367
  return true;
368
  break;
369
+ case '2.5.5':
370
+ $model_email = WYSIJA::get('email','model',false,'wysija-newsletters',false);
371
+ $model_config = WYSIJA::get('config','model');
372
+
373
+ $model_email->update( array('replyto_name'=>$model_config->getValue('replyto_name'),'replyto_email'=>$model_config->getValue('replyto_email')) ,
374
+ array('email_id'=>$model_config->getValue('confirm_email_id')) );
375
+ return true;
376
+ break;
377
  default:
378
  return false;
379
  }
380
  return false;
381
  }
382
 
 
 
 
 
 
383
 
 
 
 
 
 
384
  /**
385
  * check for a wordpress plugin new version
386
  * @return type
helpers/user.php CHANGED
@@ -2,6 +2,7 @@
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_help_user extends WYSIJA_object{
4
 
 
5
  /**
6
  * Used whend confirming email with dbl optin
7
  * @param type $user_id
@@ -439,6 +440,8 @@ class WYSIJA_help_user extends WYSIJA_object{
439
  * @return boolean
440
  */
441
  function sendConfirmationEmail($user_ids,$sendone=false,$listids=array()){
 
 
442
  if($sendone || is_object($user_ids)){
443
  /* in this case user_ids is just one user object*/
444
  $users=array($user_ids);
@@ -547,7 +550,7 @@ class WYSIJA_help_user extends WYSIJA_object{
547
  // table queue to delete
548
  $tables = array(
549
  'user_history',
550
- 'user_url',
551
  'email_user_stat',
552
  'user_list',
553
  'queue',
@@ -794,14 +797,14 @@ class WYSIJA_help_user extends WYSIJA_object{
794
 
795
  /**
796
  * function used to update the synchronisation with a plugin list or WP's one table
797
- * @global type $wpdb
798
- * @param type $listid
799
- * @param type $total means total synch of the whole user base, it's used for multisite and the WordPress users list
800
  * @return type
801
  */
802
- function synchList($listid,$total=false){
803
  $model=WYSIJA::get('list','model');
804
- $data=$model->getOne(false,array('list_id'=>(int)$listid,'is_enabled'=>'0'));
805
 
806
  if($data){
807
 
@@ -833,17 +836,18 @@ class WYSIJA_help_user extends WYSIJA_object{
833
  $ismainsite=false;
834
  }
835
  }
 
836
  $connection_info=array('name'=>'WordPress',
837
- 'pk'=>'ID',
838
- 'matches'=>array('ID'=>'wpuser_id','user_email'=>'email','display_name'=>'firstname'),
839
- 'matchesvar'=>array('status'=>1));
840
 
841
  $importHelper=WYSIJA::get('import','helper');
842
  $lists_ids=array(
843
  'wysija_list_main_id'=>$data['list_id']
844
  );
845
 
846
- $importHelper->import($data['namekey'],$connection_info,false,$total,$lists_ids);
847
 
848
  $this->cleanWordpressUsersList();
849
 
@@ -936,11 +940,18 @@ class WYSIJA_help_user extends WYSIJA_object{
936
  * make sure that the request wysija-key parameter correspond to a user in the db
937
  * @return boolean
938
  */
939
- function checkUserKey(){
940
 
941
- if(isset($_REQUEST['wysija-key'])){
942
  $modelUser=WYSIJA::get('user','model');
943
- $result=$modelUser->getDetails(array('keyuser'=>$_REQUEST['wysija-key']));
 
 
 
 
 
 
 
944
  if($result) {
945
  return $result;
946
  }
@@ -968,4 +979,74 @@ class WYSIJA_help_user extends WYSIJA_object{
968
  $query='SELECT A.* FROM [wysija]user_list as A LEFT JOIN [wysija]list as B on A.list_id=B.list_id WHERE A.user_id='.$user_id.' AND B.is_enabled=1 '.$list_id_in;
969
  return $model_user->getResults($query);
970
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971
  }
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_help_user extends WYSIJA_object{
4
 
5
+ var $no_confirmation_email =false;
6
  /**
7
  * Used whend confirming email with dbl optin
8
  * @param type $user_id
440
  * @return boolean
441
  */
442
  function sendConfirmationEmail($user_ids,$sendone=false,$listids=array()){
443
+ if($this->no_confirmation_email === true) return;
444
+
445
  if($sendone || is_object($user_ids)){
446
  /* in this case user_ids is just one user object*/
447
  $users=array($user_ids);
550
  // table queue to delete
551
  $tables = array(
552
  'user_history',
553
+ 'email_user_url',
554
  'email_user_stat',
555
  'user_list',
556
  'queue',
797
 
798
  /**
799
  * function used to update the synchronisation with a plugin list or WP's one table
800
+ * @global object $wpdb
801
+ * @param int $list_id
802
+ * @param boolean $synch_all_wp_user_base means complete synch of the whole user base, it's used for multisite and the WordPress users list
803
  * @return type
804
  */
805
+ function synchList($list_id, $synch_all_wp_user_base = false){
806
  $model=WYSIJA::get('list','model');
807
+ $data=$model->getOne(false,array('list_id'=>(int)$list_id,'is_enabled'=>'0'));
808
 
809
  if($data){
810
 
836
  $ismainsite=false;
837
  }
838
  }
839
+
840
  $connection_info=array('name'=>'WordPress',
841
+ 'pk'=>'ID',
842
+ 'matches'=>array('ID'=>'wpuser_id', 'user_email'=>'email' , 'first_name'=>'firstname' , 'last_name'=>'lastname'),
843
+ 'matchesvar'=>array('status'=>1));
844
 
845
  $importHelper=WYSIJA::get('import','helper');
846
  $lists_ids=array(
847
  'wysija_list_main_id'=>$data['list_id']
848
  );
849
 
850
+ $importHelper->import($data['namekey'],$connection_info,false,$synch_all_wp_user_base,$lists_ids);
851
 
852
  $this->cleanWordpressUsersList();
853
 
940
  * make sure that the request wysija-key parameter correspond to a user in the db
941
  * @return boolean
942
  */
943
+ function checkUserKey($user_id=false){
944
 
945
+ if(isset($_REQUEST['wysija-key']) || $user_id !==false){
946
  $modelUser=WYSIJA::get('user','model');
947
+
948
+ if($user_id===false){
949
+ $where_condition = array('keyuser'=>$_REQUEST['wysija-key']);
950
+ }else{
951
+ $where_condition = array('user_id'=>$user_id);
952
+ }
953
+
954
+ $result=$modelUser->getDetails($where_condition);
955
  if($result) {
956
  return $result;
957
  }
979
  $query='SELECT A.* FROM [wysija]user_list as A LEFT JOIN [wysija]list as B on A.list_id=B.list_id WHERE A.user_id='.$user_id.' AND B.is_enabled=1 '.$list_id_in;
980
  return $model_user->getResults($query);
981
  }
982
+
983
+ /**
984
+ * if we confirm the user manually we pass it a user_id otherwise it works with a global key
985
+ * @param type $user_id
986
+ * @return boolean
987
+ */
988
+ function confirm_user($user_id = false){
989
+ $model_config=WYSIJA::get('config','model');
990
+ // we need to call the translation otherwise it will not be loaded and translated
991
+ $model_config->add_translated_default();
992
+
993
+ $list_ids=array();
994
+ if(isset($_REQUEST['wysiconf'])) $list_ids= unserialize(base64_decode($_REQUEST['wysiconf']));
995
+
996
+ $this->title=$model_config->getValue('subscribed_title');
997
+ if(!empty($list_ids)){
998
+ $model_list=WYSIJA::get('list','model');
999
+ $lists_names_res=$model_list->get(array('name'),array('list_id'=>$list_ids));
1000
+ $names=array();
1001
+ foreach($lists_names_res as $nameob) $names[]=$nameob['name'];
1002
+
1003
+ if(!isset($model_config->values['subscribed_title'])) $this->title=__('You\'ve subscribed to: %1$s',WYSIJA);
1004
+ $this->title=sprintf($this->title, implode(', ', $names));
1005
+ }
1006
+
1007
+ $this->subtitle=$model_config->getValue('subscribed_subtitle');
1008
+ if(!isset($model_config->values['subscribed_subtitle'])) $this->subtitle=__("Yup, we've added you to our list. You'll hear from us shortly.",WYSIJA);
1009
+
1010
+ $user_data = $this->checkUserKey($user_id);
1011
+
1012
+ if($user_data){
1013
+ //user is not confirmed yet
1014
+ $model_config = WYSIJA::get('config','model');
1015
+ if((int)$user_data['details']['status']<1){
1016
+ $this->subscribe($user_data['details']['user_id'],true, false,$list_ids);
1017
+ $this->uid=$user_data['details']['user_id'];
1018
+ // send a notification to the email specified in the settings if required to
1019
+ if($model_config->getValue('emails_notified') && $model_config->getValue('emails_notified_when_sub')){
1020
+ $this->_notify($user_data['details']['email']);
1021
+ }
1022
+ return true;
1023
+ }else{
1024
+ if(isset($_REQUEST['wysiconf'])){
1025
+ $needs_subscription=false;
1026
+ foreach($user_data['lists'] as $list){
1027
+ if(in_array($list['list_id'],$list_ids) && (int)$list['sub_date']<1){
1028
+ $needs_subscription=true;
1029
+ }
1030
+ }
1031
+
1032
+ if($needs_subscription){
1033
+ $this->subscribe($user_data['details']['user_id'],true,false,$list_ids);
1034
+ $this->title=sprintf($model_config->getValue('subscribed_title'), implode(', ', $names));
1035
+ $this->subtitle=$model_config->getValue('subscribed_subtitle');
1036
+ // send a notification to the email specified in the settings if required to
1037
+ if($model_config->getValue('emails_notified') && $model_config->getValue('emails_notified_when_sub')){
1038
+ $this->_notify($user_data['details']['email'], true, $list_ids);
1039
+ }
1040
+
1041
+ }else{
1042
+ $this->title=sprintf(__('You are already subscribed to : %1$s',WYSIJA), implode(', ', $names));
1043
+ }
1044
+ }else{
1045
+ $this->title=__('You are already subscribed.',WYSIJA);
1046
+ }
1047
+ return true;
1048
+ }
1049
+
1050
+ }
1051
+ }
1052
  }
helpers/wj_engine.php CHANGED
@@ -877,17 +877,13 @@ class WYSIJA_help_wj_engine extends WYSIJA_object {
877
  $params['post_limit'] = 1;
878
  }else{
879
  //we set the post_date to filter articles only older than the last time we sent articles
880
- if(isset($email['params']['autonl']['lastSend'])){
881
- $params['post_date'] = $email['params']['autonl']['lastSend'];
882
- }else{
883
- //get the latest child newsletter sent_at value
884
- $mEmail=WYSIJA::get('email','model');
885
- $mEmail->reset();
886
- $mEmail->orderBy('email_id','DESC');
887
- $lastEmailSent=$mEmail->getOne(false,array('campaign_id'=>$email['campaign_id'],'type'=>'1'));
888
-
889
- if(isset($data['sent_at'])) $params['post_date'] = $lastEmailSent['sent_at'];
890
- }
891
  }
892
 
893
 
877
  $params['post_limit'] = 1;
878
  }else{
879
  //we set the post_date to filter articles only older than the last time we sent articles
880
+ //get the latest child newsletter sent_at value
881
+ $mEmail=WYSIJA::get('email','model');
882
+ $mEmail->reset();
883
+ $mEmail->orderBy('email_id','DESC');
884
+ $lastEmailSent=$mEmail->getOne(false,array('campaign_id'=>$email['campaign_id'],'type'=>'1'));
885
+
886
+ if(!empty($lastEmailSent)) $params['post_date'] = $lastEmailSent['sent_at'];
 
 
 
 
887
  }
888
 
889
 
inc/debug.php CHANGED
@@ -34,7 +34,7 @@ if(!function_exists('dbg')) {
34
  $debugok=false;
35
  $pageisconfig=false;
36
  //dbg(WYSIJA_DBG);
37
- if(isset($_REQUEST['page']) && $_REQUEST['page']=='wysija_config') $pageisconfig=true;
38
  if(WYSIJA_DBG==3){
39
  if(WYSIJA_ITF && !$pageisconfig){
40
  $debugok=true;
34
  $debugok=false;
35
  $pageisconfig=false;
36
  //dbg(WYSIJA_DBG);
37
+ if(isset($_REQUEST['page']) && $_REQUEST['page']=='wysija_config' && !isset($_REQUEST['wj_debug'])) $pageisconfig=true;
38
  if(WYSIJA_DBG==3){
39
  if(WYSIJA_ITF && !$pageisconfig){
40
  $debugok=true;
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Wysija Newsletters
4
  Plugin URI: http://www.wysija.com/
5
  Description: Create and send newsletters. Import and manage your lists. Add subscription forms in widgets, articles and pages. Wysija is a freemium plugin updated regularly with new features.
6
- Version: 2.5.2
7
  Author: Wysija
8
  Author URI: http://www.wysija.com/
9
  License: GPLv2 or later
3
  Plugin Name: Wysija Newsletters
4
  Plugin URI: http://www.wysija.com/
5
  Description: Create and send newsletters. Import and manage your lists. Add subscription forms in widgets, articles and pages. Wysija is a freemium plugin updated regularly with new features.
6
+ Version: 2.5.7
7
  Author: Wysija
8
  Author URI: http://www.wysija.com/
9
  License: GPLv2 or later
js/admin-campaigns-editTemplate.js CHANGED
@@ -1 +1 @@
1
- function handleRemoveImage(){$$(".wj_images li").invoke("stopObserving","mouseover"),$$(".wj_images li").invoke("stopObserving","mouseout"),$$(".wj_images li").invoke("observe","mouseover",function(){$(this).select("span.delete-wrap").first().show()}),$$(".wj_images li").invoke("observe","mouseout",function(){$(this).select("span.delete-wrap").first().hide()}),$$(".wj_images li .del-attachment").invoke("observe","click",function(){removeImage($(this).innerHTML),$(this).stopObserving("click")})}function setDefaultTheme(e){var s=e.up().previous(".wysija_theme").readAttribute("rel");return wysijaAJAX.task="setDefaultTheme",wysijaAJAX.theme=s,WYSIJA_AJAX_POST({success:function(){$$(".wj_themes .default").invoke("removeClassName","selected"),$(e).addClassName("selected")},loading_message:wysijatrans.theme_setting_default,success_message:wysijatrans.theme_saved_default}),!1}function handleRemoveTheme(){$$(".wj_themes li").invoke("stopObserving","mouseover"),$$(".wj_themes li").invoke("stopObserving","mouseout"),$$(".wj_themes li").invoke("observe","mouseover",function(){$(this).down("span.delete-wrap").show(),$(this).down("span.default-wrap").show()}),$$(".wj_themes li").invoke("observe","mouseout",function(){$(this).down("span.delete-wrap").hide(),$(this).down(".default-wrap").hide()}),$$(".wj_themes li .delete").invoke("observe","click",function(){removeTheme($(this).innerHTML),$(this).stopObserving("click")})}function handleDefaultTheme(){$$(".wj_themes li .default").invoke("observe","click",function(){$$(".wj_themes li .default.selected").length>0&&$$(".wj_themes li .default.selected").first().up().hide(),setDefaultTheme(this)})}function handleSwitchTheme(){$$("a.wysija_theme").invoke("observe","click",function(e){switchThemeWYSIJA(e)})}function removeTheme(e){return confirm(wysijatrans.abouttodeletetheme.replace("%1$s",e))&&($("wysija-theme-"+e).remove(),wysijaAJAX.task="deleteTheme",wysijaAJAX.themekey=e,WYSIJA_AJAX_POST()),!0}function removeImage(e){var s=wysijaIMG.unset(e);return void 0!==s&&$("wysija-img-"+e).remove(),saveIQS(),!0}function addImage(e){var s=new Element("img",{width:80,height:80,wysija_height:e.height,wysija_width:e.width,wysija_src:e.url,src:e.thumb_url}),i=new Element("a",{wysija_type:"image","class":"wysija_item"}).update(s),t=new Element("li",{id:"wysija-img-"+e.identifier,"class":"new"}).update(i);return t.insert('<span class="delete-wrap" style="display:none;"><span class="delete">'+e.identifier+"</span></span>"),t.insert('<span class="default-wrap" style="display:none;"><span class="default">'+e.identifier+"</span></span>"),$("wj-images-quick").insert({top:t}),handleRemoveImage(),wysijaIMG.set(e.identifier,e),saveIQS(),!0}var wysijaIMG=$H(),ajaxOver=!0;document.observe("dom:loaded",function(){void 0!=$("wysija-upload-browse")&&$("wysija-upload-browse").observe("click",function(){return WysijaPopup.open($(this).innerHTML,$(this).readAttribute("href2")),!1}),void 0!=$("wysija-themes-browse")&&$("wysija-themes-browse").observe("click",function(){return WysijaPopup.open($(this).innerHTML,$(this).readAttribute("href2")),!1}),void 0!=$("wysija_divider_settings")&&$("wysija_divider_settings").observe("click",function(){return WysijaPopup.open(wysijatrans.dividerSelectionTitle,$(this).readAttribute("href2")),!1}),handleRemoveImage(),handleRemoveTheme(),handleSwitchTheme(),handleDefaultTheme(),$$(".wysija_toolbar_tabs a").invoke("observe","click",function(){return $$(".wysija_toolbar_tabs a").invoke("removeClassName","selected"),$$(".wj_images, .wj_content, .wj_styles, .wj_themes").invoke("hide"),$$(".wj_"+$(this).readAttribute("rel"))[0].show(),$(this).addClassName("selected"),!1})});
1
+ function handleRemoveImage(){$$(".wj_images li").invoke("stopObserving","mouseover"),$$(".wj_images li").invoke("stopObserving","mouseout"),$$(".wj_images li").invoke("observe","mouseover",function(){$(this).select("span.delete-wrap").first().show()}),$$(".wj_images li").invoke("observe","mouseout",function(){$(this).select("span.delete-wrap").first().hide()}),$$(".wj_images li .delete").invoke("observe","click",function(){removeImage($(this).innerHTML),$(this).stopObserving("click")})}function setDefaultTheme(e){var s=e.up().previous(".wysija_theme").readAttribute("rel");return wysijaAJAX.task="setDefaultTheme",wysijaAJAX.theme=s,WYSIJA_AJAX_POST({success:function(){$$(".wj_themes .default").invoke("removeClassName","selected"),$(e).addClassName("selected")},loading_message:wysijatrans.theme_setting_default,success_message:wysijatrans.theme_saved_default}),!1}function handleRemoveTheme(){$$(".wj_themes li").invoke("stopObserving","mouseover"),$$(".wj_themes li").invoke("stopObserving","mouseout"),$$(".wj_themes li").invoke("observe","mouseover",function(){$(this).down("span.delete-wrap").show(),$(this).down("span.default-wrap").show()}),$$(".wj_themes li").invoke("observe","mouseout",function(){$(this).down("span.delete-wrap").hide(),$(this).down(".default-wrap").hide()}),$$(".wj_themes li .delete").invoke("observe","click",function(){removeTheme($(this).innerHTML),$(this).stopObserving("click")})}function handleDefaultTheme(){$$(".wj_themes li .default").invoke("observe","click",function(){$$(".wj_themes li .default.selected").length>0&&$$(".wj_themes li .default.selected").first().up().hide(),setDefaultTheme(this)})}function handleSwitchTheme(){$$("a.wysija_theme").invoke("observe","click",function(e){switchThemeWYSIJA(e)})}function removeTheme(e){return confirm(wysijatrans.abouttodeletetheme.replace("%1$s",e))&&($("wysija-theme-"+e).remove(),wysijaAJAX.task="deleteTheme",wysijaAJAX.themekey=e,WYSIJA_AJAX_POST()),!0}function removeImage(e){var s=wysijaIMG.unset(e);return void 0!==s&&$("wysija-img-"+e).remove(),saveIQS(),!0}function addImage(e){var s=new Element("img",{width:80,height:80,wysija_height:e.height,wysija_width:e.width,wysija_src:e.url,src:e.thumb_url}),i=new Element("a",{wysija_type:"image","class":"wysija_item"}).update(s),t=new Element("li",{id:"wysija-img-"+e.identifier,"class":"new"}).update(i);return t.insert('<span class="delete-wrap" style="display:none;"><span class="delete">'+e.identifier+"</span></span>"),t.insert('<span class="default-wrap" style="display:none;"><span class="default">'+e.identifier+"</span></span>"),$("wj-images-quick").insert({top:t}),handleRemoveImage(),wysijaIMG.set(e.identifier,e),saveIQS(),!0}var wysijaIMG=$H(),ajaxOver=!0;document.observe("dom:loaded",function(){void 0!=$("wysija-upload-browse")&&$("wysija-upload-browse").observe("click",function(){return WysijaPopup.open($(this).innerHTML,$(this).readAttribute("href2")),!1}),void 0!=$("wysija-themes-browse")&&$("wysija-themes-browse").observe("click",function(){return WysijaPopup.open($(this).innerHTML,$(this).readAttribute("href2")),!1}),void 0!=$("wysija_divider_settings")&&$("wysija_divider_settings").observe("click",function(){return WysijaPopup.open(wysijatrans.dividerSelectionTitle,$(this).readAttribute("href2")),!1}),handleRemoveImage(),handleRemoveTheme(),handleSwitchTheme(),handleDefaultTheme(),$$(".wysija_toolbar_tabs a").invoke("observe","click",function(){return $$(".wysija_toolbar_tabs a").invoke("removeClassName","selected"),$$(".wj_images, .wj_content, .wj_styles, .wj_themes").invoke("hide"),$$(".wj_"+$(this).readAttribute("rel"))[0].show(),$(this).addClassName("selected"),!1})});
js/admin-campaigns-welcome_new.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(u){function n(){return u("#poll_result").html(""),"url"==u(this).val()&&""!=u('input[name="how_did_you_find_us_url"]')?(u('input[name="how_did_you_find_us_url"]').focus(),!1):(wysijaAJAX.task="save_poll",wysijaAJAX.how=u('input[name="how_did_you_find_us"]').val(),wysijaAJAX.where=u('input[name="how_did_you_find_us_url"]').val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:_,error:i,dataType:"json"}),!1)}function _(n){u("#poll_result").html(n.result.msg)}function i(u){alert("Request error not JSON:"+u.responseText)}u('input[name="how_did_you_find_us"]').change(n),u('input[name="how_did_you_find_us_url"]').blur(n)});
js/admin-subscribers-export.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(c){function n(){c(this).attr("checked")?(c(".count-confirmed-only").show(),c(".count-all").hide()):(c(".count-confirmed-only").hide(),c(".count-all").show())}c("#confirmedcheck").change(n),c(document).ready(function(){c("#confirmedcheck").change()})});
js/admin-wysija.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(a){a("#wysija-app .submitdelete").click(function(){return confirm(wysijatrans.suredelete)}),a("#wysija-app .linkignore, .wysija-version .linkignore").click(function(){var i=this;return wysijaAJAX.controller="config",wysijaAJAX.task="linkignore",wysijaAJAX.ignorewhat=a.trim(a(this).attr("class").replace(/linkignore/g,"")),wysijaAJAX._wpnonce=a("#wysijax").val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(){a(i).parents(".removeme").length>0?a(i).parents(".removeme").fadeOut():a(i).parents("li").siblings().size()>0?a(i).parents("li").fadeOut():a(i).parents("div.updated").fadeOut()},error:function(a){alert("Request error not JSON:"+a.responseText),wysijaAJAXcallback.onSuccess=""},dataType:"json"}),!0}),a(document).on("click","#wysija-app .premium-tab, .wysija-msg .premium-tab, #theme-view .premium-tab",function(){a("#wysija-app .wysija-premium img").hide(),a(this).hasClass("ispopup")?(window.parent.tb_remove(),window.parent.location.href=wysijatrans.urlpremium):a("#wysija-tabs").length>0?a('#wysija-tabs a[href="#premium"]').trigger("click"):window.location.href=wysijatrans.urlpremium}),a("#premium-activate").click(function(){return wysijaAJAX.controller="config",wysijaAJAX.task="validate",a("#wysija-app .wysija-premium img").hide(),wysijaAJAX._wpnonce=a("#wysijax").val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(i){a("#wysija-app .wysija-premium img").hide(),i.result.result?window.location.reload():i.result.nocontact?location.reload(!0):(displaychange=0,jQuery.WYSIJA_HANDLE_RESPONSE(i))},error:function(i){a("#wysija-app .wysija-premium img").hide(),alert("Request error not JSON:"+i.responseText),wysijaAJAXcallback.onSuccess=""},dataType:"json"}),!0}),a("#premium-deactivate").click(function(){return wysijaAJAX.controller="config",wysijaAJAX.task="devalidate",a("#wysija-app .wysija-premium img").hide(),wysijaAJAX._wpnonce=a("#wysijax").val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(){a("#wysija-app .wysija-premium img").hide(),window.location.reload()},error:function(i){a("#wysija-app .wysija-premium img").hide(),alert("Request error not JSON:"+i.responseText),wysijaAJAXcallback.onSuccess=""},dataType:"json"}),!0}),a("#install-wjp,#switch_to_package").click(function(){return confirm(wysijatrans.sure_to_switch_package)}),a("#share_analytics").click(function(){var i=this;return wysijaAJAX.controller="config",wysijaAJAX.task="share_analytics",wysijaAJAX._wpnonce=a("#wysijax").val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(){a(i).text("Thanks!").contents().unwrap()},error:function(a){alert("Request error not JSON:"+a.responseText),wysijaAJAXcallback.onSuccess=""},dataType:"json"}),!0})});
1
+ jQuery(function(a){a("#wysija-app .submitdelete").click(function(){return confirm(wysijatrans.suredelete)}),a("#wysija-app .linkignore, .wysija-version .linkignore").click(function(){var i=this;return wysijaAJAX.controller="config",wysijaAJAX.task="linkignore",wysijaAJAX.ignorewhat=a.trim(a(this).attr("class").replace(/linkignore/g,"")),wysijaAJAX._wpnonce=a("#wysijax").val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(){a(i).parents(".removeme").length>0?a(i).parents(".removeme").fadeOut():a(i).parents("li").siblings().size()>0?a(i).parents("li").fadeOut():a(i).parents("div.updated").fadeOut()},error:function(a){alert("Request error not JSON:"+a.responseText),wysijaAJAXcallback.onSuccess=""},dataType:"json"}),!0}),a(document).on("click","#wysija-app .premium-tab, .wysija-msg .premium-tab, #theme-view .premium-tab",function(){a("#wysija-app .wysija-premium img").hide(),a(this).hasClass("ispopup")?(window.parent.tb_remove(),window.parent.location.href=wysijatrans.urlpremium):a("#wysija-tabs").length>0?a('#wysija-tabs a[href="#premium"]').trigger("click"):window.location.href=wysijatrans.urlpremium}),a(".premium-activate").click(function(){return wysijaAJAX.controller="config",wysijaAJAX.task="validate",a("#wysija-app .wysija-premium img").hide(),wysijaAJAX._wpnonce=a("#wysijax").val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(i){a("#wysija-app .wysija-premium img").hide(),i.result.result?window.location.reload():i.result.nocontact?location.reload(!0):(displaychange=0,jQuery.WYSIJA_HANDLE_RESPONSE(i))},error:function(i){a("#wysija-app .wysija-premium img").hide(),alert("Request error not JSON:"+i.responseText),wysijaAJAXcallback.onSuccess=""},dataType:"json"}),!0}),a("#premium-deactivate").click(function(){return wysijaAJAX.controller="config",wysijaAJAX.task="devalidate",a("#wysija-app .wysija-premium img").hide(),wysijaAJAX._wpnonce=a("#wysijax").val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(){a("#wysija-app .wysija-premium img").hide(),window.location.reload()},error:function(i){a("#wysija-app .wysija-premium img").hide(),alert("Request error not JSON:"+i.responseText),wysijaAJAXcallback.onSuccess=""},dataType:"json"}),!0}),a("#install-wjp,#switch_to_package").click(function(){return confirm(wysijatrans.sure_to_switch_package)}),a("#share_analytics").click(function(){var i=this;return wysijaAJAX.controller="config",wysijaAJAX.task="share_analytics",wysijaAJAX._wpnonce=a("#wysijax").val(),jQuery.ajax({type:"POST",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(){a(i).text("Thanks!").contents().unwrap()},error:function(a){alert("Request error not JSON:"+a.responseText),wysijaAJAXcallback.onSuccess=""},dataType:"json"}),!0})});
js/admin.js CHANGED
@@ -1 +1 @@
1
- function trim(e){return e.replace(/^\s+/g,"").replace(/\s+$/g,"")}function getURLParameter(e){return decodeURI((RegExp(e+"="+"(.+?)(&|$)").exec(location.search)||[,null])[1])}function addError(e){var r=new Array;r[0]=e,addMsg("error",r)}function addNotice(e){var r=new Array;r[0]=e,addMsg("update",r)}function addMsg(e,r){jQuery(".wysija-msg.ajax").html('<div class="allmsgs"></div>'),jQuery(".wysija-msg.ajax .allmsgs ."+e+" ul").length||jQuery(".wysija-msg.ajax .allmsgs").append('<div class="'+e+'"><ul></ul></div>'),jQuery.each(r,function(r,s){jQuery(".wysija-msg.ajax .allmsgs ."+e+" ul").append("<li>"+s+"</li>")})}jQuery(function(e){e(document).ready(function(){if("undefined"!=typeof wysijaAJAX&&void 0!==wysijaAJAX.pluginurl){var r=wysijaAJAX.pluginurl.replace("plugins/wysija-newsletters","themes"),s=wysijaAJAX.pluginurl.replace("wysija-newsletters",""),a="";e('script[src^="'+r+'"]').each(function(){a+="<li>"+e(this).attr("src")+"</li>"}),e('script[src^="'+s+'"]').each(function(){e(this).attr('src:notcontains("wysija-newsletters")')&&(a+="<li>"+e(this).attr("src")+"</li>")}),""!==a&&(e(".wysija-footer").append('<div class="expandquer"><h2 class="errors">WYSIJA POSSIBLE 3rd PARTY CONFLICTS</h2><pre><ol>'+a+"</ol></pre></div>"),e(".wysija-footer pre").hide())}}),e(document).on("click",".showerrors",function(){return e(".xdetailed-errors").toggle(),!1}),e(document).on("click",".shownotices",function(){return e(".xdetailed-updated").toggle(),!1})});
1
+ function trim(e){return e.replace(/^\s+/g,"").replace(/\s+$/g,"")}function getURLParameter(e){return decodeURI((RegExp(e+"="+"(.+?)(&|$)").exec(location.search)||[,null])[1])}function addError(e){var r=new Array;r[0]=e,addMsg("error",r)}function addNotice(e){var r=new Array;r[0]=e,addMsg("update",r)}function addMsg(e,r){jQuery(".wysija-msg.ajax").html('<div class="allmsgs"></div>'),jQuery(".wysija-msg.ajax .allmsgs ."+e+" ul").length||jQuery(".wysija-msg.ajax .allmsgs").append('<div class="'+e+'"><ul></ul></div>'),jQuery.each(r,function(r,s){jQuery(".wysija-msg.ajax .allmsgs ."+e+" ul").append("<li>"+s+"</li>")})}jQuery(function(e){e(document).ready(function(){if("undefined"!=typeof wysijaAJAX&&void 0!==wysijaAJAX.pluginurl){var r=wysijaAJAX.pluginurl.replace("plugins/wysija-newsletters","themes"),s=wysijaAJAX.pluginurl.replace("wysija-newsletters",""),a="";e('script[src^="'+r+'"]').each(function(){a+="<li>"+e(this).attr("src")+"</li>"}),e('script[src^="'+s+'"]').each(function(){e(this).attr('src:notcontains("wysija-newsletters")')&&(a+="<li>"+e(this).attr("src")+"</li>")}),""!==a&&(e(".wysija-footer").append('<div class="expandquer"><h2 class="errors">WYSIJA POSSIBLE 3rd PARTY CONFLICTS</h2><pre><ol>'+a+"</ol></pre></div>"),e(".wysija-footer pre").hide())}e("#wysija-app").siblings("div.updated, div.error").hide()}),e(document).on("click",".showerrors",function(){return e(".xdetailed-errors").toggle(),!1}),e(document).on("click",".shownotices",function(){return e(".xdetailed-updated").toggle(),!1})});
js/front-subscribers.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(i){var t=i.fn.jquery;"1.7.1">t&&(i.fn.on=function(t,a,l,s){return"function"==typeof a?i(this.context).live(t,a):i(a).live(t,l,s),this}),i(document).on("click",".showerrors",function(){return i(".xdetailed-errors").toggle(),!1}),i(document).on("click",".shownotices",function(){return i(".xdetailed-updated").toggle(),!1}),i("form.widget_wysija").on("focus","input[placeholder]",function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")}),i("form.widget_wysija").on("blur","input[placeholder]",function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").on("focus","input.defaultlabels",function(){i(this).val()===i(this).attr("title")&&i(this).val("")}),i("form.widget_wysija").on("blur","input.defaultlabels",function(){""===i(this).val()&&i(this).val(i(this).attr("title"))}),i(document).on("submit","form.widget_wysija",function(t){if(t.preventDefault(),void 0!==wysijaAJAX.noajax)return i(this).validationEngine("validate");if(i(this).validationEngine("validate")===!0){var a=i(this).find('input[name="action"]').val(),l=i(this).find('input[name="controller"]').val(),s=i(this).attr("id"),n=i(this).serializeArray();wysijaAJAX.task=a,wysijaAJAX.controller=l,wysijaAJAX.formid=s,i.each(n,function(i,t){wysijaAJAX["data["+i+"][name]"]=t.name,wysijaAJAX["data["+i+"][value]"]=t.value}),i("#msg-"+s).html('<div class="allmsgs"><blink>'+wysijaAJAX.loadingTrans+"</blink></div>"),i("#"+s).fadeOut(),i.ajax({type:"post",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(t){i("#msg-"+s).html('<div class="allmsgs"></div>'),t.result||i("#"+s).fadeIn(),i.each(t.msgs,function(t,a){i("#msg-"+s+" .allmsgs ."+t+" ul").length||i("#msg-"+s+" .allmsgs").append('<div class="'+t+'"><ul></ul></div>'),i.each(a,function(a,l){i("#msg-"+s+" .allmsgs ."+t+" ul").append("<li>"+l+"</li>")})})},error:function(t,a,l){i("#msg-"+s).html('<div class="allmsgs"></div>'),i("#msg-"+s+" .allmsgs").html('<div class="error"><ul><li>Oops! There is a problem with this form:</li><li>textStatus:'+a+"</li><li>errorThrown:"+l+"</li><li>responseText:"+t.responseText+"</li></ul></div>")},dataType:"jsonp"})}return!1}),i(function(){i("form.widget_wysija").validationEngine("attach",{promptPosition:"centerRight",scroll:!1}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input[placeholder]").each(function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")})}),i("form.widget_wysija").find("input[placeholder]").each(function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input.defaultlabels").each(function(){i(this).val()===i(this).attr("title")&&i(this).val("")})}),i("form.widget_wysija").find("input.defaultlabels").each(function(){""===i(this).val()&&i(this).val(i(this).attr("title"))})})});
1
+ jQuery(function(i){void 0===i.fn.on&&(i.fn.on=function(t,a,l,n){return"function"==typeof a?i(this.context).live(t,a):i(a).live(t,l,n),this}),i(document).on("click",".showerrors",function(){return i(".xdetailed-errors").toggle(),!1}),i(document).on("click",".shownotices",function(){return i(".xdetailed-updated").toggle(),!1}),i("form.widget_wysija").on("focus","input[placeholder]",function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")}),i("form.widget_wysija").on("blur","input[placeholder]",function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").on("focus","input.defaultlabels",function(){i(this).val()===i(this).attr("title")&&i(this).val("")}),i("form.widget_wysija").on("blur","input.defaultlabels",function(){""===i(this).val()&&i(this).val(i(this).attr("title"))}),i(document).on("submit","form.widget_wysija",function(t){if(t.preventDefault(),void 0!==wysijaAJAX.noajax)return i(this).validationEngine("validate");if(i(this).validationEngine("validate")===!0){var a=i(this).find('input[name="action"]').val(),l=i(this).find('input[name="controller"]').val(),n=i(this).attr("id"),s=i(this).serializeArray();wysijaAJAX.task=a,wysijaAJAX.controller=l,wysijaAJAX.formid=n,i.each(s,function(i,t){wysijaAJAX["data["+i+"][name]"]=t.name,wysijaAJAX["data["+i+"][value]"]=t.value}),i("#msg-"+n).html('<div class="allmsgs"><blink>'+wysijaAJAX.loadingTrans+"</blink></div>"),i("#"+n).fadeOut(),i.ajax({type:"post",url:wysijaAJAX.ajaxurl,data:wysijaAJAX,success:function(t){i("#msg-"+n).html('<div class="allmsgs"></div>'),t.result||i("#"+n).fadeIn(),i.each(t.msgs,function(t,a){i("#msg-"+n+" .allmsgs ."+t+" ul").length||i("#msg-"+n+" .allmsgs").append('<div class="'+t+'"><ul></ul></div>'),i.each(a,function(a,l){i("#msg-"+n+" .allmsgs ."+t+" ul").append("<li>"+l+"</li>")})})},error:function(t,a,l){i("#msg-"+n).html('<div class="allmsgs"></div>'),i("#msg-"+n+" .allmsgs").html('<div class="error"><ul><li>Oops! There is a problem with this form:</li><li>textStatus:'+a+"</li><li>errorThrown:"+l+"</li><li>responseText:"+t.responseText+"</li></ul></div>")},dataType:"jsonp"})}return!1}),i(function(){i("form.widget_wysija").validationEngine("attach",{promptPosition:"centerRight",scroll:!1}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input[placeholder]").each(function(){i(this).val()===i(this).attr("placeholder")&&i(this).val("")})}),i("form.widget_wysija").find("input[placeholder]").each(function(){""===i(this).val()&&i(this).val(i(this).attr("placeholder"))}),i("form.widget_wysija").bind("jqv.form.validating",function(){i(this).find("input.defaultlabels").each(function(){i(this).val()===i(this).attr("title")&&i(this).val("")})}),i("form.widget_wysija").find("input.defaultlabels").each(function(){""===i(this).val()&&i(this).val(i(this).attr("title"))})})});
js/tinymce/themes/advanced/img/wpicons-2x.png ADDED
Binary file
js/tinymce/themes/advanced/skins/highcontrast/content.css DELETED
@@ -1,24 +0,0 @@
1
- body, td, pre { margin:8px;}
2
- body.mceForceColors {background:#FFF; color:#000;}
3
- h1 {font-size: 2em}
4
- h2 {font-size: 1.5em}
5
- h3 {font-size: 1.17em}
6
- h4 {font-size: 1em}
7
- h5 {font-size: .83em}
8
- h6 {font-size: .75em}
9
- .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
10
- a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;}
11
- span.mceItemNbsp {background: #DDD}
12
- td.mceSelected, th.mceSelected {background-color:#3399ff !important}
13
- img {border:0;}
14
- table, img, hr, .mceItemAnchor {cursor:default}
15
- table td, table th {cursor:text}
16
- ins {border-bottom:1px solid green; text-decoration: none; color:green}
17
- del {color:red; text-decoration:line-through}
18
- cite {border-bottom:1px dashed blue}
19
- acronym {border-bottom:1px dotted #CCC; cursor:help}
20
- abbr {border-bottom:1px dashed #CCC; cursor:help}
21
-
22
- img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
23
- font[face=mceinline] {font-family:inherit !important}
24
- *[contentEditable]:focus {outline:0}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/tinymce/themes/advanced/skins/highcontrast/dialog.css DELETED
@@ -1,106 +0,0 @@
1
- /* Generic */
2
- body {
3
- font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
4
- background:#F0F0EE;
5
- color: black;
6
- padding:0;
7
- margin:8px 8px 0 8px;
8
- }
9
-
10
- html {background:#F0F0EE; color:#000;}
11
- td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
12
- textarea {resize:none;outline:none;}
13
- a:link, a:visited {color:black;background-color:transparent;}
14
- a:hover {color:#2B6FB6;background-color:transparent;}
15
- .nowrap {white-space: nowrap}
16
-
17
- /* Forms */
18
- fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
19
- legend {color:#2B6FB6; font-weight:bold;}
20
- label.msg {display:none;}
21
- label.invalid {color:#EE0000; display:inline;background-color:transparent;}
22
- input.invalid {border:1px solid #EE0000;background-color:transparent;}
23
- input {background:#FFF; border:1px solid #CCC;color:black;}
24
- input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
25
- input, select, textarea {border:1px solid #808080;}
26
- input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
27
- input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
28
- .input_noborder {border:0;}
29
-
30
- /* Buttons */
31
- #insert, #cancel, input.button, .updateButton {
32
- font-weight:bold;
33
- width:94px; height:23px;
34
- cursor:pointer;
35
- padding-bottom:2px;
36
- float:left;
37
- }
38
-
39
- #cancel {float:right}
40
-
41
- /* Browse */
42
- a.pickcolor, a.browse {text-decoration:none}
43
- a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
44
- .mceOldBoxModel a.browse span {width:22px; height:20px;}
45
- a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
46
- a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
47
- a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
48
- a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
49
- .mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
50
- a.pickcolor:hover span {background-color:#B2BBD0;}
51
- a.pickcolor:hover span.disabled {}
52
-
53
- /* Charmap */
54
- table.charmap {border:1px solid #AAA; text-align:center}
55
- td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
56
- #charmap a {display:block; color:#000; text-decoration:none; border:0}
57
- #charmap a:hover {background:#CCC;color:#2B6FB6}
58
- #charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
59
- #charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
60
-
61
- /* Source */
62
- .wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
63
- .mceActionPanel {margin-top:5px;}
64
-
65
- /* Tabs classes */
66
- .tabs {width:100%; height:18px; line-height:normal;}
67
- .tabs ul {margin:0; padding:0; list-style:none;}
68
- .tabs li {float:left; border: 1px solid black; border-bottom:0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block; cursor:pointer;}
69
- .tabs li.current {font-weight: bold; margin-right:2px;}
70
- .tabs span {float:left; display:block; padding:0px 10px 0 0;}
71
- .tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
72
- .tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
73
-
74
- /* Panels */
75
- .panel_wrapper div.panel {display:none;}
76
- .panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
77
- .panel_wrapper {border:1px solid #919B9C; padding:10px; padding-top:5px; clear:both; background:white;}
78
-
79
- /* Columns */
80
- .column {float:left;}
81
- .properties {width:100%;}
82
- .properties .column1 {}
83
- .properties .column2 {text-align:left;}
84
-
85
- /* Titles */
86
- h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
87
- h3 {font-size:14px;}
88
- .title {font-size:12px; font-weight:bold; color:#2B6FB6;}
89
-
90
- /* Dialog specific */
91
- #link .panel_wrapper, #link div.current {height:125px;}
92
- #image .panel_wrapper, #image div.current {height:200px;}
93
- #plugintable thead {font-weight:bold; background:#DDD;}
94
- #plugintable, #about #plugintable td {border:1px solid #919B9C;}
95
- #plugintable {width:96%; margin-top:10px;}
96
- #pluginscontainer {height:290px; overflow:auto;}
97
- #colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}
98
- #colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}
99
- #colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}
100
- #colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
101
- #colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
102
- #colorpicker #light div {overflow:hidden;}
103
- #colorpicker .panel_wrapper div.current {height:175px;}
104
- #colorpicker #namedcolors {width:150px;}
105
- #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
106
- #colorpicker #colornamecontainer {margin-top:5px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/tinymce/themes/advanced/skins/highcontrast/ui.css DELETED
@@ -1,106 +0,0 @@
1
- /* Reset */
2
- .highcontrastSkin table, .highcontrastSkin tbody, .highcontrastSkin a, .highcontrastSkin img, .highcontrastSkin tr, .highcontrastSkin div, .highcontrastSkin td, .highcontrastSkin iframe, .highcontrastSkin span, .highcontrastSkin *, .highcontrastSkin .mceText {border:0; margin:0; padding:0; vertical-align:baseline; border-collapse:separate;}
3
- .highcontrastSkin a:hover, .highcontrastSkin a:link, .highcontrastSkin a:visited, .highcontrastSkin a:active {text-decoration:none; font-weight:normal; cursor:default;}
4
- .highcontrastSkin table td {vertical-align:middle}
5
-
6
- .highcontrastSkin .mceIconOnly {display: block !important;}
7
-
8
- /* External */
9
- .highcontrastSkin .mceExternalToolbar {position:absolute; border:1px solid; border-bottom:0; display:none; background-color: white;}
10
- .highcontrastSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
11
- .highcontrastSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px;}
12
-
13
- /* Layout */
14
- .highcontrastSkin table.mceLayout {border: 1px solid;}
15
- .highcontrastSkin .mceIframeContainer {border-top:1px solid; border-bottom:1px solid}
16
- .highcontrastSkin .mceStatusbar a:hover {text-decoration:underline}
17
- .highcontrastSkin .mceStatusbar {display:block; line-height:1.5em; overflow:visible;}
18
- .highcontrastSkin .mceStatusbar div {float:left}
19
- .highcontrastSkin .mceStatusbar a.mceResize {display:block; float:right; width:20px; height:20px; cursor:se-resize; outline:0}
20
-
21
- .highcontrastSkin .mceToolbar td { display: inline-block; float: left;}
22
- .highcontrastSkin .mceToolbar tr { display: block;}
23
- .highcontrastSkin .mceToolbar table { display: block; }
24
-
25
- /* Button */
26
-
27
- .highcontrastSkin .mceButton { display:block; margin: 2px; padding: 5px 10px;border: 1px solid; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -ms-border-radius: 3px; height: 2em;}
28
- .highcontrastSkin .mceButton .mceVoiceLabel { height: 100%; vertical-align: center; line-height: 2em}
29
- .highcontrastSkin .mceButtonDisabled .mceVoiceLabel { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);}
30
- .highcontrastSkin .mceButtonActive, .highcontrastSkin .mceButton:focus, .highcontrastSkin .mceButton:active { border: 5px solid; padding: 1px 6px;-webkit-focus-ring-color:none;outline:none;}
31
-
32
- /* Separator */
33
- .highcontrastSkin .mceSeparator {display:block; width:16px; height:26px;}
34
-
35
- /* ListBox */
36
- .highcontrastSkin .mceListBox { display: block; margin:2px;-webkit-focus-ring-color:none;outline:none;}
37
- .highcontrastSkin .mceListBox .mceText {padding: 5px 6px; line-height: 2em; width: 15ex; overflow: hidden;}
38
- .highcontrastSkin .mceListBoxDisabled .mceText { opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60);}
39
- .highcontrastSkin .mceListBox a.mceText { padding: 5px 10px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;}
40
- .highcontrastSkin .mceListBox a.mceOpen { padding: 5px 4px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-left: 0; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;}
41
- .highcontrastSkin .mceListBox:focus a.mceText, .highcontrastSkin .mceListBox:active a.mceText { border-width: 5px; padding: 1px 10px 1px 6px;}
42
- .highcontrastSkin .mceListBox:focus a.mceOpen, .highcontrastSkin .mceListBox:active a.mceOpen { border-width: 5px; padding: 1px 0px 1px 4px;}
43
-
44
- .highcontrastSkin .mceListBoxMenu {overflow-y:auto}
45
-
46
- /* SplitButton */
47
- .highcontrastSkin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
48
-
49
- .highcontrastSkin .mceSplitButton { border-collapse: collapse; margin: 2px; height: 2em; line-height: 2em;-webkit-focus-ring-color:none;outline:none;}
50
- .highcontrastSkin .mceSplitButton td { display: table-cell; float: none; margin: 0; padding: 0; height: 2em;}
51
- .highcontrastSkin .mceSplitButton tr { display: table-row; }
52
- .highcontrastSkin table.mceSplitButton { display: table; }
53
- .highcontrastSkin .mceSplitButton a.mceAction { padding: 5px 10px; display: block; height: 2em; line-height: 2em; overflow: hidden; border: 1px solid; border-right: 0; border-radius: 3px 0px 0px 3px; -moz-border-radius: 3px 0px 0px 3px; -webkit-border-radius: 3px 0px 0px 3px; -ms-border-radius: 3px 0px 0px 3px;}
54
- .highcontrastSkin .mceSplitButton a.mceOpen { padding: 5px 4px; display: block; height: 2em; line-height: 2em; border: 1px solid; border-radius: 0px 3px 3px 0px; -moz-border-radius: 0px 3px 3px 0px; -webkit-border-radius: 0px 3px 3px 0px; -ms-border-radius: 0px 3px 3px 0px;}
55
- .highcontrastSkin .mceSplitButton .mceVoiceLabel { height: 2em; vertical-align: center; line-height: 2em; }
56
- .highcontrastSkin .mceSplitButton:focus a.mceAction, .highcontrastSkin .mceSplitButton:active a.mceAction { border-width: 5px; border-right-width: 1px; padding: 1px 10px 1px 6px;-webkit-focus-ring-color:none;outline:none;}
57
- .highcontrastSkin .mceSplitButton:focus a.mceOpen, .highcontrastSkin .mceSplitButton:active a.mceOpen { border-width: 5px; border-left-width: 1px; padding: 1px 0px 1px 4px;-webkit-focus-ring-color:none;outline:none;}
58
-
59
- /* Menu */
60
- .highcontrastSkin .mceNoIcons span.mceIcon {width:0;}
61
- .highcontrastSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid; direction:ltr}
62
- .highcontrastSkin .mceMenu table {background:white; color: black}
63
- .highcontrastSkin .mceNoIcons a .mceText {padding-left:10px}
64
- .highcontrastSkin .mceMenu a, .highcontrastSkin .mceMenu span, .highcontrastSkin .mceMenu {display:block;background:white; color: black}
65
- .highcontrastSkin .mceMenu td {height:2em}
66
- .highcontrastSkin .mceMenu a {position:relative;padding:3px 0 4px 0; display: block;}
67
- .highcontrastSkin .mceMenu .mceText {position:relative; display:block; cursor:default; margin:0; padding:0 25px 0 25px;}
68
- .highcontrastSkin .mceMenu pre.mceText {font-family:Monospace}
69
- .highcontrastSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:26px;}
70
- .highcontrastSkin td.mceMenuItemSeparator {border-top:1px solid; height:1px}
71
- .highcontrastSkin .mceMenuItemTitle a {border:0; border-bottom:1px solid}
72
- .highcontrastSkin .mceMenuItemTitle span.mceText {font-weight:bold; padding-left:4px}
73
- .highcontrastSkin .mceNoIcons .mceMenuItemSelected span.mceText:before {content: "\2713\A0";}
74
- .highcontrastSkin .mceMenu span.mceMenuLine {display:none}
75
- .highcontrastSkin .mceMenuItemSub a .mceText:after {content: "\A0\25B8"}
76
- .highcontrastSkin .mceMenuItem td, .highcontrastSkin .mceMenuItem th {line-height: normal}
77
-
78
- /* ColorSplitButton */
79
- .highcontrastSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid; color: #000}
80
- .highcontrastSkin .mceColorSplitMenu td {padding:2px}
81
- .highcontrastSkin .mceColorSplitMenu a {display:block; width:16px; height:16px; overflow:hidden; color:#000; margin: 0; padding: 0;}
82
- .highcontrastSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
83
- .highcontrastSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
84
- .highcontrastSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid; background-color:#B6BDD2}
85
- .highcontrastSkin a.mceMoreColors:hover {border:1px solid #0A246A; color: #000;}
86
- .highcontrastSkin .mceColorPreview {display:none;}
87
- .highcontrastSkin .mce_forecolor span.mceAction, .highcontrastSkin .mce_backcolor span.mceAction {height:17px;overflow:hidden}
88
-
89
- /* Progress,Resize */
90
- .highcontrastSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}
91
- .highcontrastSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
92
-
93
- /* Rtl */
94
- .mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0}
95
- .mceRtl .mceMenuItem .mceText {text-align: right}
96
-
97
- /* Formats */
98
- .highcontrastSkin .mce_p span.mceText {}
99
- .highcontrastSkin .mce_address span.mceText {font-style:italic}
100
- .highcontrastSkin .mce_pre span.mceText {font-family:monospace}
101
- .highcontrastSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
102
- .highcontrastSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
103
- .highcontrastSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
104
- .highcontrastSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
105
- .highcontrastSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
106
- .highcontrastSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/tinymce/themes/advanced/skins/o2k7/content.css DELETED
@@ -1,48 +0,0 @@
1
- body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
2
- body {background:#FFF;}
3
- body.mceForceColors {background:#FFF; color:#000;}
4
- h1 {font-size: 2em}
5
- h2 {font-size: 1.5em}
6
- h3 {font-size: 1.17em}
7
- h4 {font-size: 1em}
8
- h5 {font-size: .83em}
9
- h6 {font-size: .75em}
10
- .mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
11
- a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;}
12
- span.mceItemNbsp {background: #DDD}
13
- td.mceSelected, th.mceSelected {background-color:#3399ff !important}
14
- img {border:0;}
15
- table, img, hr, .mceItemAnchor {cursor:default}
16
- table td, table th {cursor:text}
17
- ins {border-bottom:1px solid green; text-decoration: none; color:green}
18
- del {color:red; text-decoration:line-through}
19
- cite {border-bottom:1px dashed blue}
20
- acronym {border-bottom:1px dotted #CCC; cursor:help}
21
- abbr {border-bottom:1px dashed #CCC; cursor:help}
22
-
23
- /* IE */
24
- * html body {
25
- scrollbar-3dlight-color:#F0F0EE;
26
- scrollbar-arrow-color:#676662;
27
- scrollbar-base-color:#F0F0EE;
28
- scrollbar-darkshadow-color:#DDD;
29
- scrollbar-face-color:#E0E0DD;
30
- scrollbar-highlight-color:#F0F0EE;
31
- scrollbar-shadow-color:#F0F0EE;
32
- scrollbar-track-color:#F5F5F5;
33
- }
34
-
35
- img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
36
- font[face=mceinline] {font-family:inherit !important}
37
- *[contentEditable]:focus {outline:0}
38
-
39
- .mceItemMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc}
40
- .mceItemShockWave {background-image:url(../../img/shockwave.gif)}
41
- .mceItemFlash {background-image:url(../../img/flash.gif)}
42
- .mceItemQuickTime {background-image:url(../../img/quicktime.gif)}
43
- .mceItemWindowsMedia {background-image:url(../../img/windowsmedia.gif)}
44
- .mceItemRealMedia {background-image:url(../../img/realmedia.gif)}
45
- .mceItemVideo {background-image:url(../../img/video.gif)}
46
- .mceItemAudio {background-image:url(../../img/video.gif)}
47
- .mceItemIframe {background-image:url(../../img/iframe.gif)}
48
- .mcePageBreak {display:block;border:0;width:100%;height:12px;border-top:1px dotted #ccc;margin-top:15px;background:#fff url(../../img/pagebreak.gif) no-repeat center top;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/tinymce/themes/advanced/skins/o2k7/dialog.css DELETED
@@ -1,118 +0,0 @@
1
- /* Generic */
2
- body {
3
- font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
4
- scrollbar-3dlight-color:#F0F0EE;
5
- scrollbar-arrow-color:#676662;
6
- scrollbar-base-color:#F0F0EE;
7
- scrollbar-darkshadow-color:#DDDDDD;
8
- scrollbar-face-color:#E0E0DD;
9
- scrollbar-highlight-color:#F0F0EE;
10
- scrollbar-shadow-color:#F0F0EE;
11
- scrollbar-track-color:#F5F5F5;
12
- background:#F0F0EE;
13
- padding:0;
14
- margin:8px 8px 0 8px;
15
- }
16
-
17
- html {background:#F0F0EE;}
18
- td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
19
- textarea {resize:none;outline:none;}
20
- a:link, a:visited {color:black;}
21
- a:hover {color:#2B6FB6;}
22
- .nowrap {white-space: nowrap}
23
-
24
- /* Forms */
25
- fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
26
- legend {color:#2B6FB6; font-weight:bold;}
27
- label.msg {display:none;}
28
- label.invalid {color:#EE0000; display:inline;}
29
- input.invalid {border:1px solid #EE0000;}
30
- input {background:#FFF; border:1px solid #CCC;}
31
- input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
32
- input, select, textarea {border:1px solid #808080;}
33
- input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
34
- input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
35
- .input_noborder {border:0;}
36
-
37
- /* Buttons */
38
- #insert, #cancel, input.button, .updateButton {
39
- border:0; margin:0; padding:0;
40
- font-weight:bold;
41
- width:94px; height:26px;
42
- background:url(../default/img/buttons.png) 0 -26px;
43
- cursor:pointer;
44
- padding-bottom:2px;
45
- float:left;
46
- }
47
-
48
- #insert {background:url(../default/img/buttons.png) 0 -52px}
49
- #cancel {background:url(../default/img/buttons.png) 0 0; float:right}
50
-
51
- /* Browse */
52
- a.pickcolor, a.browse {text-decoration:none}
53
- a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
54
- .mceOldBoxModel a.browse span {width:22px; height:20px;}
55
- a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
56
- a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
57
- a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
58
- a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
59
- .mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
60
- a.pickcolor:hover span {background-color:#B2BBD0;}
61
- a.pickcolor:hover span.disabled {}
62
-
63
- /* Charmap */
64
- table.charmap {border:1px solid #AAA; text-align:center}
65
- td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
66
- #charmap a {display:block; color:#000; text-decoration:none; border:0}
67
- #charmap a:hover {background:#CCC;color:#2B6FB6}
68
- #charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
69
- #charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
70
-
71
- /* Source */
72
- .wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
73
- .mceActionPanel {margin-top:5px;}
74
-
75
- /* Tabs classes */
76
- .tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;}
77
- .tabs ul {margin:0; padding:0; list-style:none;}
78
- .tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
79
- .tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
80
- .tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
81
- .tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;}
82
- .tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
83
- .tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
84
-
85
- /* Panels */
86
- .panel_wrapper div.panel {display:none;}
87
- .panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
88
- .panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
89
-
90
- /* Columns */
91
- .column {float:left;}
92
- .properties {width:100%;}
93
- .properties .column1 {}
94
- .properties .column2 {text-align:left;}
95
-
96
- /* Titles */
97
- h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
98
- h3 {font-size:14px;}
99
- .title {font-size:12px; font-weight:bold; color:#2B6FB6;}
100
-
101
- /* Dialog specific */
102
- #link .panel_wrapper, #link div.current {height:125px;}
103
- #image .panel_wrapper, #image div.current {height:200px;}
104
- #plugintable thead {font-weight:bold; background:#DDD;}
105
- #plugintable, #about #plugintable td {border:1px solid #919B9C;}
106
- #plugintable {width:96%; margin-top:10px;}
107
- #pluginscontainer {height:290px; overflow:auto;}
108
- #colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}
109
- #colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}
110
- #colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}
111
- #colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
112
- #colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
113
- #colorpicker #light div {overflow:hidden;}
114
- #colorpicker .panel_wrapper div.current {height:175px;}
115
- #colorpicker #namedcolors {width:150px;}
116
- #colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
117
- #colorpicker #colornamecontainer {margin-top:5px;}
118
- #colorpicker #picker_panel fieldset {margin:auto;width:325px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png DELETED
Binary file
js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png DELETED
Binary file
js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png DELETED
Binary file
js/tinymce/themes/advanced/skins/o2k7/ui.css DELETED
@@ -1,222 +0,0 @@
1
- /* Reset */
2
- .o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}
3
- .o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
4
- .o2k7Skin table td {vertical-align:middle}
5
-
6
- /* Containers */
7
- .o2k7Skin table {background:transparent}
8
- .o2k7Skin iframe {display:block;}
9
- .o2k7Skin .mceToolbar {height:26px}
10
-
11
- /* External */
12
- .o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none}
13
- .o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
14
- .o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}
15
-
16
- /* Layout */
17
- .o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD}
18
- .o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD}
19
- .o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD}
20
- .o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}
21
- .o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD}
22
- .o2k7Skin td.mceToolbar{background:#E5EFFD}
23
- .o2k7Skin .mceStatusbar {background:#E5EFFD; display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible; color:#000; height:20px}
24
- .o2k7Skin .mceStatusbar div {float:left; padding:2px}
25
- .o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
26
- .o2k7Skin .mceStatusbar a:hover {text-decoration:underline}
27
- .o2k7Skin table.mceToolbar {margin-left:3px}
28
- .o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;}
29
- .o2k7Skin .mceToolbar td.mceFirst span {margin:0}
30
- .o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px}
31
- .o2k7Skin .mceToolbar .mceToolbarEndListBox span, .o2k7Skin .mceToolbar .mceToolbarStartListBox span {display:none}
32
- .o2k7Skin span.mceIcon, .o2k7Skin img.mceIcon {display:block; width:20px; height:20px}
33
- .o2k7Skin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
34
- .o2k7Skin td.mceCenter {text-align:center;}
35
- .o2k7Skin td.mceCenter table {margin:0 auto; text-align:left;}
36
- .o2k7Skin td.mceRight table {margin:0 0 0 auto;}
37
-
38
- /* Button */
39
- .o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px}
40
- .o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px}
41
- .o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}
42
- .o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
43
- .o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px}
44
- .o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
45
- .o2k7Skin .mceButtonLabeled {width:auto}
46
- .o2k7Skin .mceButtonLabeled span.mceIcon {float:left}
47
- .o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
48
- .o2k7Skin .mceButtonDisabled .mceButtonLabel {color:#888}
49
-
50
- /* Separator */
51
- .o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px}
52
-
53
- /* ListBox */
54
- .o2k7Skin .mceListBox {padding-left: 3px}
55
- .o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block}
56
- .o2k7Skin .mceListBox .mceText {padding-left:4px; text-align:left; width:70px; border:1px solid #b3c7e1; border-right:0; background:#eaf2fb; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
57
- .o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0}
58
- .o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF}
59
- .o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px}
60
- .o2k7Skin .mceListBoxDisabled .mceText {color:gray}
61
- .o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden; margin-left:3px}
62
- .o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px}
63
- .o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;}
64
-
65
- /* SplitButton */
66
- .o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px; direction:ltr}
67
- .o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}
68
- .o2k7Skin .mceSplitButton a.mceAction {width:22px}
69
- .o2k7Skin .mceSplitButton span.mceAction {width:22px; background-image:url(../../img/icons.gif)}
70
- .o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0}
71
- .o2k7Skin .mceSplitButton span.mceOpen {display:none}
72
- .o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px}
73
- .o2k7Skin table.mceSplitButtonEnabled:hover a.mceOpen, .o2k7Skin .mceSplitButtonHover a.mceOpen, .o2k7Skin .mceSplitButtonSelected a.mceOpen {background-position:-44px -44px}
74
- .o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
75
- .o2k7Skin .mceSplitButtonActive {background-position:0 -44px}
76
-
77
- /* ColorSplitButton */
78
- .o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}
79
- .o2k7Skin .mceColorSplitMenu td {padding:2px}
80
- .o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}
81
- .o2k7Skin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
82
- .o2k7Skin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
83
- .o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
84
- .o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A}
85
- .o2k7Skin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a;overflow:hidden}
86
- .o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden}
87
-
88
- /* Menu */
89
- .o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD; direction:ltr}
90
- .o2k7Skin .mceNoIcons span.mceIcon {width:0;}
91
- .o2k7Skin .mceNoIcons a .mceText {padding-left:10px}
92
- .o2k7Skin .mceMenu table {background:#FFF}
93
- .o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block}
94
- .o2k7Skin .mceMenu td {height:20px}
95
- .o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0}
96
- .o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}
97
- .o2k7Skin .mceMenu span.mceText, .o2k7Skin .mceMenu .mcePreview {font-size:11px}
98
- .o2k7Skin .mceMenu pre.mceText {font-family:Monospace}
99
- .o2k7Skin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}
100
- .o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3}
101
- .o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px}
102
- .o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD}
103
- .o2k7Skin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}
104
- .o2k7Skin .mceMenuItemDisabled .mceText {color:#888}
105
- .o2k7Skin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)}
106
- .o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center}
107
- .o2k7Skin .mceMenu span.mceMenuLine {display:none}
108
- .o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;}
109
- .o2k7Skin .mceMenuItem td, .o2k7Skin .mceMenuItem th {line-height: normal}
110
-
111
- /* Progress,Resize */
112
- .o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}
113
- .o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
114
-
115
- /* Rtl */
116
- .mceRtl .mceListBox .mceText {text-align: right; padding: 0 4px 0 0}
117
- .mceRtl .mceMenuItem .mceText {text-align: right}
118
-
119
- /* Formats */
120
- .o2k7Skin .mce_formatPreview a {font-size:10px}
121
- .o2k7Skin .mce_p span.mceText {}
122
- .o2k7Skin .mce_address span.mceText {font-style:italic}
123
- .o2k7Skin .mce_pre span.mceText {font-family:monospace}
124
- .o2k7Skin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
125
- .o2k7Skin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
126
- .o2k7Skin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
127
- .o2k7Skin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
128
- .o2k7Skin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
129
- .o2k7Skin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
130
-
131
- /* Theme */
132
- .o2k7Skin span.mce_bold {background-position:0 0}
133
- .o2k7Skin span.mce_italic {background-position:-60px 0}
134
- .o2k7Skin span.mce_underline {background-position:-140px 0}
135
- .o2k7Skin span.mce_strikethrough {background-position:-120px 0}
136
- .o2k7Skin span.mce_undo {background-position:-160px 0}
137
- .o2k7Skin span.mce_redo {background-position:-100px 0}
138
- .o2k7Skin span.mce_cleanup {background-position:-40px 0}
139
- .o2k7Skin span.mce_bullist {background-position:-20px 0}
140
- .o2k7Skin span.mce_numlist {background-position:-80px 0}
141
- .o2k7Skin span.mce_justifyleft {background-position:-460px 0}
142
- .o2k7Skin span.mce_justifyright {background-position:-480px 0}
143
- .o2k7Skin span.mce_justifycenter {background-position:-420px 0}
144
- .o2k7Skin span.mce_justifyfull {background-position:-440px 0}
145
- .o2k7Skin span.mce_anchor {background-position:-200px 0}
146
- .o2k7Skin span.mce_indent {background-position:-400px 0}
147
- .o2k7Skin span.mce_outdent {background-position:-540px 0}
148
- .o2k7Skin span.mce_link {background-position:-500px 0}
149
- .o2k7Skin span.mce_unlink {background-position:-640px 0}
150
- .o2k7Skin span.mce_sub {background-position:-600px 0}
151
- .o2k7Skin span.mce_sup {background-position:-620px 0}
152
- .o2k7Skin span.mce_removeformat {background-position:-580px 0}
153
- .o2k7Skin span.mce_newdocument {background-position:-520px 0}
154
- .o2k7Skin span.mce_image {background-position:-380px 0}
155
- .o2k7Skin span.mce_help {background-position:-340px 0}
156
- .o2k7Skin span.mce_code {background-position:-260px 0}
157
- .o2k7Skin span.mce_hr {background-position:-360px 0}
158
- .o2k7Skin span.mce_visualaid {background-position:-660px 0}
159
- .o2k7Skin span.mce_charmap {background-position:-240px 0}
160
- .o2k7Skin span.mce_paste {background-position:-560px 0}
161
- .o2k7Skin span.mce_copy {background-position:-700px 0}
162
- .o2k7Skin span.mce_cut {background-position:-680px 0}
163
- .o2k7Skin span.mce_blockquote {background-position:-220px 0}
164
- .o2k7Skin .mce_forecolor span.mceAction {background-position:-720px 0}
165
- .o2k7Skin .mce_backcolor span.mceAction {background-position:-760px 0}
166
- .o2k7Skin span.mce_forecolorpicker {background-position:-720px 0}
167
- .o2k7Skin span.mce_backcolorpicker {background-position:-760px 0}
168
-
169
- /* Plugins */
170
- .o2k7Skin span.mce_advhr {background-position:-0px -20px}
171
- .o2k7Skin span.mce_ltr {background-position:-20px -20px}
172
- .o2k7Skin span.mce_rtl {background-position:-40px -20px}
173
- .o2k7Skin span.mce_emotions {background-position:-60px -20px}
174
- .o2k7Skin span.mce_fullpage {background-position:-80px -20px}
175
- .o2k7Skin span.mce_fullscreen {background-position:-100px -20px}
176
- .o2k7Skin span.mce_iespell {background-position:-120px -20px}
177
- .o2k7Skin span.mce_insertdate {background-position:-140px -20px}
178
- .o2k7Skin span.mce_inserttime {background-position:-160px -20px}
179
- .o2k7Skin span.mce_absolute {background-position:-180px -20px}
180
- .o2k7Skin span.mce_backward {background-position:-200px -20px}
181
- .o2k7Skin span.mce_forward {background-position:-220px -20px}
182
- .o2k7Skin span.mce_insert_layer {background-position:-240px -20px}
183
- .o2k7Skin span.mce_insertlayer {background-position:-260px -20px}
184
- .o2k7Skin span.mce_movebackward {background-position:-280px -20px}
185
- .o2k7Skin span.mce_moveforward {background-position:-300px -20px}
186
- .o2k7Skin span.mce_media {background-position:-320px -20px}
187
- .o2k7Skin span.mce_nonbreaking {background-position:-340px -20px}
188
- .o2k7Skin span.mce_pastetext {background-position:-360px -20px}
189
- .o2k7Skin span.mce_pasteword {background-position:-380px -20px}
190
- .o2k7Skin span.mce_selectall {background-position:-400px -20px}
191
- .o2k7Skin span.mce_preview {background-position:-420px -20px}
192
- .o2k7Skin span.mce_print {background-position:-440px -20px}
193
- .o2k7Skin span.mce_cancel {background-position:-460px -20px}
194
- .o2k7Skin span.mce_save {background-position:-480px -20px}
195
- .o2k7Skin span.mce_replace {background-position:-500px -20px}
196
- .o2k7Skin span.mce_search {background-position:-520px -20px}
197
- .o2k7Skin span.mce_styleprops {background-position:-560px -20px}
198
- .o2k7Skin span.mce_table {background-position:-580px -20px}
199
- .o2k7Skin span.mce_cell_props {background-position:-600px -20px}
200
- .o2k7Skin span.mce_delete_table {background-position:-620px -20px}
201
- .o2k7Skin span.mce_delete_col {background-position:-640px -20px}
202
- .o2k7Skin span.mce_delete_row {background-position:-660px -20px}
203
- .o2k7Skin span.mce_col_after {background-position:-680px -20px}
204
- .o2k7Skin span.mce_col_before {background-position:-700px -20px}
205
- .o2k7Skin span.mce_row_after {background-position:-720px -20px}
206
- .o2k7Skin span.mce_row_before {background-position:-740px -20px}
207
- .o2k7Skin span.mce_merge_cells {background-position:-760px -20px}
208
- .o2k7Skin span.mce_table_props {background-position:-980px -20px}
209
- .o2k7Skin span.mce_row_props {background-position:-780px -20px}
210
- .o2k7Skin span.mce_split_cells {background-position:-800px -20px}
211
- .o2k7Skin span.mce_template {background-position:-820px -20px}
212
- .o2k7Skin span.mce_visualchars {background-position:-840px -20px}
213
- .o2k7Skin span.mce_abbr {background-position:-860px -20px}
214
- .o2k7Skin span.mce_acronym {background-position:-880px -20px}
215
- .o2k7Skin span.mce_attribs {background-position:-900px -20px}
216
- .o2k7Skin span.mce_cite {background-position:-920px -20px}
217
- .o2k7Skin span.mce_del {background-position:-940px -20px}
218
- .o2k7Skin span.mce_ins {background-position:-960px -20px}
219
- .o2k7Skin span.mce_pagebreak {background-position:0 -40px}
220
- .o2k7Skin span.mce_restoredraft {background-position:-20px -40px}
221
- .o2k7Skin span.mce_spellchecker {background-position:-540px -20px}
222
- .o2k7Skin span.mce_visualblocks {background-position: -40px -40px}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/tinymce/themes/advanced/skins/o2k7/ui_black.css DELETED
@@ -1,8 +0,0 @@
1
- /* Black */
2
- .o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton a.mceOpen, .o2k7SkinBlack .mceListBox a.mceOpen {background-image:url(img/button_bg_black.png)}
3
- .o2k7SkinBlack td.mceToolbar, .o2k7SkinBlack td.mceStatusbar, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF}
4
- .o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0}
5
- .o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0}
6
- .o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;}
7
- .o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7SkinBlack .mceSplitButtonHover a.mceAction, .o2k7SkinBlack .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)}
8
- .o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7SkinBlack .mceMenu .mceMenuItemActive {background-color:#FFE7A1}
 
 
 
 
 
 
 
 
js/tinymce/themes/advanced/skins/o2k7/ui_silver.css DELETED
@@ -1,5 +0,0 @@
1
- /* Silver */
2
- .o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton a.mceOpen, .o2k7SkinSilver .mceListBox a.mceOpen {background-image:url(img/button_bg_silver.png)}
3
- .o2k7SkinSilver td.mceToolbar, .o2k7SkinSilver td.mceStatusbar, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee}
4
- .o2k7SkinSilver .mceListBox .mceText {background:#FFF}
5
- .o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb}
 
 
 
 
 
js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png DELETED
Binary file
js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png DELETED
Binary file
js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif DELETED
Binary file
js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png DELETED
Binary file
js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif DELETED
Binary file
js/tinymce/themes/advanced/skins/wp_theme/ui.css CHANGED
@@ -2066,6 +2066,7 @@ RTL
2066
  .wp_themeSkin span.mce_justifycenter,
2067
  .wp_themeSkin span.mce_justifyfull,
2068
  .wp_themeSkin span.mce_indent,
 
2069
  .wp_themeSkin span.mce_outdent,
2070
  .wp_themeSkin span.mce_link,
2071
  .wp_themeSkin span.mce_unlink,
@@ -2088,7 +2089,7 @@ RTL
2088
  .wp_themeSkin .mceSplitButton span.mce_numlist,
2089
  .wp_themeSkin .mceSplitButton span.mce_bullist {
2090
  background-image: url('../../img/wpicons-2x.png?ver=20120720');
2091
- background-size: 560px 40px;
2092
  }
2093
 
2094
  .wp-media-buttons .add_media span.wp-media-buttons-icon,
2066
  .wp_themeSkin span.mce_justifycenter,
2067
  .wp_themeSkin span.mce_justifyfull,
2068
  .wp_themeSkin span.mce_indent,
2069
+ .wp_themeSkin span.wj_custom_fields,
2070
  .wp_themeSkin span.mce_outdent,
2071
  .wp_themeSkin span.mce_link,
2072
  .wp_themeSkin span.mce_unlink,
2089
  .wp_themeSkin .mceSplitButton span.mce_numlist,
2090
  .wp_themeSkin .mceSplitButton span.mce_bullist {
2091
  background-image: url('../../img/wpicons-2x.png?ver=20120720');
2092
+ background-size: 580px 40px;
2093
  }
2094
 
2095
  .wp-media-buttons .add_media span.wp-media-buttons-icon,
languages/wysija-newsletters-af.mo CHANGED
Binary file
languages/wysija-newsletters-ar.mo CHANGED
Binary file
languages/wysija-newsletters-bg_BG.mo CHANGED
Binary file
languages/wysija-newsletters-bs_BA.mo CHANGED
Binary file
languages/wysija-newsletters-ca.mo CHANGED
Binary file
languages/wysija-newsletters-ca_ES.mo CHANGED
Binary file
languages/wysija-newsletters-cs_CZ.mo CHANGED
Binary file
languages/wysija-newsletters-da_DK.mo CHANGED
Binary file
languages/wysija-newsletters-de_DE.mo CHANGED
Binary file
languages/wysija-newsletters-el.mo CHANGED
Binary file
languages/wysija-newsletters-en_US.mo ADDED
Binary file
languages/wysija-newsletters-es.mo ADDED
Binary file
languages/wysija-newsletters-es_AR.mo ADDED
Binary file
languages/wysija-newsletters-es_ES.mo CHANGED
Binary file
languages/wysija-newsletters-eu.mo CHANGED
Binary file
languages/wysija-newsletters-fa.mo CHANGED
Binary file
languages/wysija-newsletters-fa_IR.mo CHANGED
Binary file
languages/wysija-newsletters-fi.mo CHANGED
Binary file
languages/wysija-newsletters-fr_FR.mo CHANGED
Binary file
languages/wysija-newsletters-gl_ES.mo CHANGED
Binary file
languages/wysija-newsletters-he_IL.mo CHANGED
Binary file
languages/wysija-newsletters-hi_IN.mo CHANGED
Binary file
languages/wysija-newsletters-hr_HR.mo CHANGED
Binary file
languages/wysija-newsletters-hu_HU.mo CHANGED
Binary file
languages/wysija-newsletters-hy_AM.mo CHANGED
Binary file
languages/wysija-newsletters-id.mo CHANGED
Binary file
languages/wysija-newsletters-it_IT.mo CHANGED
Binary file
languages/wysija-newsletters-ja.mo CHANGED
Binary file
languages/wysija-newsletters-ko_KR.mo CHANGED
Binary file
languages/wysija-newsletters-lt_LT.mo ADDED
Binary file
languages/wysija-newsletters-lv.mo CHANGED
Binary file
languages/wysija-newsletters-lv_LV.mo ADDED
Binary file
languages/wysija-newsletters-mk_MK.mo CHANGED
Binary file
languages/wysija-newsletters-my_MM.mo CHANGED
Binary file
languages/wysija-newsletters-nb_NO.mo CHANGED
Binary file
languages/wysija-newsletters-nl_NL.mo CHANGED
Binary file
languages/wysija-newsletters-pl_PL.mo CHANGED
Binary file
languages/wysija-newsletters-pt_BR.mo CHANGED
Binary file
languages/wysija-newsletters-pt_PT.mo CHANGED
Binary file
languages/wysija-newsletters-ro_RO.mo CHANGED
Binary file
languages/wysija-newsletters-ru_RU.mo CHANGED
Binary file
languages/wysija-newsletters-sk_SK.mo CHANGED
Binary file
languages/wysija-newsletters-sl_SI.mo CHANGED
Binary file
languages/wysija-newsletters-sr_RS.mo CHANGED
Binary file
languages/wysija-newsletters-sr_RS@latin.mo CHANGED
Binary file
languages/wysija-newsletters-sv_SE.mo CHANGED
Binary file
languages/wysija-newsletters-tr_TR.mo CHANGED
Binary file
languages/wysija-newsletters-uk.mo CHANGED
Binary file
languages/wysija-newsletters-ur_PK.mo CHANGED
Binary file
languages/wysija-newsletters-vi.mo ADDED
Binary file
languages/wysija-newsletters-zh_HK.mo CHANGED
Binary file
languages/wysija-newsletters-zh_TW.mo CHANGED
Binary file
models/config.php CHANGED
@@ -28,7 +28,7 @@ class WYSIJA_model_config extends WYSIJA_object{
28
  'debug_log_manual',
29
 
30
  );
31
- var $defaults=array(
32
  'limit_listing'=>10,
33
  'role_campaign'=>'switch_themes',
34
  'role_subscribers'=>'switch_themes',
@@ -43,6 +43,7 @@ class WYSIJA_model_config extends WYSIJA_object{
43
  'confirm_dbleoptin' =>1,
44
  'bounce_selfsigned'=>0,
45
  'bounce_email_notexists'=>'unsub',
 
46
  'bounce_inbox_full'=>'not',
47
  'pluginsImportedEgg'=>false,
48
  'advanced_charset'=>'UTF-8',
@@ -67,6 +68,7 @@ class WYSIJA_model_config extends WYSIJA_object{
67
  'ms_sending_emails_number'=>'100',
68
  'ms_allow_admin_sending_method'=>false,
69
  'ms_allow_admin_toggle_signup_confirmation'=>false,
 
70
  'cron_page_hit_trigger'=>1,
71
  'beta_mode'=>false,
72
  'cron_manual'=>true,
@@ -235,9 +237,9 @@ class WYSIJA_model_config extends WYSIJA_object{
235
  }
236
 
237
  //bounce frequency has been changed
238
- if(isset($data['bouncing_emails_each']) && $data['bouncing_emails_each']!=$this->getValue('bouncing_emails_each')){
239
  $bouncing_freq_has_changed=true;
240
- $data['last_save']=time();
241
  }
242
 
243
  //if saved with gmail then we set up the smtp settings
@@ -336,7 +338,7 @@ class WYSIJA_model_config extends WYSIJA_object{
336
  $from_email=$data['ms_from_email'];
337
  }
338
  else $from_email=$data['from_email'];
339
- $mailModel->update(array('from_name'=>$data['from_name'],'from_email'=>$from_email,
340
  'subject'=>$data['confirm_email_title'],'body'=>$data['confirm_email_body']),array('email_id'=>$this->values['confirm_email_id']));
341
  }
342
  unset($this->values['confirm_email_title']);
28
  'debug_log_manual',
29
 
30
  );
31
+ var $defaults = array(
32
  'limit_listing'=>10,
33
  'role_campaign'=>'switch_themes',
34
  'role_subscribers'=>'switch_themes',
43
  'confirm_dbleoptin' =>1,
44
  'bounce_selfsigned'=>0,
45
  'bounce_email_notexists'=>'unsub',
46
+ 'bouncing_emails_each'=>'daily',
47
  'bounce_inbox_full'=>'not',
48
  'pluginsImportedEgg'=>false,
49
  'advanced_charset'=>'UTF-8',
68
  'ms_sending_emails_number'=>'100',
69
  'ms_allow_admin_sending_method'=>false,
70
  'ms_allow_admin_toggle_signup_confirmation'=>false,
71
+ 'ms_bouncing_emails_each'=>'daily',
72
  'cron_page_hit_trigger'=>1,
73
  'beta_mode'=>false,
74
  'cron_manual'=>true,
237
  }
238
 
239
  //bounce frequency has been changed
240
+ if(isset($data['bouncing_emails_each']) && $data['bouncing_emails_each'] != $this->getValue('bouncing_emails_each')){
241
  $bouncing_freq_has_changed=true;
242
+ $data['last_save'] = time();
243
  }
244
 
245
  //if saved with gmail then we set up the smtp settings
338
  $from_email=$data['ms_from_email'];
339
  }
340
  else $from_email=$data['from_email'];
341
+ $mailModel->update(array('from_name'=>$data['from_name'],'from_email'=>$from_email, 'replyto_name'=>$data['replyto_name'],'replyto_email'=>$data['replyto_email'],
342
  'subject'=>$data['confirm_email_title'],'body'=>$data['confirm_email_body']),array('email_id'=>$this->values['confirm_email_id']));
343
  }
344
  unset($this->values['confirm_email_title']);
models/email.php CHANGED
@@ -97,20 +97,20 @@ class WYSIJA_model_email extends WYSIJA_model{
97
 
98
  return true;
99
  }
100
-
101
  /**
102
  * trigger on Update
103
  */
104
  function afterUpdate($result_save_id){
105
  //First reply-to address (name + email) is a default value for next newsletter
106
- $model_config=WYSIJA::get('config','model');
107
  if(!$model_config->getValue('replyto_name') || !$model_config->getValue('replyto_email')){
108
  $email = $this->getOne(false,array('email_id'=>$result_save_id));
109
  $model_config->save(array(
110
  'replyto_name' => $email['replyto_name'],
111
  'replyto_email' => $email['replyto_email']
112
  ));
113
- }
114
  return true;
115
  }
116
 
97
 
98
  return true;
99
  }
100
+
101
  /**
102
  * trigger on Update
103
  */
104
  function afterUpdate($result_save_id){
105
  //First reply-to address (name + email) is a default value for next newsletter
106
+ $model_config=WYSIJA::get('config','model');
107
  if(!$model_config->getValue('replyto_name') || !$model_config->getValue('replyto_email')){
108
  $email = $this->getOne(false,array('email_id'=>$result_save_id));
109
  $model_config->save(array(
110
  'replyto_name' => $email['replyto_name'],
111
  'replyto_email' => $email['replyto_email']
112
  ));
113
+ }
114
  return true;
115
  }
116
 
models/list.php CHANGED
@@ -6,15 +6,15 @@ class WYSIJA_model_list extends WYSIJA_model{
6
  var $table_name='list';
7
  var $columns=array(
8
  'list_id'=>array('auto'=>true),
9
- 'name' => array('req'=>true,'type'=>"text"),
10
- 'namekey' => array('req'=>true,"type"=>"text"),
11
- 'description' => array("type"=>"text"),
12
- 'unsub_mail_id' => array("req"=>true,"type"=>"integer"),
13
- 'welcome_mail_id' => array("req"=>true,"type"=>"integer"),
14
- 'is_enabled' => array("req"=>true,"type"=>"boolean"),
15
- 'is_public' => array("req"=>true,"type"=>"boolean"),
16
- 'ordering' => array("req"=>true,"type"=>"integer"),
17
- 'created_at' => array("req"=>true,"type"=>"integer"),
18
  );
19
  var $escapeFields=array('name','description');
20
  var $escapingOn=true;
@@ -36,81 +36,86 @@ class WYSIJA_model_list extends WYSIJA_model{
36
  return true;
37
  }
38
 
39
- function getLists($id=false){
40
-
41
- if($id){
42
- $query='SELECT A.name, A.list_id, A.description, A.is_enabled, A.is_public, A.namekey
43
  FROM '.$this->getPrefix().'list as A
44
  LEFT JOIN '.$this->getPrefix().'email as B on A.welcome_mail_id=B.email_id
45
- WHERE A.list_id='.(int)$id;
46
- $result=$this->getResults($query);
47
- $this->escapeQuotesFromRes($result);
48
- return $result[0];
49
- }else{
50
- $query='SELECT A.name, A.list_id, A.created_at, A.is_enabled, A.is_public, A.namekey, 0 as subscribers, 0 as campaigns_sent
51
- FROM '.$this->getPrefix().'list as A';
52
 
53
- $this->countRows=$this->count($query);
 
 
 
 
 
 
54
 
55
- if(isset($this->_limitison) && $this->_limitison) $query.=$this->setLimit();
56
- $listres=$this->getResults($query);
57
 
58
- $listids=array();
59
- foreach($listres as $res) $listids[]=$res['list_id'];
60
 
61
- //add the count of subscribers and unsubscribers
62
- $qry='SELECT count(distinct A.user_id) as nbsub,A.list_id FROM `'.$this->getPrefix().'user_list` as A WHERE list_id IN ('.implode(',',$listids).') GROUP BY list_id';
63
- $qry1='SELECT count(distinct A.user_id) as total,B.status,A.list_id FROM `'.$this->getPrefix().'user_list` as A LEFT JOIN `'.$this->getPrefix().'user` as B on A.user_id=B.user_id WHERE list_id IN ('.implode(',',$listids).') and A.sub_date>0 and A.unsub_date=0 GROUP BY A.list_id,B.status';
64
 
65
- $total=$this->getResults($qry);
66
- $subscribed=$this->getResults($qry1);
67
 
 
 
 
68
 
69
- foreach($total as $tot){
70
- foreach($listres as $key=>$res){
71
- if($tot['list_id']==$res['list_id']) $listres[$key]['totals']=$tot['nbsub'];
72
- }
73
- }
74
 
75
- //get the count of the subscribed people per list
76
- foreach($subscribed as $subscriber){
77
- foreach($listres as $key=>$res){
78
- if($subscriber['list_id']==$res['list_id']){
79
- if((int)$subscriber['status'] <0){
80
- if(!isset($listres[$key]['unsubscribers'])) $listres[$key]['unsubscribers']=0;
81
- $listres[$key]['unsubscribers']=$listres[$key]['unsubscribers']+$subscriber['total'];
82
- }elseif((int)$subscriber['status'] >0){
83
- if(!isset($listres[$key]['subscribers'])) $listres[$key]['subscribers']=0;
84
- $listres[$key]['subscribers']=$listres[$key]['subscribers']+$subscriber['total'];
85
- }else{
86
- if(!isset($listres[$key]['unconfirmed'])) $listres[$key]['unconfirmed']=0;
87
- $listres[$key]['unconfirmed']=$listres[$key]['unconfirmed']+$subscriber['total'];
88
- }
89
- }
90
- }
91
- }
92
 
93
- $model_config=WYSIJA::get('config','model');
94
- foreach($listres as $key=>$res){
95
- if(!isset($listres[$key]['unconfirmed'])) $listres[$key]['unconfirmed']=0;
96
- if(!isset($listres[$key]['unsubscribers'])) $listres[$key]['unsubscribers']=0;
97
- if(!isset($listres[$key]['subscribers'])) $listres[$key]['subscribers']=0;
98
- if(!isset($listres[$key]['totals'])) $listres[$key]['totals']=0;
99
- //if the double optin is not activated then we need to make the sum of the subscribed and unconfirmed
100
- //this is a rare case but it happens
101
- if(!$model_config->getValue('confirm_dbleoptin')){
102
- $listres[$key]['subscribers']+=$listres[$key]['unconfirmed'];
103
  }
104
  }
 
105
 
106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
 
108
-
109
- $this->escapeQuotesFromRes($listres);
110
- return $listres;
111
  }
112
 
113
- }
114
 
 
 
115
 
 
116
  }
6
  var $table_name='list';
7
  var $columns=array(
8
  'list_id'=>array('auto'=>true),
9
+ 'name' => array('req'=>true,'type'=>'text'),
10
+ 'namekey' => array('req'=>true,'type'=>'text'),
11
+ 'description' => array('type'=>'text'),
12
+ 'unsub_mail_id' => array('req'=>true,'type'=>'integer'),
13
+ 'welcome_mail_id' => array('req'=>true,'type'=>'integer'),
14
+ 'is_enabled' => array('req'=>true,'type'=>'boolean'),
15
+ 'is_public' => array('req'=>true,'type'=>'boolean'),
16
+ 'ordering' => array('req'=>true,'type'=>'integer'),
17
+ 'created_at' => array('req'=>true,'type'=>'integer'),
18
  );
19
  var $escapeFields=array('name','description');
20
  var $escapingOn=true;
36
  return true;
37
  }
38
 
39
+ function get_one_list($list_id){
40
+ $query='SELECT A.name, A.list_id, A.description, A.is_enabled, A.is_public, A.namekey
 
 
41
  FROM '.$this->getPrefix().'list as A
42
  LEFT JOIN '.$this->getPrefix().'email as B on A.welcome_mail_id=B.email_id
43
+ WHERE A.list_id='.(int)$list_id;
44
+ $result = $this->getResults($query);
45
+ $this->escapeQuotesFromRes($result);
46
+ return $result[0];
47
+ }
 
 
48
 
49
+ /**
50
+ * get the detail about list(s) total of subscribers, unsubscribers, unconfirmed etc
51
+ * @param int $list_id
52
+ * @return type
53
+ */
54
+ function getLists(){
55
+ $model_user = WYSIJA::get('user','model');
56
 
57
+ $query='SELECT A.`name`, A.`list_id`, A.`created_at`, A.`is_enabled`, A.`is_public`, A.`namekey`, 0 as subscribers, 0 as campaigns_sent
58
+ FROM '.$this->getPrefix().'list as A ORDER BY A.`name`';
59
 
60
+ $this->countRows=$this->count($query);
 
61
 
62
+ if(isset($this->_limitison) && $this->_limitison) $query.=$this->setLimit();
63
+ $result_lists=$this->getResults($query);
 
64
 
65
+ $lists_details=array();
 
66
 
67
+ foreach($result_lists as $result){
68
+ $lists_details[$result['list_id']]=$result;
69
+ }
70
 
71
+ $list_ids = array_keys($lists_details);
 
 
 
 
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
+ $counts_per_list = $model_user->count_users_per_list($list_ids);
75
+
76
+ // get the count of confirmed user per each and unconfirmed user per list
77
+ foreach($lists_details as $key_list_id => &$result){
78
+ if(isset($counts_per_list[$key_list_id])){
79
+ foreach($counts_per_list[$key_list_id] as $property => $value){
80
+ $result[$property] = $value;
 
 
 
81
  }
82
  }
83
+ }
84
 
85
 
86
+ // we need to fill in the count value that will be used by the dropdown
87
+ // the value will depend on the status filter
88
+ foreach($lists_details as $key_list_id => &$result){
89
+
90
+ if(!isset($result['unsubscribers'])) $result['unsubscribers'] = 0;
91
+ if(!isset($result['subscribers'])) $result['subscribers'] = 0;
92
+ if(!isset($result['unconfirmed'])) $result['unconfirmed'] = 0;
93
+ if(!isset($result['belonging'])) $result['belonging'] = 0;
94
+
95
+ if(!empty($_REQUEST['link_filter'])){
96
+ switch($_REQUEST['link_filter']){
97
+ case 'unsubscribed' :
98
+ $result['users'] = $result['unsubscribers'];
99
+ break;
100
+ case 'subscribed' :
101
+ $result['users'] = $result['subscribers'];
102
+ break;
103
+ case 'unconfirmed' :
104
+ $result['users'] = $result['unconfirmed'];
105
+ break;
106
+ default :
107
+
108
+ $result['users'] = $result['belonging'];
109
+ }
110
+ }else{
111
+ $result['users'] = $result['belonging'];
112
+ }
113
 
 
 
 
114
  }
115
 
 
116
 
117
+ $this->escapeQuotesFromRes($lists_details);
118
+ return $lists_details;
119
 
120
+ }
121
  }
models/user.php CHANGED
@@ -2,19 +2,20 @@
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_model_user extends WYSIJA_model{
4
 
5
- var $pk="user_id";
6
- var $table_name="user";
7
  var $columns=array(
8
- 'user_id'=>array("auto"=>true),
9
- 'wpuser_id' => array("req"=>true,"type"=>"integer"),
10
- 'email' => array("req"=>true,"type"=>"email"),
11
  'firstname' => array(),
12
  'lastname' => array(),
13
- 'ip' => array("req"=>true,"type"=>"ip"),
14
  'keyuser' => array(),
15
- 'status' => array("req"=>true,"type"=>"boolean"),
16
- 'created_at' => array("auto"=>true,"type"=>"date"),
17
  );
 
18
 
19
  function WYSIJA_model_user(){
20
  $this->columns['status']['label']=__('Status',WYSIJA);
@@ -22,135 +23,158 @@ class WYSIJA_model_user extends WYSIJA_model{
22
  $this->WYSIJA_model();
23
  }
24
 
25
- function beforeInsert(){
26
- /* set the activation key */
27
- $modelUser=WYSIJA::get("user","model");
28
-
29
- $this->values['keyuser']=md5($this->values['email'].$this->values['created_at']);
30
- while($modelUser->exists(array("keyuser"=>$this->values['keyuser']))){
31
- $this->values['keyuser']=$this->generateKeyuser($this->values['email']);
32
- $modelUser->reset();
33
- }
34
-
35
- if(!isset($this->values['status'])) $this->values['status']=0;
36
-
37
- return true;
38
- }
39
-
40
- function getSubscriptionStatus($uid){
41
  $this->getFormat=OBJECT;
42
- $result=$this->getOne(array('status'),array('user_id'=>$uid));
43
  return $result->status;
44
  }
45
-
 
 
 
 
 
 
 
46
  function countSubscribers(Array $list_ids = array(), $confirmed_subscribers = true)
47
  {
48
- $config = WYSIJA::get('config','model');
49
- $confirm_dbleoptin = $config->getValue('confirm_dbleoptin');
50
  if($confirm_dbleoptin) $confirmed_subscribers = true;
51
-
52
-
53
  $where = array();
54
  $where[] = 'C.is_enabled = 1';
55
  $where[] = $confirmed_subscribers ? 'status = 1' : 'status >= 0';
56
- if(!empty($list_ids)){
57
  $where[] = 'C.list_id IN ('.implode(',',$list_ids).')';
58
  }
59
-
60
  $query = '
61
- SELECT
62
- COUNT(DISTINCT A.user_id)
63
- FROM
64
- [wysija]user A
65
- JOIN
66
- [wysija]user_list B ON A.user_id = B.user_id
67
  JOIN
68
- [wysija]list C ON C.list_id = B.list_id
 
 
69
  WHERE 1';
70
  if(!empty($where)) $query .= ' AND '.implode (' AND ', $where);
71
  return $this->count($query);
72
  }
73
 
74
- function getObject($uid){
 
 
 
 
 
 
75
  $this->getFormat=OBJECT;
76
- return $this->getOne(false,array('user_id'=>$uid));
77
  }
78
-
79
  /**
80
- * Get User object from email address
81
- * @param type $email
82
  * @return object WYSIJA_model_user
83
  */
84
  function get_object_by_email($email){
85
  $this->getFormat=OBJECT;
86
- return $this->getOne(false,array('email'=>$email));
87
  }
88
-
89
- function getDetails($conditions,$stats=false,$subscribedListOnly=false){
 
 
 
 
 
 
 
90
  $data=array();
91
  $this->getFormat=ARRAY_A;
92
  $array=$this->getOne(false,$conditions);
93
  if(!$array) return false;
94
 
95
- $data['details']=$array;
96
 
97
  //get the list that the user subscribed to
98
- $modelRECYCLE=WYSIJA::get('user_list','model');
99
- $conditions=array('user_id'=>$data['details']['user_id']);
100
- if($subscribedListOnly){
101
  $conditions['unsub_date']=0;
102
  }
103
 
104
- $data['lists']=$modelRECYCLE->get(false,$conditions);
105
 
106
  //get the user stats if requested
107
  if($stats){
108
- $modelRECYCLE=WYSIJA::get('email_user_stat','model');
109
- $modelRECYCLE->setConditions(array('equal'=>array('user_id'=>$data['details']['user_id'])));
110
- $data['emails']=$modelRECYCLE->count(false);
111
  }
112
 
113
  return $data;
114
  }
115
 
 
 
 
 
116
  function getCurrentSubscriber(){
117
  $this->getFormat=OBJECT;
118
- $objUser=$this->getOne(false,array('wpuser_id'=>WYSIJA::wp_get_userdata('ID')));
119
 
120
- if(!$objUser){
121
  $this->getFormat=OBJECT;
122
- $objUser=$this->getOne(false,array('email'=>WYSIJA::wp_get_userdata('user_email')));
123
  $this->update(array('wpuser_id'=>WYSIJA::wp_get_userdata('ID')),array('email'=>WYSIJA::wp_get_userdata('user_email')));
124
  }
125
 
126
-
127
- //the subscriber doesn't exist
128
- if(!$objUser){
129
- $data=get_userdata(WYSIJA::wp_get_userdata('ID'));
130
- $firstname=$data->first_name;
131
- $lastname=$data->last_name;
132
- if(!$data->first_name && !$data->last_name) $firstname=$data->display_name;
133
  $this->noCheck=true;
134
  $this->insert(array(
135
  'wpuser_id'=>$data->ID,
136
  'email'=>$data->user_email,
137
  'firstname'=>$firstname,
138
  'lastname'=>$lastname));
139
- $this->getFormat=OBJECT;
140
- $objUser=$this->getOne(false,array('wpuser_id'=>WYSIJA::wp_get_userdata('ID')));
 
141
  }
142
 
143
- return $objUser;
144
  }
145
 
 
 
 
 
 
 
 
 
 
146
  function getConfirmLink($user_obj = false, $action = 'subscribe', $text = false, $url_only = false, $target = '_blank'){
147
  if(!$text) $text=__('Click here to subscribe',WYSIJA);
148
- $userspreview=false;
149
  //if($action=='subscriptions')dbg($userObj);
150
  if(!$user_obj){
151
  //preview mode
152
  $user_obj=$this->getCurrentSubscriber();
153
- $userspreview=true;
154
  }
155
  $params=array(
156
  'wysija-page'=>1,
@@ -159,91 +183,410 @@ class WYSIJA_model_user extends WYSIJA_model{
159
  if($user_obj && isset($user_obj->keyuser)){
160
  //if the user key doesn exists let's generate it
161
  if(!$user_obj->keyuser){
162
- $this->getKeyUser($user_obj);
 
 
 
 
163
  }
164
 
165
  $this->reset();
166
  $params['wysija-key']=$user_obj->keyuser;
167
  }
168
  $params['action']=$action;
169
- $modelConf=WYSIJA::get('config','model');
170
- if($userspreview) $params['demo']=1;
171
- $fullurl=WYSIJA::get_permalink($modelConf->getValue('confirm_email_link'),$params);
172
- if($url_only) return $fullurl;
173
- return '<a href="'.$fullurl.'" target="'.$target.'">'.$text.'</a>';
174
  }
175
 
 
 
 
 
 
 
 
176
  function getEditsubLink($user_obj=false,$url_only=false, $target = '_blank'){
177
  return $this->getConfirmLink($user_obj,'subscriptions',__('Edit your subscriptions',WYSIJA),$url_only,false,$target);
178
  }
179
 
180
- function getUnsubLink($userObj=false,$urlOnly=false){
181
- $modelConf=WYSIJA::get('config','model');
182
- return $this->getConfirmLink($userObj,'unsubscribe',$modelConf->getValue('unsubscribe_linkname'),$urlOnly);
183
- }
184
-
185
- function getResendLink($userid,$email_id){
186
- $params=array(
187
- 'wysija-page'=>1,
188
- 'controller'=>'confirm',
189
- 'action'=>'resend',
190
- 'user_id'=>$userid,
191
- 'email_id'=>$email_id
192
- );
193
-
194
- $modelConf=WYSIJA::get('config','model');
195
- return WYSIJA::get_permalink($modelConf->getValue('confirm_email_link'),$params);
196
- }
197
-
198
- function getKeyUser($user){
199
- //generate a user key
200
- $user->keyuser=$this->generateKeyuser($user->email);
201
- while($this->exists(array('keyuser'=>$user->keyuser))){
202
- $user->keyuser=$this->generateKeyuser($user->email);
203
- }
204
- $this->update(array('keyuser'=>$user->keyuser),array('user_id'=>$user->user_id));
205
  }
206
 
 
 
 
 
 
207
  function generateKeyuser($email){
208
  return md5($email.time());
209
  }
210
 
 
 
 
 
 
211
  function user_id($email){
212
  $this->getFormat=ARRAY_A;
213
  if(is_numeric($email)){
214
- $obj=$this->getOne(array("user_id"),array("wpuser_id"=>$email));
215
- //$cond = ' wpuser_id = '.$email;
216
  }else{
217
- $obj=$this->getOne(array("user_id"),array("email"=>$email));
218
- //$cond = 'email = '.$this->database->Quote(trim($email));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  }
220
 
221
- //$this->database->setQuery('SELECT subid FROM '.acymailing_table('subscriber').' WHERE '.$cond);
222
- return $obj['user_id'];
 
 
 
 
 
 
 
223
  }
224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  function beforeDelete($conditions){
226
- $newum=new WYSIJA_model_user();
227
- $users=$newum->get(array('user_id'),$this->conditions);
228
- $userids=array();
229
- foreach($users as $usr) $userids[]=$usr['user_id'];
230
 
231
  //delete all the user stats
232
- $eusM=WYSIJA::get('email_user_stat','model');
233
- $conditions=array('user_id'=>$userids);
234
- $eusM->delete($conditions);
235
  //delete all the queued emails
236
- $qM=WYSIJA::get('queue','model');
237
- $qM->delete($conditions);
238
  return true;
239
  }
240
 
 
 
 
 
241
  function afterDelete(){
242
  $helper_user=WYSIJA::get('user','helper');
243
  $helper_user->refreshUsers();
244
  return true;
245
  }
246
 
 
 
 
 
247
  function afterInsert($id){
248
  $helper_user=WYSIJA::get('user','helper');
249
  $helper_user->refreshUsers();
@@ -252,11 +595,36 @@ class WYSIJA_model_user extends WYSIJA_model{
252
  return true;
253
  }
254
 
 
 
 
 
255
  function afterUpdate($id){
256
  $helper_user=WYSIJA::get('user','helper');
257
  $helper_user->refreshUsers();
258
-
259
  do_action('wysija_subscriber_modified', $id);
260
  return true;
261
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  }
2
  defined('WYSIJA') or die('Restricted access');
3
  class WYSIJA_model_user extends WYSIJA_model{
4
 
5
+ var $pk='user_id';
6
+ var $table_name='user';
7
  var $columns=array(
8
+ 'user_id'=>array('auto'=>true),
9
+ 'wpuser_id' => array('req'=>true,'type'=>'integer'),
10
+ 'email' => array('req'=>true,'type'=>'email'),
11
  'firstname' => array(),
12
  'lastname' => array(),
13
+ 'ip' => array('req'=>true,'type'=>'ip'),
14
  'keyuser' => array(),
15
+ 'status' => array('req'=>true,'type'=>'boolean'),
16
+ 'created_at' => array('auto'=>true,'type'=>'date'),
17
  );
18
+ var $searchable = array('email','firstname', 'lastname');
19
 
20
  function WYSIJA_model_user(){
21
  $this->columns['status']['label']=__('Status',WYSIJA);
23
  $this->WYSIJA_model();
24
  }
25
 
26
+ /**
27
+ * return the subscription status of one subscriber using his user_id
28
+ * @param int $user_id
29
+ * @return int
30
+ */
31
+ function getSubscriptionStatus($user_id){
 
 
 
 
 
 
 
 
 
 
32
  $this->getFormat=OBJECT;
33
+ $result=$this->getOne(array('status'),array('user_id'=>$user_id));
34
  return $result->status;
35
  }
36
+
37
+ /**
38
+ * count total subscribers per list based on parameters passed
39
+ * TODO we should use get_subscribers() instead
40
+ * @param array $list_ids
41
+ * @param boolean $confirmed_subscribers
42
+ * @return int
43
+ */
44
  function countSubscribers(Array $list_ids = array(), $confirmed_subscribers = true)
45
  {
46
+ $model_config = WYSIJA::get('config','model');
47
+ $confirm_dbleoptin = $model_config->getValue('confirm_dbleoptin');
48
  if($confirm_dbleoptin) $confirmed_subscribers = true;
49
+
50
+
51
  $where = array();
52
  $where[] = 'C.is_enabled = 1';
53
  $where[] = $confirmed_subscribers ? 'status = 1' : 'status >= 0';
54
+ if(!empty($list_ids)){
55
  $where[] = 'C.list_id IN ('.implode(',',$list_ids).')';
56
  }
57
+
58
  $query = '
59
+ SELECT
60
+ COUNT(DISTINCT A.user_id)
61
+ FROM
62
+ [wysija]user A
 
 
63
  JOIN
64
+ [wysija]user_list B ON A.user_id = B.user_id
65
+ JOIN
66
+ [wysija]list C ON C.list_id = B.list_id
67
  WHERE 1';
68
  if(!empty($where)) $query .= ' AND '.implode (' AND ', $where);
69
  return $this->count($query);
70
  }
71
 
72
+
73
+ /**
74
+ * get a user object not an array as we do by default with "getOne"
75
+ * @param int $user_id
76
+ * @return object
77
+ */
78
+ function getObject($user_id){
79
  $this->getFormat=OBJECT;
80
+ return $this->getOne(false,array('user_id'=>$user_id));
81
  }
82
+
83
  /**
84
+ * Get User object using his email address
85
+ * @param string $email
86
  * @return object WYSIJA_model_user
87
  */
88
  function get_object_by_email($email){
89
  $this->getFormat=OBJECT;
90
+ return $this->getOne(false,array('email'=>$email));
91
  }
92
+
93
+ /**
94
+ * get the details, lists and stats email counts regarding one user
95
+ * @param array $conditions : Wysija's condition format
96
+ * @param boolean $stats : do we get the stats data of that user
97
+ * @param boolean $subscribed_list_only :
98
+ * @return boolean
99
+ */
100
+ function getDetails($conditions,$stats=false,$subscribed_list_only=false){
101
  $data=array();
102
  $this->getFormat=ARRAY_A;
103
  $array=$this->getOne(false,$conditions);
104
  if(!$array) return false;
105
 
106
+ $data['details'] = $array;
107
 
108
  //get the list that the user subscribed to
109
+ $model_user_list = WYSIJA::get('user_list','model');
110
+ $conditions = array('user_id'=>$data['details']['user_id']);
111
+ if($subscribed_list_only){
112
  $conditions['unsub_date']=0;
113
  }
114
 
115
+ $data['lists'] = $model_user_list->get(false,$conditions);
116
 
117
  //get the user stats if requested
118
  if($stats){
119
+ $model_email_user_stat = WYSIJA::get('email_user_stat','model');
120
+ $model_email_user_stat->setConditions(array('equal'=>array('user_id'=>$data['details']['user_id'])));
121
+ $data['emails'] = $model_email_user_stat->count(false);
122
  }
123
 
124
  return $data;
125
  }
126
 
127
+ /**
128
+ * return the subscriber object for the currently logged in WordPress user
129
+ * @return object user
130
+ */
131
  function getCurrentSubscriber(){
132
  $this->getFormat=OBJECT;
133
+ $result_user=$this->getOne(false,array('wpuser_id'=>WYSIJA::wp_get_userdata('ID')));
134
 
135
+ if(!$result_user){
136
  $this->getFormat=OBJECT;
137
+ $result_user=$this->getOne(false,array('email'=>WYSIJA::wp_get_userdata('user_email')));
138
  $this->update(array('wpuser_id'=>WYSIJA::wp_get_userdata('ID')),array('email'=>WYSIJA::wp_get_userdata('user_email')));
139
  }
140
 
141
+ //the subscriber doesn't seem to exist let's insert it in the DB
142
+ if(!$result_user){
143
+ $data = get_userdata(WYSIJA::wp_get_userdata('ID'));
144
+ $firstname = $data->first_name;
145
+ $lastname = $data->last_name;
146
+ if(!$data->first_name && !$data->last_name) $firstname = $data->display_name;
 
147
  $this->noCheck=true;
148
  $this->insert(array(
149
  'wpuser_id'=>$data->ID,
150
  'email'=>$data->user_email,
151
  'firstname'=>$firstname,
152
  'lastname'=>$lastname));
153
+
154
+ $this->getFormat = OBJECT;
155
+ $result_user = $this->getOne(false,array('wpuser_id'=>WYSIJA::wp_get_userdata('ID')));
156
  }
157
 
158
+ return $result_user;
159
  }
160
 
161
+ /**
162
+ * function used to generate the links for subscriber management, confirm, unsubscribe, edit subscription
163
+ * @param boolean,object $user_obj
164
+ * @param string $action what axctin will be performed (subscribe, unsubscribe, subscriptions)
165
+ * @param string $text name of the link
166
+ * @param boolean $url_only returns only the url no html wrapper
167
+ * @param string $target how does the link open
168
+ * @return type
169
+ */
170
  function getConfirmLink($user_obj = false, $action = 'subscribe', $text = false, $url_only = false, $target = '_blank'){
171
  if(!$text) $text=__('Click here to subscribe',WYSIJA);
172
+ $users_preview=false;
173
  //if($action=='subscriptions')dbg($userObj);
174
  if(!$user_obj){
175
  //preview mode
176
  $user_obj=$this->getCurrentSubscriber();
177
+ $users_preview=true;
178
  }
179
  $params=array(
180
  'wysija-page'=>1,
183
  if($user_obj && isset($user_obj->keyuser)){
184
  //if the user key doesn exists let's generate it
185
  if(!$user_obj->keyuser){
186
+ $user_obj->keyuser = $this->generateKeyuser($user_obj->email);
187
+ while($this->exists(array('keyuser'=>$user_obj->keyuser))){
188
+ $user_obj->keyuser=$this->generateKeyuser($user_obj->email);
189
+ }
190
+ $this->update(array('keyuser'=>$user_obj->keyuser),array('user_id'=>$user_obj->user_id));
191
  }
192
 
193
  $this->reset();
194
  $params['wysija-key']=$user_obj->keyuser;
195
  }
196
  $params['action']=$action;
197
+ $model_config=WYSIJA::get('config','model');
198
+ if($users_preview) $params['demo']=1;
199
+ $full_url=WYSIJA::get_permalink($model_config->getValue('confirm_email_link'),$params);
200
+ if($url_only) return $full_url;
201
+ return '<a href="'.$full_url.'" target="'.$target.'">'.$text.'</a>';
202
  }
203
 
204
+ /**
205
+ * get the edit subscription link
206
+ * @param type $user_obj
207
+ * @param type $url_only
208
+ * @param type $target
209
+ * @return type
210
+ */
211
  function getEditsubLink($user_obj=false,$url_only=false, $target = '_blank'){
212
  return $this->getConfirmLink($user_obj,'subscriptions',__('Edit your subscriptions',WYSIJA),$url_only,false,$target);
213
  }
214
 
215
+ /**
216
+ * get the unsubscribe link
217
+ * @param type $user_obj
218
+ * @param type $url_only
219
+ * @return string
220
+ */
221
+ function getUnsubLink($user_obj=false,$url_only=false){
222
+ $model_config=WYSIJA::get('config','model');
223
+ return $this->getConfirmLink($user_obj,'unsubscribe',$model_config->getValue('unsubscribe_linkname'),$url_only);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  }
225
 
226
+ /**
227
+ * used to generate a hash to identify each subscriber, this is used later in confirmation links etc...
228
+ * @param string $email
229
+ * @return string md5
230
+ */
231
  function generateKeyuser($email){
232
  return md5($email.time());
233
  }
234
 
235
+ /**
236
+ * returns the user_id providing either the wpuser_id value or an email
237
+ * @param string $email
238
+ * @return int
239
+ */
240
  function user_id($email){
241
  $this->getFormat=ARRAY_A;
242
  if(is_numeric($email)){
243
+ $result = $this->getOne(array('user_id'),array('wpuser_id'=>$email));
 
244
  }else{
245
+ $result = $this->getOne(array('user_id'),array('email'=>$email));
246
+ }
247
+ return (int)$result['user_id'];
248
+ }
249
+
250
+
251
+ /**
252
+ * prepare the filters for a user select query based on the PHP global parameters
253
+ * @return array
254
+ */
255
+ function detect_filters(){
256
+ $filters = array();
257
+ // get the filters
258
+ if(!empty($_REQUEST['search'])){
259
+ $filters['search'] = $_REQUEST['search'];
260
+ }
261
+
262
+ if(!empty($_REQUEST['wysija']['filter']['search'])){
263
+ $filters['search'] = $_REQUEST['wysija']['filter']['search'];
264
+ }
265
+
266
+ // Lists filters
267
+ // - override wysija[filter][filter-list] if this is empty
268
+ if( !empty($_REQUEST['redirect'])
269
+ && (!empty($_REQUEST['filter_list']))
270
+ && empty($_REQUEST['wysija']['filter']['filter_list']) ){
271
+ $_REQUEST['wysija']['filter']['filter_list'] = !empty ($_REQUEST['filter_list']) ? $_REQUEST['filter_list'] : $_REQUEST['filter-list'];
272
+ }
273
+
274
+ if(!empty($_REQUEST['wysija']['filter']['filter_list'])){
275
+ if ($_REQUEST['wysija']['filter']['filter_list'] == 'orphaned') {
276
+ $filters['lists'] = null;
277
+ } else {
278
+ //we only get subscribed or unconfirmed users
279
+ $filters['lists'] = $_REQUEST['wysija']['filter']['filter_list'];
280
+ }
281
  }
282
 
283
+ if(!empty($_REQUEST['link_filter'])){
284
+ $filters['status'] = $_REQUEST['link_filter'];
285
+ }
286
+
287
+ if(!empty($_REQUEST['wysija']['user']['timestamp'])){
288
+ //$filters['created_at']= $_REQUEST['wysija']['user']['timestamp'];
289
+ }
290
+
291
+ return $filters;
292
  }
293
 
294
+
295
+ /**
296
+ * count the confirmed and unconfirmed users for each list by status
297
+ * @param type $list_ids
298
+ * @return type
299
+ */
300
+ function count_users_per_list($list_ids=array()){
301
+ $select = array( 'COUNT(DISTINCT([wysija]user.user_id)) as total_users', '[wysija]user_list.list_id');
302
+ $count_group_by = 'list_id';
303
+
304
+ // filters for unsubscribed
305
+ $filters = array();
306
+ $filters['lists'] = $list_ids;
307
+ $filters['status'] = 'unsubscribed';
308
+
309
+ $unsubscribed_users = $this->get_subscribers( $select, $filters, $count_group_by );
310
+
311
+ $list_count_per_status=array();
312
+ foreach($unsubscribed_users as $unsubscribed){
313
+ if(!isset($list_count_per_status['list_id']['unsubscribers'])){
314
+ $list_count_per_status[$unsubscribed['list_id']]['unsubscribers']=$unsubscribed['total_users'];
315
+ }
316
+ }
317
+
318
+ // count confirmed subscribers
319
+ $filters = array();
320
+ $filters['lists'] = $list_ids;
321
+ $filters['status'] = 'subscribed';
322
+
323
+ $subscribed_users = $this->get_subscribers( $select, $filters, $count_group_by );
324
+
325
+ foreach($subscribed_users as $subscribed){
326
+ if(!isset($list_count_per_status['list_id']['subscribers'])){
327
+ $list_count_per_status[$subscribed['list_id']]['subscribers']=$subscribed['total_users'];
328
+ }
329
+ }
330
+
331
+ // count unconfirmed subscribers
332
+ $filters = array();
333
+ $filters['lists'] = $list_ids;
334
+ $filters['status'] = 'unconfirmed';
335
+
336
+ $unconfirmed_users = $this->get_subscribers( $select, $filters, $count_group_by);
337
+
338
+ foreach($unconfirmed_users as $unconfirmed){
339
+ if(!isset($list_count_per_status['list_id']['unconfirmed'])){
340
+ $list_count_per_status[$unconfirmed['list_id']]['unconfirmed']=$unconfirmed['total_users'];
341
+ }
342
+ }
343
+
344
+ // get the total count of subscribers per list
345
+ $filters = array();
346
+ $filters['lists'] = $list_ids;
347
+ $total_belonging = $this->get_subscribers( $select, $filters , $count_group_by );
348
+
349
+ // get the count of confirmed user per each and unconfirmed user per list
350
+ foreach($total_belonging as $belonging){
351
+ if(!isset($list_count_per_status['list_id']['belonging'])){
352
+ $list_count_per_status[$belonging['list_id']]['belonging']=$belonging['total_users'];
353
+ }
354
+ }
355
+
356
+ return $list_count_per_status;
357
+ }
358
+
359
+
360
+ function _convert_filters($filters_in){
361
+ $filters_out = array();
362
+ $model_config = WYSIJA::get('config','model');
363
+ $filter_has_list = false;
364
+
365
+ // here we found a search condition
366
+ if(!empty($filters_in['search'])){
367
+ $filters_out['like'] = array();
368
+ $filters_in['search'] = trim($filters_in['search']);
369
+ foreach($this->searchable as $field){
370
+ $filters_out['like'][$field] = trim($filters_in['search']);
371
+ }
372
+ }
373
+
374
+ // as soon as we detect lists we set the query that way
375
+ if(!empty($filters_in['lists'])){
376
+ $filters_out['equal']['list_id'] = $filters_in['lists'];
377
+ $filter_has_list = true;
378
+ }
379
+
380
+ // we detect a status condition
381
+ if(!empty($filters_in['status'])){
382
+ switch($filters_in['status']){
383
+ case 'unconfirmed':
384
+ $filters_out['equal']['status'] = 0;
385
+
386
+ if($filter_has_list){
387
+ $filters_out['greater_eq']['sub_date'] =0;
388
+ $filters_out['equal']['unsub_date'] =0;
389
+ }
390
+ break;
391
+ case 'unsubscribed':
392
+ $filters_out['equal']['status'] = -1;
393
+
394
+ if($filter_has_list){
395
+ $filters_out['equal']['sub_date'] =0;
396
+ $filters_out['greater_eq']['unsub_date'] =0;
397
+ }
398
+ break;
399
+ case 'subscribed':
400
+ if($model_config->getValue('confirm_dbleoptin')) $filters_out['equal']['status'] = 1;
401
+ else $filters_out['greater_eq']=array('status'=>0);
402
+
403
+ if($filter_has_list){
404
+ $filters_out['greater_eq']['sub_date'] =0;
405
+ $filters_out['equal']['unsub_date'] =0;
406
+ }
407
+
408
+ break;
409
+ case 'all':
410
+
411
+
412
+ break;
413
+ }
414
+ }
415
+
416
+ if(!empty($filters_in['created_at'])){
417
+ $filters_out['less_eq']['created_at'] = $filters_in['created_at'];
418
+ }
419
+
420
+ return $filters_out;
421
+ }
422
+ /**
423
+ *
424
+ * @param type $select
425
+ * @param type $filters
426
+ */
427
+ function get_subscribers($select = array(), $filters = array(), $count_group_by = '', $return_query=false){
428
+ $this->noCheck=true;
429
+ $is_count = false;
430
+
431
+ $select = str_replace(array('[wysija]user_list', '[wysija]user', 'count('), array('B', 'A', 'COUNT('), $select);
432
+
433
+ if(!empty($filters)){
434
+ $filters = $this->_convert_filters($filters);
435
+ $this->setConditions($filters);
436
+ }
437
+
438
+
439
+
440
+ //1 - prepare select
441
+ if(isset($filters['equal']['list_id'])){
442
+ // orphans are selected with this kind of join
443
+ if($filters['equal']['list_id']==null) {
444
+
445
+ $select_string = implode(', ', $select);
446
+ if(strpos($select_string, 'COUNT(') === false){
447
+ $select_string = str_replace('B.user_id', 'DISTINCT(B.user_id)', $select_string);
448
+ }else{
449
+ $is_count = true;
450
+ }
451
+
452
+ $query = 'SELECT '.$select_string.' FROM `[wysija]user` as A';
453
+ $query .= ' LEFT JOIN `[wysija]user_list` as B on B.user_id=A.user_id';
454
+ }else{
455
+ // standard select when lists ids are in the filters
456
+
457
+ $select_string = implode(', ', $select);
458
+ if(strpos($select_string, 'COUNT(') === false){
459
+ $select_string = str_replace('A.user_id', 'DISTINCT(B.user_id)', $select_string);
460
+ }else{
461
+ $is_count = true;
462
+ }
463
+
464
+ $query = 'SELECT '.$select_string.' FROM `[wysija]user_list` as B';
465
+ $query .= ' JOIN `[wysija]user` as A on A.user_id=B.user_id';
466
+ }
467
+ } else {
468
+ // when there is no filter list
469
+ $select_string = implode(', ', $select);
470
+ if(strpos($select_string, 'COUNT(') === false){
471
+ $select_string = str_replace('B.user_id', 'A.user_id', $select_string);
472
+ }else{
473
+ $is_count = true;
474
+ }
475
+
476
+ $query = 'SELECT '.$select_string.' FROM `[wysija]user` as A';
477
+ }
478
+
479
+ $query .= $this->makeWhere();
480
+
481
+ if(!$is_count){
482
+ if($return_query) return $query;
483
+
484
+ $order_by=' ORDER BY ';
485
+ if(!empty($_REQUEST['orderby'])){
486
+ $order_by.=$_REQUEST['orderby'].' '.$_REQUEST['ordert'];
487
+ }else{
488
+ $order_by.=$this->pk.' desc';
489
+ }
490
+
491
+ $query = $query.' '.$order_by.$this->setLimit();
492
+ return $this->getResults($query);
493
+ }else{
494
+ if(!empty($count_group_by)){
495
+ return $this->getResults($query.' GROUP BY '.$count_group_by);
496
+ }else{
497
+ $result = $this->getResults($query);
498
+ return $result[0];
499
+ }
500
+ }
501
+
502
+ }
503
+
504
+ public function structure_user_status_count_array($count_by_status){
505
+ $arr_max_create_at = array();
506
+ foreach($count_by_status as $status_data){
507
+
508
+ switch($status_data['status']){
509
+ case '-1':
510
+ $counts['unsubscribed'] = $status_data['users'];
511
+ break;
512
+ case '0':
513
+ $counts['unconfirmed'] = $status_data['users'];
514
+ break;
515
+ case '1':
516
+ $counts['subscribed'] = $status_data['users'];
517
+ break;
518
+ }
519
+ $arr_max_create_at[] = $status_data['max_create_at'];
520
+ }
521
+ $counts['all'] = 0;
522
+ if(isset($counts['unsubscribed'])) $counts['all'] += $counts['unsubscribed'];
523
+ if(isset($counts['unconfirmed'])) $counts['all'] += $counts['unconfirmed'];
524
+ if(isset($counts['subscribed'])) $counts['all'] += $counts['subscribed'];
525
+
526
+ return $counts;
527
+ }
528
+
529
+ public function get_max_create($count_by_status){
530
+ $arr_max_create_at = array();
531
+ foreach($count_by_status as $status_data){
532
+ $arr_max_create_at[] = $status_data['max_create_at'];
533
+ }
534
+ return $arr_max_create_at;
535
+ }
536
+
537
+ /**
538
+ * triggered before a user is inserte using the insert function of the user model
539
+ * @return boolean
540
+ */
541
+ function beforeInsert(){
542
+ // set the activation key
543
+ $model_user=WYSIJA::get('user','model');
544
+
545
+ $this->values['keyuser']=md5($this->values['email'].$this->values['created_at']);
546
+ while($model_user->exists(array('keyuser'=>$this->values['keyuser']))){
547
+ $this->values['keyuser']=$this->generateKeyuser($this->values['email']);
548
+ $model_user->reset();
549
+ }
550
+
551
+ if(!isset($this->values['status'])) $this->values['status']=0;
552
+
553
+ return true;
554
+ }
555
+
556
+ /**
557
+ * triggered before a user is deleted using the delete function of the user model
558
+ * @return boolean
559
+ */
560
  function beforeDelete($conditions){
561
+ $model_user = new WYSIJA_model_user();
562
+ $users = $model_user->get(array('user_id'),$this->conditions);
563
+ $user_ids = array();
564
+ foreach($users as $user) $user_ids[]=$user['user_id'];
565
 
566
  //delete all the user stats
567
+ $model_email_user_stat=WYSIJA::get('email_user_stat','model');
568
+ $conditions=array('user_id'=>$user_ids);
569
+ $model_email_user_stat->delete($conditions);
570
  //delete all the queued emails
571
+ $model_queue=WYSIJA::get('queue','model');
572
+ $model_queue->delete($conditions);
573
  return true;
574
  }
575
 
576
+ /**
577
+ * triggered after a user is deleted using the delete function of the user model
578
+ * @return boolean
579
+ */
580
  function afterDelete(){
581
  $helper_user=WYSIJA::get('user','helper');
582
  $helper_user->refreshUsers();
583
  return true;
584
  }
585
 
586
+ /**
587
+ * triggered after a user is inserted using the insert function of the user model
588
+ * @return boolean
589
+ */
590
  function afterInsert($id){
591
  $helper_user=WYSIJA::get('user','helper');
592
  $helper_user->refreshUsers();
595
  return true;
596
  }
597
 
598
+ /**
599
+ * triggered after a user is updated using the u pdate function of the user model
600
+ * @return boolean
601
+ */
602
  function afterUpdate($id){
603
  $helper_user=WYSIJA::get('user','helper');
604
  $helper_user->refreshUsers();
605
+
606
  do_action('wysija_subscriber_modified', $id);
607
  return true;
608
  }
609
+
610
+
611
+ /**
612
+ * function used to generate the links if they are not valid anymore,
613
+ * will be needed for old version of the plugin still using old unsafe links
614
+ * @param int $user_id
615
+ * @param int $email_id
616
+ * @return string
617
+ */
618
+ function old_get_new_link_for_expired_links($user_id,$email_id){
619
+ $params=array(
620
+ 'wysija-page'=>1,
621
+ 'controller'=>'confirm',
622
+ 'action'=>'resend',
623
+ 'user_id'=>$user_id,
624
+ 'email_id'=>$email_id
625
+ );
626
+
627
+ $model_config = WYSIJA::get('config','model');
628
+ return WYSIJA::get_permalink($model_config->getValue('confirm_email_link'),$params);
629
+ }
630
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wysija, benheu
3
  Tags: newsletter, newsletters, newsletter signup, newsletter widget, subscribers, post notification, email subscription, email alerts, automatic newsletter, auto newsletter, autoresponder, follow up, email marketing, email, emailing, subscription
4
  Requires at least: 3.3
5
  Tested up to: 3.5
6
- Stable tag: 2.5.2
7
  Send newsletters, post notifications or autoresponders from WordPress easily, and beautifully.
8
 
9
  == Description ==
@@ -143,6 +143,41 @@ We got a User Voice page where you can [add or vote for new features](http://wys
143
 
144
  == Changelog ==
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  = 2.5.2 - 2013-06-26 =
147
  * fixed confusing text alignment not applied in the visual editor's tiny MCE
148
  * fixed autosave on step 2, the newsletter editor
3
  Tags: newsletter, newsletters, newsletter signup, newsletter widget, subscribers, post notification, email subscription, email alerts, automatic newsletter, auto newsletter, autoresponder, follow up, email marketing, email, emailing, subscription
4
  Requires at least: 3.3
5
  Tested up to: 3.5
6
+ Stable tag: 2.5.7
7
  Send newsletters, post notifications or autoresponders from WordPress easily, and beautifully.
8
 
9
  == Description ==
143
 
144
  == Changelog ==
145
 
146
+ = 2.5.7 - 2013-09-04 =
147
+ * fixed missing cron schedules for post notifications and scheduled newsletters
148
+ * fixed issue with auto save when switching themes
149
+ * fixed issue preventing the deletion of newly added image
150
+ * fixed sending method not being override in multisite
151
+ * fixed validation messages not translated on some MS sites due to language locale issue
152
+ * improved better use of the language definition so that we understand on which language a WPML site is for instance
153
+ * improved better use of the language definition (removed WPLANG) so that we understand on which language a WPML site is for instance
154
+ * added retina icons for text editor
155
+
156
+ = 2.5.5 - 2013-08-05 =
157
+ * fixed compatibility issue with WordPress 3.6 and latest jQuery
158
+ * fixed general reply to email settings not applied to sign up confirmation email
159
+ * fixed wild "Security failure during request." in the backend of some server configurations
160
+ * fixed count issues on subscribers and list
161
+ * fixed failing to send post notification newsletter preview with the tag [newsletter:post_title]
162
+ * refactored export and import code
163
+ * improved wysija's cron in order to respect better the delays between one scheduled task and another
164
+
165
+ = 2.5.4 - 2013-07-13 =
166
+ * fixed broken sending process when DKIM is activated but the openSSL php library goes missing
167
+ * fixed missing update procedure of 2.5.2 for bulk confirm
168
+ * fixed daily post notification sending sometimes one day old posts
169
+ * fixed SQL error on user to subscriber synch
170
+ * fixed frontend notice on subscriptions modifications
171
+ * fixed delete automatic newsletters
172
+ * fixed remove one user from all mailing lists at a time from the admin interface
173
+ * added reply-to address in advanced settings
174
+
175
+ = 2.5.3 - 2013-06-27 =
176
+ * added hook to delete wysija subscribers when a WP multisite user is deleted
177
+ * fixed Wysija's cron page view auto trigger creating some errors on some servers
178
+ * fixed WordPress user auto import as wysija subscribers on multisite
179
+ * fixed rendering issue 2.5.2
180
+
181
  = 2.5.2 - 2013-06-26 =
182
  * fixed confusing text alignment not applied in the visual editor's tiny MCE
183
  * fixed autosave on step 2, the newsletter editor
tools/templates/email_v2/block_content.html DELETED
@@ -1,37 +0,0 @@
1
- {if ! $background_color}{set var="$background_color" value="$styles.body.background"}{/if}
2
- <div style="{if $background_color}background-color:{$background_color|color};{/if}clear:both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
3
- <table style="border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin: auto;" width="{#block_width|default:600}">
4
- <tr style="{if $background_color}background-color:{$background_color|color};{/if}">
5
- <td style="{if $background_color}background-color:{$background_color|color};{/if}clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:10px;padding-bottom:10px;padding-left:18px;padding-right:18px;" width="{#block_width|default:600}">
6
- <div style="width:564px;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding:0;">
7
- {if #image}
8
- {if !$image_alignment}{set var="$image_alignment" value="#image.alignment"}{/if}
9
- {set var="$container_width" value="564"}
10
- {set var="$container_height" value="#image.height"}
11
- {if #text}
12
- {if $image_alignment != 'center'}
13
- {set var="$container_width" value="#image.width|inc:13"}
14
- {set var="$container_height" value="#image.height|inc:3"}
15
- {/if}
16
- {if $image_alignment == 'center'}
17
- {set var="$container_height" value="#image.height|inc:8"}
18
- {/if}
19
- {/if}
20
- <div class="wysija-image-container align-{$image_alignment}" style="width:{$container_width}px;height:{$container_height}px;max-height:{$container_height}px;overflow:hidden;">
21
- <table align="{$image_alignment}" border="0" cellpadding="0" cellspacing="0" style="{if $background_color}border:1px solid {$background_color|color};{/if}border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0;">
22
- <tr style="{if $background_color}background-color:{$background_color|color};{/if}">
23
- <td style="{if $background_color}background-color:{$background_color|color};{/if}mso-table-lspace:0;mso-table-rspace:0;clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;" height="{$container_height}" width="{$container_width}" valign="top" align="{$image_alignment}">
24
- {if #image.url}<a href="{#image.url}" style="outline:0;border:0;display:block;height:{#image.height}px;width:{#image.width}px;">{/if}
25
- <img src="{#image.src}" height="{#image.height}" alt="{#image.alt|url_decode|htmlentities}" width="{#image.width}" style="border:0;line-height:0.1em;margin:0;padding:0;" />
26
- {if #image.url}</a>{/if}
27
- </td>
28
- </tr>
29
- </table>
30
- </div>
31
- {/if}
32
- {if #text}{#text.value|base64_decode|format_text}{/if}
33
- </div>
34
- </td>
35
- </tr>
36
- </table>
37
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v2/block_divider.html DELETED
@@ -1,13 +0,0 @@
1
- {if #src}
2
- <div style="{if $background_color}background-color:{$background_color|color};{/if}clear:both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
3
- <table style="border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin: auto;" width="600">
4
- <tr>
5
- <td style="clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:10px;padding-bottom:10px;padding-left:18px;padding-right:18px;" width="{#block_width|default:600}">
6
- <div class="wysija-divider-container">
7
- <img src="{#src}" height="{#height}" width="{#width}" alt="" style="border:0;" />
8
- </div>
9
- </td>
10
- </tr>
11
- </table>
12
- </div>
13
- {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v2/block_gallery.html DELETED
@@ -1,8 +0,0 @@
1
- <div style="{if $background_color}background-color:{$background_color|color};{/if}clear:both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
2
- <table style="{if $background_color}background-color:{$background_color|color};{/if}border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin: auto;" width="{#block_width|default:600}"><tr><td style="clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:10px;padding-bottom:10px;padding-left:18px;padding-right:18px;" width="{#block_width|default:600}">
3
- <table align="{#alignment}" width="{#width}" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse; border-spacing: 0;">
4
- <tr valign="top">
5
- {foreach name="#items" key="j" value="image"}{include file="templates/email_v2/block_gallery_item.html"}{/foreach}
6
- </tr>
7
- </table>
8
- </td></tr></table></div>
 
 
 
 
 
 
 
 
tools/templates/email_v2/block_gallery_item.html DELETED
@@ -1,8 +0,0 @@
1
- {if #image.url}
2
- <td width="{#image.cellWidth}" height="{#image.cellHeight}">
3
- <div class="wysija-image-container align-center" style="height:{#image.height}px; max-height:{#image.height}px;overflow:hidden;">
4
- <a href="{#image.url}">
5
- <img src="{#image.src}" height="{#image.height}" alt="{#image.alt}" width="{#image.width}" style="border:0;line-height:0.1em;" />
6
- </a>
7
- </div>
8
- </td>{/if}
 
 
 
 
 
 
 
 
tools/templates/email_v2/block_raw.html DELETED
@@ -1,2 +0,0 @@
1
- <div style="width:{#block_width|default:564}px;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding:0;">{#raw|base64_decode}</div>
2
-
 
 
tools/templates/email_v2/block_template.html DELETED
@@ -1,2 +0,0 @@
1
- {set var="$template" concat="templates/email_v2/block_,#type,.html"}
2
- {include file="$template"}
 
 
tools/templates/email_v2/email_template.html DELETED
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
6
- <title>{#subject|default:Wysija template}</title>
7
- <style type="text/css">
8
- {#css}
9
- </style>
10
- </head>
11
- <body bgcolor="{#styles.html.background|color}" {if #is_rtl} dir="rtl" {/if} style="background:{#styles.html.background|color};color:{#styles.body.color|color}; font-family:'{#styles.body.family}';font-size:{#styles.body.size}px;" alink="{#styles.a.color|color}" link="{#styles.a.color|color}" text="{#styles.body.color|color}">
12
- <span id="wysija_wrapper" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; display:block;background:{#styles.html.background|color};">
13
- <table cellspacing="0" id="wysija_container" align="center" style="background:none; border:none; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-color:none; border-spacing:0; margin-bottom:0; margin-left:auto; margin-right:auto; margin-top:0; width:600px;" width="600" cellpadding="0">
14
- <tr>
15
- <td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;">
16
- {if ! #hide_viewbrowser}<table cellspacing="0" id="wysija_viewbrowser" align="center" style="background:none; background-color:{#styles.html.background|color}; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width: 600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_viewbrowser_content" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;" width="600"><p style="background-color:{#styles.html.background|color};{if #styles.viewbrowser.color}color:{#styles.viewbrowser.color|color};{/if}font-family:'{#styles.viewbrowser.family}'; font-size:{#styles.viewbrowser.size}px; height:auto; padding:8px; text-align:center;">{#viewbrowser}</p></td></tr></table>{/if}
17
- {#header}
18
- <table cellspacing="0" id="wysija_body" align="center" style="background: none; background-color:{#styles.body.background|color}; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width: 600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_body_content" style="margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;width:600px;" width="600">{#body}</td></tr></table>
19
- {#footer}
20
- {if ! #hide_unsubscribe}<table cellspacing="0" id="wysija_unsubscribe" align="center" style="background:none; background-color:{#styles.html.background|color}; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width: 600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_unsubscribe_content" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;" width="600"><p style="background-color:{#styles.html.background|color}; color:{#styles.unsubscribe.color|color}; font-family:Verdana; font-size:12px; height:auto; padding:8px; text-align:center;">{#unsubscribe}</p></td></tr></table>{/if}
21
- </td>
22
- </tr>
23
- </table>
24
- </span>
25
- </body>
26
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v2/footer_template.html DELETED
@@ -1,17 +0,0 @@
1
- {if #image}
2
- <table cellspacing="0" id="wysija_footer" align="center" style="background: none; background-color:{#styles.footer.background|color}; border-collapse: collapse; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width:600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_header_content" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;" width="600">
3
- <div style="clear: both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
4
- <table style="border-collapse: collapse; border-spacing: 0; margin: auto;" width="{#block_width|default:564}">
5
- <tr>
6
- {if #image.alignment == 'right'}<td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{#block_width|dec:#image.width}">&nbsp;</td>{/if}
7
- <td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{if #image.alignment == 'center'}{#block_width|default:564}{/if}{if #image.alignment != 'center'}{#image.width}{/if}">
8
- <div class="wysija-image-container alone-{#image.alignment}" style="height:{#image.height}px; max-height:{#image.height}px;overflow:hidden;">
9
- {if #image.url}<a href="{#image.url}" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">{/if}<img class="wysija-image-{#image.alignment}" src="{#image.src}" height="{#image.height}" alt="{#image.alt|url_decode|htmlentities}" width="{#image.width}" hspace="0" vspace="0" style="border:0;">{if #image.url}</a>{/if}
10
- </div>
11
- </td>
12
- {if #image.alignment == 'left'}<td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{#block_width|dec:#image.width}">&nbsp;</td>{/if}
13
- </tr>
14
- </table>
15
- </div>
16
- </td></tr></table>
17
- {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v2/header_template.html DELETED
@@ -1,17 +0,0 @@
1
- {if #image}
2
- <table cellspacing="0" id="wysija_header" align="center" style="background: none; background-color:{#styles.header.background|color}; border-collapse: collapse; border-spacing: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; width:600px;" width="600" cellpadding="0"><tr valign="top"><td id="wysija_header_content" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0;" width="600">
3
- <div style="clear: both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
4
- <table style="border-collapse: collapse; border-spacing: 0; margin: auto;" width="{#block_width|default:564}">
5
- <tr>
6
- {if #image.alignment == 'right'}<td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{#block_width|dec:#image.width}">&nbsp;</td>{/if}
7
- <td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{if #image.alignment == 'center'}{#block_width|default:564}{/if}{if #image.alignment != 'center'}{#image.width}{/if}">
8
- <div class="wysija-image-container alone-{#image.alignment}" style="height:{#image.height}px; max-height:{#image.height}px;overflow:hidden;">
9
- {if #image.url}<a href="{#image.url}" style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">{/if}<img class="wysija-image-{#image.alignment}" src="{#image.src}" height="{#image.height}" alt="{#image.alt|url_decode|htmlentities}" width="{#image.width}" hspace="0" vspace="0" style="border:0;">{if #image.url}</a>{/if}
10
- </div>
11
- </td>
12
- {if #image.alignment == 'left'}<td style="margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;" width="{#block_width|dec:#image.width}">&nbsp;</td>{/if}
13
- </tr>
14
- </table>
15
- </div>
16
- </td></tr></table>
17
- {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/email_v2/index.html DELETED
File without changes
tools/templates/email_v2/unsubscribe_template.html DELETED
@@ -1 +0,0 @@
1
- {loop name="#unsubscribe"}<a href="{#link}" target="_blank">{#label}</a>{if ! #IS_LAST}&nbsp;-&nbsp;{/if}{/loop}<br /><br />{#company_address}
 
tools/templates/email_v2/viewbrowser_template.html DELETED
@@ -1 +0,0 @@
1
- {#pretext}<a href="{#link}" target="_blank">{#label}</a>{#posttext}
 
tools/templates/email_v3/block_content_BACKUP.html DELETED
@@ -1,37 +0,0 @@
1
- {if ! $background_color}{set var="$background_color" value="$styles.body.background"}{/if}
2
- <div style="{if $background_color}background-color:{$background_color|color};{/if}clear:both; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; padding: 0;">
3
- <table align="left" style="border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0; margin: auto;" width="{#block_width|default:600}">
4
- <tr style="{if $background_color}background-color:{$background_color|color};{/if}">
5
- <td align="left" style="{if $background_color}background-color:{$background_color|color};{/if}clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:10px;padding-bottom:10px;padding-left:18px;padding-right:18px;" width="{#block_width|default:600}">
6
- <div style="width:564px;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding:0;">
7
- {if #image}
8
- {if !$image_alignment}{set var="$image_alignment" value="#image.alignment"}{/if}
9
- {set var="$container_width" value="564"}
10
- {set var="$container_height" value="#image.height"}
11
- {if #text}
12
- {if $image_alignment != 'center'}
13
- {set var="$container_width" value="#image.width|inc:13"}
14
- {set var="$container_height" value="#image.height|inc:3"}
15
- {/if}
16
- {if $image_alignment == 'center'}
17
- {set var="$container_height" value="#image.height|inc:8"}
18
- {/if}
19
- {/if}
20
- <div class="wysija-image-container align-{$image_alignment}" style="width:{$container_width}px;height:{$container_height}px;max-height:{$container_height}px;overflow:hidden;">
21
- <table align="{$image_alignment}" border="0" cellpadding="0" cellspacing="0" style="{if $background_color}border:1px solid {$background_color|color};{/if}border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; border-spacing: 0;">
22
- <tr style="{if $background_color}background-color:{$background_color|color};{/if}">
23
- <td style="{if $background_color}background-color:{$background_color|color};{/if}mso-table-lspace:0;mso-table-rspace:0;clear:both;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;" height="{$container_height}" width="{$container_width}" valign="top" align="{$image_alignment}">
24
- {if #image.url}<a href="{#image.url}" style="outline:0;border:0;display:block;height:{#image.height}px;width:{#image.width}px;">{/if}
25
- <img src="{#image.src}" height="{#image.height}" alt="{#image.alt|url_decode|htmlentities}" width="{#image.width}" style="border:0;line-height:0.1em;margin:0;padding:0;" />
26
- {if #image.url}</a>{/if}
27
- </td>
28
- </tr>
29
- </table>
30
- </div>
31
- {/if}
32
- {if #text}{#text.value|base64_decode|format_text}{/if}
33
- </div>
34
- </td>
35
- </tr>
36
- </table>
37
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tools/templates/toolbar/images.html CHANGED
@@ -1,7 +1,7 @@
1
  {foreach name="#images" key="j" value="image"}
2
  <li id="wysija-img-{#image.identifier}">
3
  <a class="wysija_item" href="javascript:;" wysija_type="image"><img src="{#image.thumb_url}" wysija_src="{#image.url}" wysija_width="{#image.width}" wysija_height="{#image.height}" height="80" width="80" /></a>
4
- <span class="delete-wrap" style="display:none;"><span class="delete del-attachment">{#image.identifier}</span></span>
5
  </li>
6
  {/foreach}
7
 
1
  {foreach name="#images" key="j" value="image"}
2
  <li id="wysija-img-{#image.identifier}">
3
  <a class="wysija_item" href="javascript:;" wysija_type="image"><img src="{#image.thumb_url}" wysija_src="{#image.url}" wysija_width="{#image.width}" wysija_height="{#image.height}" height="80" width="80" /></a>
4
+ <span class="delete-wrap" style="display:none;"><span class="delete">{#image.identifier}</span></span>
5
  </li>
6
  {/foreach}
7
 
tools/templates/toolbar/themes.html CHANGED
@@ -1,7 +1,7 @@
1
  {foreach name="#themes" key="j" value="theme"}
2
  <li id="wysija-theme-{#theme.name}">
3
  <a class="wysija_theme" href="javascript:;" rel="{#theme.name}" title="{#theme.name|ucfirst}"><img src="{#theme.thumbnail}" wysija_src="{#theme.screenshot}" wysija_width="{#theme.width}" wysija_height="{#theme.height}"/></a>
4
- <span style="display: none;" class="delete-wrap"><span class="delete del-attachment">{#theme.name}</span></span>
5
  <span style="display: none;" class="default-wrap"><span title="{$i18n.theme_save_as_default}" class="default{if #theme.is_selected} selected{/if}">{#theme.name}</span></span>
6
  </li>
7
  {/foreach}
1
  {foreach name="#themes" key="j" value="theme"}
2
  <li id="wysija-theme-{#theme.name}">
3
  <a class="wysija_theme" href="javascript:;" rel="{#theme.name}" title="{#theme.name|ucfirst}"><img src="{#theme.thumbnail}" wysija_src="{#theme.screenshot}" wysija_width="{#theme.width}" wysija_height="{#theme.height}"/></a>
4
+ <span style="display: none;" class="delete-wrap"><span class="delete">{#theme.name}</span></span>
5
  <span style="display: none;" class="default-wrap"><span title="{$i18n.theme_save_as_default}" class="default{if #theme.is_selected} selected{/if}">{#theme.name}</span></span>
6
  </li>
7
  {/foreach}
views/back.php CHANGED
@@ -55,22 +55,25 @@ class WYSIJA_view_back extends WYSIJA_view{
55
 
56
  if($this->skip_header === true) return;
57
 
58
- echo '<div class="icon32" id="'.$this->icon.'"><br/></div>';
59
-
60
- $fulltitle=__($this->title,WYSIJA);
61
- $action=$subtitle="";
62
 
63
  if(isset($_REQUEST['action'])) $action=$_REQUEST['action'];
64
- if($action && $action!='main' && isset($this->subtitle)) $subtitle="[".ucfirst(__($action,WYSIJA))."]";
65
 
66
 
67
  if(isset($this->titlelink)){
68
- $mytitle='<a href="admin.php?page='.$_REQUEST['page'].'">'.$fulltitle.'</a> ';
69
  }else{
70
- $mytitle=$fulltitle.' ';
71
  }
72
- echo '<h2>'.$mytitle.$subtitle.$this->menuTop($this->action,$data).'</h2>';
73
- echo $this->messages();
 
 
 
74
 
75
  }
76
 
@@ -79,7 +82,7 @@ class WYSIJA_view_back extends WYSIJA_view{
79
  * to help reproduce the standard view of wordpress admin view here is the footer part
80
  */
81
  function footer(){
82
- echo "</div>";/*end div class wrap*/
83
  }
84
 
85
  /**
@@ -279,7 +282,7 @@ class WYSIJA_view_back extends WYSIJA_view{
279
  $limitPerpageS=array(10,20,50,100);
280
  if($this->model->countRows <= $limitPerpageS[0]) return true;
281
  $limitPerpage=array();
282
-
283
  foreach($limitPerpageS as $k => $count){
284
  $limitPerpage[] = $count;
285
  if($this->model->countRows < $count) break;
55
 
56
  if($this->skip_header === true) return;
57
 
58
+ $header = '<div class="icon32" id="'.$this->icon.'"><br/></div>';
59
+ $header='';
60
+ $full_title = __($this->title,WYSIJA);
61
+ $action = $sub_title = '';
62
 
63
  if(isset($_REQUEST['action'])) $action=$_REQUEST['action'];
64
+ if($action && $action!='main' && isset($this->subtitle)) $sub_title='['.ucfirst(__($action,WYSIJA)).']';
65
 
66
 
67
  if(isset($this->titlelink)){
68
+ $my_title = '<a href="admin.php?page='.$_REQUEST['page'].'">'.$full_title.'</a> ';
69
  }else{
70
+ $my_title = $full_title . ' ';
71
  }
72
+
73
+ $header .= '<h2>'.$my_title.$sub_title.$this->menuTop($this->action,$data).'</h2>';
74
+ $header .= $this->messages();
75
+
76
+ echo $header;
77
 
78
  }
79
 
82
  * to help reproduce the standard view of wordpress admin view here is the footer part
83
  */
84
  function footer(){
85
+ echo '</div>';/*end div class wrap*/
86
  }
87
 
88
  /**
282
  $limitPerpageS=array(10,20,50,100);
283
  if($this->model->countRows <= $limitPerpageS[0]) return true;
284
  $limitPerpage=array();
285
+
286
  foreach($limitPerpageS as $k => $count){
287
  $limitPerpage[] = $count;
288
  if($this->model->countRows < $count) break;
views/back/campaigns.php CHANGED
@@ -825,9 +825,12 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
825
  }
826
  }else{
827
  $return.= $statusdata;
 
 
 
828
  $link= str_replace(
829
  array('[link]','[/link]'),
830
- array('<a title="'.__('Get Premium now',WYSIJA).'" class="premium-tab" href="javascript:;">','</a>'),
831
  __('To resume send [link]Go premium now![/link]',WYSIJA));
832
  $return.= '<p>'.$link.'</p>';
833
  }
@@ -839,8 +842,10 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
839
  function linkStats($result,$data){
840
  $result='<ol>';
841
  $countloop=0;
 
 
842
  foreach($data['clicks'] as $click){
843
- if($countloop==0) $label=str_replace(array('[link]','[/link]'),array('<a class="premium-tab" href="javascript:;">','</a>'),__('see links with a [link]Premium licence[/link].',WYSIJA));
844
  else $label='...';
845
 
846
  $css_class = 'stats-url-link';
@@ -894,15 +899,6 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
894
  echo $linkshtml;
895
  }else echo __('Nothing yet!',WYSIJA);
896
 
897
- /*if(count($data['clicks'])>0){
898
- echo '<p style="font-size:14px;font-weight:bold;">';
899
- echo str_replace(
900
- array("[link]","[/link]"),
901
- array('<a title="'.__('Just a few clicks. No need to reinstall. Easy.',WYSIJA).'" class="premium-tab" href="javascript:;">','</a>'),
902
- _x_("Detailed view of links and their number of clicks is available in the Premium version. [link]Get it now.[/link]",WYSIJA));
903
- echo '</p>';
904
- }*/
905
-
906
  ?>
907
  </div>
908
  <div class="clear"></div>
@@ -1382,8 +1378,9 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
1382
  Wysija.setDivider(response.responseJSON.result.templates.divider, response.responseJSON.result.templates.divider_options);
1383
  Wysija.replaceDividers();
1384
  }
 
1385
  Wysija.init();
1386
- Wysija.autoSave();
1387
  }
1388
  });
1389
  return false;
@@ -1731,10 +1728,18 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
1731
  $fieldHTML.=$singleFieldHtml;
1732
  }
1733
 
1734
- $fieldHTML.='</div>';
 
 
1735
  return $fieldHTML;
1736
  }
1737
 
 
 
 
 
 
 
1738
  function fieldFormHTML_type_nl($key,$val,$model,$params){
1739
  $fieldHTML= '<div class="list-radios">';
1740
  $field=$key;
@@ -1798,13 +1803,14 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
1798
  return $fieldHTML;
1799
  }
1800
  function fieldFormHTML_scheduleit($key,$val,$model,$params){
1801
- $formObj=WYSIJA::get("forms","helper");
1802
 
1803
  $valuescheduled='';
1804
 
1805
- if(isset($this->data['email']['params']['schedule']['isscheduled']))$valuescheduled=$this->data['email']['params']['schedule']['isscheduled'];
1806
- $data=$formObj->checkbox( array('class'=>$params['class'], 'id'=>$key,'name'=>"wysija[email][params][schedule][isscheduled]"),true,$valuescheduled);
1807
- $data.=$this->fieldFormHTML_datepicker('datepicker',$val,$model,$params);
 
1808
  return $data;
1809
  }
1810
 
@@ -1830,8 +1836,9 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
1830
  $fieldHTML.=$formObj->dropdown(
1831
  array('name'=>'wysija[email][params][schedule][time]','id'=>$field.'-time'),
1832
  $this->data['autonl']['fields']['time']['values'],$valuetime);
1833
-
1834
- $fieldHTML.="</span>";
 
1835
  return $fieldHTML;
1836
  }
1837
 
@@ -2785,17 +2792,34 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
2785
  $class_added=' removeme';
2786
  }
2787
 
2788
- if(isset($section['type']) && $section['type'] === 'poll') {
2789
- foreach($data['polls'] as $pollid => $polltitle){
 
 
 
 
 
 
 
 
 
 
 
 
2790
  ?>
2791
- <!-- BEGIN: Poll on update -->
2792
- <h3><?php echo $section['title'].$link_hide ?></h3>
2793
- <script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/<?php echo $pollid ?>.js"></script>
2794
- <noscript><a href="http://polldaddy.com/poll/<?php echo $pollid ?>/"><?php echo $polltitle; ?></a></noscript>
2795
- <br />
2796
- <!-- END: Poll on update -->
 
 
 
 
2797
  <?php
2798
  }
 
2799
  } else {
2800
  ?>
2801
  <div class="changelog <?php echo $class_added ?>">
@@ -2834,7 +2858,7 @@ class WYSIJA_view_back_campaigns extends WYSIJA_view_back{
2834
  echo '<div class="review-left'.$class_review_kitten.'">';
2835
  echo '<div class="description"><h4>'.$section['review']['title'].'</h4>';
2836
  echo '<p>'.$section['review']['content'].'</p></div>';
2837
- echo '<a title="On wordpress.org" target="_blank" class="link-cat-review" href="http://wordpress.org/support/view/plugin-reviews/wysija-newsletters"> </a></div>';
2838
 
2839
  echo '<div class="review-right">';
2840
  echo '</div>';
825
  }
826
  }else{
827
  $return.= $statusdata;
828
+ $helper_licence = WYSIJA::get('licence','helper');
829
+ $url_checkout = $helper_licence->get_url_checkout('resume_send');
830
+
831
  $link= str_replace(
832
  array('[link]','[/link]'),
833
+ array('<a title="'.__('Get Premium now',WYSIJA).'" target="_blank" href="'.$url_checkout.'">','</a>'),
834
  __('To resume send [link]Go premium now![/link]',WYSIJA));
835
  $return.= '<p>'.$link.'</p>';
836
  }
842
  function linkStats($result,$data){
843
  $result='<ol>';
844
  $countloop=0;
845
+ $helper_licence = WYSIJA::get('licence','helper');
846
+ $url_checkout = $helper_licence->get_url_checkout('count_click_stats');
847
  foreach($data['clicks'] as $click){
848
+ if($countloop==0) $label=str_replace(array('[link]','[/link]'),array('<a class="premium-tab" target="_blank" href="'.$url_checkout.'">','</a>'),__('see links with a [link]Premium licence[/link].',WYSIJA));
849
  else $label='...';
850
 
851
  $css_class = 'stats-url-link';
899
  echo $linkshtml;
900
  }else echo __('Nothing yet!',WYSIJA);
901
 
 
 
 
 
 
 
 
 
 
902
  ?>
903
  </div>
904
  <div class="clear"></div>
1378
  Wysija.setDivider(response.responseJSON.result.templates.divider, response.responseJSON.result.templates.divider_options);
1379
  Wysija.replaceDividers();
1380
  }
1381
+
1382
  Wysija.init();
1383
+ saveWYSIJA();
1384
  }
1385
  });
1386
  return false;
1728
  $fieldHTML.=$singleFieldHtml;
1729
  }
1730
 
1731
+
1732
+
1733
+ $fieldHTML .= $this->local_time_is(). '</div>';
1734
  return $fieldHTML;
1735
  }
1736
 
1737
+ function local_time_is(){
1738
+ $helper_toolbox = WYSIJA::get('toolbox','helper');
1739
+
1740
+ return '<span class="local_time">'. sprintf( __('Local time is <code>%1$s</code>') , $helper_toolbox->site_current_time() ).'</span>';
1741
+ }
1742
+
1743
  function fieldFormHTML_type_nl($key,$val,$model,$params){
1744
  $fieldHTML= '<div class="list-radios">';
1745
  $field=$key;
1803
  return $fieldHTML;
1804
  }
1805
  function fieldFormHTML_scheduleit($key,$val,$model,$params){
1806
+ $formObj=WYSIJA::get('forms' , 'helper');
1807
 
1808
  $valuescheduled='';
1809
 
1810
+ if(isset($this->data['email']['params']['schedule']['isscheduled'])) $valuescheduled = $this->data['email']['params']['schedule']['isscheduled'];
1811
+ $data = $formObj->checkbox( array( 'class' => $params['class'], 'id' => $key , 'name' => 'wysija[email][params][schedule][isscheduled]' ) , true , $valuescheduled);
1812
+ $data .= $this->fieldFormHTML_datepicker('datepicker' , $val , $model , $params);
1813
+
1814
  return $data;
1815
  }
1816
 
1836
  $fieldHTML.=$formObj->dropdown(
1837
  array('name'=>'wysija[email][params][schedule][time]','id'=>$field.'-time'),
1838
  $this->data['autonl']['fields']['time']['values'],$valuetime);
1839
+
1840
+ $fieldHTML .= $this->local_time_is();
1841
+ $fieldHTML.='</span>';
1842
  return $fieldHTML;
1843
  }
1844
 
2792
  $class_added=' removeme';
2793
  }
2794
 
2795
+ if(isset($section['type'])) {
2796
+
2797
+ if($section['type'] === 'poll'){
2798
+ foreach($data['polls'] as $pollid => $polltitle){
2799
+ ?>
2800
+ <!-- BEGIN: Poll on update -->
2801
+ <h3><?php echo $section['title'].$link_hide ?></h3>
2802
+ <script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/<?php echo $pollid ?>.js"></script>
2803
+ <noscript><a href="http://polldaddy.com/poll/<?php echo $pollid ?>/"><?php echo $polltitle; ?></a></noscript>
2804
+ <br />
2805
+ <!-- END: Poll on update -->
2806
+ <?php
2807
+ }
2808
+ }elseif($section['type'] === 'survey'){
2809
  ?>
2810
+ <script type="text/javascript" src="http://i0.poll.fm/survey.js" charset="UTF-8"></script>
2811
+ <noscript><a href="http://mailpoet.polldaddy.com/s/wysija-user-survey-2013-07"><?php __('4 min survey to better understand what you need',WYSIJA) ?></a></noscript>
2812
+ <script type="text/javascript">
2813
+ polldaddy.add( {
2814
+ type: 'iframe',
2815
+ auto: true,
2816
+ domain: 'mailpoet.polldaddy.com/s/',
2817
+ id: 'wysija-user-survey-2013-07'
2818
+ } );
2819
+ </script>
2820
  <?php
2821
  }
2822
+
2823
  } else {
2824
  ?>
2825
  <div class="changelog <?php echo $class_added ?>">
2858
  echo '<div class="review-left'.$class_review_kitten.'">';
2859
  echo '<div class="description"><h4>'.$section['review']['title'].'</h4>';
2860
  echo '<p>'.$section['review']['content'].'</p></div>';
2861
+ echo '<a title="On wordpress.org" target="_blank" class="link-cat-review" href="http://goo.gl/P0r5Fc"> </a></div>';
2862
 
2863
  echo '<div class="review-right">';
2864
  echo '</div>';
views/back/config.php CHANGED
@@ -107,7 +107,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
107
 
108
  return $fieldHTML;
109
  }
110
-
111
  function fieldFormHTML_managesubscribe($key,$value,$model,$paramsex){
112
  // second part concerning the checkbox
113
  $formsHelp=WYSIJA::get('forms','helper');
@@ -186,35 +186,58 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
186
  return $field;
187
  }
188
 
189
- function fieldFormHTML_cron($key,$value,$model,$paramsex){
190
  //second part concerning the checkbox
191
- $formsHelp=WYSIJA::get('forms','helper');
192
- $checked=false;
193
- if($this->model->getValue($key)) $checked=true;
194
- $field='<div><div class="cronleft"><label for="'.$key.'">';
195
- $field.=$formsHelp->checkbox(array('id'=>$key,'name'=>'wysija['.$model.']['.$key.']','class'=>'activateInput'),1,$checked);
196
- $field.='</label></div>';
 
 
 
 
 
 
 
 
 
 
197
 
198
- $url_cron=site_url( 'wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process=all';
199
- $field.='<div class="cronright" id="'.$key.'_linkname">';
200
 
201
- $text_cron_manual_trigger=__('I\'ll setup a cron job on my server to execute at the frequency I want. Read about [link]setting up a cron job yourself[/link].',WYSIJA).'<br/><span>'.__('Use this URL in your cron job: [cron_url]').'</span>';
202
- $text_cron_manual_trigger= str_replace(array('[link]','[/link]','[cron_url]'), array('<a href="http://support.wysija.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">','</a>','<a href="'.$url_cron.'" target="_blank">'.$url_cron.'</a>'), $text_cron_manual_trigger);
203
 
204
- $text_cron_page_view=__('No thanks! I have enough visitors on my site. Their visits will trigger Wysija\'s cron automatically.',WYSIJA);
205
- $values_page_view_trigger = array(2=>$text_cron_manual_trigger, 1=>$text_cron_page_view);
206
 
207
- $value=2;
208
- if((int)$this->model->getValue('cron_page_hit_trigger')===1) $value=1;
209
- //echo '<pre>';print_r($this->model->values);exit;
210
- $key='cron_page_hit_trigger';
 
 
 
 
 
 
211
 
212
- $field.=$formsHelp->radios(array('id'=>$key,'name'=>'wysija['.$model.']['.$key.']'), $values_page_view_trigger , $value);
213
- $field.='</div></div>';
 
 
 
 
 
 
 
214
 
215
  return $field;
216
  }
217
 
 
218
  function fieldFormHTML_debugnew($key,$value,$model,$paramsex){
219
  /*second part concerning the checkbox*/
220
  $formsHelp=WYSIJA::get('forms','helper');
@@ -626,7 +649,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
626
  'label'=>__('Subscribe in registration form',WYSIJA),
627
  'desc'=>__('Allow users who register to your site to subscribe on a list of your choice.',WYSIJA)
628
  );
629
- }
630
 
631
  $modelU=WYSIJA::get('user','model');
632
  $objUser=$modelU->getCurrentSubscriber();
@@ -652,7 +675,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
652
  $step['unsubscribed_subtitle']=array(
653
  'type'=>'input',
654
  'label'=>__('Unsubscribe page content',WYSIJA));
655
-
656
  $modelC=WYSIJA::get('config','model');
657
 
658
  ?>
@@ -668,7 +691,9 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
668
 
669
  function premiumSoonFields(){
670
  $html='';
671
- $html.='<li class="notice">'.str_replace(array('[link]','[/link]'), array('<a href="javascript:;" class="premium-tab">','</a>'), __('Soon available in [link]Premium[/link]:', WYSIJA)).'</li>';
 
 
672
  $extraTypes=array(
673
  'new-text'=>array('label'=>__('Text or number',WYSIJA),'type'=>'text'),
674
  'new-textarea'=>array('label'=>__('Paragraph text',WYSIJA),'type'=>'textarea'),
@@ -1085,14 +1110,22 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1085
  'type'=>'capabilities',
1086
  '1col'=>1);
1087
 
 
 
 
 
 
 
 
 
1088
  $advanced_fields ['bounce_email']=array(
1089
  'type'=>'input',
1090
  'label'=>__('Bounce Email',WYSIJA),
1091
  'desc'=>__('To which address should all the bounced emails go? Get the [link]Premium version[/link] to automatically handle these.',WYSIJA),
1092
- 'link'=>'<a class="premium-tab" href="javascript:;" title="'.__('Purchase the premium version.',WYSIJA).'">');
 
 
1093
 
1094
- $advanced_fields =apply_filters('wysija_settings_advanced', $advanced_fields );
1095
-
1096
  $modelU=WYSIJA::get('user','model');
1097
  $objUser=$modelU->getCurrentSubscriber();
1098
 
@@ -1108,7 +1141,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1108
  'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)),
1109
  'desc' => __('This allows you to modify the HTML of text blocks in the visual editor.', WYSIJA)
1110
  );
1111
-
1112
  $advanced_fields ['analytics']=array(
1113
  'rowclass'=>'analytics',
1114
  'type'=>'radio',
@@ -1117,7 +1150,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1117
  'desc'=>__('Share anonymous data and help us improve the plugin. [link]Read more[/link].',WYSIJA),
1118
  'link' => '<a target="_blank" href="http://support.wysija.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=advanced_settings">'
1119
  );
1120
-
1121
  $advanced_fields ['industry']=array(
1122
  'rowclass'=>'industry',
1123
  'type'=>'dropdown_keyval',
@@ -1157,29 +1190,40 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1157
  if(WYSIJA::current_user_can('manage_network')) $advanced_fields ['ms_beta_mode'] = $beta_mode_field;
1158
  }else{
1159
  $advanced_fields ['beta_mode'] = $beta_mode_field;
1160
- }
1161
-
1162
  $super_advanced_fields ['subscribers_count']=array(
1163
  'type'=>'subscribers_count',
1164
  'label'=>__('Shortcode to display total number of subscribers',WYSIJA),
1165
  'desc'=>__('Paste this shortcode to display the number of confirmed subscribers in post or page',WYSIJA)
1166
- );
1167
 
1168
  $super_advanced_fields ['advanced_charset']=array(
1169
  'type'=>'dropdown_keyval',
1170
- 'values'=>array('UTF-8','UTF-7',
1171
- 'BIG5',
1172
- "ISO-8859-1","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-13","ISO-8859-14","ISO-8859-15",
1173
- 'Windows-1251','Windows-1252'),
 
 
1174
  'label'=>__('Charset',WYSIJA),
1175
  'desc'=>__('Squares or weird characters are displayed in your emails? Select the encoding for your language.',WYSIJA));
1176
 
1177
  $super_advanced_fields = apply_filters('wysija_settings_advancednext', $super_advanced_fields );
1178
 
1179
- $super_advanced_fields ['cron_manual']=array(
1180
- 'type'=>'cron',
1181
- 'label'=>__('Enable Wysija Cron\'s', WYSIJA),
1182
- 'desc'=>__('None of your queued emails have been sent? Then activate this option.',WYSIJA));
 
 
 
 
 
 
 
 
 
1183
 
1184
  $super_advanced_fields ['debug_new']=array(
1185
  'type'=>'debugnew',
@@ -1194,7 +1238,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1194
  array('<a href="admin.php?page=wysija_config&action=log">','<a href="admin.php?page=wysija_config&action=clearlog">','</a>','</a>'),
1195
  'View them [link]here[/link]. Clear them [linkclear]here[/linkclear]'));
1196
  }
1197
-
1198
  //attach 'super-advanced' class to super_advanced_fields
1199
  $super_advanced_field_class = 'super-advanced';
1200
  foreach($super_advanced_fields as $key => $field){
@@ -1216,7 +1260,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1216
  <div class="hide-geeky-options geeky-option">
1217
  <a href="javascript:void(0);">
1218
  <?php echo __('Hide the geeky options',WYSIJA); ?>
1219
- </a>
1220
  <span class=" icon"></span>
1221
  </div>
1222
  </td>
@@ -1244,18 +1288,18 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1244
  }
1245
 
1246
  function premium(){
1247
- $hLicence=WYSIJA::get('licence','helper');
1248
- $urlpremium = 'http://www.wysija.com/checkout/?wysijadomain='.$hLicence->getDomainInfo().'&nc=1&utm_source=wpadmin&utm_campaign=purchasebutton';
1249
 
1250
  $arrayPremiumBullets=array(
1251
  'more2000'=>array(
1252
  'title'=>__('Send to more than 2000 subscribers.',WYSIJA),
1253
  'desc'=>__('You have no more limits. Send to 100 000 if you want.',WYSIJA)
1254
  ),
1255
- 'advlinkstats'=>array(
1256
- 'title'=>__('Get the bigger picture with more stats.',WYSIJA),
1257
- 'desc'=>__('The stats dashboard will give you better insight on how you\'re scoring.',WYSIJA)
1258
- ),
1259
  'linksstats'=>array(
1260
  'title'=>__('Find out which links are clicked.',WYSIJA),
1261
  'desc'=>__('Which links in your newsletter are getting clicked on? Find out for each newsletter.',WYSIJA)
@@ -1264,10 +1308,10 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1264
  'title'=>__('Track with Google Analytics.',WYSIJA),
1265
  'desc'=>__('Find out what your subscribers do once on your site.',WYSIJA)
1266
  ),
1267
- 'customfields'=>array(
1268
- 'title'=>__('Add more fields to your forms.',WYSIJA),
1269
- 'desc'=>__('Add phone number, city, gender or whatever you wish in your subscription forms.',WYSIJA)
1270
- ),
1271
  'cron'=>array(
1272
  'title'=>__('We activate a cron job for you.',WYSIJA),
1273
  'desc'=>__('We make sure you\'re sending every 15 minutes to avoid irregular delivery.',WYSIJA)
@@ -1296,7 +1340,7 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1296
  'happy'=>array(
1297
  'title'=>__('Join our happy users.',WYSIJA),
1298
  'desc'=>__('Wysija is getting better every day thanks to users like you. <br />Read [link]what they are saying[/link].',WYSIJA),
1299
- 'link'=>'http://wordpress.org/support/view/plugin-reviews/wysija-newsletters'
1300
  ),
1301
  'trynow'=>array(
1302
  'title'=>__('Try it now. Not happy? Get your money back.',WYSIJA),
@@ -1321,8 +1365,8 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1321
  }
1322
  $htmlContent.='</div></div>';
1323
  $htmlContent.='<p class="wysija-premium-wrapper">
1324
- <a class="wysija-premium-btns wysija-support" href="'.$urlpremium.'" target="_blank">'.__('Upgrade now',WYSIJA).'</a></p>';
1325
- $htmlContent.='<br><p>'.__('Already paid?', WYSIJA).' <a id="premium-activate" type="submit" class="wysija" href="javascript:;" />'. esc_attr(__('Activate your Premium licence.',WYSIJA)).'</a></p>';
1326
 
1327
  $htmlContent.='<p>'.str_replace(array('[link]','[/link]'),array('<a href="http://www.wysija.com/contact/?utm_source=wpadmin&utm_campaign=premiumtab" target="_blank">','</a>'),__('Got a sales question? [link]Get in touch[/link] with Kim, Jo, Adrien and Ben.',WYSIJA)).'</p>';
1328
  $htmlContent.='<p>'.str_replace(array('[link]','[/link]'),array('<a href="http://support.wysija.com/terms-conditions/?utm_source=wpadmin&utm_campaign=premiumtab" target="_blank">','</a>'),__('Read our simple and easy [link]terms and conditions.[/link]',WYSIJA)).'</p>';
@@ -1395,12 +1439,6 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1395
  $fields=array();
1396
 
1397
 
1398
- $fields['ms_from_email']=array(
1399
- 'type'=>'input',
1400
- 'label'=>__('FROM email address for all sites',WYSIJA),
1401
- 'class'=>'msfromemail',
1402
- 'rowclass'=>'choice-one-for-all');
1403
-
1404
  $fields['ms_allow_admin_sending_method']=array(
1405
  'type'=>'debug',
1406
  'label'=>__('Allow site admins to change the sending method',WYSIJA));
@@ -1439,14 +1477,17 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1439
 
1440
  function ms_sending_method(){
1441
  $prefix='ms_';
1442
- $key=$prefix.'sending_method';
1443
- $mConfig=WYSIJA::get('config','model');
1444
- $realvalue=$mConfig->getValue($key);
1445
- $formsHelp=WYSIJA::get('forms','helper');
1446
- $htmlContent='<table class="form-table" id="ms-sendingmethod">
1447
- <tbody>
1448
 
1449
- <tr class="methods">
 
 
 
 
 
1450
  <th scope="row">';
1451
 
1452
  $checked=false;
@@ -1454,10 +1495,10 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1454
  $id=str_replace("_",'-',$key).'-'.$value;
1455
  if($value ==$realvalue) $checked=true;
1456
  $field='<label for="'.$id.'" class="clearfix">';
1457
- $field.=$formsHelp->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1458
  $field.='<h3>'.__('Your own website',WYSIJA).'</h3></label>';
1459
- $htmlContent.=$field;
1460
- $htmlContent.='</th>
1461
  <th scope="row">';
1462
 
1463
  $checked = false;
@@ -1466,33 +1507,48 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1466
 
1467
  $id = str_replace('_', '-', $key).'-'.$value;
1468
  $field ='<label for="'.$id.'" class="clearfix">';
1469
- $field.= $formsHelp->radio(array('id' => $id, 'name' => 'wysija[config]['.$key.']'), $value, $checked);
1470
  $field.= '<h3>'.__('Third party',WYSIJA).'</h3></label>';
1471
- $htmlContent.=$field;
1472
- $htmlContent.='</th>
1473
 
1474
  <td>
1475
  </td>
1476
  </tr>';
1477
 
1478
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-site">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1479
  <th scope="row">';
1480
  $field=__('Delivery method',WYSIJA);
1481
  $field.='<p class="description">'.__('Send yourself some test emails to confirm which method works with your server.',WYSIJA).'</p>';
1482
- $htmlContent.=$field;
1483
 
1484
- $htmlContent.='</th>
1485
  <td colspan="2">';
1486
 
1487
  $key=$prefix.'sending_emails_site_method';
1488
  $checked=false;
1489
- $realvalue=$mConfig->getValue($key);
1490
  $value='phpmail';
1491
  if($value ==$realvalue) $checked=true;
1492
 
1493
  $id=str_replace('_','-',$key).'-'.$value;
1494
  $field='<p class="title"><label for="'.$id.'">';
1495
- $field.=$formsHelp->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1496
  $field.='PHP Mail</label><a class="button-secondary" id="ms-send-test-mail-phpmail">'.__('Send a test mail',WYSIJA).'</a></p>';
1497
  $field.='<p class="description">'.__('This email engine works on 95&#37; of servers',WYSIJA).'</p>';
1498
 
@@ -1503,149 +1559,149 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1503
 
1504
  $id=str_replace('_','-',$key).'-'.$value;
1505
  $field.='<p class="title"><label for="'.$id.'">';
1506
- $field.=$formsHelp->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1507
  $field.='Sendmail</label>
1508
  <a class="button-secondary" id="ms-send-test-mail-sendmail">'.__('Send a test mail',WYSIJA).'</a></p>';
1509
  $field.='<p class="description">'.__('This method works on 5&#37; of servers',WYSIJA).'</p>';
1510
 
1511
  $id=str_replace("_",'-',$key).'-'.$value."-path";
1512
  $field.='<p class="title" id="p-'.$id.'"><label for="'.$id.'">';
1513
- $field.=__("Sendmail path",WYSIJA).'</label>'.$formsHelp->input(array("id"=>$id,'name'=>'wysija[config][sendmail_path]'),$mConfig->getValue("sendmail_path")).'</p>';
1514
 
1515
- $htmlContent.=$field;
1516
- $htmlContent.='</td>
1517
  </tr>';
1518
 
1519
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1520
  <th scope="row">';
1521
 
1522
  $key=$prefix.'smtp_host';
1523
  $id=str_replace('_','-',$key);
1524
  $field='<label for="'.$id.'">'.__('SMTP Hostname',WYSIJA)."</label>";
1525
  $field.='<p class="description">'.__('e.g.:smtp.mydomain.com',WYSIJA).'</p>';
1526
- $htmlContent.=$field;
1527
- $htmlContent.='
1528
  </th>
1529
  <td colspan="2">';
1530
 
1531
- $value=$mConfig->getValue($key);
1532
- $field=$formsHelp->input(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
1533
- $htmlContent.=$field;
1534
- $htmlContent.='</td>
1535
  </tr>';
1536
 
1537
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1538
  <th scope="row">';
1539
 
1540
  $key=$prefix.'smtp_login';
1541
  $id=str_replace('_','-',$key);
1542
  $field='<label for="'.$id.'">'.__('Login',WYSIJA)."</label>";
1543
 
1544
- $htmlContent.=$field;
1545
 
1546
- $htmlContent.='</th>
1547
  <td colspan="2">';
1548
 
1549
- $value=$mConfig->getValue($key);
1550
- $field=$formsHelp->input(array("id"=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
1551
- $htmlContent.=$field;
1552
- $htmlContent.='</td>
1553
  </tr>';
1554
 
1555
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1556
  <th scope="row">';
1557
 
1558
  $key=$prefix.'smtp_password';
1559
  $id=str_replace('_','-',$key);
1560
  $field='<label for="'.$id.'">'.__('Password',WYSIJA)."</label>";
1561
- $htmlContent.=$field;
1562
 
1563
- $htmlContent.='</th>
1564
  <td colspan="2">';
1565
 
1566
- $value=$mConfig->getValue($key);
1567
- $field=$formsHelp->input(array("type"=>"password","id"=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
1568
- $htmlContent.=$field;
1569
 
1570
- $htmlContent.='</td>
1571
  </tr>';
1572
 
1573
- $htmlContent.='<tr id="restapipossible" class="hidechoice">
1574
  <th scope="row">';
1575
 
1576
  $key=$prefix.'smtp_rest';
1577
  $id=str_replace('_','-',$key);
1578
  $field='<label for="'.$id.'">web API</label>';
1579
  $field.='<p class="description">'.__('Activate if your SMTP ports are blocked.',WYSIJA).'</p>';
1580
- $htmlContent.=$field;
1581
 
1582
- $htmlContent.='</th>
1583
  <td colspan="2">';
1584
 
1585
- $value=$mConfig->getValue($key);
1586
  $checked=false;
1587
- if($mConfig->getValue('smtp_rest')) $checked=true;
1588
- $field=$formsHelp->checkbox(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'3'),1,$checked);
1589
 
1590
- $htmlContent.=$field;
1591
 
1592
- $htmlContent.='</td>
1593
  </tr>';
1594
 
1595
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1596
  <th scope="row">';
1597
 
1598
  $key=$prefix.'smtp_port';
1599
  $id=str_replace('_','-',$key);
1600
  $field='<label for="'.$id.'">'.__('SMTP port',WYSIJA)."</label>";
1601
 
1602
- $htmlContent.=$field;
1603
 
1604
- $htmlContent.='</th>
1605
  <td colspan="2">';
1606
 
1607
- $value=$mConfig->getValue($key);
1608
- $field=$formsHelp->input(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'3'),$value,$checked);
1609
 
1610
- $htmlContent.=$field;
1611
- $htmlContent.='</td>
1612
  </tr>';
1613
 
1614
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1615
  <th scope="row">';
1616
 
1617
  $key=$prefix.'smtp_secure';
1618
  $id=str_replace('_','-',$key);
1619
  $field='<label for="'.$id.'">'.__('Secure connection',WYSIJA)."</label>";
1620
- $htmlContent.=$field;
1621
- $htmlContent.='</th>
1622
  <td colspan="2">';
1623
 
1624
- $value=$mConfig->getValue($key);
1625
 
1626
- $field=$formsHelp->dropdown(array('name'=>'wysija[config]['.$key.']',"id"=>$id),array(false=>__("No"),"ssl"=>"SSL","tls"=>"TLS"),$value);
1627
- $htmlContent.=$field;
1628
 
1629
- $htmlContent.='</td>
1630
  </tr>';
1631
 
1632
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1633
  <th scope="row">';
1634
 
1635
  $field=__('Authentication',WYSIJA);
1636
- $htmlContent.=$field.'<p class="description">'.__("Leave this option to Yes. Only a tiny portion of SMTP services ask Authentication to be turned off.",WYSIJA).'</p>';
1637
- $htmlContent.='</th>
1638
  <td colspan="2">';
1639
 
1640
  $key=$prefix.'smtp_auth';
1641
- $realvalue=$mConfig->getValue($key);
1642
 
1643
  $value=false;
1644
  $checked=false;
1645
  if($value ==$realvalue) $checked=true;
1646
  $id=str_replace('_','-',$key).'-'.$value;
1647
  $field='<label for="'.$id.'">';
1648
- $field.=$formsHelp->radio(array('id'=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1649
  $field.=__('No',WYSIJA).'</label>';
1650
 
1651
  $value=true;
@@ -1653,15 +1709,15 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1653
  if($value ==$realvalue) $checked=true;
1654
  $id=str_replace('_','-',$key).'-'.$value;
1655
  $field.='<label for="'.$id.'">';
1656
- $field.=$formsHelp->radio(array('id'=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1657
  $field.=__('Yes',WYSIJA).'</label>';
1658
 
1659
 
1660
- $htmlContent.=$field;
1661
- $htmlContent.='</td>
1662
  </tr>';
1663
 
1664
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1665
  <th scope="row">
1666
  <a class="button-secondary" id="ms-send-test-mail-smtp">'.__('Send a test mail',WYSIJA).'</a>
1667
  </th>
@@ -1669,36 +1725,36 @@ class WYSIJA_view_back_config extends WYSIJA_view_back{
1669
  </td>
1670
  </tr>';
1671
 
1672
- $htmlContent.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-sending-method-site">
1673
  <th scope="row">';
1674
 
1675
  $field=__('Send...',WYSIJA);
1676
 
1677
- $htmlContent.=$field.'<p class="description">'.str_replace(array('[link]','[/link]'),array('<a href="http://support.wysija.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=choosing%20frequency" target="_blank">','</a>'),__('Your web host has limits. We suggest 70 emails per hour to be safe. [link]Find out more[/link].',WYSIJA)).'</p>';
1678
- $htmlContent.='</th>
1679
  <td colspan="2">';
1680
 
1681
  $name=$prefix.'sending_emails_number';
1682
  $id=str_replace('_','-',$name);
1683
- $value=$mConfig->getValue($name);
1684
  $params=array('id'=>$id,'name'=>'wysija[config]['.$name.']','size'=>'6');
1685
- $field=$formsHelp->input($params,$value);
1686
  $field.= '&nbsp;'.__('emails', WYSIJA).'&nbsp;';
1687
 
1688
 
1689
  $name=$prefix.'sending_emails_each';
1690
  $id=str_replace('_','-',$name);
1691
- $value=$mConfig->getValue($name);
1692
- $field.=$formsHelp->dropdown(array('name'=>'wysija[config]['.$name.']','id'=>$id),$formsHelp->eachValues,$value);
1693
  $field.='<span class="choice-under15"><b>'.__('This is fast!',WYSIJA).'</b> '.str_replace(array('[link]','[/link]'),array('<a href="http://support.wysija.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=cron" target="_blank">','</a>'),__('We suggest you setup a cron job. [link]Read more[/link] on support.wysija.com',WYSIJA)).'</span>';
1694
- $htmlContent.=$field;
1695
 
1696
 
1697
- $htmlContent.='</td>
1698
  </tr>
1699
  </tbody>
1700
  </table>';
1701
- return $htmlContent;
1702
  }
1703
 
1704
  // WYSIJA Form Editor
107
 
108
  return $fieldHTML;
109
  }
110
+
111
  function fieldFormHTML_managesubscribe($key,$value,$model,$paramsex){
112
  // second part concerning the checkbox
113
  $formsHelp=WYSIJA::get('forms','helper');
186
  return $field;
187
  }
188
 
189
+ function fieldFormHTML_cron($key,$value,$model){
190
  //second part concerning the checkbox
191
+ $helper_forms = WYSIJA::get('forms','helper');
192
+ $checked = false;
193
+ if($this->model->getValue($key)) $checked = true;
194
+
195
+ $field = '<div><div class="cronleft"><label for="'.$key.'">';
196
+ $field .= $helper_forms->checkbox( array( 'id' => $key , 'name' => 'wysija['.$model.']['.$key.']' , 'class' => 'activateInput') , 1 , $checked);
197
+ $field .= '</label></div>';
198
+
199
+ $url_cron = site_url( 'wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process=all';
200
+ $field .= '<div class="cronright" id="'.$key.'_linkname">';
201
+
202
+ $text_cron_manual_trigger = __('I\'ll setup a cron job on my server to execute at the frequency I want. Read about [link]setting up a cron job yourself[/link].',WYSIJA).'<br/><span>'.__('Use this URL in your cron job: [cron_url]').'</span>';
203
+ $text_cron_manual_trigger = str_replace(array('[link]','[/link]','[cron_url]'), array('<a href="http://support.wysija.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">','</a>','<a href="'.$url_cron.'" target="_blank">'.$url_cron.'</a>'), $text_cron_manual_trigger);
204
+
205
+ $text_cron_page_view = __('No thanks! I have enough visitors on my site. Their visits will trigger Wysija\'s cron automatically.',WYSIJA);
206
+ $values_page_view_trigger = array(2 => $text_cron_manual_trigger, 1 => $text_cron_page_view);
207
 
208
+ $value = 2;
209
+ if((int)$this->model->getValue('cron_page_hit_trigger') === 1) $value = 1;
210
 
211
+ $key = 'cron_page_hit_trigger';
 
212
 
213
+ $field .= $helper_forms->radios(array('id'=>$key,'name'=>'wysija['.$model.']['.$key.']'), $values_page_view_trigger , $value);
214
+ $field .= '</div></div>';
215
 
216
+ return $field;
217
+ }
218
+
219
+ function fieldFormHTML_cron_prem($key,$value,$model){
220
+
221
+ $url_cron = site_url( 'wp-cron.php').'?'.WYSIJA_CRON.'&action=wysija_cron&process=all';
222
+ $field = '<p>';
223
+
224
+ $text_cron_manual_trigger = __('If I want I can [link]create an additional cron job[/link] on my end to increase the frequency.',WYSIJA).'<br/><span>'.__('Use this URL in your cron job: [cron_url]').'</span>';
225
+ $field .= str_replace(array('[link]','[/link]','[cron_url]'), array('<a href="http://support.wysija.com/knowledgebase/configure-cron-job/?utm_source=wpadmin&utm_campaign=advanced_settings" title="Seting up cron job" target="_blank">','</a>','<a href="'.$url_cron.'" target="_blank">'.$url_cron.'</a>'), $text_cron_manual_trigger);
226
 
227
+ $field .= '</p>';
228
+
229
+ $model_config = WYSIJA::get('config','model');
230
+ if($model_config->getValue('cron_manual') !== true){
231
+ $model_config->save( array('cron_manual' => true) );
232
+
233
+ $helper_licence = WYSIJA::get('licence','helper');
234
+ $helper_licence->check(true);
235
+ }
236
 
237
  return $field;
238
  }
239
 
240
+
241
  function fieldFormHTML_debugnew($key,$value,$model,$paramsex){
242
  /*second part concerning the checkbox*/
243
  $formsHelp=WYSIJA::get('forms','helper');
649
  'label'=>__('Subscribe in registration form',WYSIJA),
650
  'desc'=>__('Allow users who register to your site to subscribe on a list of your choice.',WYSIJA)
651
  );
652
+ }
653
 
654
  $modelU=WYSIJA::get('user','model');
655
  $objUser=$modelU->getCurrentSubscriber();
675
  $step['unsubscribed_subtitle']=array(
676
  'type'=>'input',
677
  'label'=>__('Unsubscribe page content',WYSIJA));
678
+
679
  $modelC=WYSIJA::get('config','model');
680
 
681
  ?>
691
 
692
  function premiumSoonFields(){
693
  $html='';
694
+ $helper_licence = WYSIJA::get('licence','helper');
695
+ $url_checkout = $helper_licence->get_url_checkout('custom_fields_soon');
696
+ $html.='<li class="notice">'.str_replace(array('[link]','[/link]'), array('<a href="'.$url_checkout.'" target="_blank">','</a>'), __('Soon available in [link]Premium[/link]:', WYSIJA)).'</li>';
697
  $extraTypes=array(
698
  'new-text'=>array('label'=>__('Text or number',WYSIJA),'type'=>'text'),
699
  'new-textarea'=>array('label'=>__('Paragraph text',WYSIJA),'type'=>'textarea'),
1110
  'type'=>'capabilities',
1111
  '1col'=>1);
1112
 
1113
+ $advanced_fields['replyto_name']=array(
1114
+ 'type'=>'fromname',
1115
+ 'class'=>'validate[required]',
1116
+ 'label'=>__('Reply-to name & email',WYSIJA),
1117
+ 'desc'=>__('You can change the default reply-to name and email for your newsletters. This option is also used for the activation emails and Admin notifications (in Basics).',WYSIJA));
1118
+
1119
+ $helper_licence = WYSIJA::get('licence','helper');
1120
+ $url_checkout = $helper_licence->get_url_checkout('bounce_address_automated');
1121
  $advanced_fields ['bounce_email']=array(
1122
  'type'=>'input',
1123
  'label'=>__('Bounce Email',WYSIJA),
1124
  'desc'=>__('To which address should all the bounced emails go? Get the [link]Premium version[/link] to automatically handle these.',WYSIJA),
1125
+ 'link'=>'<a href="'.$url_checkout.'" target="_blank" title="'.__('Purchase the premium version.',WYSIJA).'">');
1126
+
1127
+ $advanced_fields =apply_filters('wysija_settings_advanced', $advanced_fields );
1128
 
 
 
1129
  $modelU=WYSIJA::get('user','model');
1130
  $objUser=$modelU->getCurrentSubscriber();
1131
 
1141
  'values' => array(true => __('Yes', WYSIJA), false => __('No', WYSIJA)),
1142
  'desc' => __('This allows you to modify the HTML of text blocks in the visual editor.', WYSIJA)
1143
  );
1144
+
1145
  $advanced_fields ['analytics']=array(
1146
  'rowclass'=>'analytics',
1147
  'type'=>'radio',
1150
  'desc'=>__('Share anonymous data and help us improve the plugin. [link]Read more[/link].',WYSIJA),
1151
  'link' => '<a target="_blank" href="http://support.wysija.com/knowledgebase/share-your-data/?utm_source=wpadmin&utm_campaign=advanced_settings">'
1152
  );
1153
+
1154
  $advanced_fields ['industry']=array(
1155
  'rowclass'=>'industry',
1156
  'type'=>'dropdown_keyval',
1190
  if(WYSIJA::current_user_can('manage_network')) $advanced_fields ['ms_beta_mode'] = $beta_mode_field;
1191
  }else{
1192
  $advanced_fields ['beta_mode'] = $beta_mode_field;
1193
+ }
1194
+
1195
  $super_advanced_fields ['subscribers_count']=array(
1196
  'type'=>'subscribers_count',
1197
  'label'=>__('Shortcode to display total number of subscribers',WYSIJA),
1198
  'desc'=>__('Paste this shortcode to display the number of confirmed subscribers in post or page',WYSIJA)
1199
+ );
1200
 
1201
  $super_advanced_fields ['advanced_charset']=array(
1202
  'type'=>'dropdown_keyval',
1203
+ 'values'=>array('UTF-8','UTF-7','BIG5', 'ISO-2022-JP',
1204
+ 'ISO-8859-1','ISO-8859-2','ISO-8859-3',
1205
+ 'ISO-8859-4','ISO-8859-5','ISO-8859-6',
1206
+ 'ISO-8859-7','ISO-8859-8','ISO-8859-9',
1207
+ 'ISO-8859-10','ISO-8859-13','ISO-8859-14',
1208
+ 'ISO-8859-15','Windows-1251','Windows-1252'),
1209
  'label'=>__('Charset',WYSIJA),
1210
  'desc'=>__('Squares or weird characters are displayed in your emails? Select the encoding for your language.',WYSIJA));
1211
 
1212
  $super_advanced_fields = apply_filters('wysija_settings_advancednext', $super_advanced_fields );
1213
 
1214
+ // TODO force wysija's cron to wysija's premium let's do it in september
1215
+ if(false && WYSIJA::is_plugin_active('wysija-newsletters-premium/index.php') && $this->model->getValue('premium_key')){
1216
+ $super_advanced_fields ['cron_manual']=array(
1217
+ 'type'=>'cron_prem',
1218
+ 'label'=>__('Wysija\'s scheduled tasks', WYSIJA),
1219
+ 'desc'=>__('As a premium user, my scheduled tasks are launched directly by wysija.com each 15 minutes.',WYSIJA));
1220
+ }else{
1221
+ $super_advanced_fields ['cron_manual']=array(
1222
+ 'type'=>'cron',
1223
+ 'label'=>__('Enable Wysija\'s Cron', WYSIJA),
1224
+ 'desc'=>__('None of your queued emails have been sent? Then activate this option.',WYSIJA));
1225
+ }
1226
+
1227
 
1228
  $super_advanced_fields ['debug_new']=array(
1229
  'type'=>'debugnew',
1238
  array('<a href="admin.php?page=wysija_config&action=log">','<a href="admin.php?page=wysija_config&action=clearlog">','</a>','</a>'),
1239
  'View them [link]here[/link]. Clear them [linkclear]here[/linkclear]'));
1240
  }
1241
+
1242
  //attach 'super-advanced' class to super_advanced_fields
1243
  $super_advanced_field_class = 'super-advanced';
1244
  foreach($super_advanced_fields as $key => $field){
1260
  <div class="hide-geeky-options geeky-option">
1261
  <a href="javascript:void(0);">
1262
  <?php echo __('Hide the geeky options',WYSIJA); ?>
1263
+ </a>
1264
  <span class=" icon"></span>
1265
  </div>
1266
  </td>
1288
  }
1289
 
1290
  function premium(){
1291
+ $helper_licence = WYSIJA::get('licence','helper');
1292
+ $url_checkout = $helper_licence->get_url_checkout('purchasebutton');
1293
 
1294
  $arrayPremiumBullets=array(
1295
  'more2000'=>array(
1296
  'title'=>__('Send to more than 2000 subscribers.',WYSIJA),
1297
  'desc'=>__('You have no more limits. Send to 100 000 if you want.',WYSIJA)
1298
  ),
1299
+ // 'advlinkstats'=>array(
1300
+ // 'title'=>__('Get the bigger picture with more stats.',WYSIJA),
1301
+ // 'desc'=>__('The stats dashboard will give you better insight on how you\'re scoring.',WYSIJA)
1302
+ // ),
1303
  'linksstats'=>array(
1304
  'title'=>__('Find out which links are clicked.',WYSIJA),
1305
  'desc'=>__('Which links in your newsletter are getting clicked on? Find out for each newsletter.',WYSIJA)
1308
  'title'=>__('Track with Google Analytics.',WYSIJA),
1309
  'desc'=>__('Find out what your subscribers do once on your site.',WYSIJA)
1310
  ),
1311
+ // 'customfields'=>array(
1312
+ // 'title'=>__('Add more fields to your forms.',WYSIJA),
1313
+ // 'desc'=>__('Add phone number, city, gender or whatever you wish in your subscription forms.',WYSIJA)
1314
+ // ),
1315
  'cron'=>array(
1316
  'title'=>__('We activate a cron job for you.',WYSIJA),
1317
  'desc'=>__('We make sure you\'re sending every 15 minutes to avoid irregular delivery.',WYSIJA)
1340
  'happy'=>array(
1341
  'title'=>__('Join our happy users.',WYSIJA),
1342
  'desc'=>__('Wysija is getting better every day thanks to users like you. <br />Read [link]what they are saying[/link].',WYSIJA),
1343
+ 'link'=>'http://goo.gl/LVwy3E'
1344
  ),
1345
  'trynow'=>array(
1346
  'title'=>__('Try it now. Not happy? Get your money back.',WYSIJA),
1365
  }
1366
  $htmlContent.='</div></div>';
1367
  $htmlContent.='<p class="wysija-premium-wrapper">
1368
+ <a class="wysija-premium-btns wysija-support" href="'.$url_checkout.'" target="_blank">'.__('Upgrade now',WYSIJA).'</a></p>';
1369
+ $htmlContent.='<br><p>'.__('Already paid?', WYSIJA).' <a type="submit" class="premium-activate wysija" href="javascript:;" />'. esc_attr(__('Activate your Premium licence.',WYSIJA)).'</a></p>';
1370
 
1371
  $htmlContent.='<p>'.str_replace(array('[link]','[/link]'),array('<a href="http://www.wysija.com/contact/?utm_source=wpadmin&utm_campaign=premiumtab" target="_blank">','</a>'),__('Got a sales question? [link]Get in touch[/link] with Kim, Jo, Adrien and Ben.',WYSIJA)).'</p>';
1372
  $htmlContent.='<p>'.str_replace(array('[link]','[/link]'),array('<a href="http://support.wysija.com/terms-conditions/?utm_source=wpadmin&utm_campaign=premiumtab" target="_blank">','</a>'),__('Read our simple and easy [link]terms and conditions.[/link]',WYSIJA)).'</p>';
1439
  $fields=array();
1440
 
1441
 
 
 
 
 
 
 
1442
  $fields['ms_allow_admin_sending_method']=array(
1443
  'type'=>'debug',
1444
  'label'=>__('Allow site admins to change the sending method',WYSIJA));
1477
 
1478
  function ms_sending_method(){
1479
  $prefix='ms_';
1480
+ $model_config = WYSIJA::get('config','model');
1481
+ $helper_forms = WYSIJA::get('forms','helper');
1482
+ $html_content='<table class="form-table" id="ms-sendingmethod">
1483
+ <tbody>';
 
 
1484
 
1485
+
1486
+
1487
+ $key = $prefix.'sending_method';
1488
+
1489
+ $realvalue=$model_config->getValue($key);
1490
+ $html_content .= '<tr class="methods">
1491
  <th scope="row">';
1492
 
1493
  $checked=false;
1495
  $id=str_replace("_",'-',$key).'-'.$value;
1496
  if($value ==$realvalue) $checked=true;
1497
  $field='<label for="'.$id.'" class="clearfix">';
1498
+ $field.=$helper_forms->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1499
  $field.='<h3>'.__('Your own website',WYSIJA).'</h3></label>';
1500
+ $html_content.=$field;
1501
+ $html_content.='</th>
1502
  <th scope="row">';
1503
 
1504
  $checked = false;
1507
 
1508
  $id = str_replace('_', '-', $key).'-'.$value;
1509
  $field ='<label for="'.$id.'" class="clearfix">';
1510
+ $field.= $helper_forms->radio(array('id' => $id, 'name' => 'wysija[config]['.$key.']'), $value, $checked);
1511
  $field.= '<h3>'.__('Third party',WYSIJA).'</h3></label>';
1512
+ $html_content.=$field;
1513
+ $html_content.='</th>
1514
 
1515
  <td>
1516
  </td>
1517
  </tr>';
1518
 
1519
+
1520
+ $html_content.='<tr>
1521
+ <th scope="row">';
1522
+
1523
+ $key=$prefix.'from_email';
1524
+ $id=str_replace('_','-',$key);
1525
+ $field='<label for="'.$id.'">'.__('FROM email address for sites using this method',WYSIJA)."</label>";
1526
+ $html_content.=$field;
1527
+ $html_content.='
1528
+ </th>
1529
+ <td colspan="2">';
1530
+ $html_content.=$helper_forms->input( array( 'id'=>$id , 'name'=>'wysija[config]['.$key.']' , 'size'=>'40' ) , $model_config->getValue($key));
1531
+ $html_content.='</td>
1532
+ </tr>';
1533
+
1534
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-site">
1535
  <th scope="row">';
1536
  $field=__('Delivery method',WYSIJA);
1537
  $field.='<p class="description">'.__('Send yourself some test emails to confirm which method works with your server.',WYSIJA).'</p>';
1538
+ $html_content.=$field;
1539
 
1540
+ $html_content.='</th>
1541
  <td colspan="2">';
1542
 
1543
  $key=$prefix.'sending_emails_site_method';
1544
  $checked=false;
1545
+ $realvalue=$model_config->getValue($key);
1546
  $value='phpmail';
1547
  if($value ==$realvalue) $checked=true;
1548
 
1549
  $id=str_replace('_','-',$key).'-'.$value;
1550
  $field='<p class="title"><label for="'.$id.'">';
1551
+ $field.=$helper_forms->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1552
  $field.='PHP Mail</label><a class="button-secondary" id="ms-send-test-mail-phpmail">'.__('Send a test mail',WYSIJA).'</a></p>';
1553
  $field.='<p class="description">'.__('This email engine works on 95&#37; of servers',WYSIJA).'</p>';
1554
 
1559
 
1560
  $id=str_replace('_','-',$key).'-'.$value;
1561
  $field.='<p class="title"><label for="'.$id.'">';
1562
+ $field.=$helper_forms->radio(array("id"=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1563
  $field.='Sendmail</label>
1564
  <a class="button-secondary" id="ms-send-test-mail-sendmail">'.__('Send a test mail',WYSIJA).'</a></p>';
1565
  $field.='<p class="description">'.__('This method works on 5&#37; of servers',WYSIJA).'</p>';
1566
 
1567
  $id=str_replace("_",'-',$key).'-'.$value."-path";
1568
  $field.='<p class="title" id="p-'.$id.'"><label for="'.$id.'">';
1569
+ $field.=__("Sendmail path",WYSIJA).'</label>'.$helper_forms->input(array("id"=>$id,'name'=>'wysija[config][sendmail_path]'),$model_config->getValue("sendmail_path")).'</p>';
1570
 
1571
+ $html_content.=$field;
1572
+ $html_content.='</td>
1573
  </tr>';
1574
 
1575
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1576
  <th scope="row">';
1577
 
1578
  $key=$prefix.'smtp_host';
1579
  $id=str_replace('_','-',$key);
1580
  $field='<label for="'.$id.'">'.__('SMTP Hostname',WYSIJA)."</label>";
1581
  $field.='<p class="description">'.__('e.g.:smtp.mydomain.com',WYSIJA).'</p>';
1582
+ $html_content.=$field;
1583
+ $html_content.='
1584
  </th>
1585
  <td colspan="2">';
1586
 
1587
+ $value=$model_config->getValue($key);
1588
+ $field=$helper_forms->input(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
1589
+ $html_content.=$field;
1590
+ $html_content.='</td>
1591
  </tr>';
1592
 
1593
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1594
  <th scope="row">';
1595
 
1596
  $key=$prefix.'smtp_login';
1597
  $id=str_replace('_','-',$key);
1598
  $field='<label for="'.$id.'">'.__('Login',WYSIJA)."</label>";
1599
 
1600
+ $html_content.=$field;
1601
 
1602
+ $html_content.='</th>
1603
  <td colspan="2">';
1604
 
1605
+ $value=$model_config->getValue($key);
1606
+ $field=$helper_forms->input(array("id"=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
1607
+ $html_content.=$field;
1608
+ $html_content.='</td>
1609
  </tr>';
1610
 
1611
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1612
  <th scope="row">';
1613
 
1614
  $key=$prefix.'smtp_password';
1615
  $id=str_replace('_','-',$key);
1616
  $field='<label for="'.$id.'">'.__('Password',WYSIJA)."</label>";
1617
+ $html_content.=$field;
1618
 
1619
+ $html_content.='</th>
1620
  <td colspan="2">';
1621
 
1622
+ $value=$model_config->getValue($key);
1623
+ $field=$helper_forms->input(array("type"=>"password","id"=>$id,'name'=>'wysija[config]['.$key.']','size'=>'40'),$value,$checked);
1624
+ $html_content.=$field;
1625
 
1626
+ $html_content.='</td>
1627
  </tr>';
1628
 
1629
+ $html_content.='<tr id="restapipossible" class="hidechoice">
1630
  <th scope="row">';
1631
 
1632
  $key=$prefix.'smtp_rest';
1633
  $id=str_replace('_','-',$key);
1634
  $field='<label for="'.$id.'">web API</label>';
1635
  $field.='<p class="description">'.__('Activate if your SMTP ports are blocked.',WYSIJA).'</p>';
1636
+ $html_content.=$field;
1637
 
1638
+ $html_content.='</th>
1639
  <td colspan="2">';
1640
 
1641
+ $value=$model_config->getValue($key);
1642
  $checked=false;
1643
+ if($model_config->getValue('smtp_rest')) $checked=true;
1644
+ $field=$helper_forms->checkbox(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'3'),1,$checked);
1645
 
1646
+ $html_content.=$field;
1647
 
1648
+ $html_content.='</td>
1649
  </tr>';
1650
 
1651
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1652
  <th scope="row">';
1653
 
1654
  $key=$prefix.'smtp_port';
1655
  $id=str_replace('_','-',$key);
1656
  $field='<label for="'.$id.'">'.__('SMTP port',WYSIJA)."</label>";
1657
 
1658
+ $html_content.=$field;
1659
 
1660
+ $html_content.='</th>
1661
  <td colspan="2">';
1662
 
1663
+ $value=$model_config->getValue($key);
1664
+ $field=$helper_forms->input(array('id'=>$id,'name'=>'wysija[config]['.$key.']','size'=>'3'),$value,$checked);
1665
 
1666
+ $html_content.=$field;
1667
+ $html_content.='</td>
1668
  </tr>';
1669
 
1670
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1671
  <th scope="row">';
1672
 
1673
  $key=$prefix.'smtp_secure';
1674
  $id=str_replace('_','-',$key);
1675
  $field='<label for="'.$id.'">'.__('Secure connection',WYSIJA)."</label>";
1676
+ $html_content.=$field;
1677
+ $html_content.='</th>
1678
  <td colspan="2">';
1679
 
1680
+ $value=$model_config->getValue($key);
1681
 
1682
+ $field=$helper_forms->dropdown(array('name'=>'wysija[config]['.$key.']',"id"=>$id),array(false=>__("No"),"ssl"=>"SSL","tls"=>"TLS"),$value);
1683
+ $html_content.=$field;
1684
 
1685
+ $html_content.='</td>
1686
  </tr>';
1687
 
1688
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-no-restapi">
1689
  <th scope="row">';
1690
 
1691
  $field=__('Authentication',WYSIJA);
1692
+ $html_content.=$field.'<p class="description">'.__("Leave this option to Yes. Only a tiny portion of SMTP services ask Authentication to be turned off.",WYSIJA).'</p>';
1693
+ $html_content.='</th>
1694
  <td colspan="2">';
1695
 
1696
  $key=$prefix.'smtp_auth';
1697
+ $realvalue=$model_config->getValue($key);
1698
 
1699
  $value=false;
1700
  $checked=false;
1701
  if($value ==$realvalue) $checked=true;
1702
  $id=str_replace('_','-',$key).'-'.$value;
1703
  $field='<label for="'.$id.'">';
1704
+ $field.=$helper_forms->radio(array('id'=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1705
  $field.=__('No',WYSIJA).'</label>';
1706
 
1707
  $value=true;
1709
  if($value ==$realvalue) $checked=true;
1710
  $id=str_replace('_','-',$key).'-'.$value;
1711
  $field.='<label for="'.$id.'">';
1712
+ $field.=$helper_forms->radio(array('id'=>$id,'name'=>'wysija[config]['.$key.']'),$value,$checked);
1713
  $field.=__('Yes',WYSIJA).'</label>';
1714
 
1715
 
1716
+ $html_content.=$field;
1717
+ $html_content.='</td>
1718
  </tr>';
1719
 
1720
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp">
1721
  <th scope="row">
1722
  <a class="button-secondary" id="ms-send-test-mail-smtp">'.__('Send a test mail',WYSIJA).'</a>
1723
  </th>
1725
  </td>
1726
  </tr>';
1727
 
1728
+ $html_content.='<tr class="ms-hidechoice ms-choice-sending-method-smtp ms-choice-sending-method-site">
1729
  <th scope="row">';
1730
 
1731
  $field=__('Send...',WYSIJA);
1732
 
1733
+ $html_content.=$field.'<p class="description">'.str_replace(array('[link]','[/link]'),array('<a href="http://support.wysija.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=choosing%20frequency" target="_blank">','</a>'),__('Your web host has limits. We suggest 70 emails per hour to be safe. [link]Find out more[/link].',WYSIJA)).'</p>';
1734
+ $html_content.='</th>
1735
  <td colspan="2">';
1736
 
1737
  $name=$prefix.'sending_emails_number';
1738
  $id=str_replace('_','-',$name);
1739
+ $value=$model_config->getValue($name);
1740
  $params=array('id'=>$id,'name'=>'wysija[config]['.$name.']','size'=>'6');
1741
+ $field=$helper_forms->input($params,$value);
1742
  $field.= '&nbsp;'.__('emails', WYSIJA).'&nbsp;';
1743
 
1744
 
1745
  $name=$prefix.'sending_emails_each';
1746
  $id=str_replace('_','-',$name);
1747
+ $value=$model_config->getValue($name);
1748
+ $field.=$helper_forms->dropdown(array('name'=>'wysija[config]['.$name.']','id'=>$id),$helper_forms->eachValues,$value);
1749
  $field.='<span class="choice-under15"><b>'.__('This is fast!',WYSIJA).'</b> '.str_replace(array('[link]','[/link]'),array('<a href="http://support.wysija.com/knowledgebase/wp-cron-batch-emails-sending-frequency/?utm_source=wpadmin&utm_campaign=cron" target="_blank">','</a>'),__('We suggest you setup a cron job. [link]Read more[/link] on support.wysija.com',WYSIJA)).'</span>';
1750
+ $html_content.=$field;
1751
 
1752
 
1753
+ $html_content.='</td>
1754
  </tr>
1755
  </tbody>
1756
  </table>';
1757
+ return $html_content;
1758
  }
1759
 
1760
  // WYSIJA Form Editor
views/back/subscribers.php CHANGED
@@ -54,19 +54,19 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
54
  foreach($data['counts'] as $countType =>$count){
55
  if(!$count) {$i++;continue;}
56
  switch($countType){
57
- case "all":
58
  $tradText=__('All',WYSIJA);
59
  break;
60
- case "unconfirmed":
61
  $tradText=__('Unconfirmed',WYSIJA);
62
  break;
63
- case "unsubscribed":
64
  $tradText=__('Unsubscribed',WYSIJA);
65
  break;
66
- case "subscribed":
67
  $tradText=__('Subscribed',WYSIJA);
68
  break;
69
- case "unlisted":
70
  $tradText=__('Unlisted',WYSIJA);
71
  break;
72
  }
@@ -123,7 +123,7 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
123
  <?php
124
  foreach($data['lists'] as $listK => $list){
125
  //if(!(isset($_REQUEST['filter-list']) && $_REQUEST['filter-list']== $listK) && $list['is_enabled']){ // Commented by TNT
126
- if($list['is_enabled']){
127
  ?><option value="actionvar_removefromlist-listid_<?php echo $listK ?>"><?php
128
  echo str_repeat('&nbsp;',5).$list['name'];
129
  if(isset($list['users'])) echo ' ('.$list['users'].')';
@@ -133,16 +133,8 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
133
  ?>
134
  <option value="actionvar_removefromalllists"><?php _e('Remove from all lists', WYSIJA); ?></option>
135
  <option value="exportlist"><?php _e('Export', WYSIJA); ?></option>
136
- <?php
137
- /*$config=WYSIJA::get("config","model");
138
- if($config->getValue("confirm_dbleoptin")){
139
- ?>
140
- <option value="sendconfirmation"><?php _e('Resend the activation email', WYSIJA); ?></option>
141
- <?php
142
- }*/
143
- ?>
144
  <option value="deleteusers"><?php _e('Delete subscribers', WYSIJA); ?></option>
145
- <?php
146
  $config_model = WYSIJA::get('config','model');
147
  if($config_model->getValue('confirm_dbleoptin')){
148
  ?>
@@ -243,14 +235,14 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
243
  <tr class="batch-select">
244
  <td colspan="5">
245
  <input type="radio" name="wysija[user][force_select_all]" id="force_select_all" style="display:none;" />
246
- <input type="hidden" name="wysija[user][timestamp]" value="<?php echo $data['max_create_at']; ?>"/>
247
  <div class="force_to_select_all_link" style="display:none">
248
  <?php echo __('All subscribers on this page are selected.',WYSIJA); ?>
249
  <a href="javascript:void(0);"><?php echo sprintf(__('Select all %1$s subscribers.', WYSIJA), $data['current_counts']); ?></a>
250
  </div>
251
  <div class="clear_select_all" style="display:none">
252
  <?php echo sprintf(__('All %1$s subscribers are selected.', WYSIJA), $data['current_counts']); ?>
253
- <a><?php echo __('Clear selection', WYSIJA); ?></a>
254
  </div>
255
  </td>
256
  </tr>
@@ -276,18 +268,18 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
276
  <tr <?php echo $classRow ?> >
277
 
278
  <th scope="col" class="check-column" >
279
- <input type="checkbox" name="wysija[user][user_id][]" id="user_id_<?php echo $row["user_id"] ?>" value="<?php echo esc_attr($row["user_id"]) ?>" class="checkboxselec" />
280
  </th>
281
  <td class="username column-username">
282
  <?php
283
- echo get_avatar( $row["email"], 32 );
284
- echo "<strong>".$row["email"]."</strong>";
285
- echo "<p style='margin:0;'>".$row["firstname"]." ".$row["lastname"]."</p>";
286
 
287
  ?>
288
  <div class="row-actions">
289
  <span class="edit">
290
- <a href="admin.php?page=wysija_subscribers&id=<?php echo $row["user_id"] ?>&action=edit" class="submitedit"><?php _e('View stats or edit',WYSIJA)?></a>
291
  </span>
292
  </div>
293
  </td>
@@ -339,9 +331,8 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
339
  * 4-export
340
  */
341
 
342
- $formObj=WYSIJA::get("forms","helper");
343
-
344
- $config=WYSIJA::get("config","model");
345
 
346
 
347
  ?>
@@ -349,10 +340,17 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
349
  <th><label for="filterlist"><?php _e("Pick a list",WYSIJA); ?></label></th>
350
  <td>
351
  <?php
 
352
  foreach($data['lists'] as $listK => $list){
353
- echo '<input type="checkbox" name="wysija[export][filter][list][]" checked="checked" class="validate[minCheckbox[1]] checkbox" value="'.esc_attr($list['list_id']).'" />&nbsp;<label>'.$list['name'].' ('.$list['totals'].')'.'</label><br />';
354
- }
355
- ?>
 
 
 
 
 
 
356
  </td>
357
  </tr>
358
  <tr>
@@ -365,7 +363,7 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
365
  </td>
366
  </tr>
367
  <?php
368
- if($config->getValue("confirm_dbleoptin")){
369
  ?>
370
  <tr>
371
  <th><label for="confirmedcheck"><?php _e("Export confirmed subscribers only",WYSIJA); ?></label></th>
@@ -375,13 +373,13 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
375
  </tr>
376
  <?php
377
  }
378
- }elseif(!empty($data['user']['timestamp']) && (bool)$data['user']['force_select_all']){ //batch-select and export
379
  if(!empty($data['filter']) && is_array($data['filter']))
380
  foreach($data['filter'] as $k => $v)
381
  echo '<input type="hidden" value="'.$v.'" name="wysija[filter]['.$k.']" />';
382
  foreach($data['user'] as $k => $v)
383
  if($k != 'user_id') // we don't ask for user_id in case of batch-select
384
- echo '<input type="hidden" value="'.$v.'" name="wysija[user]['.$k.']" />';
385
  }
386
  ?>
387
  <tr>
@@ -409,6 +407,9 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
409
  </form>
410
  <?php
411
  }
 
 
 
412
  function add($data=false){
413
 
414
  if(!$data['user'] || isset($this->add)) {
@@ -517,7 +518,7 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
517
 
518
  $fieldHTML.= '<p><label for="'.$field.$list['list_id'].'">';
519
  $datacheck=array('id'=>$field.$list['list_id'],'name'=>"wysija[user_list][list_id][]", 'class'=>'');
520
- if(!$list['is_enabled']) $datacheck['disabled']='disabled';
521
  $fieldHTML.=$formObj->checkbox( $datacheck,$list['list_id'],$checked,$extraCheckbox).$list['name'];
522
  $fieldHTML.=$hiddenField;
523
  $fieldHTML.='</label></p>';
@@ -547,9 +548,11 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
547
 
548
  if(count($data['charts']['stats'])>0 ){
549
  $htmlContent.= '<p>';
 
 
550
  $htmlContent.= str_replace(
551
- array("[link]","[/link]"),
552
- array('<a title="'.__('Get Premium now',WYSIJA).'" class="premium-tab" href="javascript:;">','</a>'),
553
  __("Note: Find out what this subscribers opens and clicks with our [link]Premium version.[/link]",WYSIJA));
554
  $htmlContent.= '</p>';
555
  }
@@ -845,7 +848,7 @@ class WYSIJA_view_back_subscribers extends WYSIJA_view_back{
845
  <tr class="thead">
846
  <th><?php _e('Match the data',WYSIJA);?></th>
847
  <?php
848
- $columns=array("nomatch"=>__("Ignore column...",WYSIJA),'email'=>__('Email',WYSIJA),'firstname'=>__('First name',WYSIJA),'lastname'=>__('Last name',WYSIJA),'ip'=>__('IP address',WYSIJA));
849
 
850
  $formObj=WYSIJA::get("forms","helper");
851
  $i=0;
54
  foreach($data['counts'] as $countType =>$count){
55
  if(!$count) {$i++;continue;}
56
  switch($countType){
57
+ case 'all':
58
  $tradText=__('All',WYSIJA);
59
  break;
60
+ case 'unconfirmed':
61
  $tradText=__('Unconfirmed',WYSIJA);
62
  break;
63
+ case 'unsubscribed':
64
  $tradText=__('Unsubscribed',WYSIJA);
65
  break;
66
+ case 'subscribed':
67
  $tradText=__('Subscribed',WYSIJA);
68
  break;
69
+ case 'unlisted':
70
  $tradText=__('Unlisted',WYSIJA);
71
  break;
72
  }
123
  <?php
124
  foreach($data['lists'] as $listK => $list){
125
  //if(!(isset($_REQUEST['filter-list']) && $_REQUEST['filter-list']== $listK) && $list['is_enabled']){ // Commented by TNT
126
+ if($list['is_enabled']){
127
  ?><option value="actionvar_removefromlist-listid_<?php echo $listK ?>"><?php
128
  echo str_repeat('&nbsp;',5).$list['name'];
129
  if(isset($list['users'])) echo ' ('.$list['users'].')';
133
  ?>
134
  <option value="actionvar_removefromalllists"><?php _e('Remove from all lists', WYSIJA); ?></option>
135
  <option value="exportlist"><?php _e('Export', WYSIJA); ?></option>
 
 
 
 
 
 
 
 
136
  <option value="deleteusers"><?php _e('Delete subscribers', WYSIJA); ?></option>
137
+ <?php
138
  $config_model = WYSIJA::get('config','model');
139
  if($config_model->getValue('confirm_dbleoptin')){
140
  ?>
235
  <tr class="batch-select">
236
  <td colspan="5">
237
  <input type="radio" name="wysija[user][force_select_all]" id="force_select_all" style="display:none;" />
238
+ <input type="hidden" name="wysija[user][timestamp]" value="<?php echo $data['max_create_at']; ?>"/>
239
  <div class="force_to_select_all_link" style="display:none">
240
  <?php echo __('All subscribers on this page are selected.',WYSIJA); ?>
241
  <a href="javascript:void(0);"><?php echo sprintf(__('Select all %1$s subscribers.', WYSIJA), $data['current_counts']); ?></a>
242
  </div>
243
  <div class="clear_select_all" style="display:none">
244
  <?php echo sprintf(__('All %1$s subscribers are selected.', WYSIJA), $data['current_counts']); ?>
245
+ <a><?php echo __('Clear selection', WYSIJA); ?></a>
246
  </div>
247
  </td>
248
  </tr>
268
  <tr <?php echo $classRow ?> >
269
 
270
  <th scope="col" class="check-column" >
271
+ <input type="checkbox" name="wysija[user][user_id][]" id="user_id_<?php echo $row['user_id'] ?>" value="<?php echo esc_attr($row['user_id']) ?>" class="checkboxselec" />
272
  </th>
273
  <td class="username column-username">
274
  <?php
275
+ echo get_avatar( $row['email'], 32 );
276
+ echo '<strong>'.$row['email'].'</strong>';
277
+ echo '<p style="margin:0;">'.$row['firstname'].' '.$row['lastname'].'</p>';
278
 
279
  ?>
280
  <div class="row-actions">
281
  <span class="edit">
282
+ <a href="admin.php?page=wysija_subscribers&id=<?php echo $row['user_id'] ?>&action=edit" class="submitedit"><?php _e('View stats or edit',WYSIJA)?></a>
283
  </span>
284
  </div>
285
  </td>
331
  * 4-export
332
  */
333
 
334
+ $formObj=WYSIJA::get('forms','helper');
335
+ $config=WYSIJA::get('config','model');
 
336
 
337
 
338
  ?>
340
  <th><label for="filterlist"><?php _e("Pick a list",WYSIJA); ?></label></th>
341
  <td>
342
  <?php
343
+ $lists_html = '';
344
  foreach($data['lists'] as $listK => $list){
345
+ $lists_html .= '<label><input type="checkbox" name="wysija[export][filter][list][]" checked="checked" class="validate[minCheckbox[1]] checkbox" value="'.esc_attr($list['list_id']).'" />';
346
+ $lists_html .= '&nbsp;'.$list['name'];
347
+ $lists_html .= ' <span class="count-confirmed-only">('.$list['subscribers'].')</span>';
348
+ $lists_html .= '<span class="count-all">('.((int)$list['belonging']).')</span>';
349
+ $lists_html .= '</label><br />';
350
+ }
351
+
352
+ echo $lists_html;
353
+ ?>
354
  </td>
355
  </tr>
356
  <tr>
363
  </td>
364
  </tr>
365
  <?php
366
+ if($config->getValue('confirm_dbleoptin')){
367
  ?>
368
  <tr>
369
  <th><label for="confirmedcheck"><?php _e("Export confirmed subscribers only",WYSIJA); ?></label></th>
373
  </tr>
374
  <?php
375
  }
376
+ }elseif(!empty($data['user']['timestamp']) && !empty($data['user']['force_select_all']) && (bool)$data['user']['force_select_all']){ //batch-select and export
377
  if(!empty($data['filter']) && is_array($data['filter']))
378
  foreach($data['filter'] as $k => $v)
379
  echo '<input type="hidden" value="'.$v.'" name="wysija[filter]['.$k.']" />';
380
  foreach($data['user'] as $k => $v)
381
  if($k != 'user_id') // we don't ask for user_id in case of batch-select
382
+ echo '<input type="hidden" value="'.$v.'" name="wysija[user]['.$k.']" />';
383
  }
384
  ?>
385
  <tr>
407
  </form>
408
  <?php
409
  }
410
+
411
+
412
+
413
  function add($data=false){
414
 
415
  if(!$data['user'] || isset($this->add)) {
518
 
519
  $fieldHTML.= '<p><label for="'.$field.$list['list_id'].'">';
520
  $datacheck=array('id'=>$field.$list['list_id'],'name'=>"wysija[user_list][list_id][]", 'class'=>'');
521
+
522
  $fieldHTML.=$formObj->checkbox( $datacheck,$list['list_id'],$checked,$extraCheckbox).$list['name'];
523
  $fieldHTML.=$hiddenField;
524
  $fieldHTML.='</label></p>';
548
 
549
  if(count($data['charts']['stats'])>0 ){
550
  $htmlContent.= '<p>';
551
+ $helper_licence = WYSIJA::get('licence','helper');
552
+ $url_checkout = $helper_licence->get_url_checkout('subscriber_stats');
553
  $htmlContent.= str_replace(
554
+ array('[link]','[/link]'),
555
+ array('<a title="'.__('Get Premium now',WYSIJA).'" target="_blank" href="'.$url_checkout.'">','</a>'),
556
  __("Note: Find out what this subscribers opens and clicks with our [link]Premium version.[/link]",WYSIJA));
557
  $htmlContent.= '</p>';
558
  }
848
  <tr class="thead">
849
  <th><?php _e('Match the data',WYSIJA);?></th>
850
  <?php
851
+ $columns=array("nomatch"=>__("Ignore column...",WYSIJA),'email'=>__('Email',WYSIJA),'firstname'=>__('First name',WYSIJA),'lastname'=>__('Last name',WYSIJA),'ip'=>__('IP address',WYSIJA),'status'=>__('Status',WYSIJA));
852
 
853
  $formObj=WYSIJA::get("forms","helper");
854
  $i=0;