$iaCore->set_cfg('body', 'none');
 if ($mod == 'manage_recipecats') {
     $iaCore->grid('_IA_URL_packages/recipes/js/admin/recipecats');
     $iaCore->display('none');
 } elseif ($mod == 'edit_recipecat' || $mod == 'add_recipecat') {
     $iaCore->set_breadcrumb(_t('manage_recipecats'), IA_ADMIN_URL . 'manage/recipecats/');
     $iaCore->set_cfg('body', 'edit_recipecat');
     if (isset($vals[0])) {
         $_GET['id'] = (int) $_GET['id'];
     }
     $recipecat = $mod == 'add_recipecat' || empty($_GET['id']) ? array() : $iaDb->row('*', sprintf("`id`=%d", $_GET['id']));
     $fields = $iaCore->getAllFields(true, "", "recipecats");
     if (!empty($_POST)) {
         if ($fields) {
             $iaUtil = $iaCore->factory('core', 'util');
             list($data, $error, $msg, $error_fields) = iaUtil::updateItemPOSTFields($fields, $recipecat, true);
         }
         if (!$error) {
             $iaCore->startHook("phpAdminBeforeRecipecatSubmit");
             $data['locked'] = (int) $_POST['locked'];
             $data['status'] = $_POST['status'];
             $data['title_alias'] = !empty($_POST['title_alias']) ? $_POST['title_alias'] : $_POST['title'];
             // transliterate title alias
             if ($iaCore->get('recipes_auto_alias')) {
                 $iaUtil = $iaCore->factory('core', 'util');
                 if (!defined('IA_NOUTF')) {
                     iaUtf8::loadUTF8Core();
                     iaUtf8::loadUTF8Util('ascii', 'utf8_to_ascii');
                 }
                 if (!utf8_is_ascii($data['title_alias'])) {
                     $data['title_alias'] = utf8_to_ascii($data['title_alias']);
 } elseif ($mod == 'edit_cookbook' || $mod == 'add_cookbook') {
     $iaCore->set_breadcrumb(_t('manage_cookbooks'), IA_ADMIN_URL . 'manage/cookbooks/');
     $iaCore->set_cfg('body', 'edit_cookbook');
     if (isset($vals[0])) {
         $_GET['id'] = (int) $_GET['id'];
     }
     if ($mod == 'add_cookbook' || empty($_GET['id'])) {
         $cookbook = array();
     } else {
         $cookbook = $iaCookbook->getCookbookById($_GET['id']);
     }
     $fields = $iaCore->getAllFields(true, "", "cookbooks");
     if (!empty($_POST)) {
         if ($fields) {
             $iaUtil = $iaCore->factory('core', 'util');
             list($data, $error, $msg, $error_fields) = iaUtil::updateItemPOSTFields($fields, $cookbook, true);
         }
         if (!$error) {
             $iaCore->startHook("phpAdminBeforeCookbookSubmit");
             $data['status'] = $_POST['status'];
             $data['title_alias'] = !empty($_POST['title_alias']) ? $_POST['title_alias'] : $_POST['title'];
             // transliterate title alias
             if ($iaCore->get('recipes_auto_alias')) {
                 $iaUtil = $iaCore->factory('core', 'util');
                 if (!defined('IA_NOUTF')) {
                     iaUtf8::loadUTF8Core();
                     iaUtf8::loadUTF8Util('ascii', 'utf8_to_ascii');
                 }
                 if (!utf8_is_ascii($data['title_alias'])) {
                     $data['title_alias'] = utf8_to_ascii($data['title_alias']);
                 }
if ($id) {
    $sections = $iaCore->getAcoGroupsFields(false, 'lyrics', "`f`.`type` <> 'pictures'");
    $iaCore->assign_by_ref('sections', $sections);
    $pictures_sections = $iaCore->getAcoGroupsFields(false, 'lyrics', "`f`.`type`='pictures'", false);
    $iaCore->assign_by_ref('pictures_sections', $pictures_sections);
} else {
    $sections = $iaCore->getAcoGroupsFields(false, 'lyrics');
    $iaCore->assign_by_ref('sections', $sections);
}
if (iaView::REQUEST_HTML == $iaView->getRequestType()) {
    if (!empty($_POST)) {
        $fields = $iaCore->getAcoFieldsList(false, 'lyrics', false, true);
        if ($fields) {
            $data = '';
            iaCore::util();
            list($data, $error, $messages, $errorFields) = iaUtil::updateItemPOSTFields($fields, $lyric);
        }
        if (!$error) {
            $iaCore->startHook("beforeEstateSubmit");
            $dmsg = '';
            if ($iaCore->get('lyrics_auto_approval') || $action == 'deleted') {
                $data['status'] = 'active';
            } else {
                $data['status'] = 'approval';
                $dmsg = '_apporval';
            }
            if (empty($lyric)) {
                $action = 'added';
                $data['id'] = $iaLyric->add($data);
                if ($data['id'] == 0) {
                    $error = true;