-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathedit-post.php
More file actions
executable file
·203 lines (172 loc) · 9.85 KB
/
edit-post.php
File metadata and controls
executable file
·203 lines (172 loc) · 9.85 KB
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?php if (!defined('SCRIPTLOG')) {
exit();
} ?>
<div class="content-wrapper">
<section class="content-header">
<h1><?= (isset($pageTitle)) ? $pageTitle : ""; ?>
<small>Control Panel</small>
</h1>
<ol class="breadcrumb">
<li><a href="index.php?load=dashboard"><i class="fa fa-dashboard" aria-hidden="true"></i>Home </a></li>
<li><a href="index.php?load=posts">Posts </a></li>
<li class="active"> <?= (isset($pageTitle)) ? $pageTitle : " "; ?></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-8">
<!-- general form elements -->
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Post Content</h3>
</div>
<!-- /.box-header -->
<?php
if (isset($errors)) :
?>
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">×</button>
<h4><i class="icon fa fa-warning" aria-hidden="true"></i> Invalid Form Data!</h4>
<?php
foreach ($errors as $e) :
echo '<p>' . $e . '</p>';
endforeach;
?>
</div>
<?php
endif;
$action = isset($formAction) ? $formAction : null;
$post_id = isset($postData['ID']) ? (int)$postData['ID'] : 0;
?>
<!-- form start -->
<form method="post" action="<?= generate_request('index.php', 'post', ['posts', $action, $post_id])['link']; ?>" enctype="multipart/form-data">
<input type="hidden" name="post_id" value="<?= $post_id; ?>" />
<input type="hidden" name="MAX_FILE_SIZE" value="<?= APP_FILE_SIZE; ?>">
<div class="box-body">
<div class="form-group">
<label for="title">Title <span class="text-red" title="required">*</span></label>
<input type="text" class="form-control" id="title" name="post_title" placeholder="Enter title here" value="<?= (isset($postData['post_title'])) ? safe_html($postData['post_title']) : ""; ?><?= (isset($formData['post_title'])) ? safe_html($formData['post_title']) : ""; ?>" maxlength="200" required aria-required="true">
</div>
<div class="form-group">
<label for="summernote">Content <span class="text-red" title="required">*</span></label>
<textarea class="form-control" id="summernote" name="post_content" rows="10" cols="80" maxlength="500000" required aria-required="true"><?= (isset($postContent) ? $postContent : ""); ?><?= (isset($formData['post_content']) ? safe_html($formData['post_content']) : ""); ?></textarea>
</div>
<div class="form-group">
<label for="meta_desc">Meta Description</label>
<textarea class="form-control" id="meta_desc" rows="3" placeholder="Brief summary for search engines..." name="post_summary" maxlength="320" aria-describedby="metaDescHelp"><?= (isset($postData['post_summary'])) ? safe_html($postData['post_summary']) : ""; ?><?= (isset($formData['post_summary'])) ? safe_html($formData['post_summary']) : ""; ?></textarea>
<p id="metaDescHelp" class="help-block">Maximum 320 characters. This summary appears in search engine results.</p>
</div>
<div class="form-group">
<label>Featured post</label>
<p class="help-block">Highlight this post as a headline or sticky content.</p>
<div class="radio">
<label for="headlines">
<input type="radio" id="headlines" name="post_headlines" class="flat-red" value="1" <?= (isset($postData['post_headlines']) && $postData['post_headlines'] === 1 ? " checked" : ""); ?> <?= (isset($formData['post_headlines']) && $formData['post_headlines'] === 1 ? " checked" : ""); ?>> Yes, make this post featured
</label>
</div>
<div class="radio">
<label for="sticky">
<input type="radio" id="sticky" name="post_headlines" class="flat-red" value="0" <?= (isset($postData['post_headlines']) && $postData['post_headlines'] === 0 ? " checked" : ""); ?> <?= (isset($formData['post_headlines']) && $formData['post_headlines'] === 0 ? " checked" : ""); ?>> No, standard post
</label>
</div>
</div>
<div class="form-group">
<label for="datetimepicker">Publication Date</label>
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar" aria-hidden="true"></i>
</div>
<input type="text" id="datetimepicker" name="<?= (isset($postData['post_modified']) ? "post_modified" : "post_date"); ?>" class="form-control" placeholder="YYYY-MM-DD HH:MM:SS" value="<?php
if (isset($postData['post_modified']) || isset($postData['post_date'])) {
if ($postData['post_modified'] === null) {
echo make_date(safe_html($postData['post_date']));
} else {
echo make_date(safe_html($postData['post_modified']));
}
}
?>">
</div>
<p class="help-block">Schedule or backdate your post if needed.</p>
</div>
<!-- /.Date -->
<?= (isset($postVisibility)) ? $postVisibility : ""; ?>
<!-- /.post-visiblity -->
<div class="form-group">
<label for="post_locale">Language</label>
<?= (isset($postLocale)) ? $postLocale : ""; ?>
<p class="help-block">Select the language for this post.</p>
</div>
</div>
<!-- /.box-body -->
</div>
<!-- /.box-primary -->
</div>
<!--/.col (left) -->
<!-- right column -->
<div class="col-md-4">
<!-- general form elements disabled -->
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">Publishing Options</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<!-- text input -->
<?= (isset($topics)) ? $topics : ""; ?>
<div class="form-group">
<label for="tags">Tags</label>
<textarea class="form-control" id="tags" rows="3" name="post_tags" maxlength="200" placeholder="e.g. news, update, tutorial" aria-describedby="tagsHelp"><?= (isset($postData['post_tags'])) ? safe_html($postData['post_tags']) : ""; ?><?= (isset($formData['post_tags'])) ? safe_html($formData['post_tags']) : ""; ?></textarea>
<div id="suggesstion-box"></div>
<p id="tagsHelp" class="help-block">Separate tags with commas or the Enter key.</p>
</div>
<?= (isset($medialibs)) ? $medialibs : "Media Not Found"; ?>
<div class="form-group">
<label for="post_status">Post status</label>
<?= (isset($postStatus)) ? $postStatus : ""; ?>
</div>
<div class="form-group">
<label for="comment_status">Comment status</label>
<?= (isset($commentStatus)) ? $commentStatus : ""; ?>
</div>
<div class="box-footer">
<input type="hidden" name="csrfToken" value="<?= (isset($csrfToken)) ? $csrfToken : ""; ?>">
<a href="index.php?load=posts" class="btn btn-default" role="button" aria-label="Cancel and return to posts list">
<i class="fa fa-times" aria-hidden="true"></i> Cancel
</a>
<button type="submit" class="btn btn-primary pull-right" name="postFormSubmit" aria-label="<?= ((isset($post_id)) && ($post_id === 0) ? "Publish Post" : "Update Post"); ?>">
<i class="fa <?= ((isset($post_id)) && ($post_id === 0) ? "fa-paper-plane" : "fa-save"); ?>" aria-hidden="true"></i>
<?= ((isset($post_id)) && ($post_id === 0) ? "Publish" : "Update"); ?>
</button>
</div>
</form>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!--/.col (right) -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<script type="text/javascript">
var loadFile = function(event) {
var output = document.getElementById('output');
output.src = URL.createObjectURL(event.target.files[0]);
};
</script>
<script>
function checkVisibilitySelection() {
a = document.getElementById("visibility.system");
if (a.value == "protected") {
document.getElementById("protected").setAttribute("style", "display:inline");
} else {
document.getElementById("protected").setAttribute("style", "display:none");
}
return a.value;
}
</script>