diff --git a/plugins/janvince/smallcontactform/models/Message.php b/plugins/janvince/smallcontactform/models/Message.php index 46782ec94..72b271869 100644 --- a/plugins/janvince/smallcontactform/models/Message.php +++ b/plugins/janvince/smallcontactform/models/Message.php @@ -93,10 +93,10 @@ class Message extends Model foreach( $formFields as $field) { if( $field['name'] == $key) { $fieldDefined = true; - + if($field['type'] == 'file') { $fieldUpload = true; - + if(!empty(Input::file($key))) { $file = new File; $file->data = (Input::file($key)); @@ -105,7 +105,7 @@ class Message extends Model $uploads[] = $file; } } - + } } @@ -150,7 +150,7 @@ class Message extends Model // Add files if($uploads) { - + foreach($uploads as $upload) { $this->uploads()->add($upload); } @@ -179,7 +179,7 @@ class Message extends Model /** * Extract and test email field value - */ + */ $sendTo = ''; foreach($postData as $key => $field) { @@ -257,7 +257,7 @@ class Message extends Model } elseif ( !empty($componentProperties[ ('autoreply_template_'.App::getLocale())]) and empty( MailTemplate::listAllTemplates()[ $componentProperties[ ('autoreply_template_'.App::getLocale())] ] ) ) { Log::error('SMALL CONTACT FORM: Missing defined email template: ' . $componentProperties[ ('autoreply_template_'.App::getLocale())] . '. ' . $template . ' template will be used!'); } - + if(!empty($messageObject->uploads)) { $uploads = $messageObject->uploads; @@ -272,7 +272,7 @@ class Message extends Model if (!empty($componentProperties['autoreply_subject'])) { $message->subject(Twig::parse($componentProperties['autoreply_subject'],['fields' => $output])); - + \App::forgetInstance('parse.twig'); \App::forgetInstance('twig.environment'); @@ -361,13 +361,13 @@ class Message extends Model $sendTo = (!empty($componentProperties['notification_address_to']) ? $componentProperties['notification_address_to'] : Settings::getTranslated('notification_address_to') ); - $sendToAddresses = explode(',', $sendTo); + $sendToAddresses = explode(',', $sendTo); $sendToAddressesValidated = []; foreach($sendToAddresses as $sendToAddress) { $validator = Validator::make(['email' => trim($sendToAddress)], ['email' => 'required|email']); - + if($validator->fails()){ Log::error('SMALL CONTACT FORM ERROR: Notification email address (' .trim($sendToAddress). ') is invalid! No notification will be delivered!'); } else { @@ -454,7 +454,7 @@ class Message extends Model } elseif ( !empty($componentProperties[ ('notification_template_'.App::getLocale())]) and empty( MailTemplate::listAllTemplates()[ $componentProperties[ ('notification_template_'.App::getLocale())] ] ) ) { Log::error('SMALL CONTACT FORM: Missing defined email template: ' . $componentProperties[ ('notification_template_'.App::getLocale())] . '. ' . $template . ' template will be used!'); } - + if(!empty($messageObject->uploads)) { $uploads = $messageObject->uploads; @@ -467,7 +467,7 @@ class Message extends Model Mail::{$method}($template, ['messageObject' => $messageObject, 'uploads' => $uploads, 'fields' => $output, 'fieldsDetails' => $outputFull, 'url' => url()->full()], function($message) use($sendToAddressesValidated, $replyToAddress, $replyToName, $componentProperties, $output){ if( count($sendToAddressesValidated)>1 ) { - + foreach($sendToAddressesValidated as $address) { $message->bcc($address); } diff --git a/scripts/post.sql b/scripts/post.sql index e7fc0483b..0d7d588a5 100644 --- a/scripts/post.sql +++ b/scripts/post.sql @@ -1,10 +1,16 @@ DELETE from orient_wordpress.arient_ru_posts where post_type not in ('post','attachment'); DELETE from orient_wordpress.arient_ru_posts where post_status in ('draft','auto-draft'); -ALTER TABLE `rainlab_blog_posts` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, CHANGE `slug` `slug` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; +ALTER TABLE `rainlab_blog_posts` CHANGE `title` `title` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL, + CHANGE `slug` `slug` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL; -INSERT INTO orient.rainlab_blog_posts (user_id,title,slug,excerpt,content_html,published_at,published,created_at,updated_at,locale,id_en) -SELECT post_author,post_title,post_name,post_excerpt,post_content,post_date,1,post_date,post_modified,'en',id from orient_wordpress.arient_2_posts; +INSERT INTO orient.rainlab_blog_posts (user_id,title,slug,excerpt,content,content_html,published_at,published, + created_at,updated_at,locale,id_en,powerseo_title,powerseo_description, + powerseo_robot_index,powerseo_robot_follow) +SELECT post_author,post_title,post_name,post_excerpt,post_content,post_content,post_date,1,post_date,post_modified,'en', + id, post_title, post_excerpt, 'index', 'nofollow' +from orient_wordpress.arient_2_posts +where post_type='post' and post_status='publish'; INSERT INTO orient.rainlab_blog_posts (user_id,title,slug,excerpt,content,content_html,published_at,published,created_at,updated_at,locale,id_en) SELECT post_author,post_title,post_name,post_excerpt,post_content,post_content,post_date,1,post_date,post_modified,'ru',id @@ -17,16 +23,16 @@ Delete FROM arient_2_posts_temp WHERE post_date <'2019-01-01' ////////////////////////////////insert featured images UPDATE rainlab_blog_posts rb -inner join iatm_2_postmeta ip on rb.id_en = ip.post_id and ip.meta_key='_thumbnail_id' -inner join arient_2_posts_temp wp on wp.ID = ip.meta_value -set rb.featerd_image = wp.guid + inner join iatm_orient_2_postmeta ip on rb.id_en = ip.post_id and ip.meta_key='_thumbnail_id' + inner join iatm_orient_2_posts wp on wp.ID = ip.meta_value + set rb.featured_image = REPLACE(wp.guid,'https://orient.tm/en/wp-content/uploads/sites/2/','/en/') ALTER TABLE `rainlab_blog_posts` CHANGE `featured_image` `featured_image` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL; UPDATE rainlab_blog_posts rb inner join orient_wordpress.iatm_orient_postmeta ip on rb.id_ru = ip.post_id and ip.meta_key='_thumbnail_id' inner join orient_wordpress.arient_ru_posts wp on wp.ID = ip.meta_value - set rb.featured_image = REPLACE(wp.guid,'https://orient.tm/en/wp-content/','') + set rb.featured_image = REPLACE(wp.guid,'https://orient.tm/en/wp-content/','/ru/') ////////////// replace image address UPDATE rainlab_blog_posts set featured_image = REPLACE(featured_image,'https://orient.tm/en/wp-content/','') where featured_image !=''