function deleteRecord($smarty, $module_name, $local_templates_dir, &$pDB, $pACL, $arrConf, $user, $extension, $esAdministrador) { if (!$esAdministrador) { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("You are not authorized to delete any records")); return reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador); } $pMonitoring = new paloSantoMonitoring($pDB); $path_record = $arrConf['records_dir']; foreach ($_POST as $key => $values) { if (substr($key, 0, 3) == "id_") { $ID = substr($key, 3); $ID = str_replace("_", ".", $ID); $recordName = $pMonitoring->getRecordName($ID); $record = substr($recordName, 6); $record = basename($record); $path = $path_record . $record; if (is_file($path)) { // Archivo existe. Se borra si se puede actualizar CDR if ($pMonitoring->deleteRecordFile($ID)) { unlink($path); } } else { // Archivo no existe. Se actualiza CDR para mantener consistencia $pMonitoring->deleteRecordFile($ID); } } } $content = reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador); return $content; }
function deleteRecord($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials) { $error = ""; $success = false; $domain = null; if ($credentials['userlevel'] != 'superadmin') { $domain = $credentials["domain"]; } $record = getParameter("recordDel"); if (isset($record) && count($record) > 0) { $pMonitoring = new paloSantoMonitoring($pDB); $success = $pMonitoring->deleteRecordings($record, $domain); $error = $pMonitoring->errMsg; if ($success) { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", _tr("The Recordings were deleted successfully")); } else { $smarty->assign("mb_title", _tr("MESSAGE")); $smarty->assign("mb_message", "Some file could not be deleted.<br>" . $error); } } else { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", _tr("You must select at least one record")); } return reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials); }