예제 #1
0
 $path = $leadon;
 $qdir = $gpc->get('dir', none);
 $ndir = $gpc->get('newdir', none);
 if ($qdir == '#') {
     if (!preg_match('/[^\\w\\d\\-\\.]/i', $qdir) || empty($ndir)) {
         $error = $lang->phrase('admin_wysiwyg_folder_restrictions');
     } else {
         if ($filesystem->mkdir($leadon . $ndir, 0777)) {
             $path = $leadon . $ndir;
         }
     }
 }
 if ($error === null) {
     require "classes/class.upload.php";
     $my_uploader = new uploader();
     $my_uploader->max_filesize(ini_maxupload());
     $my_uploader->file_types($supportedextentions);
     $my_uploader->set_path($path);
     if ($my_uploader->upload('file')) {
         $my_uploader->save_file();
     }
     if ($my_uploader->upload_failed()) {
         $error = $my_uploader->get_error();
     }
     $image_file = $path . $my_uploader->fileinfo('filename');
     if (!file_exists($image_file)) {
         $error = $lang->phrase('admin_cms_file_does_not_exist');
     }
     $image_file = str_replace(realpath($config['fpath']) . DIRECTORY_SEPARATOR, '', $image_file);
     $image_file = str_replace(DIRECTORY_SEPARATOR, '/', $image_file);
 }
