<?php $post_id = isset($_GET["id"]) ? $_GET["id"] : ""; if ($post_id == "") { http_response_code(404); header("Location: /error/404/not-found"); } require_once $_SERVER["DOCUMENT_ROOT"] . "/../includes/base.php"; $post = get_single_post($post_id); if ($post === null) { http_response_code(404); header("Location: /error/404/not-found"); } ?> <!DOCTYPE html> <html> <head> <?php include $_SERVER["DOCUMENT_ROOT"] . "/../includes/content.head.php"; ?> <title><?php echo get_config_value("site", "title"); ?> | <?php echo $post["title"]; ?> </title> </head> <body> <div class="component-left"> <div class="container container-center">
<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/../includes/base.php"; if (!is_admin_user()) { http_response_code(404); header("Location: /error/404/not-found"); } $id = isset($_GET["id"]) ? $_GET["id"] : null; if ($id === null) { http_response_code(404); header("Location: /error/404/not-found"); } $post = get_single_post($id); if ($post === null) { http_response_code(404); header("Location: /error/404/not-found"); } ?> <!DOCTYPE html> <html> <head> <?php include $_SERVER["DOCUMENT_ROOT"] . "/../includes/content.head.php"; ?> <title><?php echo get_config_value("site", "title"); ?> | Admin - Manage Post</title> </head> <body> <div class="component-left">
function smarty_function_getposts($params, &$bBlog) { $ar = array(); $opt = array(); $ph = $bBlog->_ph; if (is_numeric($params['postid']) && $params['postid'] > 0) { $postid = $params['postid']; } else { $postid = FALSE; } // If "assign" is not set... we'll establish a default. if ($params['assign'] == '') { if ($postid) { $params['assign'] = 'post'; } else { $params['assign'] = 'posts'; } } if ($postid && is_int($postid)) { $bBlog->assign($params['assign'], get_single_post($bBlog, $ph, $postid)); return; } // If "archive" is set, order them ASCENDING by posttime. if ($params['archive']) { $opt['order'] = " ORDER BY posttime "; } // If num is set, we'll only get that many results in return if (is_numeric($params['num'])) { $opt['num'] = $params['num']; } // If skip is set, we'll skip that many results if (is_numeric($params['skip'])) { $opt['skip'] = $params['skip']; } if ($params['section'] != '') { $opt['sectionid'] = $bBlog->sect_by_name[$params['section']]; } if ($bBlog->show_section) { $opt['sectionid'] = $bBlog->show_section; } if (is_numeric($params['year'])) { if (strlen($params['year']) != 4) { $bBlog->trigger_error('getposts: year parameter requires a 4 digit year'); return; } $opt['year'] = $params['year']; } foreach (array('month', 'day', 'hour', 'minute', 'second') as $type) { if (is_numeric($params[$type])) { if (strlen($params[$type]) != 2) { $bBlog->trigger_error('getposts: ' . $type . ' parameter requires a 2 digit month'); return; } $opt[$type] = $params[$type]; } } $opt['home'] = $params['home']; $ar['posts'] = $ph->get_posts($opt); // No posts. if (!is_array($ar['posts'])) { return; } $lastmonth = 0; $lastdate = 0; foreach ($ar['posts'] as $key => $value) { /* check if new day - used by block.newday.php */ if (date('Ymd', $ar['posts'][$key]['posttime']) != $lastdate) { $ar['posts'][$key]['newday'] = TRUE; } $lastdate = date('Ymd', $ar['posts'][$key]['posttime']); /* check if new month - use by block.newmonth.php */ if (date('Fy', $ar['posts'][$key]['posttime']) != $lastmonth) { $ar['posts'][$key]['newmonth'] = TRUE; } $lastmonth = date('Fy', $ar['posts'][$key]['posttime']); } $posts = apply_modifier(&$bBlog, $ar['posts']); $bBlog->assign($params['assign'], $posts); return; }
$p = get_posts(0, $home_post_nb, ''); for ($i = 0; $i < count($p); $i++) { $content['page_element'][$i]['sub_title'] = $p[$i]['title']; $content['page_element'][$i]['thisurl'] = $p[$i]['thisurl']; $content['page_element'][$i]['social_body_text'] = $p[$i]['social_body_text']; $content['page_element'][$i]['readmore'] = $p[$i]['readmore']; $content['page_element'][$i]['main_text'] = $p[$i]['main_text']; $content['page_element'][$i]['id'] = $p[$i]['id']; $content['page_element'][$i]['date_posted'] = $p[$i]['date_posted']; } } //post page //loop throught database to see if first parameter is a category of the site if ($meta_type == 'post') { //post $p = get_single_post($path); if (!$p) { //send 404 header first header("HTTP/1.0 404 Not Found"); //then cast the content for 404 page $content['type'] = 'error404'; } else { $content['type'] = 'thepost'; $content['title'] = $p['title']; $content['description'] = $p['description']; $content['keyword'] = $p['keyword']; $post_id = $p['id']; $content['page_element'][0]['sub_title'] = $p['h1_title']; $content['page_element'][0]['thisurl'] = $p['path']; $content['page_element'][0]['description'] = $p['description']; $content['page_element'][0]['readmore'] = $p['readmore'];
function smarty_function_getposts($params, &$loq) { $ar = array(); $opt = array(); $ph = $loq->_ph; if (is_numeric($params['postid']) && $params['postid'] > 0) { $postid = $params['postid']; } else { $postid = FALSE; } // If "assign" is not set... we'll establish a default. if ($params['assign'] == '') { if ($postid) { $params['assign'] = 'post'; } else { $params['assign'] = 'posts'; } } if ($postid && is_int($postid)) { $loq->assign($params['assign'], get_single_post($loq, $ph, $postid)); return; } // If "archive" is set, order them ASCENDING by posttime. if ($params['archive']) { $opt['order'] = " ORDER BY posttime "; } // If num is set, we'll only get that many results in return if (is_numeric($params['num'])) { $opt['num'] = $params['num']; } // If skip is set, we'll skip that many results if (is_numeric($params['skip'])) { $opt['skip'] = $params['skip']; } if ($params['section'] != '') { $opt['sectionid'] = $loq->sect_by_name[$params['section']]; } if ($loq->show_section) { $opt['sectionid'] = $loq->show_section; } if (is_numeric($params['year'])) { if (strlen($params['year']) != 4) { $loq->trigger_error('getposts: year parameter requires a 4 digit year'); return; } $opt['year'] = $params['year']; } foreach (array('month', 'day', 'hour', 'minute', 'second') as $type) { if (is_numeric($params[$type])) { if (strlen($params[$type]) != 2) { $loq->trigger_error('getposts: ' . $type . ' parameter requires a 2 digit month'); return; } $opt[$type] = $params[$type]; } } $opt['home'] = $params['home']; if (($posts = $ph->get_posts($opt, 'html')) !== false) { $lastmonth = 0; $lastdate = 0; foreach ($posts as $key => $value) { if (date('Ymd', intval($posts[$key]['posttime'])) != $lastdate) { $posts[$key]['newday'] = TRUE; } $lastdate = intval(date('Ymd', $posts[$key]['posttime'])); if (intval(date('Fy', $posts[$key]['posttime'])) != $lastmonth) { $posts[$key]['newmonth'] = TRUE; } $lastmonth = strftime('%B%Y', intval($posts[$key]['posttime'])); //date('Fy',$ar['posts'][$key]['posttime']); } $loq->assign($params['assign'], $posts); } else { $loq->assign($params['assign'], array(0 => array('title' => $ph->status))); } }