$name, 'link' => $link));
if (! $result)
echo "
".__('There was a problem creating link')."
";
else {
echo "".__('Successfully created')."
";
$id_link = $result;
}
}
if (isset($_POST["update"])){ // if update
$id_link = safe_input($_POST["id_link"]);
$name = safe_input($_POST["name"]);
$link = safe_input($_POST["link"]);
$result = db_process_sql_update("tlink", array('name' => $name, 'link' => $link), array('id_link' => $id_link));
if (! $result)
echo "".__('There was a problem modifying link')."
";
else
echo "".__('Successfully updated')."
";
}
if (isset($_GET["borrar"])){ // if delete
$id_link = safe_input($_GET["borrar"]);
$result = db_process_sql_delete("tlink", array("id_link" => $id_link));
if (! $result)
echo "".__('There was a problem deleting link')."
";
else
echo "".__('Successfully deleted')."
";
}
// Main form view for Links edit
if ((isset($_GET["form_add"])) or (isset($_GET["form_edit"]))){
if (isset($_GET["form_edit"])){
$creation_mode = 0;
$id_link = safe_input($_GET["id_link"]);
$row = db_get_row("tlink", "id_link", $id_link);
if ($row !== false) {
$nombre = $row["name"];
$link = $row["link"];
}
else echo "".__('Name error')."
";
}
else { // form_add
$creation_mode =1;
$nombre = "";
$link = "";
}
echo '";
echo "';
}
else { // Main list view for Links editor
echo "";
echo "".__('Link name')." | ";
echo "".__('Delete')." | ";
$rows = db_get_all_rows_in_table('tlink', 'name');
if ($rows === false) {
$rows = array();
}
$color=1;
foreach ($rows as $row) {
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "".$row["name"]." | ";
echo '' . html_print_image("images/cross.png", true) . ' |
';
}
echo "
";
echo "";
}
?>