27 |
|
|
28 |
$smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) ); |
$smarty->assign( array ( lpic=>$lpic, lext=>$lext, mpic=>$mpic, Section_title=>$title ) ); |
29 |
|
|
30 |
$sql_where=""; |
$sql_where="where visible is true"; |
31 |
|
|
32 |
if (isset($id)) { |
function find_html_file($dir,$file) { |
33 |
$sql_where.=" where id=$id "; |
$file="./$dir/$file"; |
34 |
|
if (is_file("$file") && file_exists("$file")) { return "$file"; } |
35 |
|
if (is_file("$file.htm") && file_exists("$file.htm")) { return "$file.htm"; } |
36 |
|
if (is_file("$file.html") && file_exists("$file.html")) { return "$file.html"; } |
37 |
|
return 0; |
38 |
} |
} |
39 |
|
|
40 |
if (! isset($more) || !file_exists("./news/$more")) { |
if (file_exists(find_html_file("news",$more))) { |
41 |
|
|
42 |
$sth = $dbh->prepare("select id,title,date,body,more,pdf from news $sql_where order by id desc"); |
$main=join('',file(find_html_file("news",$more))); |
43 |
$sth->execute(); |
$back_url=$GLOBALS[HTTP_REFERER]; |
44 |
while ($row=$sth->fetchrow_hash()) { |
|
45 |
$data[]=$row; |
} else { |
46 |
} |
if (isset($id)) { |
47 |
|
$sql_where.=" and id=$id "; |
48 |
|
} |
49 |
|
|
50 |
$smarty->assign("data",$data); |
$sth = $dbh->prepare("select id,upper(title) as title,town_date,body,more,pdf from news $sql_where order by date desc"); |
51 |
|
$sth->execute(); |
52 |
|
while ($row=$sth->fetchrow_hash()) { |
53 |
|
$data[]=$row; |
54 |
|
} |
55 |
|
|
56 |
$main=$smarty->fetch("new.tpl"); |
$smarty->assign("data",$data); |
57 |
|
|
58 |
if (isset($id) && $data[0][more]) { |
$main=$smarty->fetch("new.tpl"); |
|
$main=join('',file("./news/".$data[0][more])); |
|
59 |
|
|
60 |
|
if (isset($id) && find_html_file("news",$data[0][more])) { |
61 |
|
$main=join('',file(find_html_file("news",$data[0][more]))); |
62 |
|
} |
63 |
|
|
64 |
|
if ($main == "") { |
65 |
|
$main = "This news item is no longer available"; |
66 |
} |
} |
67 |
|
|
|
} else { // display details |
|
|
$main=join('',file("./news/$more")); |
|
|
$back_url=$GLOBALS[HTTP_REFERER]; |
|
68 |
} |
} |
69 |
|
|
70 |
include("common.inc"); |
include("common.inc"); |