/[inncomm]/index.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 /index.php

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

revision 1.1 by dpavlin, Thu Dec 7 17:01:39 2000 UTC revision 1.6 by dpavlin, Thu Jan 4 14:56:48 2001 UTC
# Line 1  Line 1 
1  <?  <?
2    
3    set_magic_quotes_runtime(0);
4    
5  include("inc/class.FastTemplate.pinc");  include("inc/class.FastTemplate.pinc");
6  include("inc/conn.inc");  include("inc/conn.inc");
7  include("inc/fixsql.inc");  include("inc/fixsql.inc");
# Line 15  $tpl->define( Line 17  $tpl->define(
17                  startnew => "startnew.html",                  startnew => "startnew.html",
18                  ttable => "topics-table.html",                  ttable => "topics-table.html",
19                  theader => "topics-header.html",                  theader => "topics-header.html",
20                    tlheader => "topics-list-header.html",
21                  trow => "topics-row.html",                  trow => "topics-row.html",
22                    tlrow => "topics-list-row.html",
23                  reply => "reply.html",                  reply => "reply.html",
24                  checkboxes => "checkboxes.html"                  checkboxes => "checkboxes.html"
25          )          )
# Line 37  if (isset($PHP_AUTH_USER)) { Line 41  if (isset($PHP_AUTH_USER)) {
41                          if ($row[solution] == "t") {                          if ($row[solution] == "t") {
42                                  $solution_room=1;                                  $solution_room=1;
43                                  $sql_poruke_where.="and poruke.solution is true";                                  $sql_poruke_where.="and poruke.solution is true";
44                                    $tpl->assign(array( ROOM => "You are in solution room" ));
45                          }                          }
46                          $tpl->assign(array(                          $tpl->assign(array(
47                                  FULL_NAME => $row[full_name],                                  FULL_NAME => $row[full_name],
# Line 110  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 115  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
115                          if (isset($GLOBALS[$what])) {                          if (isset($GLOBALS[$what])) {
116                                  $GLOBALS[$what]="true";                                  $GLOBALS[$what]="true";
117                          } else {                          } else {
118                                  $GLOBALS[$what]="flase";                                  $GLOBALS[$what]="false";
119                          }                          }
120                  }                  }
121    
122                  fix_checkbox("analitical");                  fix_checkbox("analitical");
123                  fix_checkbox("solution");                  fix_checkbox("solution");
124    
125                  $dbh->dbh_do(fixsql("insert into poruke (thread_id,reply_id,osoba_id,sadrzaj,level,pos,analitical,solution) values ($thread_id,$reply_id,$osoba_id,'$sadrzaj',$level,'$pos',$analitical,$solution)"));                  $sadrzaj=trim($sadrzaj);
126                    $dbh->dbh_do(fixsql("insert into poruke (thread_id,reply_id,osoba_id,sadrzaj,level,pos,analitical,solution) values ($thread_id,$p,$osoba_id,'$sadrzaj',$level,'$pos',$analitical,$solution)"));
127    
128                  $sth=$dbh->prepare("select currval('poruke_id_seq') as id");                  $sth=$dbh->prepare("select currval('poruke_id_seq') as id");
129                  $sth->execute();                  $sth->execute();
# Line 125  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 131  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
131                  if ($row=$sth->fetchrow_hash()) {                  if ($row=$sth->fetchrow_hash()) {
132                          $p=$row[id];    // poruka_id for later                          $p=$row[id];    // poruka_id for later
133                  }                  }
134                    $what="show";
135    
136          } elseif (isset($insert_newtopic)) {          } elseif (isset($insert_newtopic)) {
137    
# Line 136  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 143  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
143                          $sth->execute();                          $sth->execute();
144                          if ($row=$sth->fetchrow_hash()) {                          if ($row=$sth->fetchrow_hash()) {
145                                  $t=$row[id];    // topic for later                                  $t=$row[id];    // topic for later
146                                    $title=trim($title);
147                                  $dbh->dbh_do(fixsql("insert into topics (id,title) values ($t,'$title')"));                                  $dbh->dbh_do(fixsql("insert into topics (id,title) values ($t,'$title')"));
148                          }                          }
149                  }                  }
# Line 143  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 151  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
151    
152  //----- end of inserts/updates...  //----- end of inserts/updates...
153    
154  if ($what=="reply" && isset($t)) {  if (($what=="reply" || $what=="show") && isset($t)) {
155          $sql_where=" and topics.id=$t";          $sql_where=" and topics.id=$t";
156  }  }
157    
158    if ($solution_room == 1) {
159            // don't limit just to topics starts
160            $sql_where.=" and poruke.thread_id=topics.id and poruke.thread_id!=0";
161    } else {
162            // limit just to topics start
163            $sql_where.=" and poruke.id=topics.id and poruke.thread_id=0";
164    }
165    
166  $sth = $dbh->prepare("select topics.id as topic_id,title,sadrzaj,full_name,poruke.datum as datum  $sth = $dbh->prepare("select topics.id as topic_id,title,sadrzaj,full_name,poruke.datum as datum
167          from topics,poruke,osobe          from topics,poruke,osobe
168          where poruke.thread_id=0 and poruke.id=topics.id and poruke.osoba_id=osobe.id $sql_where $sql_poruke_where          where poruke.osoba_id=osobe.id $sql_where $sql_poruke_where
169          order by datum asc          order by datum asc
170          ");          ");
171    
172  $sth->execute();  $sth->execute();
173  $topics="";  $topics="";
174  while ($row=$sth->fetchrow_hash()) {  while ($row=$sth->fetchrow_hash()) {
# Line 160  while ($row=$sth->fetchrow_hash()) { Line 177  while ($row=$sth->fetchrow_hash()) {
177                  AUTHOR => $row[full_name],                  AUTHOR => $row[full_name],
178                  DATE => $row[datum],                  DATE => $row[datum],
179                  SADRZAJ => $row[sadrzaj],                  SADRZAJ => $row[sadrzaj],
180                  COMMENTS => "<a href=\"$PHP_SELF?what=reply&t=$row[topic_id]\">comments&gt;&gt;</a>",                  COMMENTS => "<a href=\"$PHP_SELF?what=show&t=$row[topic_id]\">comments&gt;&gt;</a>",
181                  PHP_SELF => $PHP_SELF                  PHP_SELF => $PHP_SELF
182          ));          ));
         $tpl->parse(ROWS,".theader");  
