summaryrefslogtreecommitdiff
path: root/lib/image/newfld.php
blob: 63afd178a2813087a8a1d5905eba1e0c97b1a4ae (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/markdown.php");

$fld_name = "";
$fld_comment = "";
$fld_public = true;
if (isset($_POST['name']) && isset($_POST['comment'])) {
	$fld_public = isset($_POST['public']);
	$fld_name = esca($_POST['name']);
	$fld_comment = esca($_POST['comment']);
	$fld_comment_html = Markdown($fld_comment);
	if ($fld_name == "") {
		$error = "You must enter a name for your folder.";
	} else {
		sql("INSERT INTO img_folders(owner, name, comment, comment_html, public) ".
			"VALUES(" . $user['id'] . ", '" . escs($fld_name) . "', '" . escs($fld_comment) .
			"', '" . escs($fld_comment_html) . "', " . ($fld_public ? '1' : '0') . ")");
		header("Location: folder-image-" . mysql_insert_id());
		die();
	}
}

$title = "New folder";
$fields = array(
	array("label" => "Name : ", "name" => "name", "value" => $fld_name),
	array("label" => "Public ? ", "name" => "public", "type" => "checkbox", "checked" => $fld_public),
	array("label" => "Comment : ", "name" => "comment", "type" => "textarea", "value" => $fld_comment),
	);
$validate = "Create folder";

require("tpl/general/form.php");