function mainDelete($get) { $recno = isset($get['recno']) && $get['recno'] != '' ? htmlspecialchars($get['recno']) : -1; $uuid = isset($get['uuid']) && $get['uuid'] != '' ? htmlspecialchars($get['uuid']) : ''; $id = isset($_REQUEST['id']) && $_REQUEST['id'] != '' ? htmlspecialchars($_REQUEST['id']) : ''; if ($recno < 0 && $uuid == '' & $id == '') { Debugger::log('[micka_main_lib.mainDelete] ' . "Not complete input data! recno={$recno}, uuid={$uuid}, id={$id}", 'ERROR'); require PHPINC_DIR . '/templates/404_record.php'; } $rs = array(); $rs['akce'] = 'error'; $rs['ok'] = FALSE; $rs['report'] = ''; $rs['data'] = ''; if ($id != '') { $md_record = new MdRecord(); $id_arr = explode(",", $id); foreach ($id_arr as $key => $value) { $uuid = trim($value); if ($uuid != '') { $where_col = 'uuid'; $where_value = $uuid; $del_report = $md_record->deleteMdRecords($where_col, $where_value); $rs['report'][$uuid] = $del_report['report']; } } $rs['akce'] = 'json'; } else { $where_col = $recno > 0 ? 'recno' : 'uuid'; $where_value = $recno > 0 ? $recno : $uuid; $md_record = new MdRecord(); $del_report = $md_record->deleteMdRecords($where_col, $where_value); if ($del_report['report'] != 'ok') { $rs['report'] = $del_report['report']; Debugger::log('[micka_main_lib.mainDelete] ' . $del_report['report'], 'ERROR'); require PHPINC_DIR . '/templates/404_record.php'; return $rs; } if ($where_col == 'recno') { $rs['akce'] = 'search'; } else { $rs['akce'] = 'window_close'; } } if ($rs['akce'] == 'search') { $redirectUrl = getUrlSearchFromSession(); } else { $redirectUrl = ''; } //return $rs; return $redirectUrl; }
} break; //============================================================================== //============================================================================== case 'save': //============================================================================== if (canAction('w') === FALSE) { require PHPINC_DIR . '/templates/403.php'; } $redirectUrl = mainSave($_POST); if (is_array($redirectUrl) === TRUE) { if (isset($redirectUrl['report']) === TRUE) { setFlashMessage($redirectUrl['report'], $type = 'error'); } unsetEditValue2Session(); $redirectUrl = getUrlSearchFromSession(); } require PHPPRG_DIR . '/redirect.php'; break; //============================================================================== //============================================================================== case 'delete': //============================================================================== $redirectUrl = mainDelete($_GET); require PHPPRG_DIR . '/redirect.php'; break; //============================================================================== //============================================================================== case 'valid': //============================================================================== $uuid = isset($_GET['uuid']) ? htmlspecialchars($_GET['uuid']) : '';