/[corp_html]/new.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /new.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dpavlin, Wed Feb 21 15:52:31 2001 UTC revision 1.3 by dpavlin, Thu Feb 22 09:51:19 2001 UTC
# Line 29  $smarty->assign( array ( lpic=>$lpic, le Line 29  $smarty->assign( array ( lpic=>$lpic, le
29    
30  $sql_where="where visible is true";  $sql_where="where visible is true";
31    
32  if (isset($id)) {  function find_html_file($dir,$file) {
33          $sql_where.=" and 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,town_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,title,town_date,body,more,pdf from news $sql_where order by id 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");

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.26