| 1 | <? |
| 2 | switch ($_POST['event']) { |
| 3 | case 'pridaj.forum': |
| 4 | $status=eventz::addForum(); |
| 5 | if ($status) { |
| 6 | Header("Location:".ACTION_SCRIPT."forum"); |
| 7 | } |
| 8 | else echo $error; |
| 9 | break; |
| 10 | |
| 11 | } |
| 12 | |
| 13 | class eventz { |
| 14 | |
| 15 | function addForum() { |
| 16 | $forum_public=$_POST['forum_public']; |
| 17 | $forum_type=$_POST['forum_type']; |
| 18 | $forum_info=$_POST['forum_info']; |
| 19 | |
| 20 | if (empty($forum_name)) { |
| 21 | $error="nazov fora je prilis kratky!!!!"; |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | $set=$kyberia->query("INSERT INTO forum set forum_name='$forum_name',forum_category='$forum_category',forum_owner='$user_id',forum_public='$forum_public',forum_type='$forum_type'"); |
| 26 | $lastid=$kyberia->getLastInsertId(); |
| 27 | $kyberia->query("insert into forum_info set forum_id='$lastid',forum_info='$forum_info'"); |
| 28 | $kyberia->query("update category set category_forums=category_forums+1 where category_id='$forum_category'"); |
| 29 | $icondir="/home/hromi1/kyberia/images/forums/"; |
| 30 | $cmd=0; |
| 31 | if (strstr($forum_icon_name,".jp")){ |
| 32 | $cmd=NETPBM."/jpegtopnm $forum_icon | ".NETPBM."/pnmscale -width=123 | ".NETPBM."/ppmquant 256 | ".NETPBM."/ppmtogif > ".FORUM_IMAGE_DIR.strtolower($lastid).".gif"; |
| 33 | |
| 34 | } |
| 35 | elseif (strstr($forum_icon_name,".gif")) { |
| 36 | $cmd="/home/hromi1/kyberia/gifsicle --resize 123x_ $forum_icon > ".FORUM_IMAGE_DIR.strtolower($lastid).".gif"; |
| 37 | } |
| 38 | if ($cmd) shell_exec($cmd); |
| 39 | $forum_id=$lastid; |
| 40 | |
| 41 | $q="select friends.* from friends where friend_id='$user_id'"; |
| 42 | $set=$kyberia->query($q); |
| 43 | while($set->next()){ |
| 44 | $send_bin=$set->getString('send_mail'); |
| 45 | $u_id=$set->getString('user_id'); |
| 46 | $s_forum=floor($send_bin/2); |
| 47 | echo $send_bin."<br>"; |
| 48 | echo $s_forum."<br>"; |
| 49 | |
| 50 | if ($s_forum){ |
| 51 | $sprava="<b>".$user_name."</b> vytvoril novy klub s nazvom <br>\"<a href='?action=forum&node_id=$forum_id' target='_blank'>".$nadpis."</a>\""; |
| 52 | $kyberia->ubikMail($u_id,$sprava); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | ?> |