exit;
}
$forwardType = $_POST['forwardType'];
$forward = $_POST['forward'];
$voicemail = $_POST['voicemail'];
// TODO: add code to validate that the forwarding address and voicemail
// address are valid SIP URI's
// update the resource to the database
// note: as an additional security measure, we pass in username and only update
// the resourceId if that resourceId matches the authenticated user.  As a
// consequence, even if the user hacks the URL and replaces the resourceId
// with a new value, they will be unable to modify any resources not associated
// with the user they are logged in as ... so they can't do any damage since
// all the resourceId's associated with their user are available to them
// anyway
if (updateResource($resourceId, $username, $aor, $forwardType, $forward, $voicemail)) {
    // resource modified successfully
    $title = "Resource Modified";
    $heading = "Resource Modified";
    $msg = "Successfully updated the resource <em>{$aor}.</em>";
} else {
    $title = "Error While Updating Resource";
    $heading = "Error While Updating Resource";
    $msg = "An error occurred while attempting to update this resource.  Please contact an administrator.";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!--
System:  Repro
File:    savenewresource.php
 }
 if (isset($resourceMap[$resource['pagetitle']])) {
     unset($toRemove[$resource['pagetitle']]);
     /** @var modResource $exists */
     $exists = $modx->getObject('modResource', array('id' => $resourceMap[$resource['pagetitle']]));
     if ($exists) {
         $resource['id'] = $exists->id;
         $resId = updateResource($resource);
         if ($resId !== false) {
             $resourceMap[$resource['pagetitle']] = $resId;
         }
     } else {
         if ($resource['set_as_home'] == 1) {
             unset($resource['set_as_home']);
             $resource['id'] = $siteStart;
             $resId = updateResource($resource);
             if ($resId !== false) {
                 $resourceMap[$resource['pagetitle']] = $resId;
             }
         } else {
             $resId = createResource($resource);
             if ($resId !== false) {
                 $resourceMap[$resource['pagetitle']] = $resId;
             }
         }
     }
 } else {
     $resId = createResource($resource);
     if ($resId !== false) {
         $resourceMap[$resource['pagetitle']] = $resId;
     }
             }
         }
         $messageAction = "updated";
         $messageProduct = "board";
     } elseif ($params['type'] == "presentation") {
         $result = $vtAction->modifyPresentation($params["resource_id"]);
         $messageAction = "updated";
         $messageProduct = "presentation";
     } elseif ($params['type'] == "pc") {
         $result = $vtAction->modifyPodcaster($params["resource_id"]);
         $messageAction = "updated";
         $messageProduct = "pc";
     }
     if ($result != NULL) {
         //create the object to store in the db
         $resource_id = updateResource($result->getRid(), $session->getCourseId(), $params);
         if (empty($resource_id)) {
             error_log(__FUNCTION__ . " : Problem to update the resource on the database", TRUE);
             redirection($redirectionUrl . '&error=problem_bd');
         }
         $messageType = $params['type'] . 'Updated';
     } else {
         wimba_add_log(WIMBA_ERROR, voicepresentation_LOGS, "manageAction : Problem to add the resource into the database");
         redirection($redirectionUrl . '&error=problem_vt');
     }
 } elseif ($params['action'] == 'delete') {
     /* Bug 28439 - We need to check if the resource has a grade book associated with it
        before we try and delete it */
     $resourceDb = get_record("voicepresentation_resources", "rid", $params["resource_id"]);
     if ($resourceDb->gradeid != -1) {
         voicepresentation_delete_grade_column($params["resource_id"], $params["enc_course_id"]);