9 |
|
|
10 |
function cms_getcontent($type, $keyname, $language_id = 0) { |
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;"; |
$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 |
|
|
14 |
$res = mysql_query($sql); |
$res = mysql_query($sql); |
15 |
if(!$res) return false; |
if(!$res) return false; |
21 |
'description' => $row[1], |
'description' => $row[1], |
22 |
'unixtime' => $row[2], |
'unixtime' => $row[2], |
23 |
'language_name' => $row[3], |
'language_name' => $row[3], |
24 |
'creator_name' => $row[4] |
'creator_name' => $row[4], |
25 |
|
'keyname' => $row[5], |
26 |
); |
); |
27 |
|
|
28 |
return $contentdata; |
return $contentdata; |
43 |
|
|
44 |
return $rows; |
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 |
|
|
65 |
|
return $rows; |
66 |
|
|
67 |
} |
} |
68 |
|
|
69 |
//---------------------------------------------------------- |
//---------------------------------------------------------- |