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