1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
| 1. / 2. / ...
<?php
$cs_lang = cs_translate('squads');
$op_squads = cs_sql_option(__FILE__,'squads');
$op_clans = cs_sql_option(__FILE__,'clans');
$img_filetypes = array('gif','jpg','png');
if(isset($_POST['submit'])) {
$cs_squads['clans_id'] = $_POST['clans_id'];
$cs_squads['games_id'] = $_POST['games_id'];
$cs_squads['squads_own'] = empty($_POST['squads_own']) ? 0 : 1;
$cs_squads['squads_name'] = $_POST['squads_name'];
$cs_squads['squads_order'] = empty($_POST['squads_order']) ? $op_squads['def_order'] : $_POST['squads_order'];
$cs_squads['squads_pwd'] = $_POST['squads_pwd'];
$cs_squads['squads_fightus'] = empty($_POST['squads_fightus']) ? 0 : 1;
$cs_squads['squads_joinus'] = empty($_POST['squads_joinus']) ? 0 : 1;
$error = 0;
$message = '';
$img_size = getimagesize($_FILES['picture']['tmp_name']);
if(!empty($_FILES['picture']['tmp_name']) AND empty($img_size) OR $img_size[2] > 3) {
$message .= $cs_lang['ext_error'] . cs_html_br(1);
$error++;
} elseif(!empty($_FILES['picture']['tmp_name'])) {
switch($img_size[2]) {
case 1:
$extension = 'gif'; break;
case 2:
$extension = 'jpg'; break;
case 3:
$extension = 'png'; break;
}
if($img_size[0]>$op_squads['max_width']) {
$message .= $cs_lang['too_wide'] . cs_html_br(1);
$error++;
}
if($img_size[1]>$op_squads['max_height']) {
$message .= $cs_lang['too_high'] . cs_html_br(1);
$error++;
}
if($_FILES['picture']['size']>$op_squads['max_size']) {
$message .= $cs_lang['too_big'] . cs_html_br(1);
$error++;
}
}
if(empty($cs_squads['clans_id'])) {
$error++;
$message .= $cs_lang['no_'.$op_clans['label']] . cs_html_br(1);
}
if(empty($cs_squads['squads_name'])) {
$error++;
$message .= $cs_lang['no_name'] . cs_html_br(1);
}
$where = "squads_name = '" . cs_sql_escape($cs_squads['squads_name']) . "'";
$search = cs_sql_count(__FILE__,'squads',$where);
if(!empty($search)) {
$error++;
$message .= $cs_lang['squad_exists'] . cs_html_br(1);
}
}
else {
$cs_squads['clans_id'] = 0;
$cs_squads['games_id'] = 0;
$cs_squads['squads_own'] = 0;
$cs_squads['squads_name'] = '';
$cs_squads['squads_order'] = $op_squads['def_order'];
$cs_squads['squads_pwd'] = '';
$cs_squads['squads_fightus'] = 0;
$cs_squads['squads_joinus'] = 0;
}
echo cs_html_table(2,'volume',0);
echo cs_html_roco(1,'headb');
echo $cs_lang[$op_squads['label'].'s'] . ' - ' . $cs_lang['create'];
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
if(!isset($_POST['submit'])) {
echo $cs_lang['errors_here'];
}
elseif(!empty($error)) {
echo $message;
}
else {
echo $cs_lang['create_done'];
}
echo cs_html_roco(0);
echo cs_html_table(0);
echo cs_html_br(1);
if(!empty($error) OR !isset($_POST['submit'])) {
echo cs_html_form(2,'squads_create','squads','create',1);
echo cs_html_table(2,'volume',0);
echo cs_html_roco(1,'leftc');
echo cs_icon('yast_group_add') . $cs_lang['name'] . ' *';
echo cs_html_roco(2,'leftb');
echo cs_html_input('squads_name',$cs_squads['squads_name'],'text',80,40);
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('kdmconfig') . $cs_lang['own_'.$op_clans['label']];
echo cs_html_roco(2,'leftb');
$checked = empty($cs_squads['squads_own']) ? '' : 'checked="checked"';
echo cs_html_vote('squads_own','1','checkbox',$checked);
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('lock') . $cs_lang['hidden'];
echo cs_html_roco(2,'leftb');
$checked = empty($cs_squads['squads_joinus']) ? '' : 'checked="checked"' ;
echo cs_html_vote('squads_joinus','joinus','checkbox',$checked);
echo $cs_lang['joinus'] . cs_html_br(1);
$checked = empty($cs_squads['squads_fightus']) ? '' : 'checked="checked"' ;
echo cs_html_vote('squads_fightus','fightus','checkbox',$checked);
echo $cs_lang['fightus'];
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('kdmconfig') . $cs_lang[$op_clans['label']] . ' *';
echo cs_html_roco(2,'leftb');
$clans_data = cs_sql_select(__FILE__,'clans','clans_name,clans_id',0,'clans_name',0,0);
echo cs_dropdown('clans_id','clans_name',$clans_data,$cs_squads['clans_id']);
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('package_games') . $cs_lang['game'];
echo cs_html_roco(2,'leftb');
$el_id = 'game_1';
$onc = "document.getElementById('" . $el_id . "').src='" . $cs_main['php_self']['dirname'] . "uploads/games/' + this.form.";
$onc .= "games_id.options[this.form.games_id.selectedIndex].value + '.gif'";
echo cs_html_select(1,'games_id',"onchange=\"" . $onc . "\"");
echo cs_html_option('----',0,0);
$cs_games = cs_sql_select(__FILE__,'games','games_name,games_id',0,'games_name',0,0);
$games_count = count($cs_games);
for($run = 0; $run < $games_count; $run++) {
$sel = $cs_games[$run]['games_id'] == $cs_squads['games_id'] ? 1 : 0;
echo cs_html_option($cs_games[$run]['games_name'],$cs_games[$run]['games_id'],$sel);
}
echo cs_html_select(0) . ' ';
$url = 'uploads/games/' . $cs_squads['games_id'] . '.gif';
echo cs_html_img($url,0,0,'id="' . $el_id . '"');
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('enumList') . $cs_lang['order'];
echo cs_html_roco(2,'leftb');
echo cs_html_input('squads_order',$cs_squads['squads_order'],'text',4,4);
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('password') . $cs_lang['password'];
echo cs_html_roco(2,'leftb');
echo cs_html_input('squads_pwd',$cs_squads['squads_pwd'],'password',30,30,'onkeydown="javascript:passwordcheck(this.value);" onkeyup="javascript:passwordcheck(this.value);"','form');
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('password') . $cs_lang['secure'] . '';
echo cs_html_roco(2,'leftb');
echo cs_html_div(1,'float:left; background-image:url(' . $cs_main['php_self']['dirname'] . 'symbols/votes/vote03.png); width:100px; height:13px; margin-top: 3px; margin-left: 2px;');
echo cs_html_div(1,'float:left; background-image:url(' . $cs_main['php_self']['dirname'] . 'symbols/votes/vote01.png); width: 1px; height: 13px;','id="pass_secure"');
echo cs_html_div(0);
echo cs_html_div(0);
echo cs_html_div(1,'float:left; padding-left: 3px; padding-top: 3px; display:none','id="pass_stage_1"');
echo $cs_lang['stage_1'];
echo cs_html_div(0);
echo cs_html_div(1,'float:left; padding-left: 3px; padding-top: 3px; display:none','id="pass_stage_2"');
echo $cs_lang['stage_2'];
echo cs_html_div(0);
echo cs_html_div(1,'float:left; padding-left: 3px; padding-top: 3px; display:none','id="pass_stage_3"');
echo $cs_lang['stage_3'];
echo cs_html_div(0);
echo cs_html_div(1,'float:left; padding-left: 3px; padding-top: 3px; display:none','id="pass_stage_4"');
echo $cs_lang['stage_4'];
echo cs_html_div(0);
echo cs_html_div(1,'clear:both');
$matches[1] = $cs_lang['secure_stages'];
$matches[2] = $cs_lang['stage_1'] . $cs_lang['stage_1_text'] . cs_html_br(1);
$matches[2] .= $cs_lang['stage_2'] . $cs_lang['stage_2_text'] . cs_html_br(1);
$matches[2] .= $cs_lang['stage_3'] . $cs_lang['stage_3_text'] . cs_html_br(1);
$matches[2] .= $cs_lang['stage_4'] . $cs_lang['stage_4_text'];
echo cs_abcode_clip($matches);
echo cs_html_div(0);
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('download') . $cs_lang['pic_up'];
echo cs_html_roco(2,'leftb');
echo cs_html_input('picture','','file');
echo cs_html_br(2);
$matches[1] = $cs_lang['pic_infos'];
$return_types = '';
foreach($img_filetypes AS $add) {
$return_types .= empty($return_types) ? $add : ', ' . $add;
}
$matches[2] = $cs_lang['max_width'] . $op_squads['max_width'] . ' px' . cs_html_br(1);
$matches[2] .= $cs_lang['max_height'] . $op_squads['max_height'] . ' px' . cs_html_br(1);
$matches[2] .= $cs_lang['max_size'] . cs_filesize($op_squads['max_size']) . cs_html_br(1);
$matches[2] .= $cs_lang['filetypes'] . $return_types;
echo cs_abcode_clip($matches);
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('ksysguard') . $cs_lang['options'];
echo cs_html_roco(2,'leftb');
echo cs_html_vote('submit',$cs_lang['create'],'submit');
echo cs_html_vote('reset',$cs_lang['reset'],'reset');
echo cs_html_roco(0);
echo cs_html_table(0);
echo cs_html_form(0);
}
else {
$squads_cells = array_keys($cs_squads);
$squads_save = array_values($cs_squads);
cs_sql_insert(__FILE__,'squads',$squads_cells,$squads_save);
if(!empty($_FILES['picture']['tmp_name'])) {
$where = "squads_name = '" . cs_sql_escape($cs_squads['squads_name']) . "'";
$getid = cs_sql_select(__FILE__,'squads','squads_id',$where);
$filename = 'picture-' . $getid['squads_id'] . '.' . $extension;
cs_upload('squads',$filename,$_FILES['picture']['tmp_name']);
$cs_squads2['squads_picture'] = $filename;
$squads2_cells = array_keys($cs_squads2);
$squads2_save = array_values($cs_squads2);
cs_sql_update(__FILE__,'squads',$squads2_cells,$squads2_save,$getid['squads_id']);
}
cs_redirect($cs_lang['create_done'],'squads');
}
?> |