[Comoblog-commit] modules/mod_purge img_purge.gif,NONE,1.1 img_purge.php,NONE,1.1 mod_purge.php,NONE
Status: Inactive
Brought to you by:
markwallis
|
From: Mark W. \(a. serialmonkey\) <mar...@us...> - 2005-11-24 06:41:16
|
Update of /cvsroot/comoblog/modules/mod_purge In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6101/mod_purge Added Files: img_purge.gif img_purge.php mod_purge.php Log Message: 1352436 - Initial release - mod_purge --- NEW FILE: img_purge.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: img_purge.php --- <?php @ignore_user_abort(true); include_once (dirname(__FILE__).'/../../include/config.inc.php'); // purge interval $interval = CFG_PURGE_INTERVAL * 60 * 60; $now = time(); $diff = $now - CFG_LAST_PURGE; // if last_purge was more than CFG_PURGE_INTERVAL minutes ago, execute purge if ($diff > $interval) { // connect to db mysql_connect (CFG_MYSQL_HOST, CFG_MYSQL_USERNAME, CFG_MYSQL_PASSWORD) or die ('Error connecting to mySQL server'); mysql_select_db (CFG_MYSQL_DBNAME) or die ('Error selecting database'); $age_limit = $now - (CFG_PURGE_AGE * 24 * 60 * 60); $query = "delete from ".CFG_MYSQL_TABPREFIX."posts where post_added < ".$age_limit; $result = mysql_query($query); echo $query; // update timestamp in CFG_LAST_PURGE $query = "update ".CFG_MYSQL_TABPREFIX."preferences set pref_value='".$now."' where pref_name='CFG_LAST_PURGE'"; $result = mysql_query($query); } // output fake image $img_file = 'img_purge.gif'; $img_ctype = 'image/gif'; $fp = fopen($img_file, 'rb'); $img = fread($fp, filesize($img_file)); fclose($fp); header ('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header ('Pragma: no-cache'); // HTTP/1.0 header ('Content-type: '.$img_ctype); echo $img; // exit exit; ?> --- NEW FILE: mod_purge.php --- <?php $rand = time(); if (CFG_USE_PATH_INFO == 'no') $pathinfobug = '?'; else $pathinfobug = ''; $mod_contents = '<img src="'.CFG_SITE_URL.'modules/mod_purge/img_purge.php'.$pathinfobug.'/'.$rand.'" border="0" width="1" height="1" style="display:none;visibility:hidden;" alt="" />'; ?> |