[Comoblog-commit] comoblog/admin manage_posts.php,1.1.1.1,1.2
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2005-12-15 16:50:51
|
Update of /cvsroot/comoblog/comoblog/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19354/comoblog/admin Modified Files: manage_posts.php Log Message: as requested on the boards, ive added the code to generate a title from the body if there isnt one in the message, this is done as the post is added, however it occurs to me that this may not be the best way, ive also supplied code for the list template which just provides a title on the list screen but doesnt actually create one. Index: manage_posts.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/admin/manage_posts.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- manage_posts.php 16 Aug 2005 05:49:44 -0000 1.1.1.1 +++ manage_posts.php 15 Dec 2005 16:50:43 -0000 1.2 @@ -1,78 +1,84 @@ -<?php -require ('include/admin.inc.php'); - -$tpl = new XTemplate ('templates/manage_posts.tpl.htm'); - -$offset = 0; -if (isset($_GET['o'])) $offset = $_GET['o'] + 0; - -$delete = 'n'; -if (isset($_GET['d']) && $_GET['d'] == 'y') $delete = 'y'; - - - - - - - - -if ($delete == 'y') - $tpl->parse('main.deleted'); - - - - - -$display = 10; - -$posts = posts_list ($offset, $display); - -if ($posts) { - - for ($cnt = 0; $cnt < count($posts); $cnt++) { - - if ($cnt % 2) - $tpl->assign('BGCOLOR', '#ffffff'); - else - $tpl->assign('BGCOLOR', '#efefef'); - - $posts[$cnt]['post_mail_from'] = htmlentities(antispam($posts[$cnt]['post_mail_from'])); - $posts[$cnt]['post_mail_date'] = strftime('%D %T',$posts[$cnt]['post_mail_date']); - $tpl->assign('POST', $posts[$cnt]); - $tpl->parse('main.posts.post'); - } - - $howmany = posts_howmany(); - - $tpl->assign("OFFSET", $offset); - $tpl->assign("FIRST", $offset + 1); - $tpl->assign("LAST", $offset + $cnt); - $tpl->assign("TOTAL", $howmany); - - if ($howmany > ($offset + $display)) - { - $next_offset = $offset + $display; - $tpl->assign("NEXT_OFFSET", $next_offset); - $tpl->parse("main.posts.next"); - } - - if (($offset - $display) >= 0) - { - $prev_offset = $offset - $display; - $tpl->assign("PREV_OFFSET", $prev_offset); - $tpl->parse("main.posts.prev"); - } - $tpl->parse('main.posts'); -} -else { - $tpl->parse('main.no_posts'); -} - -$tpl->parse('main.home'); -$tpl->parse('main'); -$tpl->out('main'); - - -// close db connection -mysql_close (); -?> +<?php +require ('include/admin.inc.php'); + +$tpl = new XTemplate ('templates/manage_posts.tpl.htm'); + +$offset = 0; +if (isset($_GET['o'])) $offset = $_GET['o'] + 0; + +$delete = 'n'; +if (isset($_GET['d']) && $_GET['d'] == 'y') $delete = 'y'; + + + + + + + + +if ($delete == 'y') + $tpl->parse('main.deleted'); + + + + + +$display = 10; + +$posts = posts_list ($offset, $display); + +if ($posts) { + + for ($cnt = 0; $cnt < count($posts); $cnt++) { + + if ($cnt % 2) + $tpl->assign('BGCOLOR', '#ffffff'); + else + $tpl->assign('BGCOLOR', '#efefef'); + + $posts[$cnt]['post_mail_from'] = htmlentities(antispam($posts[$cnt]['post_mail_from'])); + $posts[$cnt]['post_mail_date'] = strftime('%D %T',$posts[$cnt]['post_mail_date']); + if ( $posts[$cnt]['post_mail_subject'] == ""){ + // need to to strip html incase we break across a tag + $title = filter_html($posts[$cnt]['post_mail_subject']); + $posts[$cnt]['post_mail_subject'] = substr($title,0,150) ."..." ; + } + + $tpl->assign('POST', $posts[$cnt]); + $tpl->parse('main.posts.post'); + } + + $howmany = posts_howmany(); + + $tpl->assign("OFFSET", $offset); + $tpl->assign("FIRST", $offset + 1); + $tpl->assign("LAST", $offset + $cnt); + $tpl->assign("TOTAL", $howmany); + + if ($howmany > ($offset + $display)) + { + $next_offset = $offset + $display; + $tpl->assign("NEXT_OFFSET", $next_offset); + $tpl->parse("main.posts.next"); + } + + if (($offset - $display) >= 0) + { + $prev_offset = $offset - $display; + $tpl->assign("PREV_OFFSET", $prev_offset); + $tpl->parse("main.posts.prev"); + } + $tpl->parse('main.posts'); +} +else { + $tpl->parse('main.no_posts'); +} + +$tpl->parse('main.home'); +$tpl->parse('main'); +$tpl->out('main'); + + +// close db connection +mysql_close (); +?> |