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 = '';
if(isset($_POST["reqversion"])) {
$reqversion = (int)$_POST["reqversion"]; $reqversion = (int)$_POST["reqversion"];
if ($reqversion<1) $reqversion=1; if ($reqversion<1) $reqversion=1;
} else {
$reqversion = 1;
}
if(isset($_POST['sequence'])) {
$sequence = $_POST["sequence"]; $sequence = $_POST["sequence"];
if (!is_numeric($sequence)) { if (!is_numeric($sequence)) {
$sequence = 1; $sequence = 1;
} }
} else {
$sequence = 1;
}
if(isset($_POST["expires"])) {
$expires = ($_POST["expires"] == "true") ? mktime(0,0,0, intval($_POST["expmonth"]), intval($_POST["expday"]), intval($_POST["expyear"])) : false; $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,19 +174,21 @@ 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(isset($_POST["categoryids"])) {
$categories = preg_replace('/[^0-9,]+/', '', $_POST["categoryids"]);
if($categories) { if($categories) {
$catids = explode(',', $categories); $catids = explode(',', $categories);
foreach($catids as $catid) { foreach($catids as $catid) {
$cats[] = $dms->getDocumentCategory($catid); $cats[] = $dms->getDocumentCategory($catid);
} }
} }
}
$res = $folder->addDocument($name, $comment, $expires, $user, $keywords, $res = $folder->addDocument($name, $comment, $expires, $user, $keywords,
$cats, $userfiletmp, basename($userfilename), $cats, $userfiletmp, basename($userfilename),
$fileType, $userfiletype, $sequence, $fileType, $userfiletype, $sequence,