| @@ -1,120 +1,14 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | function GetPostValue($parameterName) |
| 4 | 4 | { |
| 5 | - require_once SMART_FORMS_DIR.'utilities/JSONSanitizer.php'; | |
| 6 | 5 | if(isset($_POST[$parameterName])) |
| 7 | - if(is_array(($_POST[$parameterName]))) | |
| 8 | - return RednaoJSONSanitizer::Sanitize($_POST[$parameterName],(Object)['Data'=>(object)[]]); | |
| 9 | - else | |
| 10 | - return stripslashes(RednaoJSONSanitizer::Sanitize($_POST[$parameterName],(Object)['Data'=>(object)[]])); | |
| 6 | + return stripslashes($_POST[$parameterName]); | |
| 11 | 7 | |
| 12 | 8 | return ""; |
| 13 | 9 | } |
| 14 | 10 | |
| 15 | -function rednao_smart_forms_export(){ | |
| 16 | - | |
| 17 | - require_once SMART_FORMS_DIR.'smart-forms-export-form.php'; | |
| 18 | - | |
| 19 | - | |
| 20 | - die(); | |
| 21 | -} | |
| 22 | - | |
| 23 | -function smart_forms_export(){ | |
| 24 | - if(!wp_verify_nonce(GetPostValue('nonce'),'smart_forms_list_entries')||!current_user_can('edit_pages')) | |
| 25 | - { | |
| 26 | - echo json_encode(array( | |
| 27 | - 'success'=>false, | |
| 28 | - 'errorMessage'=>'Invalid Request' | |
| 29 | - )); | |
| 30 | - die(); | |
| 31 | - } | |
| 32 | - | |
| 33 | - require_once 'smart-forms-exporter.php'; | |
| 34 | -} | |
| 35 | - | |
| 36 | -function smart_forms_skip_tutorial(){ | |
| 37 | - if(!wp_verify_nonce(GetPostValue('nonce'),'save_nonce')||!current_user_can('edit_pages')) | |
| 38 | - { | |
| 39 | - echo json_encode(array( | |
| 40 | - 'success'=>false, | |
| 41 | - 'errorMessage'=>'Invalid Request' | |
| 42 | - )); | |
| 43 | - die(); | |
| 44 | - } | |
| 45 | - | |
| 46 | - update_site_option('smart_forms_show_tutorial','y'); | |
| 47 | -} | |
| 48 | - | |
| 49 | -function smart_forms_save_settings(){ | |
| 50 | - if((!wp_verify_nonce(GetPostValue('nonce'),'smart-forms-save-settings'))||!current_user_can('edit_pages')) | |
| 51 | - { | |
| 52 | - echo json_encode(array( | |
| 53 | - 'success'=>false, | |
| 54 | - 'message'=>'Invalid request' | |
| 55 | - )); | |
| 56 | - die(); | |
| 57 | - } | |
| 58 | - $options=GetPostValue('options'); | |
| 59 | - if($options=='') | |
| 60 | - return; | |
| 61 | - foreach($options as $value) | |
| 62 | - { | |
| 63 | - update_option($value['key'],$value['value']); | |
| 64 | - } | |
| 65 | -} | |
| 66 | - | |
| 67 | -function rednao_smart_forms_resend_email(){ | |
| 68 | - $data=GetPostValue('data'); | |
| 69 | - | |
| 70 | - | |
| 71 | - require_once SMART_FORMS_DIR.'utilities/JSONSanitizer.php'; | |
| 72 | - $data=RednaoJSONSanitizer::Sanitize(json_decode(stripslashes($_POST['data'])),(object)[ | |
| 73 | - "EmailIndex"=>0, | |
| 74 | - "FormId"=>0, | |
| 75 | - "EntryId"=>0, | |
| 76 | - "Nonce"=>'' | |
| 77 | - ]); | |
| 78 | - | |
| 79 | - if(!wp_verify_nonce($data->Nonce,'smart_forms_list_entries')||!current_user_can('edit_pages')) | |
| 80 | - { | |
| 81 | - echo json_encode(array( | |
| 82 | - 'success'=>false, | |
| 83 | - 'errorMessage'=>'Invalid Request' | |
| 84 | - )); | |
| 85 | - die(); | |
| 86 | - } | |
| 87 | - $emailIndex=$data->EmailIndex; | |
| 88 | - $form=$data->Form; | |
| 89 | - $entryId=$data->EntryId; | |
| 90 | - | |
| 91 | - include_once(SMART_FORMS_DIR.'php_classes/save/php_entry_saver_base.php'); | |
| 92 | - | |
| 93 | - global $wpdb; | |
| 94 | - $entryRow=$wpdb->get_row($wpdb->prepare('select data from '.SMART_FORMS_ENTRY.' where entry_id=%d',$entryId)); | |
| 95 | - $form=$wpdb->get_row($wpdb->prepare('select * from '.SMART_FORMS_TABLE_NAME.' where form_id=%d',$form)); | |
| 96 | - | |
| 97 | - | |
| 98 | - $phpEntry=new php_entry_saver_base($data->Form,$entryRow->data,'n','',json_decode($form->form_options,true),json_decode($form->element_options,true)); | |
| 99 | - if($phpEntry->FormOptions['Emails']!=null&&count($phpEntry->FormOptions['Emails'])>$emailIndex) | |
| 100 | - { | |
| 101 | - require_once SMART_FORMS_DIR.'php_classes/save/insert_entry_base.php'; | |
| 102 | - require_once SMART_FORMS_DIR.'php_classes/save/pre_insert_entry.php'; | |
| 103 | - $additionalData=[]; | |
| 104 | - $preInsertedEntry=new PreInsertEntry($data->Form,$phpEntry->FormEntryData,$phpEntry->FormOptions,$phpEntry->ElementOptions,$additionalData); | |
| 105 | - $phpEntry->SendFormEmail($phpEntry->FormOptions['Emails'][$emailIndex],$phpEntry->FormEntryData,$phpEntry->ElementOptions,$preInsertedEntry,false); | |
| 106 | - } | |
| 107 | - | |
| 108 | - echo json_encode(array( | |
| 109 | - 'success'=>true, | |
| 110 | - 'result'=>true | |
| 111 | - )); | |
| 112 | - | |
| 113 | - die(); | |
| 114 | - | |
| 115 | -} | |
| 116 | - | |
| 117 | 11 | function rednao_smart_forms_save() |
| 118 | 12 | { |
| 119 | 13 | $form_id=GetPostValue("id"); |
| 120 | 14 | $element_options=GetPostValue("element_options"); |
| @@ -119,19 +13,9 @@ | ||
| 119 | 13 | $form_id=GetPostValue("id"); |
| 120 | 14 | $element_options=GetPostValue("element_options"); |
| 121 | 15 | $form_options=GetPostValue("form_options"); |
| 122 | 16 | $client_form_options=GetPostValue("client_form_options"); |
| 123 | - $donation_email=GetPostValue("donation_email"); | |
| 124 | - $nonce=''; | |
| 125 | - if(isset($_POST['nonce'])) | |
| 126 | - $nonce=$_POST['nonce']; | |
| 127 | 17 | |
| 128 | - if(!wp_verify_nonce($nonce,'save_nonce')||!current_user_can('manage_options')) | |
| 129 | - { | |
| 130 | - $form_id=intval($form_id); | |
| 131 | - echo "{\"FormId\":\"$form_id\",\"Message\":\"Invalid Request\"}"; | |
| 132 | - die(); | |
| 133 | - } | |
| 134 | 18 | //$form_options=str_replace("\\\"","\"",$form_options); |
| 135 | 19 | $formParsedValues=json_decode($form_options); |
| 136 | 20 | |
| 137 | 21 | |
| @@ -153,10 +37,9 @@ | ||
| 153 | 37 | { |
| 154 | 38 | $values=array('form_name'=>$formParsedValues->Name, |
| 155 | 39 | 'element_options'=>$element_options, |
| 156 | 40 | 'form_options'=>$form_options, |
| 157 | - 'client_form_options'=>$client_form_options, | |
| 158 | - 'donation_email'=>$donation_email | |
| 41 | + 'client_form_options'=>$client_form_options | |
| 159 | 42 | ); |
| 160 | 43 | |
| 161 | 44 | $wpdb->insert(SMART_FORMS_TABLE_NAME,$values); |
| 162 | 45 | $form_id=$wpdb->insert_id; |
| @@ -168,10 +51,9 @@ | ||
| 168 | 51 | $wpdb->update(SMART_FORMS_TABLE_NAME,array( |
| 169 | 52 | 'form_name'=>$formParsedValues->Name, |
| 170 | 53 | 'element_options'=>$element_options, |
| 171 | 54 | 'form_options'=>$form_options, |
| 172 | - 'client_form_options'=>$client_form_options, | |
| 173 | - 'donation_email'=>$donation_email | |
| 55 | + 'client_form_options'=>$client_form_options | |
| 174 | 56 | ),array("form_id"=>$form_id)); |
| 175 | 57 | $message="saved"; |
| 176 | 58 | delete_transient("rednao_smart_forms_$form_id"); |
| 177 | 59 | |
| @@ -179,158 +61,166 @@ | ||
| 179 | 61 | |
| 180 | 62 | } |
| 181 | 63 | |
| 182 | 64 | |
| 183 | - echo json_encode(array( | |
| 184 | - 'FormId'=>$form_id, | |
| 185 | - 'Message'=>$message | |
| 186 | - )); | |
| 65 | + echo "{\"FormId\":\"$form_id\",\"Message\":\"$message\"}"; | |
| 187 | 66 | |
| 188 | 67 | die(); |
| 189 | 68 | } |
| 190 | 69 | |
| 191 | 70 | |
| 192 | -function rednao_smart_form_short_code_setup() | |
| 71 | +function rednao_smart_form_list() | |
| 193 | 72 | { |
| 194 | - if ( (! current_user_can('edit_posts') && ! current_user_can('edit_pages'))||!wp_verify_nonce($_POST['nonce'],'short_code_setup') ) { | |
| 73 | + if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) { | |
| 195 | 74 | return; |
| 196 | 75 | } |
| 197 | 76 | |
| 198 | 77 | global $wpdb; |
| 78 | + $result=$wpdb->get_results("SELECT form_id,form_name FROM ".SMART_FORMS_TABLE_NAME); | |
| 199 | 79 | |
| 200 | - $shortCodeOptions=array(); | |
| 201 | - array_push($shortCodeOptions,array( | |
| 202 | - "Name"=>"Forms", | |
| 203 | - "ShortCode"=>"sform", | |
| 204 | - "Elements"=>array() | |
| 205 | - )); | |
| 206 | - | |
| 207 | - $result=$wpdb->get_results("SELECT form_id,form_name FROM ".SMART_FORMS_TABLE_NAME); | |
| 208 | - //echo "[{\"Id\":\"0\",\"Name\":\"Select a Form\"}"; | |
| 80 | + echo "[{\"Id\":\"0\",\"Name\":\"Select a Form\"}"; | |
| 209 | 81 | foreach($result as $key=>$row) |
| 210 | 82 | { |
| 211 | - array_push($shortCodeOptions[0]["Elements"],array( | |
| 212 | - "Id"=>$row->form_id, | |
| 213 | - "Name"=>$row->form_name | |
| 214 | - )); | |
| 215 | - | |
| 83 | + echo ",{\"Id\":\"$row->form_id\",\"Name\":\"$row->form_name\"}"; | |
| 216 | 84 | } |
| 217 | - | |
| 218 | - $shortCodeOptions=apply_filters("smart_forms_get_short_code_options",$shortCodeOptions); | |
| 219 | - | |
| 220 | - echo json_encode($shortCodeOptions); | |
| 85 | + echo"]"; | |
| 221 | 86 | die(); |
| 222 | 87 | } |
| 223 | 88 | |
| 224 | 89 | |
| 225 | - | |
| 226 | - | |
| 227 | 90 | function rednao_smart_forms_save_form_values() |
| 228 | 91 | { |
| 229 | - include_once(SMART_FORMS_DIR.'php_classes/save/php_entry_saver_base.php'); | |
| 230 | 92 | |
| 231 | 93 | $form_id=GetPostValue("form_id"); |
| 232 | 94 | $formString=GetPostValue("formString"); |
| 233 | 95 | |
| 234 | - if(isset($_POST['nonce'])) | |
| 235 | - $nonce=$_POST['nonce']; | |
| 96 | + $entryData=json_decode($formString,true); | |
| 236 | 97 | |
| 237 | - $blockAnonymousSubmissions=get_option('smart_forms_block_anonymous_submissions'); | |
| 238 | - if(apply_filters('smart_forms_block_annonymous_submissions',$blockAnonymousSubmissions)&&!wp_verify_nonce($nonce,'save_form')) | |
| 239 | - { | |
| 240 | - echo '{"message":"'.__("Invalid submission, please refresh your screen and try again.").'","refreshCaptcha":"n","success":"n"}'; | |
| 241 | - die(); | |
| 98 | + global $wpdb; | |
| 99 | + $result=$wpdb->get_results($wpdb->prepare("select form_options,element_options from ".SMART_FORMS_TABLE_NAME." where form_id=%d",$form_id)); | |
| 100 | + | |
| 101 | + $formOptions=null; | |
| 102 | + $elementOptions=null; | |
| 103 | + | |
| 104 | + if(count($result)>0){ | |
| 105 | + $formOptions=json_decode($result[0]->form_options,true); | |
| 106 | + $elementOptions=json_decode($result[0]->element_options,true); | |
| 242 | 107 | } |
| 243 | 108 | |
| 244 | - $captcha=""; | |
| 245 | - if(isset($_POST["captcha"])) | |
| 246 | - if(is_array($_POST["captcha"])) | |
| 109 | + if($formOptions["UsesCaptcha"]=="y") | |
| 110 | + { | |
| 111 | + if(!isset($_POST["captcha"])) | |
| 247 | 112 | { |
| 248 | - require_once SMART_FORMS_DIR.'utilities/JSONSanitizer.php'; | |
| 249 | - $captcha=(array)RednaoJSONSanitizer::Sanitize($_POST["captcha"],(object)[ | |
| 250 | - "version"=>"", | |
| 251 | - "response"=>'' | |
| 252 | - ]); | |
| 113 | + echo '{"message":"'.__("Invalid captcha.").'"}'; | |
| 114 | + die(); | |
| 253 | 115 | } |
| 254 | - else | |
| 255 | - $captcha=sanitize_text_field(stripslashes($_POST["captcha"])); | |
| 116 | + $captchaPost=$_POST["captcha"]; | |
| 117 | + $captcha=ARRAY(); | |
| 118 | + $captcha["challenge"]=stripslashes($captchaPost["challenge"]); | |
| 119 | + $captcha["response"]=stripslashes($captchaPost["response"]); | |
| 120 | + $captcha["remoteip"]=$_SERVER['REMOTE_ADDR']; | |
| 121 | + $captcha["privatekey"]="6Lf2J-wSAAAAAOH6uSmSdx75ZLRpDIfvSeAdx9ST"; | |
| 256 | 122 | |
| 257 | - $phpEntry=new php_entry_saver_base($form_id,$formString,$captcha); | |
| 258 | - $phpEntry->ProcessEntry(); | |
| 259 | - die(); | |
| 260 | -} | |
| 123 | + $args=Array(); | |
| 261 | 124 | |
| 262 | -function rednao_smart_forms_get_form_element_info() | |
| 263 | -{ | |
| 264 | - $formId=GetPostValue("formId"); | |
| 265 | - $nonce=GetPostValue("nonce"); | |
| 266 | - if (( ! current_user_can('edit_posts') && ! current_user_can('edit_pages'))||!wp_verify_nonce($nonce,'save_nonce') ) { | |
| 267 | - return; | |
| 268 | - } | |
| 125 | + $args['headers']=Array | |
| 126 | + ( | |
| 127 | + 'Content-Type'=>'application/x-www-form-urlencoded;', | |
| 128 | + 'Method'=>'Post' | |
| 129 | + ); | |
| 130 | + $args['body']=$captcha; | |
| 131 | + $res=wp_remote_post('http://www.google.com/recaptcha/api/verify',$args); | |
| 132 | + if(strpos($res["body"],"true")!==0) | |
| 133 | + { | |
| 134 | + echo '{"message":"'.__("Invalid captcha.").'","refreshCaptcha":"y"}'; | |
| 135 | + die(); | |
| 136 | + } | |
| 269 | 137 | |
| 270 | - global $wpdb; | |
| 271 | - $result=$wpdb->get_var($wpdb->prepare("SELECT element_options FROM ".SMART_FORMS_TABLE_NAME.' where form_id=%d',$formId)); | |
| 272 | 138 | |
| 273 | - echo json_encode(array( | |
| 274 | - 'elementsInfo'=>json_decode($result) | |
| 139 | + } | |
| 140 | + | |
| 141 | + $result=$wpdb->insert(SMART_FORMS_ENTRY,array( | |
| 142 | + 'form_id'=>$form_id, | |
| 143 | + 'date'=>date('Y-m-d H:i:s'), | |
| 144 | + 'data'=>$formString, | |
| 145 | + 'ip'=>$_SERVER['REMOTE_ADDR'], | |
| 275 | 146 | )); |
| 276 | 147 | |
| 277 | - die(); | |
| 148 | + if($formOptions["SendNotificationEmail"]=="y") | |
| 149 | + send_form_email($formOptions["Emails"][0],$entryData,$elementOptions,false); | |
| 150 | + | |
| 151 | + if($result==true) | |
| 152 | + echo '{"message":"'.__("Information submitted successfully.").'"}'; | |
| 153 | + else | |
| 154 | + echo '{"message":"'.__("An error occurred, please try again later.").'"}'; | |
| 155 | + die(); | |
| 278 | 156 | } |
| 279 | 157 | |
| 280 | -function rednao_smart_forms_get_form_options() | |
| 158 | +function send_form_email($formOptions,$entryData,$elementOptions,$useTestData) | |
| 281 | 159 | { |
| 282 | - $formId=GetPostValue("formId"); | |
| 283 | - $nonce=GetPostValue("nonce"); | |
| 284 | - if (( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )||!wp_verify_nonce($nonce,'save_nonce')) { | |
| 285 | - return; | |
| 160 | + include(SMART_FORMS_DIR.'string_renderer/rednao_string_builder.php'); | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + $stringBuilder=new rednao_string_builder(); | |
| 165 | + $EmailText=$formOptions["EmailText"]; | |
| 166 | + $FromName=$formOptions["FromName"]; | |
| 167 | + $FromEmail=$formOptions["FromEmail"]; | |
| 168 | + $ToEmail=$formOptions["ToEmail"]; | |
| 169 | + $EmailSubject=$formOptions["EmailSubject"]; | |
| 170 | + | |
| 171 | + | |
| 172 | + if($FromName=="") | |
| 173 | + $FromName="Wordpress"; | |
| 174 | + | |
| 175 | + if($EmailSubject=="") | |
| 176 | + $EmailSubject="Form Submitted"; | |
| 177 | + | |
| 178 | + if($ToEmail=="") | |
| 179 | + $ToEmail=get_option("admin_email"); | |
| 180 | + | |
| 181 | + preg_match_all('/\\[field ([^\\]]+)/',$EmailText, $matches, PREG_PATTERN_ORDER); | |
| 182 | + | |
| 183 | + foreach($matches[1] as $match) | |
| 184 | + { | |
| 185 | + $value=GetValueByField($stringBuilder,$match,$entryData,$elementOptions,$useTestData); | |
| 186 | + $EmailText=str_replace("[field $match]",$value,$EmailText); | |
| 286 | 187 | } |
| 287 | 188 | |
| 288 | - global $wpdb; | |
| 289 | - $result=$wpdb->get_results($wpdb->prepare("SELECT form_options,element_options FROM ".SMART_FORMS_TABLE_NAME.' where form_id=%d',$formId)); | |
| 290 | 189 | |
| 291 | - global $current_user; | |
| 292 | - echo json_encode(array( | |
| 293 | - 'formOptions'=>json_decode($result[0]->form_options), | |
| 294 | - 'elementOptions'=>json_decode($result[0]->element_options), | |
| 295 | - 'CurrentEmail'=>strval($current_user->user_email) | |
| 296 | - )); | |
| 297 | - die(); | |
| 298 | -} | |
| 190 | +/* | |
| 299 | 191 | |
| 300 | -function rednao_get_fixed_field_value($match,$entryData,$elementOptions,$useTestData) | |
| 301 | -{ | |
| 302 | - require_once(SMART_FORMS_DIR.'filter_listeners/fixed-field-listeners.php'); | |
| 303 | - $match=str_replace("'","\"",$match); | |
| 304 | - $fixedFieldParameters=json_decode($match,true); | |
| 305 | - if($fixedFieldParameters==null) | |
| 306 | - { | |
| 307 | - error_log('error parsing fixed field'); | |
| 308 | - return ''; | |
| 309 | - } | |
| 310 | 192 | |
| 311 | - try{ | |
| 312 | - $value=apply_filters("smart-forms-fixed-field-value-".$fixedFieldParameters["Op"],$fixedFieldParameters,$entryData,$elementOptions,$useTestData); | |
| 313 | - if($value==$fixedFieldParameters) | |
| 314 | - return ""; | |
| 315 | - if($value==null) | |
| 316 | - $value=''; | |
| 317 | - return strval($value); | |
| 318 | - }catch(Exception $e) | |
| 319 | - { | |
| 320 | - error_log("Couldn't format date ".$e->getMessage()); | |
| 321 | - } | |
| 193 | + foreach($entryData as $key=>$value) | |
| 194 | + { | |
| 322 | 195 | |
| 323 | - return ""; | |
| 196 | + $element=null; | |
| 197 | + foreach($elementOptions as $item) | |
| 198 | + { | |
| 199 | + if($item->Id==$key) | |
| 200 | + { | |
| 201 | + $element=$item; | |
| 202 | + break; | |
| 203 | + } | |
| 204 | + } | |
| 205 | + | |
| 206 | + $emailText.="<tr>". $stringBuilder->GetStringFromColumn($element,$value)."</tr>"; | |
| 207 | + } | |
| 208 | + $emailText.="</table>";*/ | |
| 209 | + | |
| 210 | + $headers = 'MIME-Version: 1.0' . "\r\n"; | |
| 211 | + $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; | |
| 212 | + $headers.= "$FromName <$FromEmail>"; | |
| 213 | + if(trim($ToEmail)!="") | |
| 214 | + { | |
| 215 | + return wp_mail($ToEmail, $EmailSubject, $EmailText, $headers); | |
| 216 | + } | |
| 217 | + | |
| 218 | + return false; | |
| 324 | 219 | } |
| 325 | 220 | |
| 326 | 221 | function GetValueByField($stringBuilder,$match,$entryData,$elementOptions,$useTestData) |
| 327 | 222 | { |
| 328 | - if(strpos(trim($match),'{')===0) | |
| 329 | - { | |
| 330 | - return rednao_get_fixed_field_value($match,$entryData,$elementOptions,$useTestData); | |
| 331 | - } | |
| 332 | - | |
| 333 | 223 | foreach($entryData as $key=>$value) |
| 334 | 224 | { |
| 335 | 225 | $element=null; |
| 336 | 226 | if($key!=$match) |
| @@ -357,129 +247,44 @@ | ||
| 357 | 247 | if($useTestData) |
| 358 | 248 | return "sample text"; |
| 359 | 249 | } |
| 360 | 250 | |
| 361 | -function rednao_smart_forms_send_files(){ | |
| 362 | - require_once SMART_FORMS_DIR.'smart_forms_uploader.php'; | |
| 363 | - die(); | |
| 364 | -} | |
| 365 | - | |
| 366 | -function rednao_smart_form_delete_entries(){ | |
| 367 | - $data=json_decode(GetPostValue('data')); | |
| 368 | - | |
| 369 | - $nonce=$data->Nonce; | |
| 370 | - | |
| 371 | - if(!wp_verify_nonce($nonce,'smart_delete_entry')||!current_user_can('edit_pages')) | |
| 372 | - { | |
| 373 | - echo json_encode(array( | |
| 374 | - 'success'=>false, | |
| 375 | - 'errorMessage'=>'Invalid nonce, please refresh your screen and try again' | |
| 376 | - )); | |
| 377 | - die(); | |
| 378 | - } | |
| 379 | - | |
| 380 | - if($data==null||!isset($data->Ids)) | |
| 381 | - { | |
| 382 | - echo json_encode(array( | |
| 383 | - 'success'=>false, | |
| 384 | - 'errorMessage'=>'Invalid values' | |
| 385 | - )); | |
| 386 | - die(); | |
| 387 | - } | |
| 388 | - | |
| 389 | - global $wpdb; | |
| 390 | - | |
| 391 | - $how_many = count($data->Ids); | |
| 392 | - $placeholders = array_fill(0, $how_many, '%d'); | |
| 393 | - $format = implode(', ', $placeholders); | |
| 394 | - $query = "DELETE FROM ".SMART_FORMS_ENTRY." WHERE entry_id IN($format)"; | |
| 395 | - $wpdb->query( $wpdb->prepare($query, $data->Ids) ); | |
| 396 | - | |
| 397 | - | |
| 398 | - $query = "DELETE FROM ".SMART_FORMS_ENTRY_DETAIL." WHERE entry_id IN($format)"; | |
| 399 | - $wpdb->query( $wpdb->prepare($query, $data->Ids) ); | |
| 400 | - | |
| 401 | - echo json_encode(array( | |
| 402 | - 'success'=>true, | |
| 403 | - 'result'=>true | |
| 404 | - )); | |
| 405 | - | |
| 406 | - die(); | |
| 407 | - | |
| 408 | - | |
| 409 | -} | |
| 410 | - | |
| 411 | 251 | function rednao_smart_forms_entries_list() |
| 412 | 252 | { |
| 413 | - $data=json_decode(GetPostValue('data')); | |
| 253 | + $startDate=GetPostValue("startDate"); | |
| 254 | + $endDate=GetPostValue("endDate"); | |
| 255 | + $formId=GetPostValue("form_id"); | |
| 414 | 256 | |
| 415 | - if(!isset($data->nonce)||!wp_verify_nonce($data->nonce,'smart_forms_list_entries')||(!current_user_can('manage_options')&&!current_user_can('smart_forms_view_entries'))) { | |
| 416 | - echo json_encode(array( | |
| 417 | - 'success' => false, | |
| 418 | - 'errorMessage' => 'Invalid Request' | |
| 419 | - )); | |
| 420 | - die(); | |
| 421 | - } | |
| 422 | - if($data==null) | |
| 423 | - { | |
| 424 | - echo json_encode(array( | |
| 425 | - 'success'=>false, | |
| 426 | - 'errorMessage'=>'Invalid values' | |
| 427 | - )); | |
| 428 | - die(); | |
| 429 | - } | |
| 257 | + $startDate=date('Y-m-d H:i:s', strtotime($startDate)); | |
| 258 | + $endDate=date('Y-m-d H:i:s', strtotime($endDate .' +1 day')); | |
| 430 | 259 | |
| 431 | - require_once SMART_FORMS_API; | |
| 260 | + $query="select data from ".SMART_FORMS_ENTRY." | |
| 261 | + where date between '$startDate' and '$endDate' and form_id=$formId"; | |
| 432 | 262 | |
| 433 | - $query=new SmartFormsQuery($data->Form); | |
| 434 | 263 | |
| 435 | - | |
| 436 | 264 | global $wpdb; |
| 265 | + $result=$wpdb->get_results($query); | |
| 266 | + $isFirstRecord=true; | |
| 437 | 267 | |
| 438 | - | |
| 439 | - foreach($data->Conditions as $condition) | |
| 268 | + echo '{"entries":['; | |
| 269 | + foreach($result as $row) | |
| 440 | 270 | { |
| 441 | - if(isset($condition->FieldId)&&isset($condition->Comparison)&& $condition->FieldId!=''&&$condition->Comparison!='') | |
| 442 | - { | |
| 443 | - $query->AddCondition($condition->FieldId,$condition->Comparison,$condition->Value); | |
| 444 | - } | |
| 445 | - } | |
| 271 | + if($isFirstRecord) | |
| 272 | + $isFirstRecord=false; | |
| 273 | + else | |
| 274 | + echo ","; | |
| 446 | 275 | |
| 447 | - if($data->StartDate!=0) | |
| 448 | - { | |
| 449 | - $query->AddCondition('_Date','>=',get_gmt_from_date(date('Y-m-d H:i:s',$data->StartDate))); | |
| 276 | + echo $row->data; | |
| 450 | 277 | |
| 451 | 278 | } |
| 279 | + echo '],"formOptions":'; | |
| 452 | 280 | |
| 453 | - if($data->EndDate!=0) | |
| 454 | - { | |
| 455 | - $query->AddCondition('_Date','<',get_gmt_from_date(date('Y-m-d H:i:s',$data->EndDate+86400))); | |
| 456 | - } | |
| 281 | + $query="select element_options from ".SMART_FORMS_TABLE_NAME." where form_id=".$formId; | |
| 282 | + $elementOptions=$wpdb->get_var($query); | |
| 283 | + echo $elementOptions.'}'; | |
| 457 | 284 | |
| 458 | 285 | |
| 459 | - $result=$query->GetRaw($data->PageSize,$data->PageSize*$data->PageIndex); | |
| 460 | - $entries=array(); | |
| 461 | - foreach($result as $row) | |
| 462 | - { | |
| 463 | - $entries[]=array( | |
| 464 | - "date"=>get_date_from_gmt($row['date']), | |
| 465 | - "entry_id"=>$row['entry_id'], | |
| 466 | - "user_name"=>$row['user_name'], | |
| 467 | - "user_id"=>$row['user_id'], | |
| 468 | - "user_ip"=>$row['user_ip'], | |
| 469 | - "data"=>json_decode($row['data']) | |
| 470 | - ); | |
| 471 | - | |
| 472 | - } | |
| 473 | - echo json_encode(array( | |
| 474 | - 'success'=>true, | |
| 475 | - 'result'=>array( | |
| 476 | - 'rows'=>json_encode($entries), | |
| 477 | - 'count'=>$query->GetCount() | |
| 478 | - ) | |
| 479 | - )); | |
| 480 | 286 | die(); |
| 481 | - | |
| 482 | 287 | } |
| 483 | 288 | |
| 484 | 289 | function rednao_smart_form_send_test_email() |
| 485 | 290 | { |
| @@ -484,36 +289,22 @@ | ||
| 484 | 289 | function rednao_smart_form_send_test_email() |
| 485 | 290 | { |
| 486 | 291 | $FromEmail=GetPostValue("FromEmail"); |
| 487 | 292 | $FromName=GetPostValue("FromName"); |
| 488 | - $ToEmail=rtrim(GetPostValue("ToEmail"),","); | |
| 293 | + $ToEmail=GetPostValue("ToEmail"); | |
| 489 | 294 | $EmailSubject=GetPostValue("EmailSubject"); |
| 490 | 295 | $EmailText=GetPostValue("EmailText"); |
| 491 | - $ReplyTo=GetPostValue("ReplyTo"); | |
| 492 | - $Bcc=GetPostValue("Bcc"); | |
| 493 | 296 | $elementOptions=GetPostValue("element_options"); |
| 494 | - $pdfs=GetPostValue("PDFS"); | |
| 495 | - $nonce=GetPostValue('nonce'); | |
| 496 | 297 | |
| 497 | - if(!wp_verify_nonce($nonce,'save_nonce')||!current_user_can('edit_pages')) | |
| 498 | - { | |
| 499 | - echo '{"Message":"'.__("Invalid request").'"}'; | |
| 500 | - die(); | |
| 501 | - } | |
| 298 | + $elementOptions=json_decode($elementOptions); | |
| 502 | 299 | |
| 503 | - if(!is_array($elementOptions)) | |
| 504 | - $elementOptions=json_decode($elementOptions,true); | |
| 505 | 300 | |
| 506 | - | |
| 507 | 301 | $valueArray=Array( |
| 508 | 302 | "FromEmail"=>$FromEmail, |
| 509 | 303 | "FromName"=>$FromName, |
| 510 | 304 | "ToEmail"=>$ToEmail, |
| 511 | 305 | "EmailSubject"=>$EmailSubject, |
| 512 | - "EmailText"=>$EmailText, | |
| 513 | - "ReplyTo"=>$ReplyTo, | |
| 514 | - "PDFS"=>$pdfs, | |
| 515 | - "Bcc"=>$Bcc | |
| 306 | + "EmailText"=>$EmailText | |
| 516 | 307 | ); |
| 517 | 308 | $entryData=Array(); |
| 518 | 309 | |
| 519 | 310 | |
| @@ -522,11 +313,9 @@ | ||
| 522 | 313 | echo '{"Message":"'.__("Email text can't be empty").'"}'; |
| 523 | 314 | die(); |
| 524 | 315 | } |
| 525 | 316 | |
| 526 | - include_once(SMART_FORMS_DIR.'php_classes/save/php_entry_saver_base.php'); | |
| 527 | - $entrySaver=new php_entry_saver_base("","",""); | |
| 528 | - if($entrySaver->SendFormEmail($valueArray,$entryData,$elementOptions,null,true)) | |
| 317 | + if(send_form_email($valueArray,$entryData,$elementOptions,true)) | |
| 529 | 318 | echo '{"Message":"'.__("Email sent successfully").'"}'; |
| 530 | 319 | else |
| 531 | 320 | echo '{"Message":"'.__("There was an error sending the email, please check the configuration").'"}'; |
| 532 | 321 | die(); |
| @@ -531,334 +320,25 @@ | ||
| 531 | 320 | echo '{"Message":"'.__("There was an error sending the email, please check the configuration").'"}'; |
| 532 | 321 | die(); |
| 533 | 322 | } |
| 534 | 323 | |
| 535 | - | |
| 536 | 324 | function rednao_smart_forms_submit_license() |
| 537 | 325 | { |
| 538 | 326 | include_once(SMART_FORMS_DIR.'smart-forms-license.php'); |
| 539 | 327 | |
| 540 | - | |
| 541 | - | |
| 542 | 328 | $email=GetPostValue("email"); |
| 543 | 329 | $key=GetPostValue("key"); |
| 544 | - $nonce=GetPostValue('nonce'); | |
| 545 | - if(!wp_verify_nonce($nonce,'save_nonce')||!current_user_can('edit_pages')) | |
| 546 | - { | |
| 547 | - echo json_encode(array( | |
| 548 | - 'success'=>false, | |
| 549 | - 'errorMessage'=>'Invalid Request' | |
| 550 | - )); | |
| 551 | - die(); | |
| 552 | - } | |
| 553 | 330 | |
| 554 | - $license=smart_forms_check_license($email,$key,$error); | |
| 555 | - if($license["is_valid"]) | |
| 331 | + if(smart_forms_check_license($email,$key,$error)) | |
| 556 | 332 | { |
| 557 | - echo '{"IsValid":"y","Message":"'.__("License submitted successfully, thank you!!").'","licenseType":""}'; | |
| 333 | + echo '{"IsValid":"y","Message":"'.__("License submitted successfully, thank you!!").'"}'; | |
| 558 | 334 | }else |
| 559 | 335 | { |
| 560 | 336 | if($error==null) |
| 561 | 337 | { |
| 562 | 338 | echo '{"IsValid":"n", "Message":"'.__("Invalid user or license").'"}'; |
| 563 | - }else { | |
| 564 | - echo '{"IsValid":"n","Message":"' . __("An error occurred") . '"}'; | |
| 565 | - } | |
| 339 | + }else | |
| 340 | + echo '{"IsValid":"n","Message":"'.__("An error occurred $error").'"}'; | |
| 566 | 341 | } |
| 567 | 342 | |
| 568 | - die(); | |
| 569 | -} | |
| 570 | - | |
| 571 | -function rednao_smart_forms_execute_op() | |
| 572 | -{ | |
| 573 | - $id=GetPostValue('TransactionId'); | |
| 574 | - $oper=GetPostValue('oper'); | |
| 575 | - $nonce=GetPostValue('nonce'); | |
| 576 | - | |
| 577 | - if (( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )||!wp_verify_nonce($nonce,'smart_forms_list_entries')) { | |
| 578 | - return; | |
| 579 | - } | |
| 580 | - if($oper=="del") | |
| 581 | - { | |
| 582 | - global $wpdb; | |
| 583 | - if($wpdb->query($wpdb->prepare("delete from ".SMART_FORMS_ENTRY." WHERE entry_id=%d",$id))>0) | |
| 584 | - { | |
| 585 | - $wpdb->query($wpdb->prepare("delete from ".SMART_FORMS_ENTRY_DETAIL." WHERE entry_id=%d",$id)); | |
| 586 | - echo '{"success":"1"}'; | |
| 587 | - } | |
| 588 | - else | |
| 589 | - echo '{"success":"0","message":"'.__("Could not delete row").'"}'; | |
| 590 | - die(); | |
| 591 | - } | |
| 592 | - | |
| 593 | - if($oper=='massDelete') | |
| 594 | - { | |
| 595 | - global $wpdb; | |
| 596 | - $ids=GetPostValue('entriesToDelete'); | |
| 597 | - $ids=json_decode($ids); | |
| 598 | - $idwhere=''; | |
| 599 | - foreach($ids as $id) | |
| 600 | - { | |
| 601 | - if($idwhere!='') | |
| 602 | - $idwhere.=','; | |
| 603 | - $idwhere.=$wpdb->prepare('%d',$id); | |
| 604 | - } | |
| 605 | - | |
| 606 | - $wpdb->query('delete from '.SMART_FORMS_ENTRY.' where entry_id in('.$idwhere.')'); | |
| 607 | - $wpdb->query('delete from '.SMART_FORMS_ENTRY_DETAIL.' where entry_id in('.$idwhere.')'); | |
| 608 | - echo '{"success":"1"}'; | |
| 609 | - die(); | |
| 610 | - | |
| 611 | - } | |
| 612 | - | |
| 613 | -} | |
| 614 | - | |
| 615 | -function rednao_smart_forms_send_test() | |
| 616 | -{ | |
| 617 | - if (( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )||!wp_verify_nonce(GetPostValue('nonce'),'save_nonce')) { | |
| 618 | - return; | |
| 619 | - } | |
| 620 | - | |
| 621 | - require_once SMART_FORMS_DIR.'php_classes/smart_forms_troubleshoot/smart_forms_email.php'; | |
| 622 | - switch(GetPostValue('Id')) | |
| 623 | - { | |
| 624 | - case "basic": | |
| 625 | - $smartFormsEmail=new smart_forms_email_troubleshoot_basic(); | |
| 626 | - break; | |
| 627 | - case "custom": | |
| 628 | - $smartFormsEmail=new smart_forms_email_troubleshoot_custom_smtp(); | |
| 629 | - break; | |
| 630 | - } | |
| 631 | - if($smartFormsEmail->Start()) | |
| 632 | - echo json_encode( | |
| 633 | - array( | |
| 634 | - "Passed"=>'y' | |
| 635 | - )); | |
| 636 | - else | |
| 637 | - echo json_encode( | |
| 638 | - array( | |
| 639 | - "Passed"=>'n', | |
| 640 | - "Message"=>$smartFormsEmail->LatestError | |
| 641 | - )); | |
| 642 | - die(); | |
| 643 | -} | |
| 644 | - | |
| 645 | -function rednao_smart_forms_export_entries(){ | |
| 646 | - if(!isset($_GET['data'])) | |
| 647 | - { | |
| 648 | - echo "Invalid request"; | |
| 649 | - die(); | |
| 650 | - } | |
| 651 | - | |
| 652 | - require_once SMART_FORMS_DIR.'utilities/JSONSanitizer.php'; | |
| 653 | - $data=RednaoJSONSanitizer::Sanitize(json_decode(stripslashes($_GET['data'])),(object)[ | |
| 654 | - "Nonce"=>'', | |
| 655 | - "Form"=>0, | |
| 656 | - "StartDate"=>0, | |
| 657 | - "EndDate"=>0, | |
| 658 | - "Conditions"=>[(object)[ | |
| 659 | - "FieldId"=>"", | |
| 660 | - "Comparison"=>"", | |
| 661 | - "Value"=>"", | |
| 662 | - | |
| 663 | - ]] | |
| 664 | - ]); | |
| 665 | - | |
| 666 | - if($data==null) | |
| 667 | - { | |
| 668 | - echo "Invalid request"; | |
| 669 | - die(); | |
| 670 | - } | |
| 671 | - | |
| 672 | - if(!wp_verify_nonce($data->Nonce,'smart_forms_export')||!current_user_can('manage_options')) | |
| 673 | - { | |
| 674 | - echo "Invalid request"; | |
| 675 | - die(); | |
| 676 | - } | |
| 677 | - require_once SMART_FORMS_API; | |
| 678 | - $query=new SmartFormsQuery($data->Form); | |
| 679 | - | |
| 680 | - | |
| 681 | - global $wpdb; | |
| 682 | - | |
| 683 | - | |
| 684 | - foreach($data->Conditions as $condition) | |
| 685 | - { | |
| 686 | - if(isset($condition->FieldId)&&isset($condition->Comparison)&& $condition->FieldId!=''&&$condition->Comparison!='') | |
| 687 | - { | |
| 688 | - $query->AddCondition($condition->FieldId,$condition->Comparison,$condition->Value); | |
| 689 | - } | |
| 690 | - } | |
| 691 | - | |
| 692 | - if($data->StartDate!=0) | |
| 693 | - { | |
| 694 | - $query->AddCondition('_Date','>=',get_gmt_from_date(date('Y-m-d H:i:s',$data->StartDate))); | |
| 695 | - | |
| 696 | - } | |
| 697 | - | |
| 698 | - if($data->EndDate!=0) | |
| 699 | - { | |
| 700 | - $query->AddCondition('_Date','<',get_gmt_from_date(date('Y-m-d H:i:s',$data->EndDate+86400))); | |
| 701 | - } | |
| 702 | - | |
| 703 | - | |
| 704 | - $formName=$wpdb->get_var($wpdb->prepare('select form_name from '.SMART_FORMS_TABLE_NAME.' where form_id=%s',$data->Form)); | |
| 705 | - | |
| 706 | - $result=$query->GetResults('','','array'); | |
| 707 | - $fh = fopen('php://output', 'w'); | |
| 708 | - $headers=array(); | |
| 709 | - | |
| 710 | - header('Pragma: public'); | |
| 711 | - header('Expires: 0'); | |
| 712 | - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | |
| 713 | - header('Cache-Control: private', false); | |
| 714 | - header('Content-Type: application/octet-stream'); | |
| 715 | - header('Content-Disposition: attachment; filename="' . str_replace('"', '\"', $formName[0].'_Export') . '.csv";'); | |
| 716 | - header('Content-Transfer-Encoding: binary'); | |
| 717 | - | |
| 718 | - foreach($query->selectColumns as $column) | |
| 719 | - { | |
| 720 | - if($column=='_Date') | |
| 721 | - $headers[]='Date'; | |
| 722 | - if($column=='_UserName') | |
| 723 | - $headers[]='User Name'; | |
| 724 | - | |
| 725 | - if(isset($query->fieldDictionary[$column])) | |
| 726 | - { | |
| 727 | - $field=$query->fieldDictionary[$column]; | |
| 728 | - if($field['ClassName']=='rednaosurveytable') | |
| 729 | - { | |
| 730 | - foreach($field['Rows'] as $row) | |
| 731 | - { | |
| 732 | - $headers[]=$row['label']; | |
| 733 | - } | |
| 734 | - }else | |
| 735 | - $headers[]=$field['Label']; | |
| 736 | - } | |
| 737 | - } | |
| 738 | - | |
| 739 | - fputcsv($fh,$headers); | |
| 740 | - | |
| 741 | - foreach($result as $row) | |
| 742 | - { | |
| 743 | - $csvRow=array(); | |
| 744 | - foreach($query->selectColumns as $column) | |
| 745 | - { | |
| 746 | - if($column=='_Date') | |
| 747 | - $csvRow[]=$row['_Date']; | |
| 748 | - if($column=='_UserName') | |
| 749 | - $csvRow[]=$row['_UserName']; | |
| 750 | - | |
| 751 | - | |
| 752 | - if(!isset($query->fieldDictionary[$column])) | |
| 753 | - continue; | |
| 754 | - $field=$query->fieldDictionary[$column]; | |
| 755 | - if($field['ClassName']=='rednaosurveytable') | |
| 756 | - { | |
| 757 | - $raw=$row[$column]['raw']; | |
| 758 | - foreach($field['Rows'] as $fieldRow) | |
| 759 | - { | |
| 760 | - $value=''; | |
| 761 | - if(isset($raw['values'])&&is_array($raw['values'])) | |
| 762 | - { | |
| 763 | - foreach($raw['values'] as $surveyRow) | |
| 764 | - { | |
| 765 | - if(isset($surveyRow['QuestionLabel'])&&$surveyRow['QuestionLabel']==$fieldRow['label']){ | |
| 766 | - $value=$surveyRow['ValueLabel']; | |
| 767 | - } | |
| 768 | - } | |
| 769 | - } | |
| 770 | - | |
| 771 | - $csvRow[]=str_replace(array("\n", "\r"), ' ', $value); | |
| 772 | - } | |
| 773 | - }else | |
| 774 | - $csvRow[]=str_replace(array("\n", "\r"), ' ', $row[$column]['plain']); | |
| 775 | - } | |
| 776 | - fputcsv($fh,$csvRow); | |
| 777 | - } | |
| 778 | - | |
| 779 | - die(); | |
| 780 | - | |
| 781 | - | |
| 782 | -} | |
| 783 | - | |
| 784 | -function rednao_smart_forms_edit_form_values() | |
| 785 | -{ | |
| 786 | - $entryId=GetPostValue("entryId"); | |
| 787 | - $entryString=GetPostValue("entryString"); | |
| 788 | - $elementOptions=GetPostValue("elementOptions"); | |
| 789 | - $nonce=GetPostValue("nonce"); | |
| 790 | - | |
| 791 | - if(!wp_verify_nonce($nonce,'smart_forms_edit_values')||!current_user_can('edit_pages')) | |
| 792 | - { | |
| 793 | - echo json_encode(array('result'=>false)); | |
| 794 | - die(); | |
| 795 | - | |
| 796 | - } | |
| 797 | - | |
| 798 | - | |
| 799 | - | |
| 800 | - include_once(SMART_FORMS_DIR.'php_classes/save/php_entry_editor.php'); | |
| 801 | - $phpEditor=new php_entry_editor(); | |
| 802 | - echo json_encode(array('result'=>$phpEditor->execute_editor($entryId,$entryString,$elementOptions))); | |
| 803 | - die(); | |
| 804 | -} | |
| 805 | - | |
| 806 | -function rednao_smart_forms_get_file(){ | |
| 807 | - if(!isset($_GET['id'])) | |
| 808 | - { | |
| 809 | - echo "Invalid request"; | |
| 810 | - die(); | |
| 811 | - } | |
| 812 | - $id=sanitize_text_field($_GET['id']); | |
| 813 | - global $wpdb; | |
| 814 | - $result=$wpdb->get_row($wpdb->prepare('select original_name,file_name,file_mime from '.SMART_FORMS_UPLOADED_FILES.' where file_key=%s',$id)); | |
| 815 | - if($result==false) | |
| 816 | - { | |
| 817 | - echo 'File not found'; | |
| 818 | - die(); | |
| 819 | - } | |
| 820 | - header('Content-type: '.$result->file_mime); | |
| 821 | - header('Content-Disposition: attachment; filename="'.$result->original_name.'"'); | |
| 822 | - readfile($result->file_name); | |
| 823 | - die(); | |
| 824 | -} | |
| 825 | - | |
| 826 | -function rednao_smart_forms_update_order() | |
| 827 | -{ | |
| 828 | - if(!isset($_POST['nonce'])||!wp_verify_nonce($_POST['nonce'],'smart_forms_update_order')||!current_user_can('manage_options')) | |
| 829 | - { | |
| 830 | - echo json_encode(array( | |
| 831 | - 'success'=>false, | |
| 832 | - 'errorMessage'=>'Invalid Request' | |
| 833 | - )); | |
| 834 | - die(); | |
| 835 | - } | |
| 836 | - | |
| 837 | - if(!isset($_POST['order'])||!is_array($_POST['order'])) | |
| 838 | - { | |
| 839 | - echo json_encode(array( | |
| 840 | - 'success'=>false, | |
| 841 | - 'errorMessage'=>'Invalid order data' | |
| 842 | - )); | |
| 843 | - die(); | |
| 844 | - } | |
| 845 | - | |
| 846 | - global $wpdb; | |
| 847 | - $order=array_map('intval',$_POST['order']); | |
| 848 | - | |
| 849 | - foreach($order as $position=>$form_id) | |
| 850 | - { | |
| 851 | - $wpdb->update( | |
| 852 | - SMART_FORMS_TABLE_NAME, | |
| 853 | - array('form_order'=>$position), | |
| 854 | - array('form_id'=>$form_id), | |
| 855 | - array('%d'), | |
| 856 | - array('%d') | |
| 857 | - ); | |
| 858 | - } | |
| 859 | - | |
| 860 | - echo json_encode(array( | |
| 861 | - 'success'=>true | |
| 862 | - )); | |
| 863 | 343 | die(); |
| 864 | 344 | } |