get_urls(); $local_url = new LocalURL(); $url = $local_url->uri($sapi_path); $filter = $local_url->filter(); # main page if (empty($url)) { $url = 'main'; $template->render_cache($url, $filter); $item_list = new SapiContent(); $item_list->limit = LIMIT_MAIN_ITEM; $item_list->style_item = STYLE_MAIN_ITEM; $item_list->style_title = STYLE_MAIN_TITLE; $item_list->style_content = STYLE_MAIN_CONTENT; $item_list->style_author = STYLE_MAIN_AUTHOR; $item_list->style_pub_date = STYLE_MAIN_PUB_DATE; $item_list->style_item_taglist = STYLE_MAIN_ITEM_TAGLIST; $item_list->style_item_tag = STYLE_MAIN_ITEM_TAG; $tag_list = new SapiContent(); $tag_list->sort = SORT_MAIN_TAG; $tag_list->limit = LIMIT_MAIN_TAG; $tag_list->style_taglist = STYLE_MAIN_TAGLIST; $tag_list->style_tag = STYLE_MAIN_TAG; $home_txt = new SapiContent(); $header = new SapiContent(); $tpl = $template->get_tpl('main.tpl.htm'); $tpl = $template->assign('{--HEADER--}', $header->return_content('Header'), $tpl); $tpl = $template->assign('{--TAG_LIST--}', $tag_list->return_content('TagList'), $tpl); $tpl = $template->assign('{--ITEM_LIST--}', $item_list->return_content('ItemList'), $tpl); $tpl = $template->assign('{--HOME_TXT--}', $home_txt->return_content('HomeTXT'), $tpl); $tpl = $template->assign('{--TAGS_URL--}', TAGS_URL, $tpl); $tpl = $template->assign('{--RSS_URL--}', RSS_URL, $tpl); $tpl = $template->assign('{--SITE_TITLE--}', SITE_TITLE, $tpl); $template->render($tpl); $template->save_cache($url, $filter, $tpl); } # all tags page elseif ($url == 'tags') { $template->render_cache($url, $filter); $tag_list = new SapiContent(); $tag_list->sort = SORT_TAGS_TAG; $tag_list->style_taglist = STYLE_TAGS_TAGLIST; $tag_list->style_tag = STYLE_TAGS_TAG; $header = new SapiContent(); $tpl = $template->get_tpl('tags.tpl.htm'); $tpl = $template->assign('{--HEADER--}', $header->return_content('Header'), $tpl); $tpl = $template->assign('{--TAG_LIST--}', $tag_list->return_content('TagList'), $tpl); $tpl = $template->assign('{--TAGS_URL--}', TAGS_URL, $tpl); $tpl = $template->assign('{--RSS_URL--}', RSS_URL, $tpl); $tpl = $template->assign('{--SITE_TITLE--}', SITE_TITLE, $tpl); $template->render($tpl); $template->save_cache($url, $filter, $tpl); } # item list filter by tag page elseif ($url == 'items') { $template->render_cache($url, $filter); $item_tag_filter = new SapiContent(); $item_tag_filter->filter = $filter; $item_tag_filter->style_item = STYLE_ITEMLIST_ITEM; $item_tag_filter->style_title = STYLE_ITEMLIST_TITLE; $item_tag_filter->style_content = STYLE_ITEMLIST_CONTENT; $item_tag_filter->style_author = STYLE_ITEMLIST_AUTHOR; $item_tag_filter->style_pub_date = STYLE_ITEMLIST_PUB_DATE; $item_tag_filter->style_select_tag = STYLE_ITEMLIST_SELECT_TAG; $item_list->style_item_taglist = STYLE_ITEMLIST_ITEM_TAGLIST; $item_list->style_item_tag = STYLE_ITEMLIST_ITEM_TAG; $tag_list = new SapiContent(); $tag_list->sort = SORT_ITEMLIST_TAG; $tag_list->limit = LIMIT_ITEMLIST_TAG; $tag_list->style_taglist = STYLE_ITEMLIST_TAGLIST; $tag_list->style_tag = STYLE_ITEMLIST_TAG; $header = new SapiContent(); $header->filter = $filter; $header->title_sep = ITEMLIST_TITLE_SEP; $tpl = $template->get_tpl('itemlist.tpl.htm'); $tpl = $template->assign('{--HEADER--}', $header->return_content('Header'), $tpl); $tpl = $template->assign('{--TAG_LIST--}', $tag_list->return_content('TagList'), $tpl); $tpl = $template->assign('{--ITEM_LIST--}', $item_tag_filter->return_content('ItemList'), $tpl); $tpl = $template->assign('{--TAGS_URL--}', TAGS_URL, $tpl); $tpl = $template->assign('{--RSS_URL--}', RSS_URL, $tpl); $tpl = $template->assign('{--SITE_TITLE--}', SITE_TITLE, $tpl); $template->render($tpl); $template->save_cache($url, $filter, $tpl); } # item page elseif ($url == 'item') { $template->render_cache($url, $filter); $item = new SapiContent(); $item->filter = $filter; $item->style_item = STYLE_ITEM_ITEM; $item->style_title = STYLE_ITEM_TITLE; $item->style_content = STYLE_ITEM_CONTENT; $item->style_author = STYLE_ITEM_AUTHOR; $item->style_pub_date = STYLE_ITEM_PUB_DATE; $item->style_footnote = STYLE_ITEM_FOOTNOTE; $item->style_footanchor = STYLE_ITEM_FOOTANCHOR; $item_list->style_item_taglist = STYLE_ITEM_ITEM_TAGLIST; $item_list->style_item_tag = STYLE_ITEM_ITEM_TAG; $tag_list = new SapiContent(); $tag_list->sort = SORT_ITEM_TAG; $tag_list->limit = LIMIT_ITEM_TAG; $tag_list->style_taglist = STYLE_ITEM_TAGLIST; $tag_list->style_tag = STYLE_ITEM_TAG; $header = new SapiContent(); $header->filter = $filter; $header->title_sep = ITEM_TITLE_SEP; $tpl = $template->get_tpl('item.tpl.htm'); $tpl = $template->assign('{--HEADER--}', $header->return_content('Header'), $tpl); $tpl = $template->assign('{--TAG_LIST--}', $tag_list->return_content('TagList'), $tpl); $tpl = $template->assign('{--ITEM--}', $item->return_content('ItemHtml'), $tpl); $tpl = $template->assign('{--TAGS_URL--}', TAGS_URL, $tpl); $tpl = $template->assign('{--RSS_URL--}', RSS_URL, $tpl); $tpl = $template->assign('{--SITE_TITLE--}', SITE_TITLE, $tpl); $template->render($tpl); $template->save_cache($url, $filter, $tpl); } # rss page elseif ($url == 'rss') { $item_list = new SapiContent(); $item_list->limit = LIMIT_RSS_ITEM; $tpl = $template->get_tpl('rss.tpl.htm'); $tpl = $template->assign('{--ITEM_LIST--}', $item_list->return_content('Rss'), $tpl); $template->render($tpl); } # version elseif ($url == 'version') { print "v:" . __VERSION__ . " | c:" . CACHE_DAY . " | sapi:" . SAPI_URL; } # checker elseif ($url == 'checker') { $rest = new Sapi(); $code = $rest->api_get_content('Checker'); print $code; } # clear cache files elseif ($url == 'clear_cache') { $template->clear_cache(); print "clear cache: Done;"; } ?>