183    
184          if (isset($t) && $t==$row[topic_id]) {          if (isset($t) && $t==$row[topic_id]) {
185                    $tpl->parse(ROWS,".theader");
186                  $sth2 = $dbh->prepare("                  $sth2 = $dbh->prepare("
187                          select poruke.id as id,sadrzaj as topic,level,thread_id,reply_id,full_name,poruke.datum as datum,poruke.analitical as poruka_analitical                          select poruke.id as id,sadrzaj as topic,level,thread_id,reply_id,full_name,poruke.datum as datum,poruke.analitical as poruka_analitical
188                          from poruke,osobe                          from poruke,osobe
# Line 180  while ($row=$sth->fetchrow_hash()) { Line 197  while ($row=$sth->fetchrow_hash()) {
197                                  $l_ul.="<ul>";                                  $l_ul.="<ul>";
198                                  $r_ul.="</ul>";                                  $r_ul.="</ul>";
199                          }                          }
200                            // don't indent in solution room
201                            if ($solution_room == 1) { $l_ul=$r_ul=""; }
202                          $tpl->assign( array(                          $tpl->assign( array(
203                                  L_INDENT => $l_ul,                                  L_INDENT => $l_ul,
204                                  R_INDENT => $r_ul                                  R_INDENT => $r_ul
205                                  ));                                  ));
206                          $topic=trim(strip_tags($row2[topic]));                          $topic=trim(strip_tags($row2[topic]));
207                          if (isset($p) && $p == $row2[id]) {                          if (isset($p) && $p == $row2[id] && $what=="reply") {
208                                  $topic="<font color=red>$topic...</font>";                                  $topic="<font color=red>$topic...</font>";
209                                  $tpl->assign( array( P => $p ));                                  $tpl->assign( array( P => $p, T => $t ));
210                                  $tpl->parse(CHECKBOXES, ".checkboxes");                                  if ($analitical_room == 1) {
211                                            $tpl->parse(CHECKBOXES, ".checkboxes");
212                                    }
213                                  $tpl->parse(REPLY, ".reply");                                  $tpl->parse(REPLY, ".reply");
214                            } elseif (isset($p) && $p == $row2[id]) {
215                                    $topic="<font color=red>$topic...</font>";
216                                    $tpl->assign( array( P => $p, T => $t ));
217                          } else {                          } else {
218                                  if (!isset($p)) { $p=$t; }                                  if (!isset($p)) { $p=$t; }
219                                  $tmp_t=$row2[thread_id];                                  $tmp_t=$row2[thread_id];
# Line 209  while ($row=$sth->fetchrow_hash()) { Line 233  while ($row=$sth->fetchrow_hash()) {
233                                          DATE => $row2[datum],                                          DATE => $row2[datum],
234                                          SADRZAJ => $topic                                          SADRZAJ => $topic
235                                  ));                                  ));
 #                       $tpl->parse(ROWS,".theader");  
236                          $tpl->parse(ROWS,".trow");                          $tpl->parse(ROWS,".trow");
237                  }                  }
238          } else {          } else {
239                  // non-unroll topics                  // non-unroll topics (list)
240                  $tpl->assign( array(                  $tpl->assign( array(
241                                  SADRZAJ => $row[sadrzaj],                                  SADRZAJ => $row[sadrzaj],
242                                  COMMENTS => "<a href=\"$PHP_SELF?what=reply&t=$row[topic_id]\">comments&gt;&gt;</a>"                                  COMMENTS => "<a href=\"$PHP_SELF?what=show&t=$row[topic_id]\">comments&gt;&gt;</a>"
243                          ));                          ));
244  #               $tpl->parse(ROWS,".theader");                  $tpl->parse(ROWS,".tlheader");
245                  $tpl->parse(ROWS,".trow");                  $tpl->parse(ROWS,".tlrow");
246          }          }
247    
248  }  }
# Line 237  $tpl->parse(MAIN, "listall"); Line 260  $tpl->parse(MAIN, "listall");
260  if ($what == "new") {  if ($what == "new") {
261          $tpl->parse(MAIN, ".newtopic");          $tpl->parse(MAIN, ".newtopic");
262          $tpl->assign(array( TITLE => "Start of new topic" ));          $tpl->assign(array( TITLE => "Start of new topic" ));
263    } elseif ($what == "show") {
264            $tpl->assign(array(
265                    TITLE => "Select article for reply",
266                    P => $p
267            ));
268  } elseif ($what == "reply") {  } elseif ($what == "reply") {
269          $tpl->assign(array(          $tpl->assign(array(
270                  TITLE => "Reply to selected article",                  TITLE => "Reply to selected article",
271                  P => $p                  P => $p
272          ));          ));
 #       $tpl->parse(MAIN, ".reply");  
273  }  }
274  $tpl->parse(MAIN, "main");  $tpl->parse(MAIN, "main");
275    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.26