예제 #2
0
                 @unlink('uploads/topics/' . $row[0]);
             }
         }
         $db->query('DELETE FROM ' . $db->pre . 'uploads WHERE mid = "' . $upinfo['name'] . '" AND id IN (' . implode(',', $ids) . ')', __LINE__, __FILE__);
         viscacha_header('Location: attachments.php?type=' . $_GET['type'] . '&id=' . $_GET['id'] . SID2URL_JS_x);
     }
 } else {
     $insertuploads = array();
     $inserterrors = array();
     require "classes/class.upload.php";
     for ($i = 0; $i < $config['tpcmaxuploads']; $i++) {
         if (empty($_FILES['upload_' . $i]['name'])) {
             continue;
         }
         $my_uploader = new uploader();
         $my_uploader->max_filesize($config['tpcfilesize']);
         $my_uploader->max_image_size($config['tpcwidth'], $config['tpcheight']);
         if ($my_uploader->upload('upload_' . $i, explode('|', $config['tpcfiletypes']), 1)) {
             $my_uploader->save_file('uploads/topics/', '2');
         }
         if ($my_uploader->return_error()) {
             array_push($inserterrors, $my_uploader->return_error());
         }
         array_push($insertuploads, $my_uploader->file['name']);
     }
     if (count($inserterrors) > 0) {
         error($inserterrors, 'attachments.php?type=' . $_GET['type'] . '&amp;id=' . $_GET['id'] . SID2URL_x);
     }
     if ($_GET['type'] == 'edit' && ($my->mp[0] == 1 || $upinfo['name'] == $my->id)) {
         $upper = $upinfo['name'];
         $tid = $upinfo['id'];
예제 #3
0
            $n[] = implode('|', $row);
        }
        $filesystem->file_put_contents('data/feedcreator.inc.php', implode("\n", $n));
    }
    viscacha_header('Location: admin.php?action=misc&job=feedcreator');
} elseif ($job == 'feedcreator_add') {
    echo head();
    $name = $gpc->get('name', str);
    $class = $gpc->get('class', str);
    $active = $gpc->get('active', str);
    $dl = $gpc->get('dl', str);
    $dir = realpath('./classes/feedcreator/') . DIRECTORY_SEPARATOR;
    $inserterrors = array();
    require "classes/class.upload.php";
    $my_uploader = new uploader();
    $my_uploader->max_filesize(200 * 1024);
    $my_uploader->file_types(array('php'));
    $my_uploader->set_path($dir);
    if ($my_uploader->upload('upload')) {
        if ($my_uploader->save_file()) {
            $file = $my_uploader->fileinfo('filename');
        }
    }
    if ($my_uploader->upload_failed()) {
        array_push($inserterrors, $my_uploader->get_error());
    }
    if (empty($file)) {
        array_push($inserterrors, 'File does not exist!');
    }
    if (count($inserterrors) > 0) {
        error('admin.php?action=misc&job=feedcreator', $inserterrors);
예제 #4
0
</form>
	<?php 
    echo foot();
} elseif ($job == 'import2') {
    $overwrite = $gpc->get('overwrite', int);
    $server = $gpc->get('server', none);
    $del = $gpc->get('delete', int);
    $inserterrors = array();
    if (!empty($_FILES['upload']['name'])) {
        $filesize = 1024 * 1024;
        $filetypes = array('zip');
        $dir = realpath('temp/') . DIRECTORY_SEPARATOR;
        $insertuploads = array();
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize($filesize);
        $my_uploader->file_types($filetypes);
        $my_uploader->set_path($dir);
        if ($my_uploader->upload('upload')) {
            if ($my_uploader->save_file()) {
                $file = $dir . $my_uploader->fileinfo('filename');
                if (!file_exists($file)) {
                    $inserterrors[] = $lang->phrase('admin_lang_file_not_exist');
                }
            }
        }
        if ($my_uploader->upload_failed()) {
            array_push($inserterrors, $my_uploader->get_error());
        }
    } elseif (file_exists($server)) {
        $ext = get_extension($server);
예제 #5
0
<?php

chdir('../../');
include 'pv_core.php';
CheckLogin();
LoadUserlanguage();
if (isset($_FILES) && count($_FILES) > 0) {
    $path = '../' . $Cfg['upload_path'];
    require_once 'includes/fileupload-class.php';
    $lang = str_replace("_utf8", "", $Users[$Pivot_Vars['user']]['language']);
    $my_uploader = new uploader($lang);
    // OPTIONAL: set the max filesize of uploadable files in bytes
    $my_uploader->max_filesize($Cfg['max_filesize']);
    // UPLOAD the file
    if ($my_uploader->upload('userfile', $Cfg['upload_accept'], $Cfg['upload_extension'])) {
        $success = $my_uploader->save_file($path, $Cfg['upload_save_mode'], 1);
    }
}
if (isset($_GET['f_target'])) {
    $target = $_GET['f_target'];
} else {
    $target = $_POST['f_target'];
}
if (isset($_GET['f_text'])) {
    $text = urldecode($_GET['f_text']);
} else {
    $text = $_POST['f_text'];
}
if (!isset($Users[$Pivot_Vars['user']]['wysiwyg'])) {
    $useWysiwyg = $Cfg['wysiwyg_editor'] == 1 ? TRUE : FALSE;
} else {
예제 #6
0
 </table>
</form>
	<?php 
    echo foot();
} elseif ($job == 'custombb_import2') {
    $dir = $gpc->get('dir', int);
    $server = $gpc->get('server', none);
    $del = $gpc->get('delete', int);
    $inserterrors = array();
    if (!empty($_FILES['upload']['name'])) {
        $filesize = ini_maxupload();
        $dir = 'temp/';
        $insertuploads = array();
        require "classes/class.upload.php";
        $my_uploader = new uploader();
        $my_uploader->max_filesize(1024 * 250);
        $my_uploader->file_types(array('bbc'));
        $my_uploader->set_path($dir);
        if ($my_uploader->upload('upload')) {
            if ($my_uploader->save_file()) {
                $file = $dir . $my_uploader->fileinfo('filename');
                if (!file_exists($file)) {
                    $inserterrors[] = $lang->phrase('admin_bbc_file_not_existing');
                }
            }
        }
        if ($my_uploader->upload_failed()) {
            array_push($inserterrors, $my_uploader->get_error());
        }
    } elseif (file_exists($server)) {
        $ext = get_extension($server);
예제 #7
0
            while (!feof($userfile)) {
                $line = fgets($userfile, 255);
                switch ($mode) {
                    case 1:
                        echo $line;
                        break;
                    case 2:
                        echo nl2br(ereg_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", htmlentities($line)));
                        break;
                }
            }
        }
    }
}
$upload = new uploader();
$upload->max_filesize(30000);
if ($upload->upload("{$FILENAME}", "{$ACCEPT}", "{$EXTENSION}")) {
    while (list($key, $var) = each($upload->file)) {
        echo $key . " = " . $var . "<br>";
    }
    if ($upload->save_file("{$PATH}", $SAVE_MODE)) {
        print "<p>Saved as: " . $upload->new_file . "<p>";
        print_file($upload->new_file, $upload->file["type"], 2);
    }
}
if ($upload->errors) {
    while (list($key, $var) = each($upload->errors)) {
        echo "<p>" . $var . "<br>";
    }
}
if ($NEW_NAME) {
예제 #8
0
                    $import_array[] = $import_info;
                    //print_r($import_info);
                }
            }
            $var = "";
        }
        $now = date("U");
        $add_log = mysql_query("INSERT INTO amx_logs (timestamp, ip, username, action, remarks) VALUES ('{$now}', '" . $_SERVER['REMOTE_ADDR'] . "', '" . $_SESSION['uid'] . "', 'import ban', 'imported bans: {$j}')") or die(mysql_error());
        return $import_array;
    }
    if (isset($_POST['en'])) {
        $my_uploader = new uploader($_POST['en']);
    } else {
        $my_uploader = new uploader("en");
    }
    $my_uploader->max_filesize(45000);
    if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
        $my_uploader->save_file($path, $mode);
    }
    if ($my_uploader->error) {
        //echo $my_uploader->error . "<br><br>\n";
    } else {
        $import_array = ban_file($my_uploader->file['name']);
    }
}
if (isset($acceptable_file_types) && trim($acceptable_file_types)) {
    $submit = "This form only accepts <b>" . str_replace("|", " or ", $acceptable_file_types) . "</b> files &nbsp;&nbsp;<input type='submit' name='importit' value='" . lang("_IMPORT") . "' style='font-family: verdana, tahoma, arial; font-size: 10px;'>";
} else {
    $submit = "No acceptable filetypes set.&nbsp;&nbsp;<input type='submit' name='importit' value='" . lang("_IMPORT") . "' style='font-family: verdana, tahoma, arial; font-size: 10px;' disabled>";
}
/****************************************************************
예제 #9
0
/**
 * Upload a file
 *
 */
