2,
'automaticCleaningFactor' => 200,
'cacheDir' => './cache/tmp/',
'writeControl' => true,
'readControl' => true,
'readControlType' => 'md5',
'lifeTime' => 86400
);
// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);
$cache = $_GET['cache'];
switch ($cache) {
case 'clean': $Cache_Lite->clean(); break;
case 'clean_old': $Cache_Lite->clean(false, 'old'); break;
default: break;
}
// Test if thereis a valide cache for this id
if ($data = $Cache_Lite->get($id_cache)) {
echo $data;
} else { // No valid cache found (you have to make the page)
require('./common.php');
require('./connection.php');
/*
if (preg_match("/^http:\/\/www\..*$/Ui",$my_uri)==0) {
$new_uri = preg_replace("/^http:\/\//Ui", 'http://www.', $my_uri);
Header( "HTTP/1.1 301 Moved Permanently", TRUE, 310 );
Header( "Location: $new_uri" );
exit;
}
*/
$ric = array();
if (preg_match("/.*\/artist\.([^\.\/]+)\.html/U", $cur_uri, $ric)>0) {
$pres = "";
$artist_name = ucwords(preg_replace('/-/', ' ', $ric[1]));
$perma = "artist.".$ric[1];
$song['artists.perma'] = $perma;
$_REQUEST['action'] = 'search';
$text = "";
require('./header.php');
require('./result.php');
require('./footer.php');
} elseif (preg_match("/.*\/([^\.\/]+)\.([^\.\/]+)\.html/U", $cur_uri, $ric)>0) {
$pres = "";
$song_title = ucwords(preg_replace('/-/', ' ', $ric[1]));
$artist_name = ucwords(preg_replace('/-/', ' ', $ric[2]));
$title = "$song_title -";
$perma = $ric[1].".".$ric[2];
$sql = "";
$sql = add_where_bit($sql,"lyrics.perma", $perma, "'");
//$sql = add_where_bit($sql,"lyrics.title", $song_title, "'");
//$sql = add_where_bit($sql,"artists.artist", $artist_name, "'");
if ($sql!="") $sql = " WHERE ".$sql;
$song_rs =& $db->sql_rs("SELECT lyrics.id, texts.text FROM (lyrics INNER JOIN texts ON lyrics.id=texts.id) INNER JOIN artists ON lyrics.artist=artists.id $sql");
$text = "";
list($id, $text) = mysql_fetch_row($song_rs);
mysql_free_result($song_rs);
require('./header.php');
//echo "ci sono ".substr_count($text, "\n")." finelinea
";
$text = nl2br($text);
echo "
$song_title
$artist_name
$text
"; $my_comment = "./$perma.comment.html"; //echo $my_comment; if (file_exists($my_comment)) include($my_comment); require('./footer.php'); } else { $song_title = ""; $title = $default_title; $pres = $default_pres; require('./header.php'); require('./result.php'); require('./footer.php'); } $data = ob_get_contents(); $Cache_Lite->save($data, $id_cache); ob_end_flush(); } ?>