Beispiel #1
0
<?php

session_start();
if (isset($_SESSION["us"])) {
    include_once 'definition.php';
    $Tag = new Tag();
    $TagBySnippet = new TagBySnippet();
    $jsondata = array();
    if (isset($_GET['all'])) {
        $jsondata = $Tag->getAll();
    }
    if (isset($_GET['tbs'])) {
        $jsondata = $TagBySnippet->getAll();
    }
    header('Content-type: application/json; charset=utf-8');
    echo json_encode($jsondata);
    //echo $jsondata[1][2];
    exit;
} else {
    echo 'logout';
}
Beispiel #2
0
<?php

session_start();
if (isset($_SESSION["us"])) {
    include_once 'definition.php';
    $Tag = new Tag();
    $tbs = new TagBySnippet();
    if (isset($_POST['updateColor'])) {
        // Update color
        $Tag->updateColor($_POST['id'], $_POST['color']);
    }
    if (isset($_POST['updateTitle'])) {
        // Update color
        $Tag->updateTitle($_POST['id'], $_POST['title']);
    }
    if (isset($_POST['deleteTag'])) {
        // Update color
        $Tag->deleteTag($_POST['id']);
    }
    if (isset($_POST['addNewTag'])) {
        // add New Tag
        $num = $Tag->add($_POST['title'], $_POST['color']);
        echo $num;
    }
    if (isset($_POST['addTagToSnippet'])) {
        // add New Tag to Snippet
        $tbs->add($_POST['snippet_id'], $_POST['tag_id']);
    }
    if (isset($_POST['removeTagFromSnippet'])) {
        // add New Tag to Snippet
        $tbs->deleteTag($_POST['snippet_id'], $_POST['tag_id']);
Beispiel #3
0
$t = 'DROP TABLE snippets,tags,codes,tagbysnippet,users,usersresetpassword';
$con = new Conexion();
$con->set($t);
echo 'Deleted all tables';
?>

    <h1>Installation</h1>
    <?php 
// Create table snippets
$Snippets = new Snippet();
$Snippets->install();
// Create table tags
$Tags = new Tag();
$Tags->install();
// Create table TagBySnippet
$TagBySnippets = new TagBySnippet();
$TagBySnippets->install();
// Create table codes
$Codes = new Code();
$Codes->install();
// Create table users
$Users = new User();
$Users->install();
///////////////
// Add some tags
$Tags->add("Javascript", "#39A4FF");
// 1
$Tags->add("CSS", "#CD6CFF");
// 2
$Tags->add("HTML", "#C18F7D");
// 3