function endpointConfiguratedUnset($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf) { $paloEndPoint = new paloSantoEndPoint($dsnAsterisk, $dsnSqlite); $arrEndpoint = array(); $strError = ""; if (is_array($_POST) && count($_POST) > 0) { foreach ($_POST as $key => $value) { if (substr($key, 0, 6) == "epmac_") { $tmpMac = substr($key, 6); $macExists = false; foreach ($_SESSION["elastix_endpoints"] as $endpoint) { if ($endpoint[2] == $tmpMac) { $macExists = true; break; } } if (!$macExists) { $strError .= _tr("The mac was not found") . ": {$tmpMac}<br />"; } else { $tmpEndpoint['id_model'] = $_POST["id_model_device_{$tmpMac}"]; if ($paloEndPoint->deleteEndpointsConf($tmpMac)) { $paloFile = new paloSantoFileEndPoint($arrConf["tftpboot_path"]); $name_model = $paloEndPoint->getModelById($tmpEndpoint['id_model']); $ArrayData['vendor'] = $_POST["name_vendor_device_{$tmpMac}"]; $ArrayData['data'] = array("filename" => strtolower(str_replace(":", "", $tmpMac)), "model" => $name_model); //Falta si hay error en la eliminacion de un archivo, ya esta para saber q error es, el problema es como manejar un error o los errores dentro del este lazo (foreach). //ejemplo: if($paloFile->deleteFiles($ArrayData)==false){ $paloFile->errMsg (mostrar error con smarty)} $paloFile->deleteFiles($ArrayData); } } } } } if ($strError != "") { $smarty->assign("mb_title", _tr("ERROR")); $smarty->assign("mb_message", $strError); } unset($_SESSION['elastix_endpoints']); return endpointConfiguratedShow($smarty, $module_name, $local_templates_dir, $dsnAsterisk, $dsnSqlite, $arrConf); //header("Location: /?menu=$module_name"); }