/[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.1.1 by dpavlin, Thu Dec 7 17:01:39 2000 UTC revision 1.7 by dpavlin, Fri Jan 5 13:31:04 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 27  if (isset($PHP_AUTH_USER)) { Line 31  if (isset($PHP_AUTH_USER)) {
31          if ($row=$sth->fetchrow_hash()) {          if ($row=$sth->fetchrow_hash()) {
32                  if ($row && $row[passwd] == $PHP_AUTH_PW) {                  if ($row && $row[passwd] == $PHP_AUTH_PW) {
33                          $md5user=md5($PHP_AUTH_USER.$PHP_AUTH_PW);                          $md5user=md5($PHP_AUTH_USER.$PHP_AUTH_PW);
34                          $osoba_id=$row[id];          $osoba_id=$row[id];
35                          if ($row[analitical] == "t") {                          if ($row[analitical] == "t") {
36                                  $analitical_room=1;                                  $analitical_room=1;
37                                  $tpl->assign(array( ROOM => "You are member of analitical room" ));                                  $tpl->assign(array( ROOM => "You are member of analitical room" ));
# 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 49  if (isset($PHP_AUTH_USER)) { Line 54  if (isset($PHP_AUTH_USER)) {
54    
55                  if($pop3->connect("intranet.pliva.hr")) {                  if($pop3->connect("intranet.pliva.hr")) {
56                          $Count = $pop3->login($PHP_AUTH_USER,$PHP_AUTH_PW);                          $Count = $pop3->login($PHP_AUTH_USER,$PHP_AUTH_PW);
57                          if ( $Count != -1 ) {                          if ( $Count && $Count != -1 ) {
58                                  $pop3->quit();                                  $pop3->quit();
59                                  // o.k., user exists now insert it in db!                                  // o.k., user exists now insert it in db!
60                                  include("finger.inc");                                  include("finger.inc");
# Line 61  if (isset($PHP_AUTH_USER)) { Line 66  if (isset($PHP_AUTH_USER)) {
66                                  $md5user=md5($PHP_AUTH_USER.$PHP_AUTH_PW);                                  $md5user=md5($PHP_AUTH_USER.$PHP_AUTH_PW);
67                                  $osoba_id=$row[id];                                  $osoba_id=$row[id];
68                                  $tpl->assign(array(                                  $tpl->assign(array(
69                                          FULL_NAME => $row[full_name],                                          FULL_NAME => $full_name,
70                                          RELOGIN => "$PHP_SELF?relogin=$md5user"                                          RELOGIN => "$PHP_SELF?relogin=$md5user"
71                                  ));                                  ));
72                          }                          }
# Line 75  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 80  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
80          $tpl->parse(MAIN, "main");          $tpl->parse(MAIN, "main");
81          $tpl->FastPrint();          $tpl->FastPrint();
82          exit ;          exit ;
83    } else {
84            $dbh->dbh_do("update osobe set last_login=now() where login='$PHP_AUTH_USER'");
85  }  }
86    
87  //---- insert reply into database  //---- insert reply into database
# Line 110  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 117  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
117                          if (isset($GLOBALS[$what])) {                          if (isset($GLOBALS[$what])) {
118                                  $GLOBALS[$what]="true";                                  $GLOBALS[$what]="true";
119                          } else {                          } else {
120                                  $GLOBALS[$what]="flase";                                  $GLOBALS[$what]="false";
121                          }                          }
122                  }                  }
123    
124                  fix_checkbox("analitical");                  fix_checkbox("analitical");
125                  fix_checkbox("solution");                  fix_checkbox("solution");
126    
127                  $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);
128                    $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)"));
129    
130                  $sth=$dbh->prepare("select currval('poruke_id_seq') as id");                  $sth=$dbh->prepare("select currval('poruke_id_seq') as id");
131                  $sth->execute();                  $sth->execute();
# Line 125  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 133  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
133                  if ($row=$sth->fetchrow_hash()) {                  if ($row=$sth->fetchrow_hash()) {
134                          $p=$row[id];    // poruka_id for later                          $p=$row[id];    // poruka_id for later
135                  }                  }
136                    $what="show";
137    
138          } elseif (isset($insert_newtopic)) {          } elseif (isset($insert_newtopic)) {
139    
# Line 136  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 145  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
145                          $sth->execute();                          $sth->execute();
146                          if ($row=$sth->fetchrow_hash()) {                          if ($row=$sth->fetchrow_hash()) {
147                                  $t=$row[id];    // topic for later                                  $t=$row[id];    // topic for later
148                                    $title=trim($title);
149                                  $dbh->dbh_do(fixsql("insert into topics (id,title) values ($t,'$title')"));                                  $dbh->dbh_do(fixsql("insert into topics (id,title) values ($t,'$title')"));
150                          }                          }
151                  }                  }
# Line 143  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) != Line 153  if (md5($PHP_AUTH_USER.$PHP_AUTH_PW) !=
153    
154  //----- end of inserts/updates...  //----- end of inserts/updates...
155    
156  if ($what=="reply" && isset($t)) {  if (($what=="reply" || $what=="show") && isset($t)) {
157          $sql_where=" and topics.id=$t";          $sql_where=" and topics.id=$t";
158  }  }
159    
160    if ($solution_room == 1) {
161            // don't limit just to topics starts
162            $sql_where.=" and poruke.thread_id=topics.id and poruke.thread_id!=0";
163    } else {
164            // limit just to topics start
165            $sql_where.=" and poruke.id=topics.id and poruke.thread_id=0";
166    }
167    
168  $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
169          from topics,poruke,osobe          from topics,poruke,osobe
170          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
171          order by datum asc          order by datum asc
172          ");          ");
173    
174  $sth->execute();  $sth->execute();
175  $topics="";  $topics="";
176  while ($row=$sth->fetchrow_hash()) {  while ($row=$sth->fetchrow_hash()) {
# Line 160  while ($row=$sth->fetchrow_hash()) { Line 179  while ($row=$sth->fetchrow_hash()) {
179                  AUTHOR => $row[full_name],                  AUTHOR => $row[full_name],
180                  DATE => $row[datum],                  DATE => $row[datum],
181                  SADRZAJ => $row[sadrzaj],                  SADRZAJ => $row[sadrzaj],
182                  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>",
183                  PHP_SELF => $PHP_SELF                  PHP_SELF => $PHP_SELF
184          ));          ));
         $tpl->parse(ROWS,".theader");  
