Esempio n. 1
0
function dbLoad()
{
    global $_contents;
    global $_menu;
    if (file_exists("db/contents.txt")) {
        $_contents = json_decode(file_get_contents("db/contents.txt"), true);
    } else {
        dbAddContents(array('mode' => 1, 'title' => 'Posts', 'contents' => '', 'header' => '', 'eyecatch' => '', 'page' => -1, 'native' => ''));
    }
    if (file_exists("db/menu.txt")) {
        $_menu = json_decode(file_get_contents("db/menu.txt"), true);
    } else {
        $_menu = array();
        $_menu['bland'] = "Init Menu";
        $_menu['menu'] = array("Login" => "system/login.php");
        dbSetMenu($_menu);
    }
}
Esempio n. 2
0
function dbLoad()
{
    global $_contents;
    global $_menu;
    if (file_exists("db/contents.txt")) {
        $_contents = json_decode(file_get_contents("db/contents.txt"), true);
    } else {
        dbAddContents(array('mode' => 1, 'title' => '投稿一覧', 'contents' => '', 'header' => '', 'eyecatch' => '', 'page' => -1, 'native' => ''));
    }
    if (file_exists("db/menu.txt")) {
        $_menu = json_decode(file_get_contents("db/menu.txt"), true);
    } else {
        $_menu = array();
        $_menu['bland'] = "初期メニュー";
        $_menu['menu'] = array("ログイン" => "index.php?signin=1");
        dbSetMenu($_menu);
    }
}
Esempio n. 3
0
$submit = array_get($_POST, 'submit');
$title = array_get($_POST, 'title');
$text = array_get($_POST, 'text');
$head = array_get($_POST, 'head');
$eyecatch = array_get($_POST, 'eyecatch');
$native = array_get($_POST, 'native');
$ptag = array_get($_POST, 'ptag');
//投稿された
if (strlen($submit) > 0) {
    if (strlen($eyecatch) == 0) {
        $eyecatch = 'http://placehold.it/320x240';
    }
    if (strlen($ptag)) {
        $text = entag($text);
    }
    $page = dbAddContents(array('mode' => $mode, 'title' => $title, 'contents' => $text, 'header' => $head, 'eyecatch' => $eyecatch, 'page' => $page, 'native' => $native));
}
//編集
if ($mode == 0 || $mode == 1) {
    if ($page >= 0) {
        $data = dbGetContents($page);
        $mode = $data['mode'];
        $title = $data['title'];
        $head = $data['header'];
        $text = $data['contents'];
        $eyecatch = $data['eyecatch'];
        $native = $data['native'];
    }
    $editpage(array('title' => $title, 'text' => $text, 'head' => $head, 'eyecatch' => $eyecatch, 'mode' => $mode, 'page' => $page, 'native' => $native));
    $path = 'system/snippets';
    if (isset($_SESSION) && isset($_SESSION['snplst'])) {