Esempio n. 1
0
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');
    switch ($vbulletin->GPC['table']) {
        case 'avatar':
            print_input_row($vbphrase['minimum_posts'], 'minimumposts', 0);
            break;