function uploadfile()
{
    global $Cfg, $Paths, $Users, $Pivot_Vars, $qual, $local;
    MinLevel(2);
    include_once 'includes/fileupload-class.php';
    $lang = str_replace("_utf8", "", $Users[$Pivot_Vars['user']]['language']);
    $my_uploader = new uploader($lang);
    // OPTIONAL: set the max filesize of uploadable files in bytes
    $my_uploader->max_filesize($Cfg['max_filesize']);
    // UPLOAD the file
    if ($my_uploader->upload('userfile', $Cfg['upload_accept'], $Cfg['upload_extension'])) {
        debug($my_uploader->file['name']);
        $success = $my_uploader->save_file($Paths['upload_path'], $Cfg['upload_save_mode'], 1);
    }
    if ($success) {
        error_reporting(E_ALL);
        include_once "modules/module_imagefunctions.php";
        PageHeader(lang('userbar', 'main'), 1);
        PageAnkeiler(lang('userbar', 'files') . ' &raquo; ' . lang('userbar', 'uploaded_success'));
        printf('<script type="text/javascript">function pop(a){
			window.open("modules/module_image.php?image="+a,"",
				"toolbar=no,resizable=yes,scrollbars=yes,width=940,height=570");
			self.location="index.php?menu=files";}
                        </script>');
        echo '<tr><td align="center" colspan="2">';
        $fullentry = $Paths['upload_url'] . $my_uploader->file['name'];
        echo '<img src="' . $fullentry . '" border="0" alt="new image">';
        echo '</td></tr><tr><td align="right" width="48%"><br /><br />';
        if (auto_thumbnail($my_uploader->file['name'])) {
            echo "<p><b>Thumbnail:</b><br>";
            $thumbfilename = $Paths['upload_url'] . make_thumbname(basename($my_uploader->file['name']));
            printf('<p><img src="%s" />', $thumbfilename);
            printf('<p><a href="javascript:pop(\'%s\')">' . lang('upload', 'edit_thumbnail') . '</a></td>', $my_uploader->file['name']);
        } else {
            printf('<p><a href="javascript:pop(\'%s\');">' . lang('upload', 'create_thumb') . '</a></td>', $my_uploader->file['name']);
        }
        GenSetting('', lang('upload', 'thisfile'), '', 8, '', 6);
        StartForm('file_upload', 0, 'enctype="multipart/form-data"');
        printf('<input name="%s" type="file"  class="input"><br />', $Cfg['upload_file_name']);
        printf('<input type="submit" value="%s" class="button" /></form>', lang('upload', 'button'));
        PageFooter();
    } else {
        if ($my_uploader->errors) {
            files_main($my_uploader->errors);
        }
    }
}
예제 #10
0
            while (!feof($userfile)) {
                $line = fgets($userfile, 255);
                switch ($mode) {
                    case 1:
                        echo $line;
                        break;
                    case 2:
                        echo nl2br(ereg_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", htmlentities($line)));
                        break;
                }
            }
        }
    }
}
$upload = new uploader();
$upload->max_filesize(20000);
if ($upload->upload("{$FILENAME}", "{$ACCEPT}", "{$EXTENSION}")) {
    while (list($key, $var) = each($upload->file)) {
        echo $key . " = " . $var . "<br>";
    }
    if ($upload->save_file("{$PATH}", $SAVE_MODE)) {
        print "<p>Saved as: " . $upload->new_file . "<p>";
        print_file($upload->new_file, $upload->file["type"], 2);
    }
}
if ($upload->errors) {
    while (list($key, $var) = each($upload->errors)) {
        echo "<p>" . $var . "<br>";
    }
}
if ($NEW_NAME) {