// Add new navigations if (count($afilenavis) > 0) { for ($i = 0; $i < count($afilenavis); $i++) { $templateMgr->addNavi($objectID, $afilenavis[$i]['CODE']); } } // Remove old contentareas if (count($rfilecontentareas) > 0) { for ($i = 0; $i < count($rfilecontentareas); $i++) { $templateMgr->removeContentarea($objectID, $rfilecontentareas[$i]['CODE']); } } // Remove old navigations if (count($rfilenavis) > 0) { for ($i = 0; $i < count($rfilenavis); $i++) { $templateMgr->removeNavi($objectID, $rfilenavis[$i]['CODE']); } } } if (count($found_temp_preview_files) > 0 && $previewchanged) { // Delete old files $old_preview_files = glob($templatepreviewdir . $objectID . '-*'); foreach ($old_preview_files as $old_preview_file) { unlink($old_preview_file); } // Rename temp file to real filename rename($found_temp_preview_files[0], str_replace('TMP_', '', $found_temp_preview_files[0])); } // Set the new name & identifier if ($templateMgr->setName($objectID, $template_name) === false) { $koala->alert($itext['TXT_ERROR_ACCESS_DENIED']);