summaryrefslogtreecommitdiff
path: root/lib/deck/addent.php
diff options
context:
space:
mode:
authorroot <root@adnab.me>2014-01-31 16:42:40 +0100
committerroot <root@adnab.me>2014-01-31 16:42:40 +0100
commitb0c23ea84327d48e3a4383fac3e795c2dc0a1215 (patch)
tree625a8f0882815d9442a4ff2ec15a49e669a15ed3 /lib/deck/addent.php
parentcee55b766230837c21453f85e76a921cb5b8b89e (diff)
downloadBits-b0c23ea84327d48e3a4383fac3e795c2dc0a1215.tar.gz
Bits-b0c23ea84327d48e3a4383fac3e795c2dc0a1215.zip
Remove all studying apps code.
Diffstat (limited to 'lib/deck/addent.php')
-rw-r--r--lib/deck/addent.php46
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/deck/addent.php b/lib/deck/addent.php
deleted file mode 100644
index a860df1..0000000
--- a/lib/deck/addent.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-require("lib/markdown.php");
-
-assert_redir(count($args) == 3, 'deck');
-$deckid = intval($args[2]);
-
-$deck = mysql_fetch_assoc(sql(
- "SELECT decks.id AS id, decks.name AS name, decks.comment_md AS comment, decks.owner AS owner_id ".
- "FROM decks ".
- "WHERE decks.id = $deckid"));
-assert_error($deck && $deck['owner_id'] == $user['id'],
- "This deck does not exist, or you are not allowed to edit it.");
-
-$card_name = "";
-$card_text = "";
-if (isset($_POST['name']) && isset($_POST['text'])) {
- $card_name = esca($_POST['name']);
- $card_text = esca($_POST['text']);
- $card_text_html = Markdown($card_text);
- if ($card_name == "") {
- $error = "You must give your card a name.";
- } else if ($card_text == "") {
- $error = "You must put some text in your card.";
- } else if (mysql_fetch_assoc(sql("SELECT id FROM cards WHERE deck = $deckid AND name = '" . escs($card_name)."'"))) {
- $error = "You already have a card using that name.";
- } else {
- $n = mysql_fetch_assoc(sql("SELECT MAX(number) AS n FROM cards WHERE deck = $deckid"));
- $number = $n['n'] + 1;
- sql(
- "INSERT INTO cards(deck, number, name, text_md, text_html) ".
- "VALUES($deckid, $number, '" . escs($card_name) . "', '" . escs($card_text) . "', '" . escs($card_text_html). "')");
- header("Location: view-deck-$deckid");
- die();
- }
-}
-
-$title = "Add card to " . $deck['name'];
-$message = "Your card will be added at the end of the deck. You can always move it afterwards.";
-$fields = array(
- array("label" => "Name : ", "name" => "name", "value" => $card_name),
- array("label" => "Text : ", "name" => "text", "type" => "textarea", "value" => $card_text),
-);
-$validate = "Add card";
-
-require("tpl/deck/ef.php");