mirror of
https://gitlab.com/hacklab01/pivilion.git
synced 2026-08-07 00:18:23 +00:00
Add modern Raspberry Pi OS compatibility
This commit is contained in:
parent
4636a4f4f6
commit
3b7a16564b
35 changed files with 725 additions and 15678 deletions
|
|
@ -1,16 +1,25 @@
|
|||
<?php
|
||||
require_once '/etc/pivilion.php';
|
||||
ob_start(); // start trapping output
|
||||
$banana = @$_POST['banana'];
|
||||
$title = @$_POST['title'];
|
||||
$description = @$_POST['description'];
|
||||
$images_array = $_FILES['mytest'];
|
||||
$slides_array = @$_POST['imgs'];
|
||||
$slides_autors = @$_POST['author'];
|
||||
$slides_desc = @$_POST['work_desc'];
|
||||
$color = @$_POST['color'];
|
||||
$banana = $_POST['banana'] ?? '';
|
||||
$title = $_POST['title'] ?? '';
|
||||
$description = $_POST['description'] ?? '';
|
||||
$images_array = $_FILES['mytest'] ?? null;
|
||||
$slides_array = $_POST['imgs'] ?? array();
|
||||
$slides_autors = $_POST['author'] ?? array();
|
||||
$slides_desc = $_POST['work_desc'] ?? array();
|
||||
$color = $_POST['color'] ?? '';
|
||||
$slides_array = is_array($slides_array) ? $slides_array : array();
|
||||
$slides_autors = is_array($slides_autors) ? $slides_autors : array();
|
||||
$slides_desc = is_array($slides_desc) ? $slides_desc : array();
|
||||
|
||||
function rearrange($arr)
|
||||
{
|
||||
$new = array();
|
||||
if (!is_array($arr))
|
||||
{
|
||||
return $new;
|
||||
}
|
||||
foreach ($arr as $key => $all)
|
||||
{
|
||||
foreach ($all as $i => $val)
|
||||
|
|
@ -35,7 +44,7 @@ if (isset($_FILES['mytest']))
|
|||
$target_file = $target_dir . str_replace(",", "", str_replace(".", "", number_format(microtime(true) , 4))) . '.' . pathinfo($file['name'], PATHINFO_EXTENSION);
|
||||
|
||||
$uploadOk = 1;
|
||||
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
|
||||
$imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION));
|
||||
// Check if image file is a actual image or fake image
|
||||
//echo $imageFileType;
|
||||
// $check = getimagesize($file['tmp_name']);
|
||||
|
|
@ -189,6 +198,7 @@ $myfiles = preg_replace("/gen\//", "", $myfiles);
|
|||
|
||||
//var_dump($myfiles);
|
||||
$cnt = 1;
|
||||
$sld = 1;
|
||||
foreach ($slides_array as $imageVal)
|
||||
{
|
||||
// echo $cnt;
|
||||
|
|
@ -206,7 +216,9 @@ foreach ($slides_array as $imageVal)
|
|||
else
|
||||
{
|
||||
$ext = "";
|
||||
$ext = explode(".", current($myfiles));
|
||||
$current_file = current($myfiles);
|
||||
$current_file = is_string($current_file) ? $current_file : '';
|
||||
$ext = explode(".", $current_file);
|
||||
$format = $ext[sizeof($ext) - 1];
|
||||
switch ($format)
|
||||
{
|
||||
|
|
@ -247,15 +259,22 @@ foreach ($slides_array as $imageVal)
|
|||
</body>
|
||||
</html>
|
||||
<?php
|
||||
$source = "skeleton/";
|
||||
$dest = "/var/www/html/pivilion/gen";
|
||||
$source = PIVILION_WEBROOT . "/skeleton/";
|
||||
$dest = PIVILION_WEBROOT . "/gen";
|
||||
|
||||
mkdir($dest, 0755);
|
||||
if (!is_dir($dest) && !mkdir($dest, 0775, true) && !is_dir($dest))
|
||||
{
|
||||
throw new RuntimeException("Unable to create gallery directory");
|
||||
}
|
||||
foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS) , \RecursiveIteratorIterator::SELF_FIRST) as $item)
|
||||
{
|
||||
if ($item->isDir())
|
||||
{
|
||||
mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
|
||||
$directory = $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
|
||||
if (!is_dir($directory))
|
||||
{
|
||||
mkdir($directory, 0775, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -264,12 +283,17 @@ foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryItera
|
|||
}
|
||||
?>
|
||||
<?php
|
||||
$torname = file_get_contents('/home/pi/pivilion/torname');
|
||||
$torname_file = PIVILION_DIR . '/torname';
|
||||
$torname = is_readable($torname_file) ? file_get_contents($torname_file) : '';
|
||||
$tornamemode = preg_replace('/\s+/', '', $torname);
|
||||
$output = ob_get_contents(); // get contents of trapped output
|
||||
//write to file, e.g.
|
||||
$newfile = "/var/www/html/pivilion/gen/index.php";
|
||||
$newfile = PIVILION_WEBROOT . "/gen/index.php";
|
||||
$file = fopen($newfile, "w");
|
||||
if ($file === false)
|
||||
{
|
||||
throw new RuntimeException("Unable to write generated gallery");
|
||||
}
|
||||
fwrite($file, $output);
|
||||
fclose($file);
|
||||
ob_end_clean(); // discard trapped output and stop trapping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue