mirror of
https://git.code.sf.net/p/quake/website
synced 2025-02-22 19:51:58 +00:00
news caching stuff
This commit is contained in:
parent
eb60c7044b
commit
231eb79fc2
1 changed files with 234 additions and 205 deletions
|
@ -126,10 +126,39 @@
|
||||||
}
|
}
|
||||||
mysql_close ($conn);
|
mysql_close ($conn);
|
||||||
} else {
|
} else {
|
||||||
newsItem ('Now', 'Web Server', '<P>Error: Could not connect to SQL server to fetch news. Please notify the server administrator.');
|
include ('cache.php');
|
||||||
|
// newsItem ('Now', 'Web Server', '<P>Error: Could not connect to SQL server to fetch news. Please notify the server administrator.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fetchNewsEntry ($number)
|
||||||
|
{
|
||||||
|
need('date');
|
||||||
|
|
||||||
|
$conn = @mysql_pconnect (sqlHost, sqlUser, sqlPass);
|
||||||
|
if ($conn) {
|
||||||
|
$query = 'SELECT n_date, n_user, n_news FROM news_main' .
|
||||||
|
" ORDER BY n_date DESC LIMIT $number";
|
||||||
|
$result = @mysql_db_query (sqlDB, $query, $conn);
|
||||||
|
if ($result) {
|
||||||
|
$numRows = @mysql_num_rows ($result);
|
||||||
|
if ($numRows) {
|
||||||
|
for ($i = 0 ; $i < $numRows ; $i++) {
|
||||||
|
list ($n_date, $n_user, $n_news) = mysql_fetch_row ($result);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
mysql_close ($conn);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return array (dateFromSQLDateTime ($n_date), $n_user, StripSlashes($n_news));
|
||||||
|
}
|
||||||
|
|
||||||
function monthlyNews ($month, $year)
|
function monthlyNews ($month, $year)
|
||||||
{
|
{
|
||||||
need('date');
|
need('date');
|
||||||
|
|
Loading…
Reference in a new issue