--- index.php 2000/12/07 17:01:39 1.1 +++ index.php 2000/12/08 08:27:32 1.2 @@ -110,14 +110,15 @@ if (isset($GLOBALS[$what])) { $GLOBALS[$what]="true"; } else { - $GLOBALS[$what]="flase"; + $GLOBALS[$what]="false"; } } fix_checkbox("analitical"); fix_checkbox("solution"); - $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); + $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)")); $sth=$dbh->prepare("select currval('poruke_id_seq') as id"); $sth->execute(); @@ -125,6 +126,7 @@ if ($row=$sth->fetchrow_hash()) { $p=$row[id]; // poruka_id for later } + $what="show"; } elseif (isset($insert_newtopic)) { @@ -136,6 +138,7 @@ $sth->execute(); if ($row=$sth->fetchrow_hash()) { $t=$row[id]; // topic for later + $title=trim($title); $dbh->dbh_do(fixsql("insert into topics (id,title) values ($t,'$title')")); } } @@ -143,15 +146,24 @@ //----- end of inserts/updates... -if ($what=="reply" && isset($t)) { +if (($what=="reply" || $what="show") && isset($t)) { $sql_where=" and topics.id=$t"; } +if ($solution_room == 1) { + // don't limit just to topics starts + $sql_where.=" and poruke.thread_id=topics.id and poruke.thread_id!=0"; +} else { + // limit just to topics start + $sql_where.=" and poruke.id=topics.id and poruke.thread_id=0"; +} + $sth = $dbh->prepare("select topics.id as topic_id,title,sadrzaj,full_name,poruke.datum as datum from topics,poruke,osobe - 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 order by datum asc "); + $sth->execute(); $topics=""; while ($row=$sth->fetchrow_hash()) { @@ -160,7 +172,7 @@ AUTHOR => $row[full_name], DATE => $row[datum], SADRZAJ => $row[sadrzaj], - COMMENTS => "comments>>", + COMMENTS => "comments>>", PHP_SELF => $PHP_SELF )); $tpl->parse(ROWS,".theader"); @@ -180,16 +192,23 @@ $l_ul.="