mirror of
https://github.com/danpros/htmly.git
synced 2026-04-21 21:16:23 +05:30
custom Description added
This commit is contained in:
parent
0ef08de74c
commit
0316cf0602
2 changed files with 96 additions and 114 deletions
|
|
@ -108,7 +108,7 @@ post('/login', function() {
|
|||
}
|
||||
});
|
||||
|
||||
get("/:static/:sub/edit", function($static,$sub) {
|
||||
get("/:static/:sub/edit", function($static, $sub) {
|
||||
|
||||
if (login()) {
|
||||
|
||||
|
|
@ -120,8 +120,8 @@ get("/:static/:sub/edit", function($static,$sub) {
|
|||
}
|
||||
|
||||
$post = $post[0];
|
||||
|
||||
$page = get_static_sub_post($static,$sub);
|
||||
|
||||
$page = get_static_sub_post($static, $sub);
|
||||
|
||||
if (!$page) {
|
||||
not_found();
|
||||
|
|
@ -141,22 +141,20 @@ get("/:static/:sub/edit", function($static,$sub) {
|
|||
header("location: $login");
|
||||
}
|
||||
});
|
||||
post("/:static/:sub/edit", function($static,$sub) {
|
||||
post("/:static/:sub/edit", function($static, $sub) {
|
||||
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
|
||||
|
||||
if(!login())
|
||||
{
|
||||
if (!login()) {
|
||||
$login = site_url() . 'login';
|
||||
header("location: $login");
|
||||
header("location: $login");
|
||||
}
|
||||
|
||||
|
||||
$title = from($_REQUEST, 'title');
|
||||
$url = from($_REQUEST, 'url');
|
||||
$content = from($_REQUEST, 'content');
|
||||
$oldfile = from($_REQUEST, 'oldfile');
|
||||
$destination = from($_GET, 'destination');
|
||||
if($destination === null)
|
||||
{
|
||||
if ($destination === null) {
|
||||
$destination = $static . "/" . $sub;
|
||||
}
|
||||
if ($proper && !empty($title) && !empty($content)) {
|
||||
|
|
@ -192,7 +190,7 @@ post("/:static/:sub/edit", function($static,$sub) {
|
|||
}
|
||||
});
|
||||
|
||||
get("/:static/:sub/delete", function($static,$sub) {
|
||||
get("/:static/:sub/delete", function($static, $sub) {
|
||||
|
||||
if (login()) {
|
||||
|
||||
|
|
@ -205,7 +203,7 @@ get("/:static/:sub/delete", function($static,$sub) {
|
|||
|
||||
$post = $post[0];
|
||||
|
||||
$page = get_static_sub_post($static,$sub);
|
||||
$page = get_static_sub_post($static, $sub);
|
||||
|
||||
if (!$page) {
|
||||
not_found();
|
||||
|
|
@ -238,8 +236,7 @@ post("/:static/:sub/delete", function() {
|
|||
// The blog post page
|
||||
get('/:year/:month/:name', function($year, $month, $name) {
|
||||
|
||||
if(config("views.counter") != "true")
|
||||
{
|
||||
if (config("views.counter") != "true") {
|
||||
if (!login()) {
|
||||
file_cache($_SERVER['REQUEST_URI']);
|
||||
}
|
||||
|
|
@ -252,9 +249,8 @@ get('/:year/:month/:name', function($year, $month, $name) {
|
|||
if (!$current) {
|
||||
not_found();
|
||||
}
|
||||
|
||||
if(config("views.counter") == "true")
|
||||
{
|
||||
|
||||
if (config("views.counter") == "true") {
|
||||
add_view($current->file);
|
||||
|
||||
if (!login()) {
|
||||
|
|
@ -283,7 +279,7 @@ get('/:year/:month/:name', function($year, $month, $name) {
|
|||
}
|
||||
|
||||
render('post', array(
|
||||
'head_contents' => head_contents($current->title . ' - ' . blog_title(), $description = get_description($current->body), $current->url),
|
||||
'head_contents' => head_contents($current->title . ' - ' . blog_title(), $current->description, $current->url),
|
||||
'p' => $current,
|
||||
'authorinfo' => authorinfo($bio->title, $bio->body),
|
||||
'bodyclass' => 'inpost',
|
||||
|
|
@ -452,9 +448,11 @@ get('/author/:profile', function($profile) {
|
|||
$bio = default_profile($profile);
|
||||
}
|
||||
|
||||
$description = 'Profile page and all posts by ' . $bio->title . ' on ' . blog_title() . '.';
|
||||
|
||||
if (empty($posts) || $page < 1) {
|
||||
render('profile', array(
|
||||
'head_contents' => head_contents('Profile for: ' . $bio->title . ' - ' . blog_title(), 'Profile page and all posts by ' . $bio->title . ' on ' . blog_title() . '.', site_url() . 'author/' . $profile),
|
||||
'head_contents' => head_contents('Profile for: ' . $bio->title . ' - ' . blog_title(), $description, site_url() . 'author/' . $profile),
|
||||
'page' => $page,
|
||||
'posts' => null,
|
||||
'bio' => $bio->body,
|
||||
|
|
@ -467,7 +465,7 @@ get('/author/:profile', function($profile) {
|
|||
}
|
||||
|
||||
render('profile', array(
|
||||
'head_contents' => head_contents('Profile for: ' . $bio->title . ' - ' . blog_title(), 'Profile page and all posts by ' . $bio->title . ' on ' . blog_title() . '.', site_url() . 'author/' . $profile),
|
||||
'head_contents' => head_contents('Profile for: ' . $bio->title . ' - ' . blog_title(), $description, site_url() . 'author/' . $profile),
|
||||
'page' => $page,
|
||||
'posts' => $posts,
|
||||
'bio' => $bio->body,
|
||||
|
|
@ -704,14 +702,13 @@ get('/:static', function($static) {
|
|||
}
|
||||
die;
|
||||
} else {
|
||||
|
||||
if( config("views.counter") != "true")
|
||||
{
|
||||
|
||||
if (config("views.counter") != "true") {
|
||||
if (!login()) {
|
||||
file_cache($_SERVER['REQUEST_URI']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$post = get_static_post($static);
|
||||
|
||||
if (!$post) {
|
||||
|
|
@ -720,8 +717,7 @@ get('/:static', function($static) {
|
|||
|
||||
$post = $post[0];
|
||||
|
||||
if(config("views.counter") == "true")
|
||||
{
|
||||
if (config("views.counter") == "true") {
|
||||
add_view($post->file);
|
||||
if (!login()) {
|
||||
file_cache($_SERVER['REQUEST_URI']);
|
||||
|
|
@ -729,7 +725,7 @@ get('/:static', function($static) {
|
|||
}
|
||||
|
||||
render('static', array(
|
||||
'head_contents' => head_contents($post->title . ' - ' . blog_title(), $description = get_description($post->body), $post->url),
|
||||
'head_contents' => head_contents($post->title . ' - ' . blog_title(), $post->description, $post->url),
|
||||
'bodyclass' => 'inpage',
|
||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » ' . $post->title,
|
||||
'p' => $post,
|
||||
|
|
@ -769,12 +765,11 @@ get('/:static/edit', function($static) {
|
|||
post('/:static/edit', function() {
|
||||
$proper = is_csrf_proper(from($_REQUEST, 'csrf_token'));
|
||||
|
||||
if(!login())
|
||||
{
|
||||
if (!login()) {
|
||||
$login = site_url() . 'login';
|
||||
header("location: $login");
|
||||
header("location: $login");
|
||||
}
|
||||
|
||||
|
||||
$title = from($_REQUEST, 'title');
|
||||
$url = from($_REQUEST, 'url');
|
||||
$content = from($_REQUEST, 'content');
|
||||
|
|
@ -1238,14 +1233,13 @@ get('/:static/add', function($static) {
|
|||
config('views.root', 'system/admin/views');
|
||||
|
||||
$post = get_static_post($static);
|
||||
|
||||
if(! $post)
|
||||
{
|
||||
|
||||
if (!$post) {
|
||||
not_found();
|
||||
}
|
||||
|
||||
|
||||
$post = $post[0];
|
||||
|
||||
|
||||
render('add-page', array(
|
||||
'head_contents' => head_contents('Add page - ' . blog_title(), blog_description(), site_url()),
|
||||
'bodyclass' => 'addpage',
|
||||
|
|
@ -1294,29 +1288,28 @@ post('/:static/add', function($static) {
|
|||
}
|
||||
});
|
||||
|
||||
get('/:static/:sub', function($static,$sub) {
|
||||
|
||||
get('/:static/:sub', function($static, $sub) {
|
||||
|
||||
$father_post = get_static_post($static);
|
||||
if (!$father_post) {
|
||||
not_found();
|
||||
}
|
||||
$post = get_static_sub_post($static,$sub);
|
||||
$post = get_static_sub_post($static, $sub);
|
||||
if (!$post) {
|
||||
not_found();
|
||||
}
|
||||
$post = $post[0];
|
||||
|
||||
if(config("views.counter") == "true")
|
||||
{
|
||||
add_view($post->file);
|
||||
}
|
||||
|
||||
if (config("views.counter") == "true") {
|
||||
add_view($post->file);
|
||||
}
|
||||
|
||||
if (!login()) {
|
||||
file_cache($_SERVER['REQUEST_URI']);
|
||||
}
|
||||
|
||||
render('static', array(
|
||||
'head_contents' => head_contents($post->title . ' - ' . blog_title(), $description = get_description($post->body), $post->url),
|
||||
'head_contents' => head_contents($post->title . ' - ' . blog_title(), $post->description, $post->url),
|
||||
'bodyclass' => 'inpage',
|
||||
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » <a href="' . $father_post[0]->url . '">' . $father_post[0]->title . '</a> » ' . $post->title,
|
||||
'p' => $post,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue