From 6ac3aec1e909f5cfee29cefc8580aad371818d23 Mon Sep 17 00:00:00 2001
From: Kim Keown <kimkeown@users.noreply.github.com>
Date: Tue, 25 Oct 2016 05:34:17 -0600
Subject: [PATCH] Revise edit-post.php - Admin folder rename

Add variable in bl-kernel/boot/init.php that allows User to rename bl-kernel/admin folder.
User can then define variable in bl-kernel/boot/init.php and change the foldername itself to effect the rename.

Add global $adminfolder variable as necessary and replace relevant 'admin' strings with $adminfolder.
Applies to most of the files in bl-kernel/admin/controllers.

Line 15- Reference Admin folder variable within function
	       global $adminfolder;

Line 30 - Replace Admin string with folder variable:
		Redirect::page($adminfolder, 'edit-post/'.$args['slug']);
Original: 	Redirect::page('admin', 'edit-post/'.$args['slug']);

Line 44- Reference Admin folder variable within function
	      global $adminfolder;

Line 55 - Replace Admin string with folder variable:
		Redirect::page($adminfolder, 'manage-posts');
Original: 	Redirect::page('admin', 'manage-posts');

Line 85- Reference Admin folder variable
              global $adminfolder;

Line 90 - Replace Admin string with folder variable:
	Redirect::page('admin', 'manage-posts');
Original: 	Redirect::page('admin', 'manage-pages');
---
 bl-kernel/admin/controllers/edit-post.php | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/bl-kernel/admin/controllers/edit-post.php b/bl-kernel/admin/controllers/edit-post.php
index d4f4b9b3..92594bbf 100644
--- a/bl-kernel/admin/controllers/edit-post.php
+++ b/bl-kernel/admin/controllers/edit-post.php
@@ -12,7 +12,8 @@ function editPost($args)
 {
 	global $dbPosts;
 	global $Language;
-
+	global $adminfolder;
+	
 	// Add the page, if the $key is FALSE the creation of the post failure.
 	$key = $dbPosts->edit($args);
 
@@ -26,7 +27,7 @@ function editPost($args)
 
 		// Alert the user
 		Alert::set($Language->g('The changes have been saved'));
-		Redirect::page('admin', 'edit-post/'.$args['slug']);
+		Redirect::page($adminfolder, 'edit-post/'.$args['slug']);
 	}
 	else
 	{
@@ -40,7 +41,8 @@ function deletePost($key)
 {
 	global $dbPosts;
 	global $Language;
-
+	global $adminfolder;
+	
 	if( $dbPosts->delete($key) )
 	{
 		// Reindex tags, this function is in 70.posts.php
@@ -50,7 +52,7 @@ function deletePost($key)
 		Theme::plugins('afterPostDelete');
 
 		Alert::set($Language->g('The post has been deleted successfully'));
-		Redirect::page('admin', 'manage-posts');
+		Redirect::page($adminfolder, 'manage-posts');
 	}
 	else
 	{
@@ -80,6 +82,8 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' )
 // Main after POST
 // ============================================================================
 
+global $adminfolder;
+
 if(!$dbPosts->postExists($layout['parameters']))
 {
 	Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the post: '.$layout['parameters']);