1 |
rabit |
1.1 |
<?php |
2 |
|
|
/*------------------------------------------------------------------------------ |
3 |
|
|
--- www.netfrag.org |
4 |
|
|
--- Content management functions include file. |
5 |
|
|
-------------------------------------------------------------------------------- |
6 |
|
|
--- rabit, 01:04 27.08.2004 |
7 |
joko |
1.4 |
--- $Id: cms.php.inc,v 1.3 2004/08/30 04:16:24 rabit Exp $ |
8 |
rabit |
1.1 |
------------------------------------------------------------------------------*/ |
9 |
|
|
|
10 |
|
|
function cms_getcontent($type, $keyname, $language_id = 0) { |
11 |
|
|
|
12 |
joko |
1.4 |
$sql = "SELECT contents.content, contents.description, UNIX_TIMESTAMP(contents.timestamp), languages.name, users.name, contents.keyname 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 |
rabit |
1.1 |
|
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 |
joko |
1.4 |
'creator_name' => $row[4], |
25 |
|
|
'keyname' => $row[5], |
26 |
rabit |
1.1 |
); |
27 |
|
|
|
28 |
|
|
return $contentdata; |
29 |
|
|
|
30 |
|
|
} |
31 |
rabit |
1.3 |
|
32 |
|
|
//---------------------------------------------------------- |
33 |
|
|
|
34 |
|
|
function cms_getlist($types, $keynames, $daterange = '', $languageids = '', $languages = '') { |
35 |
|
|
|
36 |
|
|
$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;"; |
37 |
|
|
|
38 |
|
|
$res = mysql_query($sql); |
39 |
|
|
|
40 |
|
|
$rowcount = 0; |
41 |
|
|
|
42 |
|
|
while($row = mysql_fetch_row($res)) $rows[$rowcount++] = $row; |
43 |
joko |
1.4 |
|
44 |
|
|
return $rows; |
45 |
|
|
|
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
//---------------------------------------------------------- |
49 |
|
|
|
50 |
|
|
function cms_getindex($type) { |
51 |
|
|
|
52 |
|
|
$sql = " |
53 |
|
|
SELECT contents.id, contents.keyname, contents.description, |
54 |
|
|
UNIX_TIMESTAMP(contents.timestamp) as timestamp, languages.id, |
55 |
|
|
languages.name as lang, users.name as creator |
56 |
|
|
FROM contents, languages, users |
57 |
|
|
WHERE contents.type='$type' AND users.id=contents.creator_id AND languages.id=contents.language_id;"; |
58 |
|
|
|
59 |
|
|
$res = mysql_query($sql); |
60 |
|
|
|
61 |
|
|
$rowcount = 0; |
62 |
|
|
|
63 |
|
|
while($row = mysql_fetch_assoc($res)) $rows[$rowcount++] = $row; |
64 |
rabit |
1.3 |
|
65 |
|
|
return $rows; |
66 |
|
|
|
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
//---------------------------------------------------------- |
70 |
rabit |
1.1 |
|
71 |
|
|
//------------------------------------------------------------------------------ |
72 |
|
|
|
73 |
|
|
?> |