From 4e27072496ab3e1a4e7c21e3535d212a67ac94fd Mon Sep 17 00:00:00 2001 From: Danang Probo Sayekti Date: Mon, 27 Jan 2014 07:11:47 +0700 Subject: [PATCH] Use traditional title Use traditional input for title. --- admin/action/create_page.php | 6 ++++-- admin/action/create_post.php | 6 ++++-- admin/action/edit_bio.php | 19 ++++++++++++++++--- admin/action/edit_page.php | 19 ++++++++++++++++--- admin/action/edit_post.php | 19 ++++++++++++++++--- system/includes/functions.php | 20 ++++++++++---------- 6 files changed, 66 insertions(+), 23 deletions(-) diff --git a/admin/action/create_page.php b/admin/action/create_page.php index f9d7bda..dabd686 100644 --- a/admin/action/create_page.php +++ b/admin/action/create_page.php @@ -6,11 +6,12 @@ include '../includes/session.php'; if(isset($_POST['submit'])) { + $post_title = $_POST['title']; $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['url']); $post_url = rtrim($post_url, ',\.\-'); - $post_content = $_POST['content']; + $post_content = '' . "\n\n" . $_POST['content']; } - if(!empty($post_url) && !empty($post_content)) { + if(!empty($post_title) && !empty($post_url) && !empty($post_content)) { if(get_magic_quotes_gpc()) { $post_content = stripslashes($post_content); } @@ -53,6 +54,7 @@
+ Title:


Url:



diff --git a/admin/action/create_post.php b/admin/action/create_post.php index 004cd91..8457a2a 100644 --- a/admin/action/create_post.php +++ b/admin/action/create_post.php @@ -7,13 +7,14 @@ if(isset($_POST['submit'])) { $post_date = date('Y-m-d-H-i'); + $post_title = $_POST['title']; $post_tag = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['tag']); $post_tag = rtrim($post_tag, ',\.\-'); $post_url = preg_replace('/[^A-Za-z0-9,.-]/u', '', $_POST['url']); $post_url = rtrim($post_url, ',\.\-'); - $post_content = $_POST['content']; + $post_content = '' . "\n\n" . $_POST['content']; } - if(!empty($post_tag) && !empty($post_url) && !empty($post_content)) { + if(!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) { if(get_magic_quotes_gpc()) { $post_content = stripslashes($post_content); } @@ -57,6 +58,7 @@
+ Title:


Tag:


Url:


diff --git a/admin/action/edit_bio.php b/admin/action/edit_bio.php index 9d7f715..688442f 100644 --- a/admin/action/edit_bio.php +++ b/admin/action/edit_bio.php @@ -14,10 +14,22 @@ $filename = '../../content/' . $user . '/author.md'; + $content = file_get_contents($filename); + $arr = explode('t-->', $content); + if(isset($arr[1])) { + $oldtitle = ltrim(rtrim(str_replace('' . "\n\n" . $_POST['content']; } - if(!empty($bio_content)) { + if(!empty($bio_title) && !empty($bio_content)) { if(get_magic_quotes_gpc()) { $bio_content = stripslashes($bio_content); } @@ -60,8 +72,9 @@
+ Title:


-
+
diff --git a/admin/action/edit_page.php b/admin/action/edit_page.php index e1a1e23..4145bc7 100644 --- a/admin/action/edit_page.php +++ b/admin/action/edit_page.php @@ -12,16 +12,28 @@ header('location: ../index.php'); } + $content = file_get_contents($url); + $arr = explode('t-->', $content); + if(isset($arr[1])) { + $oldtitle = ltrim(rtrim(str_replace('' . "\n\n" . $_POST['content']; } - if(!empty($post_url) && !empty($post_content)) { + if(!empty($post_title) && !empty($post_url) && !empty($post_content)) { if(get_magic_quotes_gpc()) { $post_content = stripslashes($post_content); } @@ -65,9 +77,10 @@
+ Title:


Url:


-
+
diff --git a/admin/action/edit_post.php b/admin/action/edit_post.php index 7874b7d..812121a 100644 --- a/admin/action/edit_post.php +++ b/admin/action/edit_post.php @@ -12,6 +12,17 @@ header('location: ../index.php'); } + $content = file_get_contents($url); + $arr = explode('t-->', $content); + if(isset($arr[1])) { + $oldtitle = ltrim(rtrim(str_replace('' . "\n\n" . $_POST['content']; } - if(!empty($post_tag) && !empty($post_url) && !empty($post_content)) { + if(!empty($post_title) && !empty($post_tag) && !empty($post_url) && !empty($post_content)) { if(get_magic_quotes_gpc()) { $post_content = stripslashes($post_content); } @@ -71,10 +83,11 @@
+ Title:


Tag:


Url:


-
+
diff --git a/system/includes/functions.php b/system/includes/functions.php index 3f348b5..829569e 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -156,13 +156,13 @@ function get_posts($posts, $page = 1, $perpage = 0){ $content = MarkdownExtra::defaultTransform(file_get_contents($filepath)); // Extract the title and body - $arr = explode('', $content); + $arr = explode('t-->', $content); if(isset($arr[1])) { - $post->title = str_replace('

','',$arr[0]); + $post->title = str_replace('', $content); if(isset($arr[1])) { - $post->title = str_replace('

','',$arr[0]); + $post->title = str_replace('', $content); if(isset($arr[1])) { - $post->title = str_replace('

','',$arr[0]); + $post->title = str_replace('', $content); if(isset($arr[1])) { - $post->title = str_replace('

','',$arr[0]); + $post->title = str_replace('