-
Notifications
You must be signed in to change notification settings - Fork 0
/
site_settings.php
166 lines (159 loc) · 7.47 KB
/
site_settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<link rel="stylesheet" href="assets/wysiwyg/css/froala_editor.css">
<link rel="stylesheet" href="assets/wysiwyg/css/froala_style.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/code_view.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/draggable.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/colors.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/emoticons.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/image_manager.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/image.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/line_breaker.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/table.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/char_counter.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/video.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/fullscreen.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/file.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/quick_insert.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/help.css">
<link rel="stylesheet" href="assets/wysiwyg/css/third_party/spell_checker.css">
<link rel="stylesheet" href="assets/wysiwyg/css/plugins/special_characters.css">
<script type="text/javascript" src="assets/wysiwyg/js/froala_editor.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/align.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/char_counter.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/code_beautifier.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/code_view.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/colors.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/draggable.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/emoticons.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/entities.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/file.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/font_size.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/font_family.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/fullscreen.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/image.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/image_manager.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/line_breaker.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/inline_style.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/link.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/lists.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/paragraph_format.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/paragraph_style.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/quick_insert.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/quote.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/table.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/save.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/url.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/video.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/help.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/print.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/third_party/spell_checker.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/special_characters.min.js"></script>
<script type="text/javascript" src="assets/wysiwyg/js/plugins/word_paste.min.js"></script>
<?php
include 'db_connect.php';
$qry = $conn->query("SELECT * from system_settings limit 1");
if($qry->num_rows > 0){
foreach($qry->fetch_array() as $k => $val){
$meta[$k] = $val;
}
}
?>
<div class="container-fluid">
<div class="card col-lg-12">
<div class="card-body">
<form action="" id="manage-settings">
<div class="form-group">
<label for="name" class="control-label">System Name</label>
<input type="text" class="form-control" id="name" name="name" value="<?php echo isset($meta['name']) ? $meta['name'] : '' ?>" required>
</div>
<div class="form-group">
<label for="email" class="control-label">Email</label>
<input type="email" class="form-control" id="email" name="email" value="<?php echo isset($meta['email']) ? $meta['email'] : '' ?>" required>
</div>
<div class="form-group">
<label for="contact" class="control-label">Contact</label>
<input type="text" class="form-control" id="contact" name="contact" value="<?php echo isset($meta['contact']) ? $meta['contact'] : '' ?>" required>
</div>
<div class="form-group">
<label for="about" class="control-label">About Content</label>
<textarea name="about" class="text-jqte" id="page_content"><?php echo isset($meta['about_content']) ? $meta['about_content'] : '' ?></textarea>
</div>
<div class="form-group">
<label for="" class="control-label">Image</label>
<input type="file" class="form-control" name="img" onchange="displayImg(this,$(this))">
</div>
<div class="form-group">
<img src="<?php echo isset($meta['cover_img']) ? 'assets/uploads/'.$meta['cover_img'] :'' ?>" alt="" id="cimg">
</div>
<center>
<button class="btn btn-info btn-primary btn-block col-md-2">Save</button>
</center>
</form>
</div>
</div>
<style>
img#cimg{
max-height: 10vh;
max-width: 6vw;
}
</style>
<script>
function displayImg(input,_this) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cimg').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
(function () {
const editorInstance = new FroalaEditor('#page_content',{
heightMin:'40vh',
imageUploadParam: 'img',
imageUploadURL: 'ajax.php?action=save_page_img',
imageUploadParams: {},
imageUploadMethod: 'POST',
imageMaxSize: 5 * 1024 * 1024,
imageAllowedTypes: ['jpeg', 'jpg', 'png'],
events: {
'image.beforeUpload': function (images) {
start_load()
},
'image.uploaded': function (response) {
end_load()
},
'image.replaced': function ($img, response) {
// Image was replaced in the editor.
console.log($img,response)
},
}
})
})()
$('#manage-settings').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:'ajax.php?action=save_settings',
data: new FormData($(this)[0]),
cache: false,
contentType: false,
processData: false,
method: 'POST',
type: 'POST',
error:err=>{
console.log(err)
},
success:function(resp){
if(resp == 1){
alert_toast('Data successfully saved.','success')
setTimeout(function(){
location.reload()
},1000)
}
}
})
})
</script>
<style>
</style>
</div>