exit; } } else { echo json_encode(array('result' => false, 'msg' => 'AJAX Validation failed')); exit; } } //////////////////////////////////////////////////// // updatePrimaryPagePath - adds or updates the primary url to a page //////////////////////////////////////////////////// if ($_POST['action'] == 'updatePrimaryPagePath') { if (isset($_POST['nodeID']) && is_int((int) $_POST['nodeID']) && isset($_POST['path'])) { // first check we're not about to create a duplicate $result = $content->checkPagePath((int) $_POST['nodeID'], 0, $_POST['path']); if ($result === false) { $result = $content->setPrimaryPagePath((int) $_POST['nodeID'], $_POST['path']); if ($result == 0) { echo json_encode(array('result' => false, 'msg' => 'Error updating primary page path')); exit; } else { echo json_encode(array('result' => true, 'msg' => 'Primary Page Path updated')); exit; } } else { echo json_encode(array('result' => $result, 'msg' => 'Primary Page Path cannot be updated - there is already a node with this page path')); exit; } } else { echo json_encode(array('result' => false, 'msg' => 'AJAX Validation failed')); exit; }