function check_for_changes($row, $row_alternatives)
{
    global $contentManager, $cid, $glossary, $glossary_ids_related, $addslashes;
    $changes = array();
    if ($row && strcmp(trim($addslashes($_POST['title'])), addslashes($row['title']))) {
        $changes[0] = true;
    } else {
        if (!$row && $_POST['title']) {
            $changes[0] = true;
        }
    }
    if ($row && strcmp($addslashes(trim($_POST['head'])), trim(addslashes($row['head'])))) {
        $changes[0] = true;
    } else {
        if (!$row && $_POST['head']) {
            $changes[0] = true;
        }
    }
    if ($row && strcmp($addslashes(trim($_POST['body_text'])), trim(addslashes($row['text'])))) {
        $changes[0] = true;
    } else {
        if (!$row && $_POST['body_text']) {
            $changes[0] = true;
        }
    }
    if ($row && strcmp($addslashes(trim($_POST['weblink_text'])), trim(addslashes($row['text'])))) {
        $changes[0] = true;
    } else {
        if (!$row && $_POST['weblink_text']) {
            $changes[0] = true;
        }
    }
    /* use customized head: */
    if ($row && isset($_POST['use_customized_head']) && $_POST['use_customized_head'] != $row['use_customized_head']) {
        $changes[0] = true;
    }
    /* formatting: */
    if ($row && strcmp(trim($_POST['formatting']), $row['formatting'])) {
        $changes[0] = true;
    } else {
        if (!$row && $_POST['formatting']) {
            $changes[0] = true;
        }
    }
    /* release date: */
    if ($row && strcmp(substr(generate_release_date(), 0, -2), substr($row['release_date'], 0, -2))) {
        /* the substr was added because sometimes the release_date in the db has the seconds field set, which we dont use */
        /* so it would show a difference, even though it should actually be the same, so we ignore the seconds with the -2 */
        /* the seconds gets added if the course was created during the installation process. */
        $changes[1] = true;
    } else {
        if (!$row && strcmp(generate_release_date(), generate_release_date(true))) {
            $changes[1] = true;
        }
    }
    /* related content: */
    $row_related = $contentManager->getRelatedContent($cid);
    if (is_array($_POST['related']) && is_array($row_related)) {
        $sum = array_sum(array_diff($_POST['related'], $row_related));
        $sum += array_sum(array_diff($row_related, $_POST['related']));
        if ($sum > 0) {
            $changes[1] = true;
        }
    } else {
        if (!is_array($_POST['related']) && !empty($row_related)) {
            $changes[1] = true;
        }
    }
    /* keywords */
    if ($row && strcmp(trim($_POST['keywords']), $row['keywords'])) {
        $changes[1] = true;
    } else {
        if (!$row && $_POST['keywords']) {
            $changes[1] = true;
        }
    }
    /* glossary */
    if (is_array($_POST['glossary_defs'])) {
        global $glossary_ids;
        foreach ($_POST['glossary_defs'] as $w => $d) {
            $key = in_array_cin($w, $glossary_ids);
            if ($key === false) {
                /* new term */
                $changes[2] = true;
                break;
            } else {
                if ($cid && ($d && $d != $glossary[$glossary_ids[$key]])) {
                    /* changed term */
                    $changes[2] = true;
                    break;
                }
            }
        }
        if (is_array($_POST['related_term'])) {
            foreach ($_POST['related_term'] as $term => $r_id) {
                if ($glossary_ids_related[$term] != $r_id) {
                    $changes[2] = true;
                    break;
                }
            }
        }
    }
    /* adapted content */
    if (isset($_POST['use_post_for_alt'])) {
        foreach ($_POST as $alt_id => $alt_value) {
            if (substr($alt_id, 0, 4) == 'alt_' && $alt_value != $row_alternatives[$alt_id]) {
                $changes[3] = true;
                break;
            }
        }
    }
    /* test & survey */
    if ($row && isset($_POST['test_message']) && $_POST['test_message'] != $row['test_message']) {
        $changes[4] = true;
    }
    if ($row && isset($_POST['allow_test_export']) && $_POST['allow_test_export'] != $row['allow_test_export']) {
        $changes[4] = true;
    }
    return $changes;
}
    // needed to display content pages. A single row is needed here.
    foreach ($content_array as $content_sub) {
        $content_row = $content_sub;
    }
}
if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) {
    $course_base_href = 'get.php/';
} else {
    $course_base_href = 'content/' . $_SESSION['course_id'] . '/';
}
// save changes
if ($_POST['submit']) {
    if ($_POST['title'] == '') {
        $msg->addError(array('EMPTY_FIELDS', _AT('title')));
    }
    if (!($release_date = generate_release_date())) {
        $msg->addError('BAD_DATE');
    }
    if (!$msg->containsErrors()) {
        $_POST['title'] = $content_row['title'] = $addslashes($_POST['title']);
        if ($cid > 0) {
            // edit existing content
            $err = $contentManager->editContent($cid, $_POST['title'], '', '', '', $content_row['formatting'], $release_date, '', $content_row['use_customized_head'], '', $content_row['allow_test_export'], CONTENT_TYPE_FOLDER);
        } else {
            // add new content
            // find out ordering and content_parent_id
            if ($pid) {
                // insert sub content folder
                $ordering = count($contentManager->getContent($pid)) + 1;
            } else {
                // insert a top content folder