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.
| 1. / 2. / ...
<?php // ClanSphere 2007 - www.clansphere.net
// $Id: picture.php 206 2006-08-13 18:02:16Z hajo $
$cs_lang = cs_translate('users');
$op_users = cs_sql_option(__FILE__,'users');
$img_filetypes = array('gif','jpg','png');
echo cs_html_table(1,'forum',1);
echo cs_html_roco(1,'headb');
echo $cs_lang['mod_name'] . ' - ' . $cs_lang['picture'];
echo cs_html_roco(0);
$user = cs_sql_select(__FILE__,'users','users_picture',"users_id = '" . $account['users_id'] . "'");
$userpic = $user['users_picture'];
$place = 'uploads/users/' . $userpic;
$del = 0;
if(isset($_POST['delete']) AND $_POST['delete'] == TRUE AND !empty($userpic)) {
$del = 1;
unlink($place);
$cells = array('users_picture');
$content = array('');
cs_sql_update(__FILE__,'users',$cells,$content,$account['users_id']);
echo cs_html_roco(1,'leftb');
echo $cs_lang['success'].'. ';
echo cs_html_roco(0);
echo cs_html_roco(1,'centerc');
echo cs_link($cs_lang['continue'],'users','home');
echo cs_html_roco(0);
echo cs_html_table(0);
}
elseif(!empty($_FILES['picture']['tmp_name'])) {
$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:
$ext = 'gif'; break;
case 2:
$ext = 'jpg'; break;
case 3:
$ext = 'png'; break;
}
$filename = 'picture-' . $account['users_id'] . '.' . $ext;
if($img_size[0]>$op_users['max_width']) {
$message .= $cs_lang['too_wide'] . cs_html_br(1);
$error++;
}
if($img_size[1]>$op_users['max_height']) {
$message .= $cs_lang['too_high'] . cs_html_br(1);
$error++;
}
if($_FILES['picture']['size']>$op_users['max_size']) {
$message .= $cs_lang['too_big'] . cs_html_br(1);
$error++;
}
if(empty($error) AND cs_upload('users', $filename, $_FILES['picture']['tmp_name']) OR !empty($error) AND extension_loaded('gd') AND cs_resample($_FILES['picture']['tmp_name'], 'uploads/users/' . $filename, $op_users['max_width'], $op_users['max_height'])) {
$error = 0;
$message = '';
if($userpic != $filename AND !empty($userpic)) {
unlink($place);
}
$cells = array('users_picture');
$content = array($filename);
cs_sql_update(__FILE__,'users',$cells,$content,$account['users_id']);
echo cs_html_roco(1,'leftb');
echo $cs_lang['success'];
echo cs_html_roco(0);
echo cs_html_roco(1,'centerc');
echo cs_link($cs_lang['continue'],'users','home');
echo cs_html_roco(0);
echo cs_html_table(0);
}
else {
$message .= $cs_lang['up_error'];
$error++;
}
}
}
if(!empty($error) OR empty($_FILES['picture']['tmp_name']) AND empty($del)) {
echo cs_html_roco(1,'leftb');
if(!empty($message)) {
echo $message;
}
else {
echo $cs_lang['picture_manage'];
}
echo cs_html_roco(0);
echo cs_html_table(0);
echo cs_html_br(1);
echo cs_html_form(1,'users_picture','users','picture',1);
echo cs_html_table(1,'forum',1);
echo cs_html_roco(1,'leftc');
echo cs_icon('images') . $cs_lang['current'];
echo cs_html_roco(2,'leftb');
if(empty($userpic)) {
echo $cs_lang['nopic'];
}
else {
$size = getimagesize($cs_main['def_path'] . '/' . $place);
echo cs_html_img($place,$size[1],$size[0]);
}
echo cs_html_roco(0);
echo cs_html_roco(1,'leftc');
echo cs_icon('download_manager') . $cs_lang['upload'];
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_users['max_width'] . ' px' . cs_html_br(1);
$matches[2] .= $cs_lang['max_height'] . $op_users['max_height'] . ' px' . cs_html_br(1);
$matches[2] .= $cs_lang['max_size'] . cs_filesize($op_users['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('configure') . $cs_lang['extended'];
echo cs_html_roco(2,'leftb');
echo cs_html_vote('delete','1','checkbox');
echo $cs_lang['remove'];
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['save'],'submit');
echo cs_html_roco(0);
echo cs_html_table(0);
echo cs_html_form(0);
}
?> |