mirror of
https://github.com/danpros/htmly.git
synced 2026-04-21 13:06:22 +05:30
Add category
Add category feature to the core.
This commit is contained in:
parent
eb2e5320e4
commit
a4b6fe18db
26 changed files with 1282 additions and 159 deletions
|
|
@ -9,6 +9,9 @@
|
|||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$desc = get_category_info(null);
|
||||
?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
|
|
@ -18,6 +21,14 @@
|
|||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
|
|||
57
system/admin/views/add-category.html.php
Normal file
57
system/admin/views/add-category.html.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<script src="<?php echo site_url() ?>system/resources/js/jquery.min.js"></script>
|
||||
<script src="<?php echo site_url() ?>system/resources/js/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="<?php echo site_url() ?>system/resources/css/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span><br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" class="text" name="url" value="<?php if (isset($postUrl)) {
|
||||
echo $postUrl;
|
||||
} ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the page title.</span><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" rows="3" cols="20"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} ?></textarea>
|
||||
<br><br>
|
||||
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php if (isset($postContent)) {
|
||||
echo $postContent;
|
||||
} ?></textarea><br/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="submit" class="submit" value="Add category"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<!-- Declare the base path. Important -->
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>';</script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/image.js"></script>
|
||||
|
|
@ -9,6 +9,9 @@
|
|||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$desc = get_category_info(null);
|
||||
?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
|
|
@ -18,6 +21,14 @@
|
|||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$desc = get_category_info(null);
|
||||
?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
|
|
@ -18,6 +21,14 @@
|
|||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$desc = get_category_info(null);
|
||||
?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
|
|
@ -18,6 +21,14 @@
|
|||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$desc = get_category_info(null);
|
||||
?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
|
|
@ -18,6 +21,14 @@
|
|||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$desc = get_category_info(null);
|
||||
?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTitle)) {
|
||||
|
|
@ -18,6 +21,14 @@
|
|||
} ?>" name="title" value="<?php if (isset($postTitle)) {
|
||||
echo $postTitle;
|
||||
} ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
|
|||
21
system/admin/views/categories.html.php
Normal file
21
system/admin/views/categories.html.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
$desc = get_category_info(null);
|
||||
?>
|
||||
|
||||
<a href="<?php echo site_url();?>add/category">Add category</a>
|
||||
<table class="category-list">
|
||||
<tr class="head">
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Contents</th>
|
||||
<th>Operations</th>
|
||||
</tr>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<tr>
|
||||
<td><a href="<?php echo $d->url;?>" target="_blank"><?php echo $d->title;?></a></td>
|
||||
<td><?php echo $d->body;?></td>
|
||||
<td><?php $total = get_draftcount($d->md) + get_categorycount($d->md); echo $total?></td>
|
||||
<td><a href="<?php echo $d->url;?>/edit?destination=admin/categories">Edit</a> <?php if (get_categorycount($d->md) == 0 && get_draftcount($d->md) == 0 ){echo '<a href="' . $d->url . '/delete?destination=admin/categories">Delete</a>';}?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</table>
|
||||
30
system/admin/views/delete-category.html.php
Normal file
30
system/admin/views/delete-category.html.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
if (isset($_GET['destination'])) {
|
||||
$destination = $_GET['destination'];
|
||||
}
|
||||
$url = $p->file;
|
||||
|
||||
$dir = substr($url, 0, strrpos($url, '/'));
|
||||
$oldurl = str_replace($dir . '/', '', $url);
|
||||
$oldmd = str_replace('.md', '', $oldurl);
|
||||
|
||||
$post = $p->url;
|
||||
|
||||
if (isset($destination)) {
|
||||
|
||||
if ($destination == 'post') {
|
||||
$back = $post;
|
||||
} else {
|
||||
$back = site_url() . $destination;
|
||||
}
|
||||
} else {
|
||||
$back = site_url();
|
||||
}
|
||||
?>
|
||||
<p>Are you sure want to delete <strong><?php echo $p->title; ?></strong>?</p>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="file" value="<?php echo $p->file ?>"/><br>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="submit" value="Delete"/>
|
||||
<span><a href="<?php echo $back ?>">Cancel</a></span>
|
||||
</form>
|
||||
|
|
@ -5,6 +5,8 @@ if (isset($p->file)) {
|
|||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$desc = get_category_info(null);
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
|
|
@ -28,6 +30,11 @@ if (isset($_GET['destination'])) {
|
|||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
|
||||
// Category string
|
||||
$cat = explode('/', $replaced);
|
||||
$category = $cat[count($cat) - 3];
|
||||
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
|
|
@ -61,6 +68,14 @@ if (config('permalink.type') == 'post') {
|
|||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
@ -89,7 +104,7 @@ if (config('permalink.type') == 'post') {
|
|||
<input type="hidden" name="is_audio" class="text" value="is_audio"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<?php if ($isdraft[4] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
|
|
|
|||
86
system/admin/views/edit-category.html.php
Normal file
86
system/admin/views/edit-category.html.php
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
if (isset($p->file)) {
|
||||
$url = $p->file;
|
||||
} else {
|
||||
$url = $oldfile;
|
||||
}
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
$oldcontent = remove_html_comments($content);
|
||||
|
||||
if (isset($_GET['destination'])) {
|
||||
$destination = $_GET['destination'];
|
||||
} else {
|
||||
$destination = 'admin';
|
||||
}
|
||||
$dir = substr($url, 0, strrpos($url, '/'));
|
||||
$oldurl = str_replace($dir . '/', '', $url);
|
||||
$oldmd = str_replace('.md', '', $oldurl);
|
||||
|
||||
if (isset($p->url)) {
|
||||
$delete = $p->url . '/delete?destination=' . $destination;
|
||||
}
|
||||
else {
|
||||
if(empty($sub)) {
|
||||
$delete = site_url() . $oldmd . '/delete?destination=' . $destination;
|
||||
}
|
||||
else {
|
||||
$delete = site_url() . $static .'/'. $sub . '/delete?destination=' . $destination;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo site_url() ?>system/admin/editor/css/editor.css"/>
|
||||
<script src="<?php echo site_url() ?>system/resources/js/jquery.min.js"></script>
|
||||
<script src="<?php echo site_url() ?>system/resources/js/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Converter.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Sanitizer.js"></script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/Markdown.Editor.js"></script>
|
||||
<link rel="stylesheet" href="<?php echo site_url() ?>system/resources/css/jquery-ui.css">
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/jquery.ajaxfileupload.js"></script>
|
||||
<?php if (isset($error)) { ?>
|
||||
<div class="error-message"><?php echo $error ?></div>
|
||||
<?php } ?>
|
||||
<div class="wmd-panel">
|
||||
<form method="POST">
|
||||
Title <span class="required">*</span><br><input type="text" name="title"
|
||||
class="text <?php if (isset($postTitle)) {
|
||||
if (empty($postTitle)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Url (optional)<br><input type="text" name="url" class="text" value="<?php echo $oldmd ?>"/><br>
|
||||
<span class="help">If the url leave empty we will use the page title.</span><br><br>
|
||||
Meta Description (optional)<br><textarea name="description" rows="3" cols="20"><?php if (isset($p->description)) {
|
||||
echo $p->description;
|
||||
} else {echo $olddescription;}?></textarea>
|
||||
<br><br>
|
||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||
<textarea id="wmd-input" class="wmd-input <?php if (isset($postContent)) {
|
||||
if (empty($postContent)) {
|
||||
echo 'error';
|
||||
}
|
||||
} ?>" name="content" cols="20" rows="10"><?php echo $oldcontent ?></textarea><br>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<input type="submit" name="submit" class="submit" value="Save category"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="insertImageDialog" title="Insert Image">
|
||||
<h4>URL</h4>
|
||||
<input type="text" placeholder="Enter image URL" />
|
||||
<h4>Upload</h4>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="file" id="file" />
|
||||
</form>
|
||||
<style>
|
||||
#insertImageDialog { display:none; padding: 10px; font-size:12px;}
|
||||
.wmd-prompt-background {z-index:10!important;}
|
||||
</style>
|
||||
</div>
|
||||
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
|
||||
<!-- Declare the base path. Important -->
|
||||
<script type="text/javascript">var base_path = '<?php echo site_url() ?>';</script>
|
||||
<script type="text/javascript" src="<?php echo site_url() ?>system/admin/editor/js/image.js"></script>
|
||||
|
|
@ -5,6 +5,8 @@ if (isset($p->file)) {
|
|||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$desc = get_category_info(null);
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
|
|
@ -28,6 +30,11 @@ if (isset($_GET['destination'])) {
|
|||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
|
||||
// Category string
|
||||
$cat = explode('/', $replaced);
|
||||
$category = $cat[count($cat) - 3];
|
||||
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
|
|
@ -61,6 +68,14 @@ if (config('permalink.type') == 'post') {
|
|||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
@ -89,7 +104,7 @@ if (config('permalink.type') == 'post') {
|
|||
<input type="hidden" name="is_image" class="text" value="is_image"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<?php if ($isdraft[4] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ if (isset($p->file)) {
|
|||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$desc = get_category_info(null);
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
|
|
@ -28,6 +30,11 @@ if (isset($_GET['destination'])) {
|
|||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
|
||||
// Category string
|
||||
$cat = explode('/', $replaced);
|
||||
$category = $cat[count($cat) - 3];
|
||||
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
|
|
@ -62,6 +69,14 @@ if (config('permalink.type') == 'post') {
|
|||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
@ -90,7 +105,7 @@ if (config('permalink.type') == 'post') {
|
|||
<input type="hidden" name="is_link" class="text" value="is_link"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<?php if ($isdraft[4] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ if (isset($p->file)) {
|
|||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$desc = get_category_info(null);
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
|
|
@ -27,6 +29,11 @@ if (isset($_GET['destination'])) {
|
|||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
|
||||
// Category string
|
||||
$cat = explode('/', $replaced);
|
||||
$category = $cat[count($cat) - 3];
|
||||
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
|
|
@ -61,6 +68,14 @@ if (config('permalink.type') == 'post') {
|
|||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
@ -84,7 +99,7 @@ if (config('permalink.type') == 'post') {
|
|||
<input type="hidden" name="is_post" class="text" value="is_post"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<?php if ($isdraft[4] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ if (isset($p->file)) {
|
|||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$desc = get_category_info(null);
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
|
|
@ -28,6 +30,11 @@ if (isset($_GET['destination'])) {
|
|||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
|
||||
// Category string
|
||||
$cat = explode('/', $replaced);
|
||||
$category = $cat[count($cat) - 3];
|
||||
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
|
|
@ -62,6 +69,14 @@ if (config('permalink.type') == 'post') {
|
|||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
@ -90,7 +105,7 @@ if (config('permalink.type') == 'post') {
|
|||
<input type="hidden" name="is_quote" class="text" value="is_quote"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<?php if ($isdraft[4] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ if (isset($p->file)) {
|
|||
$url = $oldfile;
|
||||
}
|
||||
|
||||
$desc = get_category_info(null);
|
||||
|
||||
$content = file_get_contents($url);
|
||||
$oldtitle = get_content_tag('t', $content, 'Untitled');
|
||||
$olddescription = get_content_tag('d', $content);
|
||||
|
|
@ -29,6 +31,11 @@ if (isset($_GET['destination'])) {
|
|||
$destination = 'admin';
|
||||
}
|
||||
$replaced = substr($oldurl[0], 0, strrpos($oldurl[0], '/')) . '/';
|
||||
|
||||
// Category string
|
||||
$cat = explode('/', $replaced);
|
||||
$category = $cat[count($cat) - 3];
|
||||
|
||||
$dt = str_replace($replaced, '', $oldurl[0]);
|
||||
$t = str_replace('-', '', $dt);
|
||||
$time = new DateTime($t);
|
||||
|
|
@ -63,6 +70,14 @@ if (config('permalink.type') == 'post') {
|
|||
echo 'error';
|
||||
}
|
||||
} ?>" value="<?php echo $oldtitle ?>"/><br><br>
|
||||
Category <span class="required">*</span> <br>
|
||||
<select name="category">
|
||||
<option value="uncategorized">Uncategorized</option>
|
||||
<?php foreach ($desc as $d):?>
|
||||
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<br><br>
|
||||
Tag <span class="required">*</span> <br><input type="text" name="tag" class="text <?php if (isset($postTag)) {
|
||||
if (empty($postTag)) {
|
||||
echo 'error';
|
||||
|
|
@ -91,7 +106,7 @@ if (config('permalink.type') == 'post') {
|
|||
<input type="hidden" name="is_video" class="text" value="is_video"/>
|
||||
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
|
||||
<input type="hidden" name="csrf_token" value="<?php echo get_csrf() ?>">
|
||||
<?php if ($isdraft[2] == 'draft') { ?>
|
||||
<?php if ($isdraft[4] == 'draft') { ?>
|
||||
<input type="submit" name="publishdraft" class="submit" value="Publish draft"/> <input type="submit" name="updatedraft" class="draft" value="Update draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
<?php } else { ?>
|
||||
<input type="submit" name="updatepost" class="submit" value="Update post"/> <input type="submit" name="revertpost" class="revert" value="Revert to draft"/> <a href="<?php echo $delete ?>">Delete</a>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue