| 1 | <?php |
| 2 | |
| 3 | if ($access_type=="ban" and $forum['forum_owner']!=$user_id) return; |
| 4 | elseif (!empty($access_type)) { |
| 5 | echo "<center><b>si $access_type tohto klubu</b></center>"; |
| 6 | } |
| 7 | |
| 8 | if ($forum['forum_public']=='private' and !($forum['forum_owner']==$user_id OR $access_type=='access')) { |
| 9 | echo "toto forum je privatne. sorry"; |
| 10 | return; |
| 11 | } |
| 12 | |
| 13 | if($forum['forum_owner'] == $user_id) $access_type = 'owner'; |
| 14 | |
| 15 | $stats=$_GET['stats']; |
| 16 | $update=$_GET['update']; |
| 17 | $alone=$_GET['alone']; |
| 18 | |
| 19 | //statistiky |
| 20 | if ($stats) { |
| 21 | $set=$kyberia->query("select count(*) as pocet from user_forum where forum_id='$node_id'"); |
| 22 | $set->next();$pocet=$set->getString('pocet'); |
| 23 | echo "pocet ludi: $pocet"; |
| 24 | echo "<table align='center' class='box'>"; |
| 25 | $set=$kyberia->query("select user_forum.*,user.login as login,user.id as user_id from user_forum left join user on user.id=user_forum.user_id where forum_id='$node_id' order by submission_count"); |
| 26 | while ($set->next()) { |
| 27 | if ($set->getString('user_bookmark')==1) { |
| 28 | echo "<tr style='font-color: red;'>"; |
| 29 | } |
| 30 | else echo "<tr>"; |
| 31 | if ($friend_array[$set->getString('user_id')]){ |
| 32 | echo "<td><b>",$set->getString('login'),"</b></td><td>",$set->getString('submission_count'),"</td><td>",$set->getString('last_visit'),"</td>"; |
| 33 | }else{ |
| 34 | echo "<td>",$set->getString('login'),"</td><td>",$set->getString('submission_count'),"</td><td>",$set->getString('last_visit'),"</td>"; |
| 35 | } |
| 36 | echo "</tr>"; |
| 37 | } |
| 38 | echo "</table>"; |
| 39 | } |
| 40 | |
| 41 | //admin update mode |
| 42 | elseif($update || $_GET['status']) { |
| 43 | $set=$kyberia->query("select user.login,node_access.* from node_access left join user on user.id=user_id where node_type='forum' and node_id='$node_id'"); |
| 44 | while ($set->next()) { |
| 45 | if ($set->getString('access_type')=="ban") $banlist.=$set->getString('login').";"; |
| 46 | elseif ($set->getString('access_type')=="master") $masterlist.=$set->getString('login').";"; |
| 47 | elseif ($set->getString('access_type')=="op") $oplist.=$set->getString('login').";"; |
| 48 | elseif ($set->getString('access_type')=="access" && $forum['forum_public']!='public') $accesslist.=$set->getString('login').";"; |
| 49 | } |
| 50 | ?> |
| 51 | <form enctype='multipart/form-data' method='post' action='<?=SCRIPT?>'> |
| 52 | <table class='box' width='100%'> |
| 53 | <tr><td valign='top'><img src='/images/forums/<?=$node_id?>.gif' border='0'></td> |
| 54 | <td> |
| 55 | <table align='center' width='100%'> |
| 56 | <?php if ($forum['forum_public']=='public') {?> |
| 57 | <tr><td><textarea name='banlist' cols='230' rows='3'><?=$banlist?></textarea></td><td><input type='submit' value='ban list' name='event'> </td></tr> |
| 58 | <tr><td><textarea name='oplist' cols='230' rows='3'><?=$oplist?></textarea></td><td> <?php if(($access_type == 'owner') or ($access_type == 'master')) echo "<input type='submit' value='op list' name='event'>"; ?> </td></tr> |
| 59 | <tr><td><textarea name='masterlist' cols='230' rows='3'><?=$masterlist?></textarea></td><td> <?php if($access_type == 'owner') echo "<input type='submit' value='master list' name='event'>"; ?> </td></tr> |
| 60 | <?php } elseif ($forum['forum_public']=='private') { ?> |
| 61 | <tr><td><textarea name='accesslist' cols='230' rows='3'><?=$accesslist?></textarea></td><td><input type='submit' value='access list' name='event'> </td></tr> |
| 62 | <?php } else { ?> |
| 63 | <tr><td><textarea name='banlist' cols='230' rows='3'><?=$banlist?></textarea></td><td><input type='submit' value='ban list' name='event'> </td></tr> |
| 64 | <tr><td><textarea name='oplist' cols='230' rows='3'><?=$oplist?></textarea></td><td> <?php if(($access_type == 'owner') or ($access_type == 'master')) echo "<input type='submit' value='op list' name='event'>"; ?> </td></tr> |
| 65 | <tr><td><textarea name='masterlist' cols='230' rows='3'><?=$masterlist?></textarea></td><td> <?php if($access_type == 'owner') echo "<input type='submit' value='master list' name='event'>"; ?> |
| 66 | </td></tr> |
| 67 | <tr><td><textarea name='accesslist' cols='230' rows='3'><?=$accesslist?></textarea></td><td><input type='submit' value='access list' name='event'> </td></tr> |
| 68 | <?php } ?> |
| 69 | </table> |
| 70 | </td></tr> |
| 71 | </table><br> |
| 72 | <?php |
| 73 | $set=$kyberia->query("select * from category order by category_tree"); |
| 74 | $selectstring="<select name='forum_category'>"; |
| 75 | while ($set->next()) { |
| 76 | $count=substr_count($set->getString('category_tree'),";"); |
| 77 | $selectstring.="<option value='".$set->getString('category_id')."'"; |
| 78 | if ($forum['forum_category']==$set->getString('category_id')) $selectstring.= " selected "; |
| 79 | $selectstring.= ">"; |
| 80 | if ($count) { |
| 81 | $selectstring.="|"; |
| 82 | for ($i=0;$i<$count;$i++) $selectstring.="----"; |
| 83 | } |
| 84 | $selectstring.=$set->getString('category_name')."</option>"; |
| 85 | } |
| 86 | $selectstring.="</select>"; |
| 87 | |
| 88 | ?> |
| 89 | |
| 90 | <input type='hidden' name='action' value='forum'> |
| 91 | <input type='hidden' name='node_id' value='<?=$node_id?>'> |
| 92 | <table class='box'> |
| 93 | <tr><td>info: <br><textarea class='long' name='forum_info' cols='230' rows='23'><?=$forum['forum_info']?></textarea></td><td> |
| 94 | nazov: <input type='text' class='longtext' name='forum_name' value='<?=$forum['forum_name']?>'><br> |
| 95 | owner: <input type='text' class='longtext' name='forum_owner' value='<?=$forum['owner_name']?>'><br> |
| 96 | public?<input type=radio name='forum_public' value='public' <?php if ($forum['forum_public']=='public') {?> checked <?php } ?>> moderated?<input type=radio name='forum_public' value='moderated' <?php if ($forum['forum_public']=='moderated') {?> checked <?php } ?>> private?<input type=radio name=forum_public value='private' <?php if ($forum['forum_public']=='private') {?> checked <?php } ?>><br> |
| 97 | picture: <input type='file' class='bigtextinput' name='forum_icon'><br> |
| 98 | <?=$selectstring?><br><br> |
| 99 | <?php |
| 100 | // to je v poho, kazdy aj tak moze menit iba to, co je dovolene |
| 101 | if($access_type == 'owner' || $access_type == 'master' || $access_type == 'op') echo " |
| 102 | <input type='submit' name='event' value='zmen nastavenie'> |
| 103 | <input type='submit' value='zmaz forum' name='event' onClick=\"return confirm('Bravco, chces zmazat svoje forum???')\">"; ?> |
| 104 | </td></tr></table> |
| 105 | <br> |
| 106 | <?php |
| 107 | include("polladmin.inc"); |
| 108 | } |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | else { |
| 115 | |
| 116 | $new=$forum['submission_count']; |
| 117 | $count=$forum['forum_submissions']; |
| 118 | |
| 119 | |
| 120 | echo $forum['forum_info']."<br><br>"; |
| 121 | |
| 122 | |
| 123 | $old_submission_text=StripSlashes($_POST['submission_text']); |
| 124 | |
| 125 | // navigacia! sofistikovana bitch |
| 126 | |
| 127 | if (empty($limit)) $limit=$user_amount; |
| 128 | else $limit=$limit; |
| 129 | if ($new > $limit) $limit=$new; |
| 130 | if (empty($offset)) $offset=0; |
| 131 | if ($event=='>') $offset+=$limit; |
| 132 | if ($event=='<') $offset-=$limit; |
| 133 | if ($event=='<<') $offset='0'; |
| 134 | if ($event=='>>') $offset=$count-$limit; |
| 135 | if ($offset<0) $offset=0; |
| 136 | if ($offset+$limit>$count AND $limit<$count) $offset=$count-$limit; |
| 137 | elseif ($offset+$limit>$count AND $limit>$count) $offset=0; |
| 138 | // koniec sofistikovanej bitch |
| 139 | |
| 140 | |
| 141 | if ($user_id=='38') echo "POCET:$count OFFSET: $offset LIMIT: $limit NEW : $new"; |
| 142 | include_once("active.inc"); |
| 143 | ?> |
| 144 | <form action='<?=$PHP_SELF?>?node_id=<?=$node_id?>&action=forum' method='post'> |
| 145 | <?php if(!($forum['forum_public'] == 'moderated' AND empty($access_type))) { ?> <textarea style="width: 510pt; height: 50pt;" name='submission_text'><?php if($event=='nahlad') echo $old_submission_text; ?></textarea> <?php } ?> |
| 146 | <br> |
| 147 | |
| 148 | <?php |
| 149 | if($forum['forum_public']=='moderated' AND empty($access_type)) { Showz::showNav(false); } |
| 150 | else Showz::showNav(); |
| 151 | ?> |
| 152 | |
| 153 | <?php |
| 154 | |
| 155 | if ($_GET['karma']) { |
| 156 | $q="SELECT submissions.*,user.login as user_name,user.id as user_id ,session.user_action_name as user_action_name,user_action_id as user_action_id,session.user_action as user_action,user.user_mode as user_mode FROM submissions left join user on submissions.submission_owner=user.id left join session on user.id=session.user_id where forum_id='$node_id' and submission_k>0"; |
| 157 | $q.=" ORDER BY submission_k DESC LIMIT $offset,$limit"; |
| 158 | } |
| 159 | |
| 160 | else { |
| 161 | $q="SELECT submissions.*,user.login as user_name,user.id as user_id ,session.user_action_name as user_action_name,user_action_id as user_action_id,session.user_action as user_action,user.user_mode as user_mode FROM submissions left join user on submissions.submission_owner=user.id left join session on user.id=session.user_id where forum_id='$node_id' "; |
| 162 | if ($event=="hladat") $q.=" and submission_text like '%$submission_text%' or user.login like '%submission_text%'"; |
| 163 | if (IsSet($alone)) $q.=" and submission_id=$alone"; |
| 164 | if ($forum['forum_type']=='threaded') $q.=" group by submission_id order by concat(submission_thread,submission_timestamp) desc limit $offset,$limit"; |
| 165 | else $q.=" ORDER BY submission_id DESC LIMIT $offset,$limit"; |
| 166 | } |
| 167 | |
| 168 | $set=$kyberia->query($q); |
| 169 | |
| 170 | if ($preview) echo $preview; |
| 171 | |
| 172 | while ($set->next()) { |
| 173 | $submissions=$set->getRecord(); |
| 174 | if ($forum['forum_type']=='threaded') { |
| 175 | $zub=substr_count($submissions['submission_thread'],"."); |
| 176 | $width=$zub*50; |
| 177 | echo "<table width='100%'><tr width='100%'><td width='$width'></td><td align='left'>"; |
| 178 | echo "<table class='bigitem'><tr><td class='icon'>"; |
| 179 | if ($user_icons_in_forum == 'yes') |
| 180 | echo "<img alt='",$submissions['user_name'],"' src='/images/users/",strtolower($submissions['user_name']),".gif'>"; |
| 181 | else |
| 182 | echo " "; |
| 183 | echo "</td><td class='item'>"; |
| 184 | echo "<table class='item'>"; |
| 185 | echo "<td class='header'><a href='?action=userinfo&node_id=",$submissions['user_id'],"'>",$submissions['user_name'],"</a>"; |
| 186 | if ($submissions['user_mode']=="normal" AND ($submissions['user_action'])) { |
| 187 | echo " [lokacia:<a class='location' href='?action=",$submissions['user_action']; |
| 188 | if ($submissions['user_action']=="forum") echo "&node_id=".$submissions['user_action_id']."'>",$submissions['user_action_name']; |
| 189 | else echo "'>".$submissions['user_action']; |
| 190 | echo "</a>] "; |
| 191 | } |
| 192 | Showz::showDate($submissions['submission_timestamp']); |
| 193 | // echo "<input class='delete' type=hidden name=delete_time[".$submissions['submission_id']."] value='".$submissions['submission_timestamp']."'>"; |
| 194 | echo " <input class='delete' type=checkbox name=delete_name[] value='".$submissions['submission_id']."'>"; |
| 195 | if ($user_id==$submissions['submission_owner'] or $forum['forum_owner']==$user_id) { |
| 196 | echo "<input class='delete' type=hidden name=delete_time[".$submissions['submission_id']."] value='".$submissions['submission_timestamp']."'>"; |
| 197 | |
| 198 | } |
| 199 | if ($new>0) echo "<font color='red'><b> :: NEW :: </b></font>"; |
| 200 | |
| 201 | echo "</td>"; |
| 202 | echo "</tr>"; |
| 203 | echo "<tr class='content'><td class='content'>",Stripslashes($submissions['submission_text']),"</td></tr>"; |
| 204 | echo "</table>"; |
| 205 | echo "</table>"; |
| 206 | echo "</table>"; |
| 207 | |
| 208 | } else { |
| 209 | echo "<table class='bigitem'><tr><td class='icon' nowrap>"; |
| 210 | if ($user_icons_in_forum == 'yes') |
| 211 | echo "<img alt='",$submissions['user_name'],"' src='/images/users/",strtolower($submissions['user_name']),".gif'>"; |
| 212 | else |
| 213 | echo " "; |
| 214 | if ($submissions['submission_k']) echo "<center><font color='red'>".$submissions['submission_k']." K</font></center>"; |
| 215 | echo "</td><td class='item'>"; |
| 216 | echo "<table class='item'>"; |
| 217 | echo "<td class='header'><a href='?action=userinfo&node_id=",$submissions['user_id'],"'>",$submissions['user_name'],"</a>"; |
| 218 | if ($submissions['user_mode']=="normal" AND ($submissions['user_action'])) { |
| 219 | echo " [lokacia:<a class='location' href='?action=",$submissions['user_action']; |
| 220 | if ($submissions['user_action']=="forum") echo "&node_id=".$submissions['user_action_id']."'>",$submissions['user_action_name']; |
| 221 | else echo "'>".$submissions['user_action']; |
| 222 | echo "</a>] "; |
| 223 | } |
| 224 | Showz::showDate($submissions['submission_timestamp']); |
| 225 | // if ($user_id==$submissions['submission_owner'] or $forum['forum_owner']==$user_id) { |
| 226 | echo " <input class='delete' type=checkbox name=delete_name[] value='".$submissions['submission_id']."'><input class='delete' type=hidden name=delete_time[".$submissions['submission_id']."] value='".$submissions['submission_timestamp']."'>"; |
| 227 | // } |
| 228 | if ($new>0) echo "<font color='red'><b> :: NEW :: </b></font>"; |
| 229 | echo "<div align='right' valign='top'><a href='?action=forum&node_id=".$node_id."&alone=".$submissions['submission_id']."'>link alone ".$submissions['submission_id']."</a></div>"; |
| 230 | echo "</td>"; |
| 231 | echo "</tr>"; |
| 232 | echo "<tr class='content'><td class='content'>",Stripslashes($submissions['submission_text']),"</td></tr>"; |
| 233 | echo "</table>"; |
| 234 | echo "</td></tr></table>"; |
| 235 | $new--; |
| 236 | } |
| 237 | } |
| 238 | ?> |
| 239 | |
| 240 | <?php if (!($limit>$count)) { |
| 241 | echo "<center>"; |
| 242 | Showz::showNav(false); |
| 243 | echo "</center>"; |
| 244 | } |
| 245 | |
| 246 | } |
| 247 | ?> |
| 248 | |
| 249 | </form> |