making things really work

This commit is contained in:
LJ 2018-07-16 20:32:30 +03:00
parent 89e2652ace
commit 930a397618
3 changed files with 17 additions and 23 deletions

File diff suppressed because one or more lines are too long

30
dist/index.php vendored
View file

@ -14,8 +14,8 @@ class Config {
];
public $paths = [
"js" => "/fibr/dist/js",
"css" => "/fibr/dist/css",
"js" => "/fibr/js",
"css" => "/fibr/css",
];
public $sql_auto = true; // Set this to false if you don't want to automatically make the new tables. Please note that this is not recommended.
@ -121,7 +121,7 @@ class Sql {
$this->tables = [];
$this->table_defaults = [];
$this->tables["table"] = $config->sql["table_prefix"] . "__table";
$this->table_defaults["table"] = "CREATE TABLE `" . $this->tables["table"] . "` (
$this->table_defaults["table"] = "`" . $this->tables["table"] . "` (
`id` BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
`folder_path` text NOT NULL,
`real_filename` text NOT NULL,
@ -130,8 +130,8 @@ class Sql {
`permissions` text DEFAULT NULL,
`downloadable` boolean DEFAULT 0 NOT NULL,
`is_folder` boolean DEFAULT 0 NOT NULL,
`hidden` boolean DEFAULT 0 NOT NULL,
) DEFAULT CHARSET=utf8;";
`hidden` boolean DEFAULT 0 NOT NULL
) DEFAULT CHARACTER SET=utf8mb4;";
}
function array_to_sql($array) {
@ -156,16 +156,10 @@ $sql = New Sql;
#region Test for tables, if they are missing then create them.
// Id is just arbitary to link table name and table defaults together
foreach ($sql->tables as $id => $table_name) {
$c = $sql->connection->query("show tables like '" . $table_name . "';");
if ($c->num_rows < 1) {
$debug->comment("Creating a table");
if ($c = $sql->connection["connection"]->prepare($sql->table_defaults[$id])) {
$c->execute();
$c->reset();
} else {
echo ("Error with sql on making new tables...");
}
$command = "CREATE TABLE IF NOT EXISTS " . $sql->table_defaults[$id];
#$debug->comment($command);
if (!$sql->connection->query($command)) {
$debug->comment("Error description: " . mysqli_error($sql->connection));
}
}
#endregion
@ -224,7 +218,7 @@ if ($c = $sql->connection->prepare("SELECT * FROM " . $sql->tables["table"] . "
}
} else {
echo "<h1>Get folder items from mysql failed</h1>";
die($functions->debug($sql->connection));
die($debug->msg($sql->connection));
}
#endregion
@ -245,7 +239,7 @@ foreach ($real_dir as $name) {
$i = $i + 1;
$tmp[] = $functions->defaults([
"name" => $name,
"path" => $path
"path" => $path,
]);
}
}
@ -272,7 +266,7 @@ if ($c = $sql->connection->prepare("SELECT * FROM " . $sql->tables["table"] . "
"permissions" => $tmp["permissions"],
"downloadable" => $tmp["downloadable"],
"is_folder" => $tmp["is_folder"],
"hidden" => $tmp["hidden"]
"hidden" => $tmp["hidden"],
];
++$i;
}

View file

@ -1,8 +1,8 @@
$icons-32px-path: "/fibr/dist/icons/32px/";
$icons-512px-path: "/fibr/dist/icons/32px/";
$icons-32px-path: "/fibr/icons/32px/";
$icons-512px-path: "/fibr/icons/32px/";
$redbooth-32px-path: "/fibr/dist/icons/redbooth/32px/";
$redbooth-512px-path: "/fibr/dist/icons/redbooth/512px/";
$redbooth-32px-path: "/fibr/icons/redbooth/32px/";
$redbooth-512px-path: "/fibr/icons/redbooth/512px/";
$redbooth-icons: "aac", "ai", "aiff", "avi", "bmp", "c", "cpp", "css", "csv", "dat", "dmg", "doc", "dotx", "dwg", "dxf", "eps", "exe", "flv", "gif", "h", "hpp", "html", "ics", "iso", "java", "jpg", "js", "key", "less", "mid", "mp3", "mp4", "mpg", "odf", "ods", "odt", "odp", "ots", "ott", "pdf", "php", "png", "ppt", "psd", "py", "qt", "rar", "rb", "rtf", "sass", "scss", "sql", "tga", "tgz", "tiff", "txt", "wav", "xls", "xlsx", "xml", "yml", "zip";
$rebooth-alternative-names: ("html": ".htm", "zip": ".7z", "txt": (".asc", ".md", ".gitignore", "license", ".json"));