diff options
author | Nicolas BERNSTEIN <alexis211@gmail.com> | 2012-02-12 19:50:55 +0100 |
---|---|---|
committer | Nicolas BERNSTEIN <alexis211@gmail.com> | 2012-02-12 19:50:55 +0100 |
commit | 24547ccec6526fcef3cccb34bc35fb81f31236b3 (patch) | |
tree | fc908fb06a6b8b4d4131c7303c4fb3b7d348f9bf /lib/image/rename.php | |
parent | cd76af42463bd80539db8c9671a427a9f0fe5d69 (diff) | |
download | Bits-24547ccec6526fcef3cccb34bc35fb81f31236b3.tar.gz Bits-24547ccec6526fcef3cccb34bc35fb81f31236b3.zip |
A lot of changes : blogging system essentially.
Diffstat (limited to 'lib/image/rename.php')
-rw-r--r-- | lib/image/rename.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/image/rename.php b/lib/image/rename.php new file mode 100644 index 0000000..0fbc442 --- /dev/null +++ b/lib/image/rename.php @@ -0,0 +1,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"); |