$i18n = exponent_lang_loadFile('modules/NavigationModule/actions/save_internalalias.php'); // Update the section from the _POST data. $section = section::updateInternalAlias($_POST, $section); if ($section->active == 0) { // User tried to link to an inactive section. This makes little or no sense in // this context, so throw them back to the edit form, with an error message. $_POST['_formError'] = $i18n['internal_link_err']; exponent_sessions_set('last_POST', $_POST); header('Location: ' . $_SERVER['HTTP_REFERER']); exit(''); } if (isset($section->id)) { if ($section->parent != $old_parent) { // Old_parent id was different than the new parent id. Need to decrement the ranks // of the old children (after ours), and then add $section = section::changeParent($section, $old_parent, $section->parent); } // Existing section. Update the database record. // The 'id=x' WHERE clause is implicit with an updateObject if (isset($_SESSION['nav_cache']['kids'])) { unset($_SESSION['nav_cache']['kids']); } $db->updateObject($section, 'section'); } else { // Since this is new, we need to increment ranks, in case the user // added it in the middle of the level. $db->increment('section', 'rank', 1, 'rank >= ' . $section->rank . ' AND parent=' . $section->parent); // New section. Insert a new database record. if (isset($_SESSION['nav_cache']['kids'])) { unset($_SESSION['nav_cache']['kids']); }