if ($mime == "application/xml") { require dirname(__FILE__) . "/validators/validator_xml.php"; $a = ValidateCode($filefullpath); } else { if ($mime == "text/html") { require dirname(__FILE__) . "/validators/validator_html.php"; $a = ValidateCode($filefullpath); } else { $a = array("msg" => "Tipo de fichero no reconocido"); } } } $msgbox = new jsO("msgbox", "parent", false); if (is_array($a)) { $msgbox->jsO->value = "{$a["msg"]} {$a["line"]}"; $editor = new jsO("editor", "parent", true); if ($a["line"]) { $editor->setMethod("jumpToLine", array($a["line"])); } $editor->jsMapO(); $editor->jsMapM(); } else { $msgbox->jsO->value = "{$mime} : Syntaxis OK"; } $msgbox->jsMapO(); $msgbox->jsMapM(); jsCodeFlush(); ?>
try { $data = stripslashes(utf8_encode($_POST["code"])); $f = fopen(dirname(__FILE__) . "/../" . trim($file), "wt"); if (!$f) { $textarea = new jsO("msgbox", "parent", false); $textarea->jsO->value = "Error al guardar {$file}"; $textarea->jsMapO(); $textarea->jsMapM(); jsCodeFlush(); die; } fwrite($f, $data, strlen($data)); fclose($f); } catch (Exception $e) { jsCodePush("\n//alert('{$e}');\n"); $textarea = new jsO("msgbox", "parent", false); $textarea->jsO->value = "Error al guardar {$file} ({$e})"; $textarea->jsMapO(); $textarea->jsMapM(); jsCodeFlush(); die; } debug($data, "red"); $textarea = new jsO("msgbox", "parent", false); $textarea->jsO->value = "{$file} guardado (" . strftime("%H:%M:%S") . ")"; $textarea->jsMapO(); $textarea->jsMapM(); jsCodeFlush(); ?>