[Comoblog-commit] comoblog/include config.inc.php, 1.4, 1.5 libraries.inc.php, 1.11, 1.12
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2006-08-16 16:39:05
|
Update of /cvsroot/comoblog/comoblog/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8874/include Modified Files: config.inc.php libraries.inc.php Log Message: Initial cache code added, just libraries and base schema, not linked in functionally Index: libraries.inc.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/include/libraries.inc.php,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- libraries.inc.php 16 Aug 2006 01:12:41 -0000 1.11 +++ libraries.inc.php 16 Aug 2006 16:39:01 -0000 1.12 @@ -828,4 +828,78 @@ return strtr ($string, $trans_tbl); } + +//ADDED in 1.3 +function get_cache_config($keyphrase){ + $query = " + select * + from ".CFG_MYSQL_TABPREFIX."cache c + where c.cache_keyphrase= '".addslashes($keyphrase)."'"; + $res = mysql_query($query); + + if (!$res || !mysql_num_rows($res)){ + return ("not-cached"); + } + + return $res; + +} + +function get_cache_content($keyphrase,$post_id){ + $query = " + select cache_content + from ".CFG_MYSQL_TABPREFIX."cache c + where c.cache_keyphrase= '".addslashes($keyphrase)."' and and cache_clear > now()+0 and cache_post_id='".addslashes($post_id)."'"; + ; + $res = mysql_query($query); + + if (!$res || !mysql_num_rows($res)){ + return false; + } + + return mysql_query($res,0,0); + +} +// ADDED IN 1.3 +function set_cache_content($keyphrase,$post_id,$cache_content,$cache_age){ + + // empty place holder + $query =""; + // find out if we have this cached already + if (get_cache_content($keyphrase,$post_id) !=false){ + // if we do - update the record. + $query ="update ".CFG_MYSQL_TABPREFIX."cache " . + "set cache_content=''".addslashes($cache_content)."',cache_added=now()+0,cache_clear=now()+".$cache_age." where cache_keyphrase= '".addslashes($keyphrase)."' and cache_post_id='".addslashes($post_id)."'"; + } + + else { + // if not - add a record + $query = " + insert into ".CFG_MYSQL_TABPREFIX."commenters + (cache_keyphrase,cache_post_id,cache_content,cache_added,cache_clear) + values ( + '".addslashes($keyphrase)."', + '".addslashes($post_id)."', + '".addslashes($cache_content)."', + now()+0, + now()+"/$cache_age." + ) + "; + } + + + // run the query + $res = mysql_query($query); + + if (!$res) + return (false); + + $insert_id = mysql_insert_id(); + + return ($insert_id); + +} + + + ?> Index: config.inc.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/include/config.inc.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- config.inc.php 16 Aug 2006 01:12:41 -0000 1.4 +++ config.inc.php 16 Aug 2006 16:39:01 -0000 1.5 @@ -53,6 +53,7 @@ // modules and filters $TOP_MODULES = array(); $SIDEBAR_MODULES = array(); +$BOTTOM_MODULES = array(); $POST_PRE_FILTERS = array(); $POST_POST_FILTERS = array(); @@ -80,7 +81,11 @@ elseif ($row['mod_pos'] == 'top') { $TOP_MODULES[] = $row['mod_name']; } - + //ADDED in 1.3 + // well, why not have them as well + elseif ($row['mod_pos'] == 'bottom') { + $BOTTOM_MODULES[] = $row['mod_name']; + } if ($row['mod_filter_posts'] == 'Y'){ $POST_PRE_FILTERS[] = $row['mod_name']; } |