Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Merge branch 'dev' into HEAD
Browse files Browse the repository at this point in the history
Change-Id: I706eda5c75106de88addf0a0bea4cf7ef6e7b5ca
  • Loading branch information
andi34 committed Jun 6, 2020
2 parents 9115641 + ace98d1 commit 68b4cb6
Show file tree
Hide file tree
Showing 17 changed files with 579 additions and 33 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,4 @@ Donators who donated 5€ or more get early access to new features/options i am
- [poldixd](https://github.com/poldixd)
- [TheVaan](https://github.com/TheVaan)
- [Andreas Remdt](https://andreasremdt.com)
- [philippselle](https://github.com/philippselle)
3 changes: 2 additions & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
if($i == 0){
$open = ' open init';
}
echo '<div class="panel'.$open.'"><div class="panel-heading"><h3><span class="minus">-</span><span class="plus">+</span><span data-i18n="'.$panel.'">'.$panel.'</span></h3></div>
echo '<div class="panel'.$open.'"><div class="panel-heading"><h3><span class="minus">-</span><span class="plus">+</span><span data-i18n="'.$panel.'">'.$panel.'</span> <a href="../manual" title="Need help?" target="newwin"><i class="fa fa-question-circle-o" aria-hidden="true"></i></a></h3>
</div>
<div class="panel-body">
';

Expand Down
7 changes: 2 additions & 5 deletions api/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@
}

if($config['reset_remove_mailtxt']) {
$mailAddressesFile = $config['foldersAbs']['data'] . '/mail-addresses.txt';

// delete mail-addresses.txt
if(is_file($mailAddressesFile)){
unlink($mailAddressesFile);
if (is_file(MAIL_FILE)) {
unlink(MAIL_FILE); // delete file
}
}

Expand Down
3 changes: 2 additions & 1 deletion api/applyEffects.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$filename_tmp = $config['foldersAbs']['tmp'] . DIRECTORY_SEPARATOR . $file;
$filename_thumb = $config['foldersAbs']['thumbs'] . DIRECTORY_SEPARATOR . $file;
$frame_path = __DIR__ . DIRECTORY_SEPARATOR .$config['take_frame_path'];
$collage_frame_path = __DIR__ . DIRECTORY_SEPARATOR .$config['take_collage_frame_path'];

if (isset($_POST['isCollage']) && $_POST['isCollage'] === 'true') {
$collageBasename = substr($filename_tmp, 0, -4);
Expand All @@ -30,7 +31,7 @@
$collageSrcImagePaths[] = $collageBasename . '-' . $i . '.jpg';
}

if (!createCollage($collageSrcImagePaths, $filename_tmp, $config['take_frame'], $frame_path)) {
if (!createCollage($collageSrcImagePaths, $filename_tmp, $config['take_collage_frame'], $collage_frame_path)) {
die(json_encode([
'error' => 'Could not create collage'
]));
Expand Down
8 changes: 3 additions & 5 deletions api/sendPic.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,17 @@
}

if (isset($_POST['send-link']) && $_POST['send-link'] === 'yes') {
$mailAddressesFile = $config['foldersAbs']['data'] . '/mail-addresses.txt';

if (!file_exists($mailAddressesFile)) {
if (!file_exists(MAIL_FILE)) {
$addresses = [];
} else {
$addresses = json_decode(file_get_contents($mailAddressesFile));
$addresses = json_decode(file_get_contents(MAIL_FILE));
}

if (!in_array($_POST['sendTo'], $addresses)) {
$addresses[] = $_POST['sendTo'];
}

file_put_contents($mailAddressesFile, json_encode($addresses));
file_put_contents(MAIL_FILE, json_encode($addresses));

die(json_encode([
'success' => true,
Expand Down
5 changes: 5 additions & 0 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$config['previewFromCam'] = false; // experimental see https://github.com/andreknieriem/photobooth/pull/30
$config['previewCamTakesPic'] = false; // HTTPS required to use tablet- or mobile phone camera
$config['previewCamFlipHorizontal'] = true;
$config['previewCamBackground'] = false;
$config['previewFromIPCam'] = false;
$config['ipCamPreviewRotation'] = '0deg';
$config['ipCamURL'] = null;
Expand All @@ -44,6 +45,8 @@
$config['polaroid_rotation'] = '0';
$config['take_frame'] = false;
$config['take_frame_path'] = '../resources/img/frames/frame.png';
$config['take_collage_frame'] = false;
$config['take_collage_frame_path'] = '../resources/img/frames/frame.png';
$config['chroma_keying'] = true;
$config['use_collage'] = false;
$config['continuous_collage'] = false;
Expand All @@ -54,6 +57,8 @@
$config['webserver_ip'] = null;
$config['rounded_corners'] = false;
$config['time_to_live'] = '90000';
$config['db_file'] = 'db';
$config['mail_file'] = 'mail-adresses';

// specify key id to use that key to take a picture or collage (e.g. 13 is the enter key)
// use for example https://keycode.info to get the key code
Expand Down
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<?php endif; ?>
</head>

<video id="video--preview" autoplay playsinline></video>
<body class="deselect">
<div id="wrapper">
<?php if( !$config['login_enabled'] || (isset($_SESSION['auth']) && $_SESSION['auth'] === true || !$config['protect_index'])): ?>
Expand Down
28 changes: 28 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
'name' => 'show_error_messages',
'value' => $config['show_error_messages']
],
'db_file' => [
'type' => 'input',
'placeholder' => $defaultConfig['db_file'],
'name' => 'db_file',
'value' => $config['db_file']
],
'file_format_date' => [
'type' => 'checkbox',
'name' => 'file_format_date',
Expand Down Expand Up @@ -192,6 +198,17 @@
'name' => 'use_collage',
'value' => $config['use_collage']
],
'take_collage_frame' => [
'type' => 'checkbox',
'name' => 'take_collage_frame',
'value' => $config['take_collage_frame']
],
'take_collage_frame_path' => [
'type' => 'input',
'placeholder' => $defaultConfig['take_collage_frame_path'],
'name' => 'take_collage_frame_path',
'value' => $config['take_collage_frame_path']
],
'collage_cntdwn_time' => [
'type' => 'range',
'name' => 'collage_cntdwn_time',
Expand Down Expand Up @@ -222,6 +239,11 @@
'name' => 'previewCamFlipHorizontal',
'value' => $config['previewCamFlipHorizontal']
],
'previewCamBackground' => [
'type' => 'checkbox',
'name' => 'previewCamBackground',
'value' => $config['previewCamBackground']
],
'previewFromIPCam' => [
'type' => 'checkbox',
'name' => 'previewFromIPCam',
Expand Down Expand Up @@ -677,6 +699,12 @@
'name' => 'send_all_later',
'value' => $config['send_all_later']
],
'file' => [
'type' => 'input',
'placeholder' => $defaultConfig['mail_file'],
'name' => 'mail_file',
'value' => $config['mail_file']
],
'host' => [
'type' => 'input',
'placeholder' => $defaultConfig['mail_host'],
Expand Down
3 changes: 2 additions & 1 deletion lib/db.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
require_once(__DIR__ . '/config.php');

define('DB_FILE', $config['foldersAbs']['data'] . '/db.txt');
define('DB_FILE', $config['foldersAbs']['data'] . DIRECTORY_SEPARATOR . $config['db_file'] . '.txt');
define('MAIL_FILE', $config['foldersAbs']['data'] . DIRECTORY_SEPARATOR . $config['mail_file'] . '.txt');

function getImagesFromDB() {
// get data from db.txt
Expand Down
106 changes: 106 additions & 0 deletions manual/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php

require_once('../lib/config.php');
require_once('../lib/configsetup.inc.php');

?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
<meta name="msapplication-TileColor" content="<?=$config['colors']['primary']?>">
<meta name="theme-color" content="<?=$config['colors']['primary']?>">

<title>Photobooth Manual</title>

<!-- Favicon + Android/iPhone Icons -->
<link rel="apple-touch-icon" sizes="180x180" href="../resources/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="../resources/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../resources/img/favicon-16x16.png">
<link rel="manifest" href="../resources/img/site.webmanifest">
<link rel="mask-icon" href="../resources/img/safari-pinned-tab.svg" color="#5bbad5">

<link rel="stylesheet" type="text/css" href="../node_modules/normalize.css/normalize.css" />
<link rel="stylesheet" type="text/css" href="../node_modules/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" type="text/css" href="../resources/css/manual.css" />
<?php if ($config['rounded_corners']): ?>
<link rel="stylesheet" type="text/css" href="../resources/css/rounded.css" />
<?php endif; ?>
</head>
<body class="manualwrapper">
<div class="manual-panel">
<h2>Photobooth Manual</h2>
<h3><a class="back-to-pb" href="../">Photobooth</a></h3>

<div class="accordion">
<form>
<?php
$i = 0;
foreach($configsetup as $panel => $fields) {
$open = '';
if($i == 0){
$open = ' open init';
}
echo '<div class="panel'.$open.'">';
echo '<div class="panel-heading">';
echo '<h3><span class="minus">-</span><span class="plus">+</span><span data-i18n="'.$panel.'">'.$panel.'</span></h3>';
echo '</div>';
echo '<div class="panel-body">';

foreach($fields as $key => $field) {
echo '<div class="form-row">';
switch($field['type']) {
case 'checkbox':
echo '<p><h4><span data-i18n="'.$key.'">'.$key.'</span></h4></p>';
echo '<p><span data-i18n="manual_'.$key.'">manual_'.$key.'</span></p><hr>';
echo '</div>';
break;
case 'multi-select':
case 'range':
case 'select':
case 'input':
echo '<p><h4><span data-i18n="'.$panel.'_'.$key.'"></span></h4></p>';
echo '<p><span data-i18n="manual_'.$panel.'_'.$key.'">manual_'.$panel.'_'.$key.'</span></p><hr>';
echo '</div>';
break;
case 'color':
case 'hidden':
echo '<input type="hidden" name="'.$field['name'].'" value="'.$field['value'].'"/>';
echo '</div>';
break;
}
}
echo '</div>';
echo '</div>';
$i++;
}
?>
</form>
<a href="https://github.com/andi34/photobooth/wiki" class="btn wiki-btn"><span data-i18n="show_wiki"></span></a>
</div>
</div>

<script type="text/javascript" src="../api/config.php"></script>
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../resources/js/theme.js"></script>
<script type="module" src="../resources/js/i18n-sub.js"></script>

<script>
$(function() {
$('.panel-heading').on('click', function() {
const panel = $(this).parents('.panel');
const others = $(this).parents('.accordion').find('.open').not(panel);

others.removeClass('open init');

panel.toggleClass('open');
panel.find('.panel-body').slideToggle();

others.find('.panel-body').slideUp('fast');
});
});
</script>

</body>
</html>
Loading

0 comments on commit 68b4cb6

Please sign in to comment.