185    
186          if (isset($t) && $t==$row[topic_id]) {          if (isset($t) && $t==$row[topic_id]) {
187                    $tpl->parse(ROWS,".theader");
188                  $sth2 = $dbh->prepare("                  $sth2 = $dbh->prepare("
189                          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
190                          from poruke,osobe                          from poruke,osobe
# Line 180  while ($row=$sth->fetchrow_hash()) { Line 199  while ($row=$sth->fetchrow_hash()) {
199                                  $l_ul.="<ul>";                                  $l_ul.="<ul>";
200                                  $r_ul.="</ul>";                                  $r_ul.="</ul>";
201                          }                          }
202                            // don't indent in solution room
203                            if ($solution_room == 1) { $l_ul=$r_ul=""; }
204                          $tpl->assign( array(                          $tpl->assign( array(
205                                  L_INDENT => $l_ul,                                  L_INDENT => $l_ul,
206                                  R_INDENT => $r_ul                                  R_INDENT => $r_ul
207                                  ));                                  ));
208                          $topic=trim(strip_tags($row2[topic]));                          $topic=trim(strip_tags($row2[topic]));
209                          if (isset($p) && $p == $row2[id]) {                          if (isset($p) && $p == $row2[id] && $what=="reply") {
210                                  $topic="<font color=red>$topic...</font>";                                  $topic="<font color=red>$topic...</font>";
211                                  $tpl->assign( array( P => $p ));                                  $tpl->assign( array( P => $p, T => $t ));
212                                  $tpl->parse(CHECKBOXES, ".checkboxes");                                  if ($analitical_room == 1) {
213                                            $tpl->parse(CHECKBOXES, ".checkboxes");
214                                    }
215                                  $tpl->parse(REPLY, ".reply");                                  $tpl->parse(REPLY, ".reply");
216                            } elseif (isset($p) && $p == $row2[id]) {
217                                    $topic="<font color=red>$topic...</font>";
218                                    $tpl->assign( array( P => $p, T => $t ));
219                          } else {                          } else {
220                                  if (!isset($p)) { $p=$t; }                                  if (!isset($p)) { $p=$t; }
221                                  $tmp_t=$row2[thread_id];                                  $tmp_t=$row2[thread_id];
# Line 209  while ($row=$sth->fetchrow_hash()) { Line 235  while ($row=$sth->fetchrow_hash()) {
235                                          DATE => $row2[datum],                                          DATE => $row2[datum],
236                                          SADRZAJ => $topic                                          SADRZAJ => $topic
237                                  ));                                  ));
 #                       $tpl->parse(ROWS,".theader");  
238                          $tpl->parse(ROWS,".trow");                          $tpl->parse(ROWS,".trow");
239                  }                  }
240          } else {          } else {
241                  // non-unroll topics                  // non-unroll topics (list)
242                  $tpl->assign( array(                  $tpl->assign( array(
243                                  SADRZAJ => $row[sadrzaj],                                  SADRZAJ => $row[sadrzaj],
244                                  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>"
245                          ));                          ));
246  #               $tpl->parse(ROWS,".theader");                  $tpl->parse(ROWS,".tlheader");
247                  $tpl->parse(ROWS,".trow");                  $tpl->parse(ROWS,".tlrow");
248          }          }
249    
250  }  }
# Line 237  $tpl->parse(MAIN, "listall"); Line 262  $tpl->parse(MAIN, "listall");
262  if ($what == "new") {  if ($what == "new") {
263          $tpl->parse(MAIN, ".newtopic");          $tpl->parse(MAIN, ".newtopic");
264          $tpl->assign(array( TITLE => "Start of new topic" ));          $tpl->assign(array( TITLE => "Start of new topic" ));
265    } elseif ($what == "show") {
266            $tpl->assign(array(
267                    TITLE => "Select article for reply",
268                    P => $p
269            ));
270  } elseif ($what == "reply") {  } elseif ($what == "reply") {
271          $tpl->assign(array(          $tpl->assign(array(
272                  TITLE => "Reply to selected article",                  TITLE => "Reply to selected article",
273                  P => $p                  P => $p
274          ));          ));
 #       $tpl->parse(MAIN, ".reply");  
275  }  }
276  $tpl->parse(MAIN, "main");  $tpl->parse(MAIN, "main");
277    

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.26