/[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.5 by dpavlin, Thu Dec 21 15:05:43 2000 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 37  if (isset($PHP_AUTH_USER)) { Line 39  if (isset($PHP_AUTH_USER)) {
39                          if ($row[solution] == "t") {                          if ($row[solution] == "t") {
40                                  $solution_room=1;                                  $solution_room=1;
41                                  $sql_poruke_where.="and poruke.solution is true";                                  $sql_poruke_where.="and poruke.solution is true";
42                                    $tpl->assign(array( ROOM => "You are in solution room" ));
43                          }                          }
44                          $tpl->assign(array(                          $tpl->assign(array(
45                                  FULL_NAME => $row[full_name],                                  FULL_NAME => $row[full_name],
# Line 110  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 113  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
113                          if (isset($GLOBALS[$what])) {                          if (isset($GLOBALS[$what])) {
114                                  $GLOBALS[$what]="true";                                  $GLOBALS[$what]="true";
115                          } else {                          } else {
116                                  $GLOBALS[$what]="flase";                                  $GLOBALS[$what]="false";
117                          }                          }
118                  }                  }
119    
120                  fix_checkbox("analitical");                  fix_checkbox("analitical");
121                  fix_checkbox("solution");                  fix_checkbox("solution");
122    
123                  $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);
124                    $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)"));
125    
126                  $sth=$dbh->prepare("select currval('poruke_id_seq') as id");                  $sth=$dbh->prepare("select currval('poruke_id_seq') as id");
127                  $sth->execute();                  $sth->execute();
# Line 125  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 129  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
129                  if ($row=$sth->fetchrow_hash()) {                  if ($row=$sth->fetchrow_hash()) {
130                          $p=$row[id];    // poruka_id for later                          $p=$row[id];    // poruka_id for later
131                  }                  }
132                    $what="show";
133    
134          } elseif (isset($insert_newtopic)) {          } elseif (isset($insert_newtopic)) {
135    
# Line 136  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 141  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
141                          $sth->execute();                          $sth->execute();
142                          if ($row=$sth->fetchrow_hash()) {                          if ($row=$sth->fetchrow_hash()) {
143                                  $t=$row[id];    // topic for later                                  $t=$row[id];    // topic for later
144                                    $title=trim($title);
145                                  $dbh->dbh_do(fixsql("insert into topics (id,title) values ($t,'$title')"));                                  $dbh->dbh_do(fixsql("insert into topics (id,title) values ($t,'$title')"));
146                          }                          }
147                  }                  }
# Line 143  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 149  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
149    
150  //----- end of inserts/updates...  //----- end of inserts/updates...
151    
152  if ($what=="reply" && isset($t)) {  if (($what=="reply" || $what=="show") && isset($t)) {
153          $sql_where=" and topics.id=$t";          $sql_where=" and topics.id=$t";
154  }  }
155    
156    if ($solution_room == 1) {
157            // don't limit just to topics starts
158            $sql_where.=" and poruke.thread_id=topics.id and poruke.thread_id!=0";
159    } else {
160            // limit just to topics start
161            $sql_where.=" and poruke.id=topics.id and poruke.thread_id=0";
162    }
163    
164  $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
165          from topics,poruke,osobe          from topics,poruke,osobe
166          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
167          order by datum asc          order by datum asc
168          ");          ");
169    
170  $sth->execute();  $sth->execute();
171  $topics="";  $topics="";
172  while ($row=$sth->fetchrow_hash()) {  while ($row=$sth->fetchrow_hash()) {
# Line 160  while ($row=$sth->fetchrow_hash()) { Line 175  while ($row=$sth->fetchrow_hash()) {
175                  AUTHOR => $row[full_name],                  AUTHOR => $row[full_name],
176                  DATE => $row[datum],                  DATE => $row[datum],
177                  SADRZAJ => $row[sadrzaj],                  SADRZAJ => $row[sadrzaj],
178                  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>",
179                  PHP_SELF => $PHP_SELF                  PHP_SELF => $PHP_SELF
180          ));          ));
181          $tpl->parse(ROWS,".theader");          $tpl->parse(ROWS,".theader");
# Line 180  while ($row=$sth->fetchrow_hash()) { Line 195  while ($row=$sth->fetchrow_hash()) {
195                                  $l_ul.="<ul>";                                  $l_ul.="<ul>";
196                                  $r_ul.="</ul>";                                  $r_ul.="</ul>";
197                          }                          }
198                            // don't indent in solution room
199                            if ($solution_room == 1) { $l_ul=$r_ul=""; }
200                          $tpl->assign( array(                          $tpl->assign( array(
201                                  L_INDENT => $l_ul,                                  L_INDENT => $l_ul,
202                                  R_INDENT => $r_ul                                  R_INDENT => $r_ul
203                                  ));                                  ));
204                          $topic=trim(strip_tags($row2[topic]));                          $topic=trim(strip_tags($row2[topic]));
205                          if (isset($p) && $p == $row2[id]) {                          if (isset($p) && $p == $row2[id] && $what=="reply") {
206                                  $topic="<font color=red>$topic...</font>";                                  $topic="<font color=red>$topic...</font>";
207                                  $tpl->assign( array( P => $p ));                                  $tpl->assign( array( P => $p, T => $t ));
208                                  $tpl->parse(CHECKBOXES, ".checkboxes");                                  if ($analitical_room == 1) {
209                                            $tpl->parse(CHECKBOXES, ".checkboxes");
210                                    }
211                                  $tpl->parse(REPLY, ".reply");                                  $tpl->parse(REPLY, ".reply");
212                            } elseif (isset($p) && $p == $row2[id]) {
213                                    $topic="<font color=red>$topic...</font>";
214                                    $tpl->assign( array( P => $p, T => $t ));
215                          } else {                          } else {
216                                  if (!isset($p)) { $p=$t; }                                  if (!isset($p)) { $p=$t; }
217                                  $tmp_t=$row2[thread_id];                                  $tmp_t=$row2[thread_id];
# Line 216  while ($row=$sth->fetchrow_hash()) { Line 238  while ($row=$sth->fetchrow_hash()) {
238                  // non-unroll topics                  // non-unroll topics
239                  $tpl->assign( array(                  $tpl->assign( array(
240                                  SADRZAJ => $row[sadrzaj],                                  SADRZAJ => $row[sadrzaj],
241                                  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>"
242                          ));                          ));
243  #               $tpl->parse(ROWS,".theader");  #               $tpl->parse(ROWS,".theader");
244                  $tpl->parse(ROWS,".trow");                  $tpl->parse(ROWS,".trow");
# Line 237  $tpl->parse(MAIN, "listall"); Line 259  $tpl->parse(MAIN, "listall");
259  if ($what == "new") {  if ($what == "new") {
260          $tpl->parse(MAIN, ".newtopic");          $tpl->parse(MAIN, ".newtopic");
261          $tpl->assign(array( TITLE => "Start of new topic" ));          $tpl->assign(array( TITLE => "Start of new topic" ));
262    } elseif ($what == "show") {
263            $tpl->assign(array(
264                    TITLE => "Select article for reply",
265                    P => $p
266            ));
267  } elseif ($what == "reply") {  } elseif ($what == "reply") {
268          $tpl->assign(array(          $tpl->assign(array(
269                  TITLE => "Reply to selected article",                  TITLE => "Reply to selected article",
270                  P => $p                  P => $p
271          ));          ));
 #       $tpl->parse(MAIN, ".reply");  
272  }  }
273  $tpl->parse(MAIN, "main");  $tpl->parse(MAIN, "main");
274    

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

  ViewVC Help
Powered by ViewVC 1.1.26