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