no more errors if url parameters are missing

This commit is contained in:
Uwe Steinmann 2013-09-27 15:01:45 +02:00
parent 544cc2669f
commit 902cae2804

View File

@ -71,15 +71,27 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
else else
$keywords = ''; $keywords = '';
$reqversion = (int)$_POST["reqversion"]; if(isset($_POST["reqversion"])) {
if ($reqversion<1) $reqversion=1; $reqversion = (int)$_POST["reqversion"];
if ($reqversion<1) $reqversion=1;
} else {
$reqversion = 1;
}
$sequence = $_POST["sequence"]; if(isset($_POST['sequence'])) {
if (!is_numeric($sequence)) { $sequence = $_POST["sequence"];
if (!is_numeric($sequence)) {
$sequence = 1;
}
} else {
$sequence = 1; $sequence = 1;
} }
$expires = ($_POST["expires"] == "true") ? mktime(0,0,0, intval($_POST["expmonth"]), intval($_POST["expday"]), intval($_POST["expyear"])) : false; if(isset($_POST["expires"])) {
$expires = ($_POST["expires"] == "true") ? mktime(0,0,0, intval($_POST["expmonth"]), intval($_POST["expday"]), intval($_POST["expyear"])) : false;
} else {
$expires = false;
}
// Get the list of reviewers and approvers for this document. // Get the list of reviewers and approvers for this document.
$reviewers = array(); $reviewers = array();
@ -162,17 +174,19 @@ if( move_uploaded_file( $source_file_path, $target_file_path ) ) {
if (is_bool($lastDotIndex) && !$lastDotIndex) $fileType = "."; if (is_bool($lastDotIndex) && !$lastDotIndex) $fileType = ".";
else $fileType = substr($userfilename, $lastDotIndex); else $fileType = substr($userfilename, $lastDotIndex);
if($_POST["name"] != "") if(isset($_POST["name"]) && $_POST["name"] != "")
$name = $_POST["name"]; $name = $_POST["name"];
else else
$name = basename($userfilename); $name = basename($userfilename);
$categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]);
$cats = array(); $cats = array();
if($categories) { if(isset($_POST["categoryids"])) {
$catids = explode(',', $categories); $categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]);
foreach($catids as $catid) { if($categories) {
$cats[] = $dms->getDocumentCategory($catid); $catids = explode(',', $categories);
foreach($catids as $catid) {
$cats[] = $dms->getDocumentCategory($catid);
}
} }
} }
$res = $folder->addDocument($name, $comment, $expires, $user, $keywords, $res = $folder->addDocument($name, $comment, $expires, $user, $keywords,