예제 #1
0
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    } elseif (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($config['avfilesize']);
        $my_uploader->max_image_size($config['avwidth'], $config['avheight']);
        if ($my_uploader->upload('upload', explode('|', $config['avfiletypes']))) {
            $my_uploader->save_file('uploads/pics/', '2');
        }
        if ($my_uploader->return_error()) {
            error($my_uploader->return_error(), 'editprofile.php?action=pic');
        } else {
            if (file_exists($my->pic)) {
                @unlink($my->pic);
            }
            $ext = $my_uploader->rename_file('uploads/pics/', $my_uploader->file['name'], $my->id);
        }
        $my->pic = 'uploads/pics/' . $my->id . $ext;
    } elseif (!empty($pic) && preg_match('/^(http:\\/\\/|www.)([\\wהצ�ִײ�@\\-_\\.]+)\\:?([0-9]*)\\/(.*)$/', $pic, $url_ary)) {
        $my->pic = checkRemotePic($pic, $url_ary, $my->id);
    } else {
        removeOldImages('uploads/pics/', $my->id);
    }
    $db->query("UPDATE {$db->pre}user SET pic = '{$my->pic}' WHERE id = '{$my->id}' LIMIT 1", __LINE__, __FILE__);
    ok($lang->phrase('editprofile_pic_success'), "editprofile.php?action=pic" . SID2URL_x);
} elseif ($_GET['action'] == "pic") {
    if ($my->p['usepic'] == 0) {
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    }
    $breadcrumb->Add($lang->phrase('editprofile_pic'));
    echo $tpl->parse("header");
예제 #2
0
    ($code = $plugins->load('editprofile_pic3_end')) ? eval($code) : null;
    ok($lang->phrase('editprofile_pic_success'), "editprofile.php?action=pic" . SID2URL_x);
} elseif ($_GET['action'] == "pic2") {
    $pic = $gpc->get('pic', none);
    if ($my->p['usepic'] == 0) {
        errorLogin($lang->phrase('not_allowed'), "editprofile.php");
    }
    $error = array();
    if (isset($_FILES) && is_array($_FILES['upload']) && !empty($_FILES['upload']['name'])) {
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($config['avfilesize']);
        $my_uploader->max_image_size($config['avwidth'], $config['avheight']);
        $my_uploader->file_types(explode(',', $config['avfiletypes']));
        $my_uploader->set_path('uploads/pics/');
        $my_uploader->rename_file($my->id);
        if ($my_uploader->upload('upload')) {
            removeOldImages('uploads/pics/', $my->id);
            if ($my_uploader->save_file()) {
                $my->pic = 'uploads/pics/' . $my_uploader->fileinfo('filename');
            }
        }
        if ($my_uploader->upload_failed()) {
            $error[] = $my_uploader->get_error();
        }
    } elseif (!empty($pic) && preg_match(URL_REGEXP, $pic)) {
        $my->pic = checkRemotePic($pic, $my->id);
        switch ($my->pic) {
            case REMOTE_INVALID_URL:
                $error[] = $lang->phrase('editprofile_pic_error1');
                $my->pic = '';