[Comoblog-commit] comoblog/include libraries.inc.php,1.8,1.9
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2006-02-17 15:16:40
|
Update of /cvsroot/comoblog/comoblog/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2179/include Modified Files: libraries.inc.php Log Message: work towards the 1.2 release - this adds url for commentors as well as an email address -- NB may need to move exisinting data to the new row (will on my site,but not sure if thats public code or not) SEO friendly URLS on apache to the main site and most of the modules (optionally turned on by new config setting) ---------------------------------------------------------------------- Enter Log. Lines beginning with `CVS:' are removed automatically Committing in . Modified Files: _install/comoblog_db.xml _install/patch_1.php include/libraries.inc.php lang/english.inc.php templates/add_comment.tpl.htm templates/index.tpl.htm templates/list_comments.tpl.htm Added Files: htaccess _install/upgrades/1.1_to_1.2.xml ---------------------------------------------------------------------- Index: libraries.inc.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/include/libraries.inc.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- libraries.inc.php 10 Jan 2006 00:45:57 -0000 1.8 +++ libraries.inc.php 17 Feb 2006 15:16:37 -0000 1.9 @@ -125,6 +125,9 @@ $posts = array(); while ($row = mysql_fetch_array($res)) { $row['post_permalink'] = CFG_SITE_URL.'post.php'.$iisbug.'/'.$row['post_id']; + if (CFG_USE_FRIENDLY_URLS =="yes"){ + $row['post_permalink'] = CFG_SITE_URL.'/' .$row['post_id'] ."/". $row['post_mail_subject']; + } $row['post_trackback_ping_url'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id']; $row['post_trackback_list'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id'].'?__mode=list'; $row['post_trackback_list_rss'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id'].'?__mode=rss'; @@ -155,6 +158,9 @@ $posts = array(); while ($row = mysql_fetch_array($res)) { $row['post_permalink'] = CFG_SITE_URL.'post.php'.$iisbug.'/'.$row['post_id']; + if (CFG_USE_FRIENDLY_URLS =="yes"){ + $row['post_permalink'] = CFG_SITE_URL.'/' .$row['post_id'] ."/". $row['post_mail_subject']; + } $row['post_trackback_ping_url'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id']; $row['post_trackback_list'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id'].'?__mode=list'; $row['post_trackback_list_rss'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id'].'?__mode=rss'; @@ -164,8 +170,6 @@ return ($posts); } - - function posts_howmany () { $query = "select count(post_id) from ".CFG_MYSQL_TABPREFIX."posts"; $res = mysql_query($query); @@ -177,6 +181,40 @@ } +function hits_howmany () { + $query = "select count(contentextra2_id) from easymoblog_mod_contentextra2"; + $res = mysql_query($query); + if ($res) { + $howmany = mysql_result($res,0,0); + return ($howmany); + } + return (false); +} + + + +function post_first() { + $query = "select FROM_UNIXTIME(min(post_mail_date)) from easymoblog_posts"; + $res = mysql_query($query); + if ($res) { + $howmany = mysql_result($res,0,0); + return ($howmany); + } + return (false); +} + + +function comments_howmany () { + $query = "select count(comment_id) from easymoblog_comments"; + $res = mysql_query($query); + if ($res) { + $howmany = mysql_result($res,0,0); + return ($howmany); + } + return (false); +} + + function posts_last ($howmany) { if (CFG_USE_PATH_INFO == 'no') $iisbug = '?'; @@ -207,9 +245,13 @@ $posts = array(); while ($row = mysql_fetch_array($res)) { $row['post_permalink'] = CFG_SITE_URL.'post.php'.$iisbug.'/'.$row['post_id']; + if (CFG_USE_FRIENDLY_URLS =="yes"){ + $row['post_permalink'] = CFG_SITE_URL.'/' .$row['post_id'] ."/". $row['post_mail_subject']; + } $row['post_trackback_ping_url'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id']; $row['post_trackback_list'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id'].'?__mode=list'; $row['post_trackback_list_rss'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id'].'?__mode=rss'; + $row['post_mail_date_rss'] = gmstrftime("%a, %d %b %Y %T %Z",$row['post_mail_date']); $posts[] = $row; } @@ -248,7 +290,7 @@ where p.post_mail_date >= ".$start." and p.post_mail_date < ".$end." group by p.post_id - order by p.post_mail_date desc + order by p.post_mail_date ".CFG_POST_SORT_ORDER." "; $res = mysql_query($query); @@ -258,6 +300,9 @@ $posts = array(); while ($row = mysql_fetch_array($res)) { $row['post_permalink'] = CFG_SITE_URL.'post.php'.$iisbug.'/'.$row['post_id']; + if (CFG_USE_FRIENDLY_URLS =="yes"){ + $row['post_permalink'] = CFG_SITE_URL.'/' .$row['post_id'] ."/". $row['post_mail_subject']; + } $row['post_trackback_ping_url'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id']; $row['post_trackback_list'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id'].'?__mode=list'; $row['post_trackback_list_rss'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$row['post_id'].'?__mode=rss'; @@ -267,6 +312,46 @@ return ($posts); } +##### PLACE HOLDER FOR TUNES ##### +# to line 356 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + function post_details ($post_id) { if (CFG_USE_PATH_INFO == 'no') @@ -275,16 +360,22 @@ $iisbug = ''; $query = " - select p.*, count(c.post_id) as post_comments, count(tr.post_id) as post_trackback_pings, t.topic_name, concat(t.img_id,'.',i.img_extension) as topic_img - from ".CFG_MYSQL_TABPREFIX."posts p - left join ".CFG_MYSQL_TABPREFIX."comments c - on p.post_id = c.post_id - left join ".CFG_MYSQL_TABPREFIX."trackback_pings tr - on p.post_id = tr.post_id - left join ".CFG_MYSQL_TABPREFIX."topics t - on p.topic_id = t.topic_id - left join ".CFG_MYSQL_TABPREFIX."images i - on t.img_id = i.img_id + select + p.*, + FROM_UNIXTIME(p.post_mail_date) as post_mail_date_nice , + count(c.post_id) as post_comments, + count(tr.post_id) as post_trackback_pings, + t.topic_name, concat(t.img_id,'.',i.img_extension) as topic_img + from + ".CFG_MYSQL_TABPREFIX."posts p + left join ".CFG_MYSQL_TABPREFIX."comments c + on p.post_id = c.post_id + left join ".CFG_MYSQL_TABPREFIX."trackback_pings tr + on p.post_id = tr.post_id + left join ".CFG_MYSQL_TABPREFIX."topics t + on p.topic_id = t.topic_id + left join ".CFG_MYSQL_TABPREFIX."images i + on t.img_id = i.img_id where p.post_id = '".$post_id."' group by p.post_id "; @@ -295,6 +386,9 @@ $post = mysql_fetch_array($res); $post['post_permalink'] = CFG_SITE_URL.'post.php'.$iisbug.'/'.$post['post_id']; + if (CFG_USE_FRIENDLY_URLS =="yes"){ + $post['post_permalink'] = CFG_SITE_URL.'/' .$post['post_id'] ."/". $post['post_mail_subject']; + } $post['post_trackback_ping_url'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$post['post_id']; $post['post_trackback_list'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$post['post_id'].'?__mode=list'; $post['post_trackback_list_rss'] = CFG_SITE_URL.'trackback.php'.$iisbug.'/'.$post['post_id'].'?__mode=rss'; @@ -339,17 +433,18 @@ } } - $query = " - insert into ".CFG_MYSQL_TABPREFIX."comments - (comment_author,comment_author_email,comment_text,comment_added,post_id) - values ( - '".$comment['comment_author']."', - '".$comment['comment_author_email']."', - '".$comment['comment_text']."', - '".time()."', - '".$comment['post_id']."' - ) - "; + $query = " + insert into ".CFG_MYSQL_TABPREFIX."comments + (comment_author,comment_author_email,comment_author_url,comment_text,comment_added,post_id) + values ( + '".addslashes($comment['comment_author'])."', + '".addslashes($comment['comment_author_email'])."', + '".addslashes($comment['comment_author_url'])."', + '".addslashes($comment['comment_text'])."', + '".time()."', + '".$comment['post_id']."' + ) + "; $res = mysql_query($query); if (!$res) @@ -365,7 +460,7 @@ select c.* from ".CFG_MYSQL_TABPREFIX."comments c where c.post_id = '".$post_id."' - order by c.comment_added desc + order by c.comment_added ". CFG_COMMENT_SORT_ORDER . " "; $res = mysql_query($query); |