Skip to content

Commit

Permalink
Set contact info in system config
Browse files Browse the repository at this point in the history
  • Loading branch information
kutaloweb committed Sep 6, 2018
1 parent 9370a88 commit f30d1f2
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"page_length" => 50,
"company_name" => "Spala",
"company_description" => "A modern lightweight CMS for Laravel and Vue developers",
"contact_info" => "",
"reset_password_token_lifetime" => 30,
"lock_screen" => 0,
"lock_screen_timeout" => 60,
Expand Down Expand Up @@ -40,6 +41,7 @@
"page_length",
"company_name",
"company_description",
"contact_info",
"maintenance_mode",
"reset_password",
"registration",
Expand Down
12 changes: 12 additions & 0 deletions resources/assets/js/views/configuration/system/System.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@
</show-error>
</div>
</div>
<div class="col-12 col-md-6">
<div class="form-group">
<label>{{ trans('configuration.contact_info') }}</label>
<input class="form-control" type="text" value=""
v-model="configForm.contact_info" name="contact_info"
:placeholder="trans('configuration.contact_info')">
<show-error :form-name="configForm"
prop-name="contact_info">
</show-error>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-6">
Expand Down Expand Up @@ -240,6 +251,7 @@
footer_credit: '',
company_name: '',
company_description: '',
contact_info: '',
facebook_group: '',
https: 0,
multilingual: 0,
Expand Down
24 changes: 24 additions & 0 deletions resources/assets/js/views/page/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
},
methods: {
submit() {
this.pageForm.body = this.cleanHTML(this.pageForm.body);
this.pageForm.body = this.addAttributes(this.pageForm.body);
this.pageForm.post('/api/page/new')
.then(response => {
Expand All @@ -89,6 +90,29 @@
helper.showErrorMsg(error);
})
},
cleanHTML(bodyHtml) {
let stringStripper = /(\n|\r| class=(")?Mso[a-zA-Z]+(")?)/g;
let output = bodyHtml.replace(stringStripper, ' ');
let commentStripper = new RegExp('<!--(.*?)-->', 'g');
output = output.replace(commentStripper, '');
let allowedTags = [
'<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<p>', '<br>', '<blockquote>', '<code>',
'<ul>', '<ol>', '<li>', '<b>', '<strong>', '<i>', '<u>', '<a>', '<img>', '<iframe>', '<hr>'
];
allowedTags = (((allowedTags||'') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('');
let tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;
output = output.replace(tags, function($0, $1) {
return allowedTags.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''
});
let badAttributes = ['style', 'class', 'align'];
for (let i = 0; i < badAttributes.length; i++) {
let attributeStripper = new RegExp(' ' + badAttributes[i] + '="(.*?)"', 'gi');
output = output.replace(attributeStripper, '');
}
output = output.replace(/[&]nbsp[;]/gi," ");
return output;
},
addAttributes(bodyHtml) {
bodyHtml = bodyHtml.replace(new RegExp('<a href', 'g'), '<a target="_blank" rel="nofollow" href');
bodyHtml = bodyHtml.replace(new RegExp('<img src', 'g'), '<img class="img-fluid" src');
Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/views/page/View.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
</a>
</div>
<div class="text-muted card-caps mt-3 mb-1">{{ trans('general.contact_info') }}</div>
<b>{{ getConfig('contact_info') }}</b>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/views/post/View.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</a>
</div>
<div class="text-muted card-caps mt-3 mb-1">{{ trans('general.contact_info') }}</div>
<b>{{ getConfig('contact_info') }}</b>
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions resources/assets/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2671,4 +2671,8 @@ samp {

.topbar ul.dropdown-user li.divider {
margin: 0;
}

.modal {
top: 50px;
}
1 change: 1 addition & 0 deletions resources/lang/en/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'https' => 'HTTPS',
'config_image_removed' => 'Image removed.',
'config_image_uploaded' => 'Image uploaded.',
'contact_info' => 'Contact Info',
'maintenance_mode' => 'Maintenance Mode',
'maintenance_mode_message' => 'Maintenance Mode Message',
'multilingual' => 'Multilingual',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/ru/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'https' => 'HTTPS',
'config_image_removed' => 'Изображение удалено.',
'config_image_uploaded' => 'Изображение загружено.',
'contact_info' => 'Контакты',
'maintenance_mode' => 'Сайт временно недоступен',
'maintenance_mode_message' => 'Сообщение о технических работах',
'multilingual' => 'Мультиязычный сайт',
Expand Down

0 comments on commit f30d1f2

Please sign in to comment.