Commit | Line | Data |
---|---|---|
bc13d5d6 H |
1 | <? |
2 | include_once("htmlparse.inc"); | |
3 | switch ($_POST['event']) { | |
4 | ||
5 | case 'pridaj.forum' : | |
6 | $status=eventz::addForum(); | |
7 | if ($status) { | |
8 | Header("Location:".SCRIPT."?action=forum&node_id=$status&nocache=".time()); | |
9 | } | |
10 | break; | |
11 | } | |
12 | ||
13 | class eventz { | |
14 | ||
15 | function addForum() { | |
16 | global $kyberia; | |
17 | global $user_id; | |
18 | global $user_name; | |
19 | global $forum_icon_name; | |
20 | global $forum_icon; | |
21 | $forum_public=$_POST['forum_public']; | |
22 | ||
23 | $forum_category=$_POST['forum_category']; | |
24 | $forum_type=$_POST['forum_type']; | |
25 | $forum_info=$_POST['forum_info']; | |
26 | $forum_name=$_POST['forum_name']; | |
27 | ||
28 | if (empty($forum_name)) { | |
29 | $error="nazov fora je prilis kratky!!!!"; | |
30 | return false; | |
31 | } | |
32 | ||
33 | if (!htmlparse::htmlparse($forum_name)) { | |
34 | global $htmlparse; | |
35 | global $error; | |
36 | $error=$htmlparse; | |
37 | return false; | |
38 | } | |
39 | ||
40 | ||
41 | if (!htmlparse::htmlparse($forum_info)) { | |
42 | global $htmlparse; | |
43 | global $error; | |
44 | $error=$htmlparse; | |
45 | return false; | |
46 | } | |
47 | ||
48 | ||
49 | ||
50 | ||
51 | $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'"); | |
52 | $lastid=$kyberia->getLastInsertId(); | |
53 | $kyberia->query("insert into forum_info set forum_id='$lastid',forum_info='$forum_info'"); | |
54 | $kyberia->query("update category set category_forums=category_forums+1 where category_id='$forum_category'"); | |
55 | ||
56 | $q="select friends.* from friends where friend_id='$user_id'"; | |
57 | $set=$kyberia->query($q); | |
58 | while($set->next()){ | |
59 | $send_bin=$set->getString('send_mail'); | |
60 | $u_id=$set->getString('user_id'); | |
61 | $s_forum=floor($send_bin/2); | |
62 | ||
63 | if (($s_forum)&&(!$check)){ | |
64 | $check[$u_id]=1; | |
65 | $sprava="<b>".$user_name."</b> vytvoril novy klub s nazvom <br>\"<a href='?action=forum&node_id=$lastid' target='_blank'>".$forum_name."</a>\""; | |
66 | $kyberia->ubikMail($u_id,$sprava); | |
67 | } | |
68 | } | |
69 | ||
70 | $cmd=0; | |
71 | if (strstr($forum_icon_name,".jp")){ | |
72 | $cmd=NETPBM."/jpegtopnm $forum_icon | ".NETPBM."/pnmscale -width=123 | ".NETPBM."/ppmquant 256 | ".NETPBM."/ppmtogif > ".ICONDIR_FORUM.strtolower($lastid).".gif"; | |
73 | ||
74 | } | |
75 | elseif (strstr($forum_icon_name,".gif")) { | |
76 | $cmd=GIFSICLE." --resize 123x_ $forum_icon > ".ICONDIR_FORUM.strtolower($lastid).".gif"; | |
77 | } | |
78 | ||
79 | if ($cmd) shell_exec($cmd); | |
80 | return $lastid; | |
81 | } | |
82 | } | |
83 | ||
84 | ?> |