Example #1
0
foreach ($Columns as $Item) {
    $ColumnNames[] = $Item["column_name"];
}
// On post
if (isset($_POST) && count($_POST) > 0) {
    foreach ($ColumnNames as $Item) {
        if (isset($ColumnCommands[$Item]["type"][0]) && $ColumnCommands[$Item]["type"][0] == "timestamp") {
            $_POST[$Item] = strtotime($_POST[$Item]);
        }
        if (isset($_POST[$Item]) && is_array($_POST[$Item])) {
            $_POST[$Item] = implode(",", $_POST[$Item]);
        }
    }
    InsertQueryFromArray($_GET["param_0"], $_POST);
    $LastInsertId = $DB->LastInsertId;
    AppendLog("Added item #" . $LastInsertId . " to " . $_GET["param_0"]);
    //IMAGE
    foreach ($ColumnNames as $Column) {
        if (ArrGet($ColumnCommands, $Column, "type", 0) != "image" && ArrGet($ColumnCommands, $Column, "type", 0) != "file") {
            continue;
        }
        if (ArrGet($_FILES, $Column, "name") != "") {
            $Image = new upload($_FILES[$Column]);
            if ($Image->uploaded) {
                foreach (array_keys($ColumnCommands[$Column]) as $Item) {
                    if (substr($Item, 0, 3) == "io_") {
                        $ImgOptionKey = substr($Item, 3);
                        $Val = $ColumnCommands[$Column]["io_" . $ImgOptionKey][0];
                        $Val = str_replace("[id]", $LastInsertId, $Val);
                        $Val = str_replace("[timestamp]", time(), $Val);
                        $Image->{$ImgOptionKey} = $Val;
Example #2
0
<?php

/* Page setup
	------------------------------*/
$PHPZevelop->OverrideObjectData("CFG", array("PageTitle" => "Home", "Template" => "none", "PassParams" => true));
// Check if invalid
if (isset($_GET["param_0"])) {
    foreach ($TableOptions as $K => $V) {
        if (strstr(str_replace(" ", "", $_SESSION["Query"]), "FROM" . $K) !== false && (isset($V["Status"]) && $V["Status"] == "disabled")) {
            die("Invalid table");
        }
    }
} else {
    die("Invalid table");
}
AppendLog("Downloaded CSV dataset from " . $_GET["param_0"]);
$Data = $DB->Query($_SESSION["Query"], $_SESSION["Data"]);
// Get column commands
GetColumnsCommands($_GET["param_0"], $Columns, $ColumnCommands);
$ColumnNames = array();
foreach ($Columns as $Item) {
    $ColumnNames[] = $Item["column_name"];
}
// Build rows
$Rows = array();
$I = -1;
foreach ($Data as $Item) {
    $I++;
    $II = -1;
    foreach ($Item as $K => $V) {
        $II++;
Example #3
0
                        $Val = str_replace("[timestamp]", time(), $Val);
                        $Image->{$ImgOptionKey} = $Val;
                    }
                }
                $Image->process($FrontEndImageLocationRoot . "/" . (string) $ColumnCommands[$Column]["filelocation"][0]);
                if ($Image->processed) {
                    $_POST[$Column] = $Image->file_dst_name_body . "." . $Image->file_dst_name_ext;
                } else {
                    die($Image->error . "<br /><br />" . $FrontEndImageLocationRoot . "/" . (string) $ColumnCommands[$Column]["filelocation"][0]);
                }
            }
        }
    }
    //IMAGE
    UpdateQueryFromArray($_GET["param_0"], $_POST, "WHERE id=:id", $_GET["param_1"]);
    AppendLog("Edited item #" . $_GET["param_1"] . " in " . $_GET["param_0"]);
    $Data = $DB->QuerySingle("SELECT * FROM " . $_GET["param_0"] . " WHERE id=:id", array("id" => $_GET["param_1"]));
}
$FormGen = new FormGen();
foreach ($Columns as $Item) {
    if (strtolower($Item["column_name"]) == "id") {
        continue;
    }
    $Title = ucfirst(ltrim(str_replace("_", " ", $Item["column_name"]), " "));
    $Type = isset($ColumnCommands[$Item["column_name"]]["type"][0]) ? $ColumnCommands[$Item["column_name"]]["type"][0] : "text";
    $Class = isset($ColumnCommands[$Item["column_name"]]["class"][0]) ? $ColumnCommands[$Item["column_name"]]["class"][0] : "";
    if ($Type == "select") {
        $Options = array("0" => " - none -");
        if (isset($ColumnCommands[$Item["column_name"]]["join"])) {
            foreach ($DB->Query("SELECT id," . $ColumnCommands[$Item["column_name"]]["join"][1] . " FROM " . $ColumnCommands[$Item["column_name"]]["join"][0]) as $Option) {
                $Options[$Option["id"]] = $Option[$ColumnCommands[$Item["column_name"]]["join"][1]];
Example #4
0
<?php

/* Page setup
	------------------------------*/
$PHPZevelop->OverrideObjectData("CFG", array("PageTitle" => "Login", "Template" => "style2/fullwidth"));
if (count($_POST) > 0) {
    $MSG = Administrator::AttemptLogin($Administrator, $_POST["username"], $_POST["password"]);
    if ($MSG === true) {
        AppendLog("Successful login");
    } else {
        AppendLog("Failed login with username '" . $_POST["username"] . "'");
    }
}
if (isset($_GET["param_0"])) {
    $Split = explode("-", $_GET["param_0"]);
    if ($Split[0] == "activated") {
        $ActivatedUser = Administrator::GetSingle(array("id", "=", $Split[1]));
        $_POST["username"] = $ActivatedUser->Data["username"];
    }
}
if ($Administrator->LoggedIn()) {
    $PHPZevelop->Location("home");
}
?>

<style type="text/css">
	#loginForm {width: 50%; margin: auto; background: #EEEEEE; border: 1px solid #009ACD; box-sizing: border-box; padding-bottom: 15px;}
	#loginForm h2 {margin: 0px; padding: 15px;}
	#loginForm h3 {margin: 0px; padding: 9px 13px;}
	#loginForm table.FormGen {width: 95%; margin: auto;}