if ($useavatar) { $crop = array(); if (!empty($_FILES['upload']['tmp_name'])) { if (!file_exists($_FILES['upload']['tmp_name'])) { throw new Exception('Upload failed. PHP upload error: ' . intval($_FILES['upload']['error'])); } $filearray = $_FILES['upload']; $data['org_file_info'] = pathinfo($_FILES['upload']['name']); $filesize = filesize($_FILES['upload']['tmp_name']); $fileContents = file_get_contents($_FILES['upload']['tmp_name']); $filename = $_FILES['upload']['tmp_name']; $crop['org_file_info'] = pathinfo($_FILES['upload']['name']); } elseif (!empty($vbulletin->GPC['avatarurl'])) { //Make a local copy require_once DIR . '/includes/class_upload.php'; $upload = new vB_Upload_Image($vbulletin); $upload->image = vB_Image::instance(); $upload->path = vB_Utilities::getTmpDir(); $filename = $upload->process_upload($vbulletin->GPC['avatarurl']); } if ($filename) { vB_Library::instance('user')->uploadAvatar($filename, $crop, $userinfo['userid']); } else { print_stop_message2('upload_file_failed'); } } else { // not using an avatar $vbulletin->GPC['avatarid'] = 0; $userpic = new vB_Datamanager_Userpic_Avatar($vbulletin, vB_DataManager_Constants::ERRTYPE_CP); $userpic->condition = array(array('field' => 'userid', 'value' => $userinfo['userid'], 'operator' => vB_dB_Query::OPERATOR_EQ)); $userpic->delete();
define('CP_REDIRECT', "image.php?do=modify&table=" . $vbulletin->GPC['table']); print_stop_message('saved_display_order_successfully'); } // ###################### Start Do Upload ####################### if ($_POST['do'] == 'doupload') { $vbulletin->input->clean_array_gpc('f', array('upload' => TYPE_FILE)); $vbulletin->input->clean_array_gpc('p', array('imagespath' => TYPE_STR, 'title' => TYPE_STR, 'smilietext' => TYPE_STR)); if (empty($vbulletin->GPC['title']) or empty($vbulletin->GPC['imagespath']) or $vbulletin->GPC['table'] == 'smilie' and empty($vbulletin->GPC['smilietext'])) { print_stop_message('please_complete_required_fields'); } if (file_exists('./' . $vbulletin->GPC['imagespath'] . '/' . $vbulletin->GPC['upload']['name'])) { print_stop_message('file_x_already_exists', htmlspecialchars_uni($vbulletin->GPC['upload']['name'])); } require_once DIR . '/includes/class_upload.php'; require_once DIR . '/includes/class_image.php'; $upload = new vB_Upload_Image($vbulletin); $upload->image =& vB_Image::fetch_library($vbulletin); $upload->path = $vbulletin->GPC['imagespath']; if (!($imagepath = $upload->process_upload($vbulletin->GPC['upload']))) { print_stop_message('there_were_errors_encountered_with_your_upload_x', $upload->fetch_error()); } define('IMAGE_UPLOADED', true); $_POST['do'] = 'insert'; } // ###################### Start Upload ####################### if ($_REQUEST['do'] == 'upload') { print_form_header('image', 'doupload', 1); construct_hidden_code('table', $vbulletin->GPC['table']); print_table_header($vbphrase["upload_{$itemtype}"]); print_upload_row($vbphrase['filename'], 'upload'); print_input_row($vbphrase['title'], 'title');