diff --git a/system/htmly.php b/system/htmly.php
index 5f4f91a..431cd8f 100644
--- a/system/htmly.php
+++ b/system/htmly.php
@@ -430,7 +430,7 @@ post('/add/content', function () {
$is_quote = from($_REQUEST, 'is_quote');
$is_link = from($_REQUEST, 'is_link');
$is_post = from($_REQUEST, 'is_post');
-
+
if (!empty($is_image)) {
$type = 'is_image';
} elseif (!empty($is_video)) {
@@ -467,91 +467,91 @@ post('/add/content', function () {
header("location: $add");
}
- if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
- if (!empty($url)) {
- add_content($title, $tag, $url, $content, $user, $description, null, $draft, $category, 'post');
- } else {
- $url = $title;
- add_content($title, $tag, $url, $content, $user, $description, null, $draft, $category, 'post');
- }
- } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
- if (!empty($url)) {
- add_content($title, $tag, $url, $content, $user, $description, $image, $draft, $category, 'image');
- } else {
- $url = $title;
- add_content($title, $tag, $url, $content, $user, $description, $image, $draft, $category, 'image');
- }
- } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
- if (!empty($url)) {
- add_content($title, $tag, $url, $content, $user, $description, $video, $draft, $category, 'video');
- } else {
- $url = $title;
- add_content($title, $tag, $url, $content, $user, $description, $video, $draft, $category, 'video');
- }
- } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
- if (!empty($url)) {
- add_content($title, $tag, $url, $content, $user, $description, $audio, $draft, $category, 'audio');
- } else {
- $url = $title;
- add_content($title, $tag, $url, $content, $user, $description, $audio, $draft, $category, 'audio');
- }
- } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
- if (!empty($url)) {
- add_content($title, $tag, $url, $content, $user, $description, $quote, $draft, $category, 'quote');
- } else {
- $url = $title;
- add_content($title, $tag, $url, $content, $user, $description, $quote, $draft, $category, 'quote');
- }
- } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
- if (!empty($url)) {
- add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link');
- } else {
- $url = $title;
- add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link');
- }
- } else {
- $message['error'] = '';
- if (empty($title)) {
- $message['error'] .= '
Title field is required.';
- }
- if (empty($tag)) {
- $message['error'] .= 'Tag field is required.';
- }
- if (empty($content)) {
- $message['error'] .= 'Content field is required.';
- }
- if (!$proper) {
- $message['error'] .= 'CSRF Token not correct.';
- }
-
- if (!empty($is_image)) {
- if (empty($image)) {
- $message['error'] .= 'Image field is required.';
- }
- } elseif (!empty($is_video)) {
- if (empty($video)) {
- $message['error'] .= 'Video field is required.';
- }
- } elseif (!empty($is_link)) {
- if (empty($link)) {
- $message['error'] .= 'Link field is required.';
- }
- } elseif (!empty($is_quote)) {
- if (empty($quote)) {
- $message['error'] .= 'Quote field is required.';
- }
- } elseif (!empty($is_audio)) {
- if (empty($audio)) {
- $message['error'] .= 'Audio field is required.';
- }
- }
-
- config('views.root', 'system/admin/views');
- render('add-content', array(
- 'title' => 'Add content - ' . blog_title(),
- 'description' => strip_tags(blog_description()),
- 'canonical' => site_url(),
- 'error' => '' . $message['error'] . '
',
+ if ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($is_post)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, null, $draft, $category, 'post');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, null, $draft, $category, 'post');
+ }
+ } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($image)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $image, $draft, $category, 'image');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $image, $draft, $category, 'image');
+ }
+ } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($video)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $video, $draft, $category, 'video');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $video, $draft, $category, 'video');
+ }
+ } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($audio)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $audio, $draft, $category, 'audio');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $audio, $draft, $category, 'audio');
+ }
+ } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($quote)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $quote, $draft, $category, 'quote');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $quote, $draft, $category, 'quote');
+ }
+ } elseif ($proper && !empty($title) && !empty($tag) && !empty($content) && !empty($link)) {
+ if (!empty($url)) {
+ add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link');
+ } else {
+ $url = $title;
+ add_content($title, $tag, $url, $content, $user, $description, $link, $draft, $category, 'link');
+ }
+ } else {
+ $message['error'] = '';
+ if (empty($title)) {
+ $message['error'] .= 'Title field is required.';
+ }
+ if (empty($tag)) {
+ $message['error'] .= 'Tag field is required.';
+ }
+ if (empty($content)) {
+ $message['error'] .= 'Content field is required.';
+ }
+ if (!$proper) {
+ $message['error'] .= 'CSRF Token not correct.';
+ }
+
+ if (!empty($is_image)) {
+ if (empty($image)) {
+ $message['error'] .= 'Image field is required.';
+ }
+ } elseif (!empty($is_video)) {
+ if (empty($video)) {
+ $message['error'] .= 'Video field is required.';
+ }
+ } elseif (!empty($is_link)) {
+ if (empty($link)) {
+ $message['error'] .= 'Link field is required.';
+ }
+ } elseif (!empty($is_quote)) {
+ if (empty($quote)) {
+ $message['error'] .= 'Quote field is required.';
+ }
+ } elseif (!empty($is_audio)) {
+ if (empty($audio)) {
+ $message['error'] .= 'Audio field is required.';
+ }
+ }
+
+ config('views.root', 'system/admin/views');
+ render('add-content', array(
+ 'title' => 'Add content - ' . blog_title(),
+ 'description' => strip_tags(blog_description()),
+ 'canonical' => site_url(),
+ 'error' => '' . $message['error'] . '
',
'postTitle' => $title,
'postImage' => $image,
'postVideo' => $video,
@@ -562,11 +562,11 @@ post('/add/content', function () {
'postUrl' => $url,
'postContent' => $content,
'type' => $type,
- 'is_admin' => true,
- 'bodyclass' => 'add-content',
- 'breadcrumb' => '' . config('breadcrumb.home') . ' » Add content'
- ));
- }
+ 'is_admin' => true,
+ 'bodyclass' => 'add-content',
+ 'breadcrumb' => '' . config('breadcrumb.home') . ' » Add content'
+ ));
+ }
});
@@ -800,7 +800,7 @@ get('/admin/popular', function () {
'canonical' => site_url(),
'is_admin' => true,
'bodyclass' => 'admin-popular',
- 'breadcrumb' => '' . config('breadcrumb.home') . ' » Popular posts'
+ 'breadcrumb' => '' . config('breadcrumb.home') . ' » Popular posts'
));
die;
@@ -1136,7 +1136,7 @@ post('/admin/config', function () {
if(!is_null(config($name))) {
$new_config[$name] = $value;
} else {
- $new_Keys[$name] = $value;
+ $new_Keys[$name] = $value;
}
}
}
@@ -1188,7 +1188,7 @@ get('/admin/config/custom', function () {
// Submitted Config page data
post('/admin/config/custom', function () {
-
+
error_reporting(E_ALL);
ini_set("display_errors", 1);
@@ -1256,7 +1256,7 @@ get('/admin/config/reading', function () {
// Submitted Config page data
post('/admin/config/reading', function () {
-
+
error_reporting(E_ALL);
ini_set("display_errors", 1);
@@ -1271,7 +1271,7 @@ post('/admin/config/reading', function () {
if(!is_null(config($name))) {
$new_config[$name] = $value;
} else {
- $new_Keys[$name] = $value;
+ $new_Keys[$name] = $value;
}
}
}
@@ -1323,7 +1323,7 @@ get('/admin/config/widget', function () {
// Submitted Config page data
post('/admin/config/widget', function () {
-
+
error_reporting(E_ALL);
ini_set("display_errors", 1);
@@ -1338,7 +1338,7 @@ post('/admin/config/widget', function () {
if(!is_null(config($name))) {
$new_config[$name] = $value;
} else {
- $new_Keys[$name] = $value;
+ $new_Keys[$name] = $value;
}
}
}
@@ -1390,7 +1390,7 @@ get('/admin/config/metatags', function () {
// Submitted Config page data
post('/admin/config/metatags', function () {
-
+
error_reporting(E_ALL);
ini_set("display_errors", 1);
@@ -1405,7 +1405,7 @@ post('/admin/config/metatags', function () {
if(!is_null(config($name))) {
$new_config[$name] = $value;
} else {
- $new_Keys[$name] = $value;
+ $new_Keys[$name] = $value;
}
}
}
@@ -1457,7 +1457,7 @@ get('/admin/config/performance', function () {
// Submitted Config page data
post('/admin/config/performance', function () {
-
+
error_reporting(E_ALL);
ini_set("display_errors", 1);
@@ -1472,7 +1472,7 @@ post('/admin/config/performance', function () {
if(!is_null(config($name))) {
$new_config[$name] = $value;
} else {
- $new_Keys[$name] = $value;
+ $new_Keys[$name] = $value;
}
}
}
@@ -1616,7 +1616,7 @@ post('/admin/menu', function () {
if (login()) {
$json = from($_REQUEST, 'json');
- file_put_contents('content/data/menu.json', json_encode($json, JSON_UNESCAPED_UNICODE));
+ file_put_contents('content/data/menu.json', json_encode($json, JSON_UNESCAPED_UNICODE));
echo json_encode(array(
'message' => 'Menu saved successfully!',
));
@@ -1650,45 +1650,45 @@ get('/admin/categories/:category', function ($category) {
$user = $_SESSION[config("site.url")]['user'];
$role = user('role', $user);
if (login()) {
-
+
config('views.root', 'system/admin/views');
if ($role === 'admin') {
- $page = from($_GET, 'page');
- $page = $page ? (int)$page : 1;
- $perpage = config('category.perpage');
-
- if (empty($perpage)) {
- $perpage = 10;
- }
-
- $posts = get_category($category, $page, $perpage);
-
- $desc = get_category_info($category);
-
- if(strtolower($category) !== 'uncategorized') {
- $desc = $desc[0];
- }
-
- $total = get_categorycount($category);
-
- if (empty($posts) || $page < 1) {
- // a non-existing page
- not_found();
- }
-
- render('category-list', array(
- 'title' => $desc->title . ' - ' . blog_title(),
- 'description' => $desc->description,
- 'canonical' => $desc->url,
- 'page' => $page,
- 'posts' => $posts,
- 'category' => $desc,
- 'bodyclass' => 'in-category category-' . strtolower($category),
- 'breadcrumb' => '' . config('breadcrumb.home') . ' » Categories » ' . $desc->title,
- 'pagination' => has_pagination($total, $perpage, $page),
- 'is_category' => true,
- ));
+ $page = from($_GET, 'page');
+ $page = $page ? (int)$page : 1;
+ $perpage = config('category.perpage');
+
+ if (empty($perpage)) {
+ $perpage = 10;
+ }
+
+ $posts = get_category($category, $page, $perpage);
+
+ $desc = get_category_info($category);
+
+ if(strtolower($category) !== 'uncategorized') {
+ $desc = $desc[0];
+ }
+
+ $total = get_categorycount($category);
+
+ if (empty($posts) || $page < 1) {
+ // a non-existing page
+ not_found();
+ }
+
+ render('category-list', array(
+ 'title' => $desc->title . ' - ' . blog_title(),
+ 'description' => $desc->description,
+ 'canonical' => $desc->url,
+ 'page' => $page,
+ 'posts' => $posts,
+ 'category' => $desc,
+ 'bodyclass' => 'in-category category-' . strtolower($category),
+ 'breadcrumb' => '' . config('breadcrumb.home') . ' » Categories » ' . $desc->title,
+ 'pagination' => has_pagination($total, $perpage, $page),
+ 'is_category' => true,
+ ));
} else {
render('denied', array(
'title' => 'Categories - ' . blog_title(),
@@ -2553,7 +2553,7 @@ get('/post/:name/delete', function ($name) {
}
$current = $post['current'];
-
+
if (config('blog.enable') === 'true') {
$blog = 'Blog » ';
} else {
diff --git a/system/includes/functions.php b/system/includes/functions.php
index bf144f1..d3645a4 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -1487,7 +1487,7 @@ function tag_cloud($custom = null)
foreach ($tag_collection as $tag => $count) {
$size = $min_size + (($count - $min_qty) * $step);
echo ' '.tag_i18n($tag).' ';
- }
+ }
} else {
return $tag_collection;
@@ -1807,7 +1807,7 @@ function get_image($text)
return $vidThumb;
}
} else{
- return false;
+ return false;
}
}
@@ -1972,7 +1972,7 @@ function publisher()
function analytics()
{
$analytics = config('google.analytics.id');
- $gtag = config('google.gtag.id');
+ $gtag = config('google.gtag.id');
$script = <<
(function (i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function () {
@@ -1997,8 +1997,8 @@ EOF;
if (!empty($gtag)) {
return $gtagScript;
} elseif (!empty($analytics)) {
- return $script;
- }
+ return $script;
+ }
}
function slashUrl($url) {
@@ -2006,88 +2006,88 @@ function slashUrl($url) {
}
function parseNodes($nodes, $child = null, $class = null) {
- if (empty($child)) {
- $ul = '';
- foreach ($nodes as $node) {
- if (isset($node->children)) {
- $ul .= parseNode($node, true);
- } else {
- $ul .= parseNode($node);
- }
- }
- $ul .= '
';
- return $ul;
- } else {
- $ul = '';
- return $ul;
- }
+ if (empty($child)) {
+ $ul = '';
+ foreach ($nodes as $node) {
+ if (isset($node->children)) {
+ $ul .= parseNode($node, true);
+ } else {
+ $ul .= parseNode($node);
+ }
+ }
+ $ul .= '
';
+ return $ul;
+ } else {
+ $ul = '';
+ return $ul;
+ }
}
function parseNode($node, $child = null) {
- $req = strtok($_SERVER["REQUEST_URI"],'?');
+ $req = strtok($_SERVER["REQUEST_URI"],'?');
$url = parse_url(slashUrl($node->slug));
$su = parse_url(site_url());
- if (empty($child)) {
+ if (empty($child)) {
if (isset($url['host']) && isset($su['host'])) {
if ($url['host'] == $su['host']) {
if (slashUrl($url['path']) == slashUrl($req)) {
$li = '';
- } else {
- $li = '';
- }
- } else {
- $li = ''; // Link out
- }
- } else {
- if (slashUrl($node->slug) == slashUrl($req)) {
- $li = '';
- } else {
- $li = '';
- }
- }
-
- $li .= ''.$node->name.'';
- if (isset($node->children)) {
- $li .= parseNodes($node->children, true, null);
- }
- $li .= '';
- return $li;
- } else {
-
- if (isset($url['host'])) {
- if ($url['host'] == $su['host']) {
- if (slashUrl($url['path']) == slashUrl($req)) {
+ } else {
+ $li = '';
+ }
+ } else {
+ $li = ''; // Link out
+ }
+ } else {
+ if (slashUrl($node->slug) == slashUrl($req)) {
+ $li = '';
+ } else {
+ $li = '';
+ }
+ }
+
+ $li .= ''.$node->name.'';
+ if (isset($node->children)) {
+ $li .= parseNodes($node->children, true, null);
+ }
+ $li .= '';
+ return $li;
+ } else {
+
+ if (isset($url['host'])) {
+ if ($url['host'] == $su['host']) {
+ if (slashUrl($url['path']) == slashUrl($req)) {
$li = '';
- } else {
- $li = '';
- }
- } else {
- $li = ''; // Link out
- }
- } else {
- if (slashUrl($node->slug) == slashUrl($req)) {
- $li = '';
- } else {
- $li = '';
- }
- }
-
- $li .= ''.$node->name.'';
- if (isset($node->children)) {
- $li .= parseNodes($node->children, true, null);
- }
- $li .= '';
- return $li;
- }
+ } else {
+ $li = '';
+ }
+ } else {
+ $li = ''; // Link out
+ }
+ } else {
+ if (slashUrl($node->slug) == slashUrl($req)) {
+ $li = '';
+ } else {
+ $li = '';
+ }
+ }
+
+ $li .= ''.$node->name.'';
+ if (isset($node->children)) {
+ $li .= parseNodes($node->children, true, null);
+ }
+ $li .= '';
+ return $li;
+ }
}
// Menu
@@ -2095,11 +2095,11 @@ function menu($class = null)
{
$filename = "content/data/menu.json";
if (file_exists($filename)) {
- $json = json_decode(file_get_contents('content/data/menu.json', true));
- $nodes = json_decode($json);
- if (empty($nodes)) {
+ $json = json_decode(file_get_contents('content/data/menu.json', true));
+ $nodes = json_decode($json);
+ if (empty($nodes)) {
get_menu($class);
- } else {
+ } else {
$html = parseNodes($nodes, null, $class);
libxml_use_internal_errors(true);
$doc = new DOMDocument();
@@ -2112,20 +2112,20 @@ function menu($class = null)
foreach ($elements as $element) {
$nodes = $element->childNodes;
foreach ($nodes as $node) {
- $class = $node->getAttribute('class');
- if (stripos($class, 'active')) {
- $parentClass = $element->parentNode->getAttribute('class') . ' active';
- $element->parentNode->setAttribute('class', $parentClass);
- }
- }
+ $class = $node->getAttribute('class');
+ if (stripos($class, 'active')) {
+ $parentClass = $element->parentNode->getAttribute('class') . ' active';
+ $element->parentNode->setAttribute('class', $parentClass);
+ }
+ }
}
-
- return preg_replace('~<(?:!DOCTYPE|/?(?:html|head|body))[^>]*>\s*~i', '', utf8_decode($doc->saveHTML($doc->documentElement)));
-
- }
- } else {
- get_menu($class);
- }
+
+ return preg_replace('~<(?:!DOCTYPE|/?(?:html|head|body))[^>]*>\s*~i', '', utf8_decode($doc->saveHTML($doc->documentElement)));
+
+ }
+ } else {
+ get_menu($class);
+ }
}
// Get the title from file
@@ -2281,7 +2281,7 @@ function not_found()
} else {
$layout = '';
}
-
+
header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
render('404', array(
'title' => 'This page doesn\'t exist! - ' . blog_title(),
@@ -3035,7 +3035,7 @@ function get_video_id($url)
}
$link = parse_url($url);
-
+
if(!isset($link['host'])) {
return $url;
}