コード例 #1
0
ファイル: createConfig.php プロジェクト: NickGeek/Fancy
				alert("There was an error contacting the server. Please check your Internet connection.");
			});
		}
	</script>
	<?php 
} else {
    fwrite($file, htmlspecialchars_decode($fancyVarsStr));
}
session_start();
$_SESSION['authed'] = true;
//Add the site
$con = new mysqli($_POST['address'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname']);
$con->query("CREATE TABLE IF NOT EXISTS `elements` ( `id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `html` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `site` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
$con->query("CREATE TABLE IF NOT EXISTS `sites` ( `id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
$con->query("CREATE TABLE IF NOT EXISTS `blogs` ( `id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
$con->query("CREATE TABLE IF NOT EXISTS `blog_posts` ( `id` int(11) NOT NULL, `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, `html` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL, `blog` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
$con->query("ALTER TABLE `elements` ADD PRIMARY KEY (`id`);");
$con->query("ALTER TABLE `sites` ADD PRIMARY KEY (`id`);");
$con->query("ALTER TABLE `elements` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;");
$con->query("ALTER TABLE `sites` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;");
$con->query("ALTER TABLE `blogs` ADD PRIMARY KEY (`id`);");
$con->query("ALTER TABLE `blogs` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;");
$con->query("ALTER TABLE `blog_posts` ADD PRIMARY KEY (`id`);");
$con->query("ALTER TABLE `blog_posts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;");
$con->query("ALTER TABLE `blog_posts` ADD `timestamp` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `title`;");
if (is_resource($file)) {
    include_once 'api/DashboardHandler.php';
    $handler = new DashboardHandler();
    $handler->newSite($name);
    header('Location: index.php?site=' . $name);
}
コード例 #2
0
ファイル: getElements.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
session_start();
if (!isset($_SESSION['authed'])) {
    echo "Authentication Error";
    exit;
}
if (empty($_GET['site'])) {
    echo "Not enough data has been sent";
    exit;
}
$handler = new DashboardHandler($_GET['site']);
echo $handler->getElements();
コード例 #3
0
ファイル: update.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
session_start();
if (!isset($_SESSION['authed'])) {
    echo "Authentication Error";
    exit;
} else {
    if (empty($_POST['name']) || !isset($_POST['id']) || empty($_POST['site']) || empty($_POST['html'])) {
        echo "Not enough data has been sent";
        exit;
    }
    $name = $_POST['name'];
    $html = $_POST['html'];
    $site = $_POST['site'];
    $id = $_POST['id'];
    $handler = new DashboardHandler($site);
    if ($id == 0) {
        //New section
        $handler->newElement($name, $html);
    } else {
        //Updating
        $handler->updateElement($name, $html, $id);
    }
    echo "done";
    exit;
}
コード例 #4
0
ファイル: getElement.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
// session_start();
// if (!isset($_SESSION['authed'])) {
// 	echo "Authentication Error";
// 	exit();
// }
if (empty($_GET['id']) || empty($_GET['site'])) {
    echo "Not enough data has been sent";
    exit;
}
$handler = new DashboardHandler($_GET['site']);
echo $handler->getElement($_GET['id']);
コード例 #5
0
ファイル: getSites.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
// session_start();
// if (!isset($_SESSION['authed'])) {
// 	echo "Authentication Error";
// 	exit();
// }
$handler = new DashboardHandler();
echo $handler->getSites();
コード例 #6
0
ファイル: updateBlog.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
session_start();
if (!isset($_SESSION['authed'])) {
    echo "Authentication Error";
    exit;
} else {
    if (empty($_POST['title']) || !isset($_POST['id']) || empty($_POST['blog']) || empty($_POST['html'])) {
        echo "Not enough data has been sent";
        exit;
    }
    $title = $_POST['title'];
    $html = $_POST['html'];
    $blog = $_POST['blog'];
    $id = $_POST['id'];
    $handler = new DashboardHandler();
    if ($id == 0) {
        //New post
        $handler->newPost($title, $html, $blog);
    } else {
        //Updating
        $handler->updatePost($title, $html, $id);
    }
    echo "done";
    exit;
}
コード例 #7
0
ファイル: getPosts.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
if (empty($_GET['blog'])) {
    echo "Not enough data has been sent";
    exit;
}
$handler = new DashboardHandler();
echo $handler->getPosts($_GET['blog']);
コード例 #8
0
ファイル: newblog.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
session_start();
if (!isset($_SESSION['authed'])) {
    echo "Authentication Error";
    exit;
} else {
    if (empty($_GET['name'])) {
        echo "Not enough data has been sent";
        exit;
    }
    $name = $_GET['name'];
    $handler = new DashboardHandler();
    $handler->newBlog($name);
    echo "done";
}
コード例 #9
0
ファイル: getPost.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
session_start();
if (!isset($_SESSION['authed'])) {
    echo "Authentication Error";
    exit;
}
if (empty($_GET['id']) || empty($_GET['blog'])) {
    echo "Not enough data has been sent";
    exit;
}
$handler = new DashboardHandler();
echo $handler->getPost($_GET['id'], $_GET['blog']);
コード例 #10
0
ファイル: delete.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
session_start();
if (!isset($_SESSION['authed'])) {
    echo "Authentication Error";
    exit;
} else {
    $type = $_GET['type'];
    if ($type == 'site' && !empty($_GET['name'])) {
        $handler = new DashboardHandler();
        $handler->deleteSite($_GET['name']);
    } elseif ($type == 'blog' && !empty($_GET['name'])) {
        $handler = new DashboardHandler();
        $handler->deleteBlog($_GET['name']);
    } elseif ($type == 'element' && !empty($_GET['name']) && !empty($_GET['site'])) {
        $handler = new DashboardHandler($_GET['site']);
        $handler->deleteElement($_GET['name']);
    } elseif ($type == 'post' && !empty($_GET['name']) && !empty($_GET['blog'])) {
        $handler = new DashboardHandler();
        $handler->deletePost($_GET['name'], $_GET['blog']);
    } else {
        echo "Not enough data has been sent";
    }
    echo "done";
    exit;
}
コード例 #11
0
ファイル: getBlogs.php プロジェクト: NickGeek/Fancy
<?php

include_once 'DashboardHandler.php';
$handler = new DashboardHandler();
echo $handler->getBlogs();