mirror of
https://github.com/danpros/htmly.git
synced 2026-04-22 05:26:22 +05:30
Fix formatting
This commit is contained in:
parent
1848c024cd
commit
55286443e6
2 changed files with 235 additions and 235 deletions
274
system/htmly.php
274
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'] .= '<li class="alert alert-danger">Title field is required.</li>';
|
||||
}
|
||||
if (empty($tag)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Tag field is required.</li>';
|
||||
}
|
||||
if (empty($content)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Content field is required.</li>';
|
||||
}
|
||||
if (!$proper) {
|
||||
$message['error'] .= '<li class="alert alert-danger">CSRF Token not correct.</li>';
|
||||
}
|
||||
|
||||
if (!empty($is_image)) {
|
||||
if (empty($image)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Image field is required.</li>';
|
||||
}
|
||||
} elseif (!empty($is_video)) {
|
||||
if (empty($video)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Video field is required.</li>';
|
||||
}
|
||||
} elseif (!empty($is_link)) {
|
||||
if (empty($link)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Link field is required.</li>';
|
||||
}
|
||||
} elseif (!empty($is_quote)) {
|
||||
if (empty($quote)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Quote field is required.</li>';
|
||||
}
|
||||
} elseif (!empty($is_audio)) {
|
||||
if (empty($audio)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Audio field is required.</li>';
|
||||
}
|
||||
}
|
||||
|
||||
config('views.root', 'system/admin/views');
|
||||
render('add-content', array(
|
||||
'title' => 'Add content - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'error' => '<ul>' . $message['error'] . '</ul>',
|
||||
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'] .= '<li class="alert alert-danger">Title field is required.</li>';
|
||||
}
|
||||
if (empty($tag)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Tag field is required.</li>';
|
||||
}
|
||||
if (empty($content)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Content field is required.</li>';
|
||||
}
|
||||
if (!$proper) {
|
||||
$message['error'] .= '<li class="alert alert-danger">CSRF Token not correct.</li>';
|
||||
}
|
||||
|
||||
if (!empty($is_image)) {
|
||||
if (empty($image)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Image field is required.</li>';
|
||||
}
|
||||
} elseif (!empty($is_video)) {
|
||||
if (empty($video)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Video field is required.</li>';
|
||||
}
|
||||
} elseif (!empty($is_link)) {
|
||||
if (empty($link)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Link field is required.</li>';
|
||||
}
|
||||
} elseif (!empty($is_quote)) {
|
||||
if (empty($quote)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Quote field is required.</li>';
|
||||
}
|
||||
} elseif (!empty($is_audio)) {
|
||||
if (empty($audio)) {
|
||||
$message['error'] .= '<li class="alert alert-danger">Audio field is required.</li>';
|
||||
}
|
||||
}
|
||||
|
||||
config('views.root', 'system/admin/views');
|
||||
render('add-content', array(
|
||||
'title' => 'Add content - ' . blog_title(),
|
||||
'description' => strip_tags(blog_description()),
|
||||
'canonical' => site_url(),
|
||||
'error' => '<ul>' . $message['error'] . '</ul>',
|
||||
'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' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Add content'
|
||||
));
|
||||
}
|
||||
'is_admin' => true,
|
||||
'bodyclass' => 'add-content',
|
||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Add content'
|
||||
));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -800,7 +800,7 @@ get('/admin/popular', function () {
|
|||
'canonical' => site_url(),
|
||||
'is_admin' => true,
|
||||
'bodyclass' => 'admin-popular',
|
||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » Popular posts'
|
||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » 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;
|
||||
}
|
||||
$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];
|
||||
}
|
||||
$posts = get_category($category, $page, $perpage);
|
||||
|
||||
$desc = get_category_info($category);
|
||||
|
||||
if(strtolower($category) !== 'uncategorized') {
|
||||
$desc = $desc[0];
|
||||
}
|
||||
|
||||
$total = get_categorycount($category);
|
||||
$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' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » <a href="' . site_url() . 'admin/categories">Categories</a> » ' . $desc->title,
|
||||
'pagination' => has_pagination($total, $perpage, $page),
|
||||
'is_category' => true,
|
||||
));
|
||||
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' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » <a href="' . site_url() . 'admin/categories">Categories</a> » ' . $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 = '<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="' . site_url() . 'blog"><span itemprop="name">Blog</span></a><meta itemprop="position" content="2" /></li> » ';
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue