[Comoblog-commit] comoblog index.php,1.3,1.4
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2006-02-24 00:01:18
|
Update of /cvsroot/comoblog/comoblog In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12776 Modified Files: index.php Log Message: initial commit to make sure i've not missed anything transfering the code from my live site down to my cvs version basic premis is that new skins sit in css/SKINNAME/css.php of mod skin select is set to be shown then the users can change the skin via a drop down, if not then a default can be set in the admin area. these skins are imported after the rest of the css so that the content overrides and extends the existing comoblog css - i think we need to decide if skins will provide a full set of styleing or just override and extend the exising code should skin css be entered via the admin area, or uploaded (like a module) ? id prefere to upload as a module as that allows for custom images etc note need to change things like the topic icons some how Index: index.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/index.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- index.php 22 Dec 2005 05:30:18 -0000 1.3 +++ index.php 24 Feb 2006 00:01:13 -0000 1.4 @@ -1,144 +1,151 @@ -<?php -if (!file_exists('include/param.inc.php')) { - Header ('Location: _install/install.php'); - exit; -} -require_once ("include/config.inc.php"); - +<?php +if (!file_exists('include/param.inc.php')) { + Header ('Location: _install/install.php'); + exit; +} +require_once ("include/config.inc.php"); + // CHECK VERSION UPGRADE ///////////////////////////////////////////////////// if (!check_version_match()) { Header ('Location: _install/patch_0.php'); exit; } +// is it a change skin request? + +if ($_GET['useskin']){ // 30 days + setcookie('comoskin', $_GET['useskin'], time()+60*60*24*30); +} + + ////////////////////////////////////////////////////////////////////////////// -// CURRENT_TIMESTAMP ////////////////////////////////////////////////////////// -// - $current_timestamp = ''; - - if(isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '/') { - $current_date = substr($_SERVER['PATH_INFO'],1,strlen($_SERVER['PATH_INFO'])-1); - $y = substr($current_date,0,4); - $m = substr($current_date,4,2); - $d = substr($current_date,6,2); - - $current_timestamp = mktime(0,0,0,$m,$d,$y); - if ($current_timestamp > time() || $current_timestamp <= 0) - $current_timestamp = time(); - } - else { - $current_timestamp = time(); - } -// -/////////////////////////////////////////////////////////////////////////////// - - -$tpl = new XTemplate ("templates/index.tpl.htm", "main"); - -if(isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '/' && $_SERVER['PATH_INFO'] != '') { - $posts = posts_in_date ($current_timestamp); - $date = ucfirst(strftime($POST_DATE_FORMAT, $current_timestamp)); - $page_title = $TXT['posts_received'] . ' : ' . $date; -} -else { - $posts = posts_last (CFG_HOWMANY_ITEMS); - $page_title = $TXT['recent_posts']; -} - -$tpl->assign ('PAGE_TITLE', $page_title); - - - - - -if ($posts) { - for ($c = 0; $c < count($posts); $c++) { - // clean up post - $posts[$c]['post_mail_from'] = antispam(htmlentities($posts[$c]['post_mail_from']), true); - $posts[$c]['post_mail_subject'] = antispam(htmlentities($posts[$c]['post_mail_subject']), true); - $date = getdate($posts[$c]['post_mail_date']); - $posts[$c]['post_mail_date'] = strftime($CAL_DATE_FORMAT." %H:%M", $posts[$c]['post_mail_date']); - - $tpl->assign('POST', $posts[$c]); - - // topic icon - if ($posts[$c]['topic_id'] != 0) - $tpl->parse('main.post.topic'); - - // images - if ($posts[$c]['post_images'] > 0) { - $query = " - select img_thumb, concat(img_id,'.',img_extension) as img_name, concat(img_id,'_thumb.',img_extension) as img_thumb_name, img_width, img_height - from ".CFG_MYSQL_TABPREFIX."images - where post_id = '".$posts[$c]['post_id']."' - and img_display = 'attach' - "; - $res = mysql_query($query); - - while ($row = mysql_fetch_assoc($res)) { +// CURRENT_TIMESTAMP ////////////////////////////////////////////////////////// +// + $current_timestamp = ''; + + if(isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '/') { + $current_date = substr($_SERVER['PATH_INFO'],1,strlen($_SERVER['PATH_INFO'])-1); + $y = substr($current_date,0,4); + $m = substr($current_date,4,2); + $d = substr($current_date,6,2); + + $current_timestamp = mktime(0,0,0,$m,$d,$y); + if ($current_timestamp > time() || $current_timestamp <= 0) + $current_timestamp = time(); + } + else { + $current_timestamp = time(); + } +// +/////////////////////////////////////////////////////////////////////////////// + + +$tpl = new XTemplate ("templates/index.tpl.htm", "main"); + +if(isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '/' && $_SERVER['PATH_INFO'] != '') { + $posts = posts_in_date ($current_timestamp); + $date = ucfirst(strftime($POST_DATE_FORMAT, $current_timestamp)); + $page_title = $TXT['posts_received'] . ' : ' . $date; +} +else { + $posts = posts_last (CFG_HOWMANY_ITEMS); + $page_title = $TXT['recent_posts']; +} + +$tpl->assign ('PAGE_TITLE', $page_title); + + + + + +if ($posts) { + for ($c = 0; $c < count($posts); $c++) { + // clean up post + $posts[$c]['post_mail_from'] = antispam(htmlentities($posts[$c]['post_mail_from']), true); + $posts[$c]['post_mail_subject'] = antispam(htmlentities($posts[$c]['post_mail_subject']), true); + $date = getdate($posts[$c]['post_mail_date']); + $posts[$c]['post_mail_date'] = strftime($CAL_DATE_FORMAT." %H:%M", $posts[$c]['post_mail_date']); + + $tpl->assign('POST', $posts[$c]); + + // topic icon + if ($posts[$c]['topic_id'] != 0) + $tpl->parse('main.post.topic'); + + // images + if ($posts[$c]['post_images'] > 0) { + $query = " + select img_thumb, concat(img_id,'.',img_extension) as img_name, concat(img_id,'_thumb.',img_extension) as img_thumb_name, img_width, img_height + from ".CFG_MYSQL_TABPREFIX."images + where post_id = '".$posts[$c]['post_id']."' + and img_display = 'attach' + "; + $res = mysql_query($query); + + while ($row = mysql_fetch_assoc($res)) { if (eregi('\.3g2',$row['img_name'])) { $tpl->assign('IMAGE', $row); $tpl->parse('main.post.video_3g2'); } - else if ($row['img_thumb'] == 'Y') { - $tpl->assign('IMAGE', $row); - $tpl->parse('main.post.thumb_img'); - } - else { - $tpl->assign('IMAGE', $row); - $tpl->parse('main.post.img'); - } - } - } - - // author email - if (CFG_INTERACTION_AUTHOR == 'yes') - $tpl->parse('main.post.author'); - - // interaction bar - if (CFG_INTERACTION_COMMENTS == 'yes') - $tpl->parse('main.post.comment_button'); - if (CFG_INTERACTION_TRACKBACK == 'yes') { - $tpl->parse('main.post.auto_discovery_trackback'); - $tpl->parse('main.post.trackback_button'); - } - - - $tpl->parse('main.post'); - } -} -else { - $tpl->parse('main.noposts'); -} - - -// modules //////////////////////////////////////////////////////////////////// -// - if (count($SIDEBAR_MODULES) > 0) { - for ($mod_cnt = 0; $mod_cnt < count($SIDEBAR_MODULES); $mod_cnt++) { - include_once (CFG_BASE_PATH.'/modules/'.$SIDEBAR_MODULES[$mod_cnt].'/'.$SIDEBAR_MODULES[$mod_cnt].'.php'); - $tpl->assign('SIDEBAR_MODULE',$mod_contents); - $tpl->parse('main.sidebar_module'); - } - } - if (count($TOP_MODULES) > 0) { - for ($mod_cnt = 0; $mod_cnt < count($TOP_MODULES); $mod_cnt++) { - include_once (CFG_BASE_PATH.'/modules/'.$TOP_MODULES[$mod_cnt].'/'.$TOP_MODULES[$mod_cnt].'.php'); - $tpl->assign('TOP_MODULE',$mod_contents); - $tpl->parse('main.top_bar.top_module'); - } - $tpl->parse('main.top_bar'); - } -// -/////////////////////////////////////////////////////////////////////////////// - - -$tpl->parse('main'); -$tpl->out('main'); - - -// close db connection -mysql_close (); -?> + else if ($row['img_thumb'] == 'Y') { + $tpl->assign('IMAGE', $row); + $tpl->parse('main.post.thumb_img'); + } + else { + $tpl->assign('IMAGE', $row); + $tpl->parse('main.post.img'); + } + } + } + + // author email + if (CFG_INTERACTION_AUTHOR == 'yes') + $tpl->parse('main.post.author'); + + // interaction bar + if (CFG_INTERACTION_COMMENTS == 'yes') + $tpl->parse('main.post.comment_button'); + if (CFG_INTERACTION_TRACKBACK == 'yes') { + $tpl->parse('main.post.auto_discovery_trackback'); + $tpl->parse('main.post.trackback_button'); + } + + + $tpl->parse('main.post'); + } +} +else { + $tpl->parse('main.noposts'); +} + + +// modules //////////////////////////////////////////////////////////////////// +// + if (count($SIDEBAR_MODULES) > 0) { + for ($mod_cnt = 0; $mod_cnt < count($SIDEBAR_MODULES); $mod_cnt++) { + include_once (CFG_BASE_PATH.'/modules/'.$SIDEBAR_MODULES[$mod_cnt].'/'.$SIDEBAR_MODULES[$mod_cnt].'.php'); + $tpl->assign('SIDEBAR_MODULE',$mod_contents); + $tpl->parse('main.sidebar_module'); + } + } + if (count($TOP_MODULES) > 0) { + for ($mod_cnt = 0; $mod_cnt < count($TOP_MODULES); $mod_cnt++) { + include_once (CFG_BASE_PATH.'/modules/'.$TOP_MODULES[$mod_cnt].'/'.$TOP_MODULES[$mod_cnt].'.php'); + $tpl->assign('TOP_MODULE',$mod_contents); + $tpl->parse('main.top_bar.top_module'); + } + $tpl->parse('main.top_bar'); + } +// +/////////////////////////////////////////////////////////////////////////////// + + +$tpl->parse('main'); +$tpl->out('main'); + + +// close db connection +mysql_close (); +?> |