irgendwie wird dennoch kein usertyp erkannt. beim testlauf: ein user mit registered typ wird von der abfrage mit mosNotAuth(); durchgeführt und er kann ohne beschränkung hochladen.
hier die komplette funktion:
Code:
function doUpload( $dir, $file, $ext, $resize, $resize_quality, $max_value, $thumb, $thumb_quality, $thumb_size, $overwrite, $unique )
{
global $cmnlang, $imlang;
$error = false;
//hier max Uploadgroesse haendisch eintragen, hier 150 kb fuer Standarduser und 1 MB für andere
//registered
if( isset($my->jaclplus) ? jaclplusInList(1, $my->jaclplus) : 1 == $my->gid ) {
$max_size = 150000;
$max_text = "_kb > 150kb";
}
//author, editor, ... admin
else if( isset($my->jaclplus) ? jaclplusInList(2, $my->jaclplus) : 2 == $my->gid ) {
$max_size = 1000000;
$max_text = "_kb > 1MB";
//other
} else {
mosNotAuth();
return;
}
$format = substr( $file['name'], -3 );
//$allowable = explode( ',', $ext );
$size = $file['size'];
$noMatch = 0;
foreach( $ext as $valid_ext ) {
if ( strcasecmp( $format, $valid_ext ) == 0 ) $noMatch = 1;
}
if( $size > $max_size )
{
$error = $cmnlang['upload_size_err'] ."_". ($size / 1000). $max_text ;
}elseif( !$noMatch ){
$error = $cmnlang['upload_ext_err'];
}else{
$path = JPath::makePath( $this->getBaseDir(), $dir );
$file_path = JPath::makePath( $path, JFile::makeSafe( $file['name'] ) );
$result = JFile::upload( $file['tmp_name'], $file_path, $overwrite, $unique );
if( JFile::exists( $result ) ){
if( $resize ){
if( !$this->resize( $result, false, $max_value, $max_value, intval( $resize_quality ) ) ){
$error = $imlang['resize_error'];
}
}
if( $thumb ){
$file_name = JPath::makePath( $dir, basename( $result ) );
if( $this->newThumb( $file_name, $thumb_size, intval( $thumb_quality ) ) ){
$error = $imlang['new_thumb_err'];
}
}
}else{
$error = $result;
}
}
return $error;
}
Lesezeichen