25 include_once
$GLOBALS[
'xoops']->path(
'class/xoopsformloader.php');
35 if (! empty(
$_POST[
'op'])) {
38 if (! empty(
$_GET[
'op'])) {
45 if (
$op ==
'saveuser') {
46 if (!
$GLOBALS[
'xoopsSecurity']->check()) {
51 if (!empty(
$_POST[
'uid'])) {
61 if (!empty(
$_POST[
'email'])) {
69 if (!empty(
$_POST[
'password'])) {
77 if (!empty(
$_POST[
'vpass'])) {
85 include
$GLOBALS[
'xoops']->path(
'header.php');
88 echo
'<span class="red bold">' . $er .
'</span><br />';
95 $edituser->setVar(
'name',
$_POST[
'name']);
97 $edituser->setVar(
'email',
$email,
true);
100 $edituser->setVar(
'user_icq',
$_POST[
'user_icq']);
101 $edituser->setVar(
'user_from',
$_POST[
'user_from']);
105 $edituser->setVar(
'user_aim',
$_POST[
'user_aim']);
106 $edituser->setVar(
'user_yim',
$_POST[
'user_yim']);
107 $edituser->setVar(
'user_msnm',
$_POST[
'user_msnm']);
109 $edituser->setVar(
'pass', md5(
$password),
true);
111 $attachsig = (!empty(
$_POST[
'attachsig'])) ? 1 : 0;
112 $edituser->setVar(
'attachsig', $attachsig);
113 $edituser->setVar(
'timezone_offset',
$_POST[
'timezone_offset']);
114 $edituser->setVar(
'uorder',
$_POST[
'uorder']);
115 $edituser->setVar(
'umode',
$_POST[
'umode']);
116 $edituser->setVar(
'notify_method',
$_POST[
'notify_method']);
117 $edituser->setVar(
'notify_mode',
$_POST[
'notify_mode']);
119 $edituser->setVar(
'user_occ',
$_POST[
'user_occ']);
120 $edituser->setVar(
'user_intrest',
$_POST[
'user_intrest']);
121 $edituser->setVar(
'user_mailok',
$_POST[
'user_mailok']);
122 if (!empty(
$_POST[
'usecookie'])) {
128 include
$GLOBALS[
'xoops']->path(
'header.php');
129 echo $edituser->getHtmlErrors();
130 include
$GLOBALS[
'xoops']->path(
'footer.php');
138 if (
$op ==
'editprofile') {
139 include_once
$GLOBALS[
'xoops']->path(
'header.php');
140 include_once
$GLOBALS[
'xoops']->path(
'include/comment_constants.php');
141 include_once
$GLOBALS[
'xoops']->path(
'include/xoopscodes.php');
142 echo
'<a href="userinfo.php?uid=' .
$xoopsUser->getVar(
'uid') .
'" title="">' .
_US_PROFILE .
'</a> <span class="bold">»»</span> ' .
_US_EDITPROFILE .
'<br /><br />';
145 $form->addElement($uname_label);
147 $form->addElement($name_text);
155 $email_cbox_value =
$xoopsUser->user_viewemail() ? 1 : 0;
161 $form->addElement($url_text);
173 $sig_tray->addElement($sig_tarea);
174 $sig_cbox_value =
$xoopsUser->getVar(
'attachsig') ? 1 : 0;
177 $sig_tray->addElement($sig_cbox);
189 include_once
$GLOBALS[
'xoops']->path(
'language/' .
$xoopsConfig[
'language'] .
'/notification.php');
190 include_once
$GLOBALS[
'xoops']->path(
'include/notification_constants.php');
202 $cookie_radio_value = empty($_COOKIE[
$xoopsConfig[
'usercookie']]) ? 0 : 1;
207 $pwd_tray->addElement($pwd_text);
208 $pwd_tray->addElement($pwd_text2);
214 $form->addElement($timezone_select);
215 $form->addElement($icq_text);
216 $form->addElement($aim_text);
217 $form->addElement($yim_text);
218 $form->addElement($msnm_text);
219 $form->addElement($location_text);
220 $form->addElement($occupation_text);
221 $form->addElement($interest_text);
222 $form->addElement($sig_tray);
223 $form->addElement($umode_select);
224 $form->addElement($uorder_select);
225 $form->addElement($notify_method_select);
226 $form->addElement($notify_mode_select);
227 $form->addElement($bio_tarea);
228 $form->addElement($pwd_tray);
229 $form->addElement($cookie_radio);
230 $form->addElement($mailok_radio);
231 $form->addElement($uid_hidden);
232 $form->addElement($op_hidden);
233 $form->addElement($token_hidden);
234 $form->addElement($submit_button);
239 include
$GLOBALS[
'xoops']->path(
'footer.php');
242 if (
$op ==
'avatarform') {
243 include
$GLOBALS[
'xoops']->path(
'header.php');
245 $oldavatar =
$xoopsUser->getVar(
'user_avatar');
246 if (!empty($oldavatar) && $oldavatar !=
'blank.gif') {
247 echo
'<div class="pad10 txtcenter floatcenter0"><h4 class="red bold">' .
_US_OLDDELETED .
'</h4>';
248 echo
'<img src="' .
XOOPS_UPLOAD_URL .
'/' . $oldavatar .
'" alt="" /></div>';
251 include_once
$GLOBALS[
'xoops']->path(
'class/xoopsformloader.php');
253 $form->setExtra(
'enctype="multipart/form-data"');
265 $avatar_list = $avatar_handler->getList(
'S',
true);
266 $avatar_selected =
$xoopsUser->getVar(
"user_avatar",
"E");
267 $avatar_selected = in_array($avatar_selected, array_keys($avatar_list)) ? $avatar_selected :
"blank.gif";
268 $avatar_select->addOptionArray($avatar_list);
269 $avatar_select->setExtra(
"onchange='showImgSelected(\"avatar\", \"user_avatar\", \"uploads\", \"\", \"" . XOOPS_URL .
"\")'");
271 $avatar_tray->addElement($avatar_select);
272 $avatar_tray->addElement(
new XoopsFormLabel(
'',
"<a href=\"javascript:openWithSelfMain('" . XOOPS_URL .
"/misc.php?action=showpopups&type=avatars','avatars',600,400);\">" .
_LIST .
"</a><br />"));
273 $avatar_tray->addElement(
new XoopsFormLabel(
'',
"<br /><img src='" .
XOOPS_UPLOAD_URL .
"/" . $avatar_selected .
"' name='avatar' id='avatar' alt='' />"));
274 $form2->addElement($avatar_tray);
279 include
$GLOBALS[
'xoops']->path(
'footer.php');
282 if (
$op ==
'avatarupload') {
283 if (!
$GLOBALS[
'xoopsSecurity']->check()) {
287 $xoops_upload_file = array();
289 if (!empty(
$_POST[
'xoops_upload_file']) && is_array(
$_POST[
'xoops_upload_file'])) {
290 $xoops_upload_file =
$_POST[
'xoops_upload_file'];
292 if (!empty(
$_POST[
'uid'])) {
299 if ($xoopsConfigUser[
'avatar_allow_upload'] == 1 &&
$xoopsUser->getVar(
'posts') >= $xoopsConfigUser[
'avatar_minposts']) {
300 include_once
$GLOBALS[
'xoops']->path(
'class/uploader.php');
306 'image/png'), $xoopsConfigUser[
'avatar_maxsize'], $xoopsConfigUser[
'avatar_width'], $xoopsConfigUser[
'avatar_height']);
307 if ($uploader->fetchMedia(
$_POST[
'xoops_upload_file'][0])) {
308 $uploader->setPrefix(
'cavt');
309 if ($uploader->upload()) {
311 $avatar = & $avt_handler->create();
312 $avatar->setVar(
'avatar_file',
'avatars/' . $uploader->getSavedFileName());
314 $avatar->setVar(
'avatar_mimetype', $uploader->getMediaType());
315 $avatar->setVar(
'avatar_display', 1);
316 $avatar->setVar(
'avatar_type',
'C');
317 if (!$avt_handler->insert(
$avatar)) {
318 @unlink($uploader->getSavedDestination());
320 $oldavatar =
$xoopsUser->getVar(
'user_avatar');
321 if (! empty($oldavatar) &&
false !== strpos(strtolower($oldavatar),
"cavt")) {
322 $avatars = $avt_handler->getObjects(
new Criteria(
'avatar_file', $oldavatar));
323 if (! empty($avatars) && count($avatars) == 1 && is_object($avatars[0])) {
324 $avt_handler->delete($avatars[0]);
326 if (0 === strpos($oldavatar_path,
XOOPS_UPLOAD_PATH) && is_file($oldavatar_path)) {
327 unlink($oldavatar_path);
331 $sql = sprintf(
"UPDATE %s SET user_avatar = %s WHERE uid = %u",
$xoopsDB->prefix(
'users'),
$xoopsDB->quoteString(
'avatars/' . $uploader->getSavedFileName()),
$xoopsUser->getVar(
'uid'));
338 redirect_header(
"edituser.php?op=avatarform", 3, $uploader->getErrors());
342 if (
$op ==
'avatarchoose') {
343 if (!
$GLOBALS[
'xoopsSecurity']->check()) {
348 if (!empty(
$_POST[
'uid'])) {
357 if (!empty(
$_POST[
'user_avatar'])) {
358 $user_avatar =
$myts->addSlashes(trim(
$_POST[
'user_avatar']));
360 $criteria_avatar->add(
new Criteria(
'avatar_type',
"S"));
361 $avatars = $avt_handler->getObjects($criteria_avatar);
362 if (!is_array($avatars) || ! count($avatars)) {
363 $user_avatar =
'avatars/blank.gif';
365 unset($avatars, $criteria_avatar);
368 if (0 === strpos($user_avatarpath, realpath(
XOOPS_UPLOAD_PATH)) && is_file($user_avatarpath)) {
369 $oldavatar =
$xoopsUser->getVar(
'user_avatar');
370 $xoopsUser->setVar(
'user_avatar', $user_avatar);
373 include
$GLOBALS[
'xoops']->path(
'header.php');
375 include
$GLOBALS[
'xoops']->path(
'footer.php');
378 if ($oldavatar && preg_match(
"/^cavt/", strtolower(substr($oldavatar,8)))) {
379 $avatars = $avt_handler->getObjects(
new Criteria(
'avatar_file', $oldavatar));
380 if (!empty($avatars) && count($avatars) == 1 && is_object($avatars[0])) {
381 $avt_handler->delete($avatars[0]);
383 if (0 === strpos($oldavatar_path, realpath(
XOOPS_UPLOAD_PATH)) && is_file($oldavatar_path)) {
384 unlink($oldavatar_path);
388 if ($user_avatar !=
'avatars/blank.gif') {
389 $avatars = $avt_handler->getObjects(
new Criteria(
'avatar_file', $user_avatar));
390 if (is_object($avatars[0])) {
391 $avt_handler->addUser($avatars[0]->getVar(
'avatar_id'),
$xoopsUser->getVar(
'uid'));