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; }
if ($num_terms == 0) { echo _AT('no_terms_found'); } $num_glossary = count($glossary_ids); for ($i = 0; $i < $num_terms; $i++) { for ($j = 0; $j < $i; $j++) { if ($strtolower($word[$j]) == $strtolower($word[$i])) { /* skip multiple occurances of the same word: */ continue 2; } } ?> <table cellspacing="1" cellpadding="0" border="0" class="bodyline" summary="" align="center"> <tr> <td align="right" class="row1"><strong><?php $key = in_array_cin($word[$i], $glossary_ids); if ($key === false) { echo '<strong>' . _AT('new') . '</strong> '; $current_word = $word[$i]; $current_defn = $_POST['glossary_defs'][$word[$i]]; } else { $current_word = $glossary_ids[$key]; if (!$_POST['glossary_defs'][$word[$i]]) { $current_defn = $glossary[$glossary_ids[$key]]; } else { $current_defn = $_POST['glossary_defs'][$word[$i]]; } } echo _AT('glossary_term'); ?> :</strong></td>