blob: 0fbc44268cf96de3c9ab95e174b7c6781d231f70 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
require("lib/conf/image.php");
$title = "Rename an image";
if (count($args) < 3) header("location: index.php");
$id = intval($args[2]);
$info = mysql_fetch_assoc(sql("SELECT * FROM images WHERE id = $id"));
assert_error($info["owner"] == $user["id"], "You cannot rename this image.");
$name = $info['name'];
if (isset($_POST['name'])) {
$name = esca($_POST['name']);
if ($name == "") {
$error = "You must give a non-empty name to this image. Please.";
} else {
sql("UPDATE images SET name = '" . escs($name) . "' WHERE id = $id");
header("Location: image");
die();
}
}
$title = "Rename : " . $info['name'];
$fields = array(
array("label" => "New name : ", "name" => "name", "value" => $name),
);
$validate = "Rename";
require("tpl/general/form.php");
|