This commit is contained in:
modus75 2017-11-12 10:31:46 +01:00
commit b9f0f22395
2 changed files with 39 additions and 4 deletions

View file

@ -53,7 +53,7 @@ $redirect_to = '';
if ( !empty($_GET['redirect']) )
{
$redirect_to = urldecode($_GET['redirect']);
if ( is_a_guest() and $conf['guest_access'] )
if ( $conf['guest_access'] and !isset($_GET['hide_redirect_error']))
{
$page['errors'][] = l10n('You are not authorized to access the requested page');
}

View file

@ -740,7 +740,7 @@ UPDATE '. IMAGES_TABLE .'
* @option int rank
*/
function ws_images_setRank($params, $service)
{
{
if (count($params['image_id']) > 1)
{
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
@ -773,7 +773,7 @@ SELECT
{
return new PwgError(WS_ERR_MISSING_PARAM, 'rank is missing');
}
// does the image really exist?
$query = '
SELECT COUNT(*)
@ -1167,13 +1167,48 @@ SELECT id, name, permalink
*/
function ws_images_addSimple($params, $service)
{
global $conf;
global $conf, $logger;
if (!isset($_FILES['image']))
{
return new PwgError(405, 'The image (file) is missing');
}
if (isset($_FILES['image']['error']) && $_FILES['image']['error'] != 0)
{
switch($_FILES['image']['error'])
{
case UPLOAD_ERR_INI_SIZE:
$message = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
break;
case UPLOAD_ERR_FORM_SIZE:
$message = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.';
break;
case UPLOAD_ERR_PARTIAL:
$message = 'The uploaded file was only partially uploaded.';
break;
case UPLOAD_ERR_NO_FILE:
$message = 'No file was uploaded.';
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = 'Missing a temporary folder.';
break;
case UPLOAD_ERR_CANT_WRITE:
$message = 'Failed to write file to disk.';
break;
case UPLOAD_ERR_EXTENSION:
$message = 'A PHP extension stopped the file upload. ' .
'PHP does not provide a way to ascertain which extension caused the file ' .
'upload to stop; examining the list of loaded extensions with phpinfo() may help.';
break;
default:
$message = "Error number {$_FILES['image']['error']} occurred while uploading a file.";
}
$logger->error(__FUNCTION__ . " " . $message);
return new PwgError(500, $message);
}
if ($params['image_id'] > 0)
{
$query='