Пример #1
0
function upload_avatar_func($xmlrpc_params)
{
    global $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups;
    //chdir("../");
    $input = Tapatalk_Input::filterXmlInput(array('content' => Tapatalk_Input::STRING), $xmlrpc_params);
    if ($mybb->usergroup['canuploadavatars'] == 0) {
        error_no_permission();
    }
    $avatar = upload_avatar($_FILES['upload']);
    if ($avatar['error']) {
        return xmlrespfalse($avatar['error']);
    } else {
        if ($avatar['width'] > 0 && $avatar['height'] > 0) {
            $avatar_dimensions = $avatar['width'] . "|" . $avatar['height'];
        }
        $updated_avatar = array("avatar" => $avatar['avatar'] . '?dateline=' . TIME_NOW, "avatardimensions" => $avatar_dimensions, "avatartype" => "upload");
        $db->update_query("users", $updated_avatar, "uid='" . $mybb->user['uid'] . "'");
    }
    return xmlresptrue();
}
Пример #2
0
 }
 // Set the data of the user in the datahandler.
 $userhandler->set_data($updated_user);
 $errors = '';
 // Validate the user and get any errors that might have occurred.
 if (!$userhandler->validate_user()) {
     $errors = $userhandler->get_friendly_errors();
 } else {
     // Are we removing an avatar from this user?
     if ($mybb->input['remove_avatar']) {
         $extra_user_updates = array("avatar" => "", "avatardimensions" => "", "avatartype" => "");
         remove_avatars($user['uid']);
     }
     // Are we uploading a new avatar?
     if ($_FILES['avatar_upload']['name']) {
         $avatar = upload_avatar($_FILES['avatar_upload'], $user['uid']);
         if ($avatar['error']) {
             $errors = array($avatar['error']);
         } else {
             if ($avatar['width'] > 0 && $avatar['height'] > 0) {
                 $avatar_dimensions = $avatar['width'] . "|" . $avatar['height'];
             }
             $extra_user_updates = array("avatar" => $avatar['avatar'] . '?dateline=' . TIME_NOW, "avatardimensions" => $avatar_dimensions, "avatartype" => "upload");
         }
     } else {
         if ($mybb->input['avatar_url'] && $mybb->input['avatar_url'] != $user['avatar']) {
             $mybb->input['avatar_url'] = preg_replace("#script:#i", "", $mybb->input['avatar_url']);
             $ext = get_extension($mybb->input['avatar_url']);
             // Copy the avatar to the local server (work around remote URL access disabled for getimagesize)
             $file = fetch_remote_file($mybb->input['avatar_url']);
             if (!$file) {
Пример #3
0
}
if ($mybb->input['action'] == "do_avatar" && $mybb->request_method == "post") {
    // Verify incoming POST request
    verify_post_check($mybb->get_input('my_post_key'));
    $plugins->run_hooks("usercp_do_avatar_start");
    require_once MYBB_ROOT . "inc/functions_upload.php";
    $avatar_error = "";
    if (!empty($mybb->input['remove'])) {
        $updated_avatar = array("avatar" => "", "avatardimensions" => "", "avatartype" => "");
        $db->update_query("users", $updated_avatar, "uid='" . $mybb->user['uid'] . "'");
        remove_avatars($mybb->user['uid']);
    } elseif ($_FILES['avatarupload']['name']) {
        if ($mybb->usergroup['canuploadavatars'] == 0) {
            error_no_permission();
        }
        $avatar = upload_avatar();
        if ($avatar['error']) {
            $avatar_error = $avatar['error'];
        } else {
            if ($avatar['width'] > 0 && $avatar['height'] > 0) {
                $avatar_dimensions = $avatar['width'] . "|" . $avatar['height'];
            }
            $updated_avatar = array("avatar" => $avatar['avatar'] . '?dateline=' . TIME_NOW, "avatardimensions" => $avatar_dimensions, "avatartype" => "upload");
            $db->update_query("users", $updated_avatar, "uid='" . $mybb->user['uid'] . "'");
        }
    } else {
        $mybb->input['avatarurl'] = trim($mybb->get_input('avatarurl'));
        if (validate_email_format($mybb->input['avatarurl']) != false) {
            // Gravatar
            $mybb->input['avatarurl'] = my_strtolower($mybb->input['avatarurl']);
            // If user image does not exist, or is a higher rating, use the mystery man
Пример #4
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
need_login();
if ($_POST) {
    $update = array('email' => $_POST['email'], 'website' => $_POST['website'], 'location' => $_POST['location'], 'tagline' => $_POST['tagline'], 'bio' => $_POST['bio']);
    $avatar = upload_avatar('avatar', $login_user['username'], 'user');
    $update['avatar'] = $avatar;
    if ($_POST['password'] == $_POST['password2'] && $_POST['password']) {
        $update['password'] = $_POST['password'];
    }
    if (ZUser::Modify($login_user['id'], $update)) {
        Session::Set('notice', '修改账户设置成功');
        redirect(WEB_ROOT . '/account/settings.php ');
    } else {
        Session::Set('error', '修改账户设置失败');
    }
}
include template('account_settings');
Пример #5
0
<?php

////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.com                                                     //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['upload_avatar']) and $_POST['upload_avatar'] == "true") {
    upload_avatar();
}
$config_ext = parse_ini_file(CONFIG_PATH . 'avatars.ini');
$avatars_enabled = parse_ini_file(CONFIG_PATH . 'disable.ini');
if (LOGGED_IN) {
    if (!isset($avatars_enabled['avatar.control'])) {
        show_window(__('Your current avatar'), show_new_avatar($system->user['username']), 'center');
        show_window(__('Update your avatar'), show_avatar_requirements() . '<br/>' . avatar_upload_box(), 'center');
    }
}
Пример #6
0
if (isset($_POST['valid_file'])) {
    $_SESSION['id'] = uniqid();
    $avatar = $_FILES['avatar']['name'];
    $avatar_tmp = $_FILES['avatar']['tmp_name'];
    $errors = array();
    //Récupérer l'extension de l'image (jpeg, jpg, png, gif...)
    if (!empty($avatar_tmp)) {
        $image = explode('.', $avatar);
        $image_ext = end($image);
        if (in_array(strtolower($image_ext), array('png', 'jpeg', 'jpg', 'gif')) === false) {
            $errors[] = "Veuillez choisir un autre format d'image";
        }
    }
    if (empty($errors)) {
        //Fonction permettant de redimensionner l'image
        upload_avatar($avatar_tmp);
    } else {
        foreach ($errors as $error) {
            echo $error;
        }
    }
}
?>


<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8"/>
		<title>Chat en PHP de DELOIZY & RUIZ</title>
		<link rel="stylesheet" href="src/css/reset.css"/>