Exemple #1
0
	if(empty($_REQUEST['id'])){
		$error_msg .= "Error: No ID specified!\n";
	}else{
		if(!$project->get($_REQUEST['id'])){
			$error_msg .= "Could not retreive project information!\n";
			debug_message($project->getLastError());
		}
		if(!$project->hasRights(PROJECT_RIGHT_EDIT)){
			fatal_error('Insufficent access rights for this project!');
		}
	}

	if($_POST['save']){
		$_POST['due_ts'] = getTSFromInput($_POST['due_ts']);
		$project->updateFromAssocArray($_POST);
		if($project->update()){
			$activities = array("Project details modified");
			if(!empty($_FILES['attachment_file']['tmp_name'])){
				if($project->addAttachment($_FILES['attachment_file']['tmp_name'], $_FILES['attachment_file']['name'], $_POST['attachment_description']) === FALSE){
					$error_msg .= "Error adding attachment!\n";
					debug_message($project->getLastError());
				}else{
					$activities[] = "Added attachment {$_POST['attachment_description']}";
				}
			}
			if(isset($_POST['right_user_id']) && $_POST['right_user_id'] > 0){
				if(!$project->hasRights(PROJECT_RIGHT_FULL)){
					fatal_error('Insufficent access rights to add users!');
				}
				if($project->addUserRight($_POST['right_user_id'], $_POST['right_level']) === FALSE){
					$error_msg .= "Error adding user access to project!\n";