示例#1
0
function avatars_manage_upload($user, $name)
{
    global $globals;
    $subdir = get_avatars_dir() . '/' . intval($user / $globals['avatars_files_per_dir']);
    $file_base = $subdir . '/' . $user;
    @mkdir(get_avatars_dir());
    @mkdir($subdir);
    if (!is_writable($subdir)) {
        return false;
    }
    avatars_remove_user_files($user);
    move_uploaded_file($_FILES[$name]['tmp_name'], $file_base . '-orig.img');
    $size = @getimagesize("{$file_base}-orig.img");
    avatar_resize("{$file_base}-orig.img", "{$file_base}-80.jpg", 80);
    $size = @getimagesize("{$file_base}-80.jpg");
    if (!($size[0] == 80 && $size[1] == 80 && avatars_db_store($user, "{$file_base}-80.jpg"))) {
        // Mark FALSE in DB
        avatars_db_remove($user);
        avatars_remove_user_files($user);
        return false;
    }
    // Upload to DB and mark TRUE
    avatar_resize("{$file_base}-orig.img", "{$file_base}-20.jpg", 20);
    avatar_resize("{$file_base}-orig.img", "{$file_base}-25.jpg", 25);
    avatar_resize("{$file_base}-orig.img", "{$file_base}-40.jpg", 40);
    unlink("{$file_base}-orig.img");
    return true;
}
示例#2
0
 function disable()
 {
     global $db;
     require_once mnminclude . 'avatars.php';
     require_once mnminclude . 'geo.php';
     avatars_db_remove($this->id);
     avatars_remove_user_files($this->id);
     geo_delete('user', $this->id);
     // Delete relationships
     $db->query("DELETE FROM friends WHERE friend_type='manual' and (friend_from = {$this->id} or friend_to = {$this->id})");
     // Delete preferences
     $db->query("DELETE FROM prefs WHERE pref_user_id = {$this->id}");
     $this->username = '******' . $this->id . '--';
     $this->email = "{$this->id}@disabled";
     $this->url = '';
     $this->level = 'disabled';
     $this->names = 'disabled';
     $this->public_info = '';
     $this->adcode = '';
     $this->adchannel = '';
     $this->phone = '';
     $this->avatar = 0;
     $this->karma = 6;
     return $this->store();
 }
示例#3
0
function avatars_manage_upload($user, $name)
{
    global $globals;
    $subdir = get_avatars_dir() . '/' . intval($user / $globals['avatars_files_per_dir']);
    $file_base = $subdir . '/' . $user;
    @mkdir($subdir);
    avatars_remove_user_files($user);
    move_uploaded_file($_FILES[$name]['tmp_name'], $file_base . '-orig.img');
    $size = @getimagesize("{$file_base}-orig.img");
    system("convert -quality 85 -resize 80x80! {$file_base}-orig.img {$file_base}-80.jpg");
    $size = @getimagesize("{$file_base}-80.jpg");
    if (!($size[0] == 80 && $size[1] == 80 && avatars_db_store($user, "{$file_base}-80.jpg"))) {
        // Mark FALSE in DB
        avatars_db_remove($user);
        avatars_remove_user_files($user);
        return false;
    }
    // Upload to DB and mark TRUE
    system("convert -quality 85 -resize 20x20 {$file_base}-orig.img {$file_base}-20.jpg");
    system("convert -quality 85 -resize 25x25 {$file_base}-orig.img {$file_base}-25.jpg");
    unlink("{$file_base}-orig.img");
    return true;
}
示例#4
0
function avatars_remove($user)
{
    avatars_remove_user_files($user);
    avatars_db_remove($user);
}