1 |
<?php |
2 |
/*------------------------------------------------------------------------------ |
3 |
--- www.netfrag.org |
4 |
--- Content management functions include file. |
5 |
-------------------------------------------------------------------------------- |
6 |
--- rabit, 01:04 27.08.2004 |
7 |
--- $Id$ |
8 |
------------------------------------------------------------------------------*/ |
9 |
|
10 |
function cms_getcontent($type, $keyname, $language_id = 0) { |
11 |
|
12 |
$sql = "SELECT contents.content, contents.description, UNIX_TIMESTAMP(contents.timestamp), languages.name, users.name FROM contents, languages, users WHERE contents.type='$type' AND contents.keyname='$keyname'" . ($language_id ? " AND languages.id='$language_id'" : '') . " AND users.id=contents.creator_id AND languages.id=contents.language_id LIMIT 0,1;"; |
13 |
|
14 |
$res = mysql_query($sql); |
15 |
if(!$res) return false; |
16 |
|
17 |
$row = mysql_fetch_row($res); |
18 |
|
19 |
$contentdata = array( |
20 |
'content' => $row[0], |
21 |
'description' => $row[1], |
22 |
'unixtime' => $row[2], |
23 |
'language_name' => $row[3], |
24 |
'creator_name' => $row[4] |
25 |
); |
26 |
|
27 |
return $contentdata; |
28 |
|
29 |
} |
30 |
|
31 |
//---------------------------------------------------------- |
32 |
|
33 |
function cms_getlist($types, $keynames, $daterange = '', $languageids = '', $languages = '') { |
34 |
|
35 |
$sql = "SELECT contents.id, contents.description, UNIX_TIMESTAMP(contents.timestamp), languages.id, languages.name, users.name FROM contents, languages, users WHERE contents.type='$types' AND contents.keyname='$keynames' AND users.id=contents.creator_id AND languages.id=contents.language_id;"; |
36 |
|
37 |
$res = mysql_query($sql); |
38 |
|
39 |
$rowcount = 0; |
40 |
|
41 |
while($row = mysql_fetch_row($res)) $rows[$rowcount++] = $row; |
42 |
|
43 |
return $rows; |
44 |
|
45 |
} |
46 |
|
47 |
//---------------------------------------------------------- |
48 |
|
49 |
//------------------------------------------------------------------------------ |
50 |
|
51 |
?> |