Browse Source

Can edit the bio

User can edit their bio from admin panel.
pull/31/merge
Danang Probo Sayekti 12 years ago
parent
commit
a2e96a7b51
15 changed files with 102 additions and 19 deletions
  1. +2
    -1
      admin/action/create_page.php
  2. +2
    -1
      admin/action/create_post.php
  3. +3
    -1
      admin/action/delete_page.php
  4. +3
    -1
      admin/action/delete_post.php
  5. +85
    -0
      admin/action/edit_bio.php
  6. +2
    -0
      admin/action/edit_page.php
  7. +2
    -0
      admin/action/edit_post.php
  8. +2
    -1
      admin/index.php
  9. +0
    -1
      content/.htaccess
  10. +0
    -3
      content/admin/author.md
  11. +0
    -3
      content/admin/blog/2014-01-01_general_welcome.md
  12. +0
    -3
      content/static/about.md
  13. +0
    -3
      content/static/contact.md
  14. +0
    -1
      content/static/readme.txt
  15. +1
    -0
      robots.txt

+ 2
- 1
admin/action/create_page.php View File

@ -42,7 +42,8 @@
<div class="nav">
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/edit_bio.php">Edit bio</a> |
<a href="../action/logout.php">Logout</a> |
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
</div>


+ 2
- 1
admin/action/create_post.php View File

@ -45,7 +45,8 @@
<div class="nav">
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
<a href="../action/create_page.php">Create page</a> |
<a href="../action/create_page.php">Create page</a> |
<a href="../action/edit_bio.php">Edit bio</a> |
<a href="../action/logout.php">Logout</a> |
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
</div>


+ 3
- 1
admin/action/delete_page.php View File

@ -41,7 +41,9 @@
<div class="nav">
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/create_page.php">Create page</a> |
<a href="../action/edit_bio.php">Edit bio</a> |
<a href="../action/logout.php">Logout</a> |
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
</div>


+ 3
- 1
admin/action/delete_post.php View File

@ -41,7 +41,9 @@
<div class="nav">
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/create_page.php">Create page</a> |
<a href="../action/edit_bio.php">Edit bio</a> |
<a href="../action/logout.php">Logout</a> |
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
</div>


+ 85
- 0
admin/action/edit_bio.php View File

@ -0,0 +1,85 @@
<?php
// Change this to your timezone
date_default_timezone_set('Asia/Jakarta');
require '../../system/includes/dispatch.php';
config('source', '../../admin/config.ini');
include '../includes/session.php';
if(isset($_SESSION['user'])) {
$user = $_SESSION['user'];
}
else {
header('location: ../index.php');
}
$filename = '../../content/' . $user . '/author.md';
if(isset($_POST['submit'])) {
$bio_content = $_POST['content'];
}
if(!empty($bio_content)) {
$dir = '../../content/' . $user. '/';
if(is_dir($dir)) {
file_put_contents($dir . $filename, print_r($bio_content, true));
}
else {
mkdir($dir, 0777, true);
file_put_contents($dir . $filename, print_r($bio_content, true));
}
header('location: ../index.php');
}
if (login()) {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no" />
<title>Edit post</title>
<link rel="stylesheet" type="text/css" href="../resources/style.css" />
<link rel="stylesheet" type="text/css" href="../editor/css/editor.css" />
<script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script>
<script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script>
<script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script>
</head>
<body>
<div class="wrapper-outer">
<div class="wrapper-inner">
<div class="nav">
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/create_page.php">Create page</a> |
<a href="../action/logout.php">Logout</a> |
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
</div>
<div class="wmd-panel">
<form method="POST">
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php if(file_exists($filename)) { echo file_get_contents($filename);} ?></textarea><br>
<input type="submit" name="submit" value="Submit"/>
</form>
</div>
<div id="wmd-preview" class="wmd-panel wmd-preview"></div>
<script type="text/javascript">
(function () {
var converter = Markdown.getSanitizingConverter();
converter.hooks.chain("preBlockGamut", function (text, rbg) {
return text.replace(/^ {0,3}""" *\n((?:.*?\n)+?) {0,3}""" *$/gm, function (whole, inner) {
return "<blockquote>" + rbg(inner) + "</blockquote>\n";
});
});
var editor = new Markdown.Editor(converter);
editor.run();
})();
</script>
</div>
</div>
</body>
</html>
<?php } else {header('location: ../index.php');} ?>

+ 2
- 0
admin/action/edit_page.php View File

@ -42,6 +42,8 @@
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/create_page.php">Create page</a> |
<a href="../action/edit_bio.php">Edit bio</a> |
<a href="../action/logout.php">Logout</a> |
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
</div>


+ 2
- 0
admin/action/edit_post.php View File

@ -42,6 +42,8 @@
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
<a href="../action/create_post.php">Create post</a> |
<a href="../action/create_page.php">Create page</a> |
<a href="../action/edit_bio.php">Edit bio</a> |
<a href="../action/logout.php">Logout</a> |
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
</div>


+ 2
- 1
admin/index.php View File

@ -24,7 +24,8 @@
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
<a href="action/create_post.php">Create post</a> |
<a href="action/create_page.php">Create page</a> |
<a href="action/create_page.php">Create page</a> |
<a href="action/edit_bio.php">Edit bio</a> |
<a href="action/logout.php">Logout</a> |
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
</div>


+ 0
- 1
content/.htaccess View File

@ -1 +0,0 @@
deny from all

+ 0
- 3
content/admin/author.md View File

@ -1,3 +0,0 @@
# Administrator #
I'm this blog administrator.

+ 0
- 3
content/admin/blog/2014-01-01_general_welcome.md View File

@ -1,3 +0,0 @@
# Welcome #
Welcome to Example.com.

+ 0
- 3
content/static/about.md View File

@ -1,3 +0,0 @@
# About
About this blog.

+ 0
- 3
content/static/contact.md View File

@ -1,3 +0,0 @@
# Contact
Contact blog owner at contact@example.com.

+ 0
- 1
content/static/readme.txt View File

@ -1 +0,0 @@
Put your static content here.

+ 1
- 0
robots.txt View File

@ -19,6 +19,7 @@
User-agent: *
Crawl-delay: 10
# Directories
Disallow: /admin/
Disallow: /content/
Disallow: /system/
Disallow: /themes/


Loading…
Cancel
Save