Replace switch with series of if, makes the code slightly cleaner, I think.
This commit is contained in:
parent
5c9fadef99
commit
47955dd43a
1 changed files with 13 additions and 13 deletions
|
|
@ -26,19 +26,20 @@ fn blagh_init {
|
||||||
ll_add handlers_bar_left echo '<a href="'$blagh_uri'new_post">Make a new post</a>'
|
ll_add handlers_bar_left echo '<a href="'$blagh_uri'new_post">Make a new post</a>'
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($req_path) {
|
if(~ $req_path $blagh_uri) {
|
||||||
case $blagh_uri
|
|
||||||
handler_body_main=blagh_body
|
handler_body_main=blagh_body
|
||||||
u=$blagh_uri'index'
|
u=$blagh_uri'index'
|
||||||
extraHeaders=$"extraHeaders ^ \
|
extraHeaders=$"extraHeaders ^ \
|
||||||
'<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"u'.rss" />
|
'<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"u'.rss" />
|
||||||
<link rel="alternate" type="application/atom+xml" title="ATOM" href="'$"u'.atom" />'
|
<link rel="alternate" type="application/atom+xml" title="ATOM" href="'$"u'.atom" />'
|
||||||
case $blagh_uri^index.atom
|
}
|
||||||
|
if not if(~ $req_path $blagh_uri^index.atom)
|
||||||
blagh_setup_feed_handlers atom.tpl
|
blagh_setup_feed_handlers atom.tpl
|
||||||
case $blagh_uri^index.rss
|
|
||||||
|
if not if(~ $req_path $blagh_uri^index.rss)
|
||||||
blagh_setup_feed_handlers rss20.tpl
|
blagh_setup_feed_handlers rss20.tpl
|
||||||
case $blagh_uri^new_post
|
|
||||||
if(! ~ $#editor_mode 0) {
|
if not if(~ $req_path $blagh_uri^new_post && ! ~ $#editor_mode 0) {
|
||||||
handler_body_main=( tpl_handler `{get_lib_file blagh/new_post.tpl apps/blagh/new_post.tpl} )
|
handler_body_main=( tpl_handler `{get_lib_file blagh/new_post.tpl apps/blagh/new_post.tpl} )
|
||||||
if(~ $REQUEST_METHOD POST) {
|
if(~ $REQUEST_METHOD POST) {
|
||||||
if(mkbpost $"post_arg_body $"post_date $"post_arg_title $post_arg_id)
|
if(mkbpost $"post_arg_body $"post_date $"post_arg_title $post_arg_id)
|
||||||
|
|
@ -47,7 +48,6 @@ fn blagh_init {
|
||||||
notify_errors=$status
|
notify_errors=$status
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue