Skip to content

Commit

Permalink
Merge pull request #1849 from xibosignage/develop
Browse files Browse the repository at this point in the history
Release 3.3.6
  • Loading branch information
dasgarner authored Jun 6, 2023
2 parents 6f5d4dd + 11b3a4b commit 591c039
Show file tree
Hide file tree
Showing 68 changed files with 339 additions and 117 deletions.
15 changes: 11 additions & 4 deletions lib/Controller/Library.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand Down Expand Up @@ -980,7 +980,7 @@ public function delete(Request $request, Response $response, $id)
* operationId="libraryAdd",
* tags={"library"},
* summary="Add Media",
* description="Add Media to the Library",
* description="Add Media to the Library, optionally replacing an existing media item, optionally adding to a playlist.",
* @SWG\Parameter(
* name="files",
* in="formData",
Expand Down Expand Up @@ -1031,16 +1031,23 @@ public function delete(Request $request, Response $response, $id)
* required=false
* ),
* @SWG\Parameter(
* name="playlistId",
* in="formData",
* description="A playlistId to add this uploaded media to",
* type="int",
* required=false
* ),
* @SWG\Parameter(
* name="widgetFromDt",
* in="formData",
* description="Date in Y-m-d H:i:s format, will set widget start date",
* description="Date in Y-m-d H:i:s format, will set widget start date. Requires a playlistId.",
* type="string",
* required=false
* ),
* @SWG\Parameter(
* name="widgetToDt",
* in="formData",
* description="Date in Y-m-d H:i:s format, will set widget end date",
* description="Date in Y-m-d H:i:s format, will set widget end date. Requires a playlistId.",
* type="string",
* required=false
* ),
Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/Module.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/*
* Copyright (c) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
Expand Down Expand Up @@ -799,7 +799,7 @@ public function editWidgetForm(Request $request, Response $response, $id)
'validExtensions' => str_replace(',', '|', $module->getModule()->validExtensions),
'templatesAvailable' => $templates,
'options' => $options,
'isTopLevel' => $this->playlistFactory->getById($module->widget->playlistId)->isRegionPlaylist()
'isTopLevel' => $this->playlistFactory->getById($module->widget->playlistId)->isRegionPlaylist(),
]));

return $this->render($request, $response);
Expand Down
54 changes: 51 additions & 3 deletions lib/Entity/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,57 @@ public function validate()
if ($this->isPriority < 0) {
throw new InvalidArgumentException(__('Priority must be 0 or a positive number'), 'isPriority');
}
// Check recurrenceDetail every is positive
if ($this->recurrenceType != '' && ($this->recurrenceDetail === null || $this->recurrenceDetail <= 0)) {
throw new InvalidArgumentException(__('Repeat every must be a positive number'), 'recurrenceDetail');

// Run some additional validation if we have a recurrence type set.
if (!empty($this->recurrenceType)) {
// Check recurrenceDetail every is positive
if ($this->recurrenceDetail === null || $this->recurrenceDetail <= 0) {
throw new InvalidArgumentException(__('Repeat every must be a positive number'), 'recurrenceDetail');
}

// Make sure that we don't repeat more frequently than the duration of the event as this is a common
// misconfiguration which results in overlapping repeats
if ($this->eventTypeId !== Schedule::$COMMAND_EVENT) {
$eventDuration = $this->toDt - $this->fromDt;

// Determine the number of seconds our repeat type/interval represents
switch ($this->recurrenceType) {
case 'Minute':
$repeatDuration = $this->recurrenceDetail * 60;
break;

case 'Hour':
$repeatDuration = $this->recurrenceDetail * 3600;
break;

case 'Day':
$repeatDuration = $this->recurrenceDetail * 86400;
break;

case 'Week':
$repeatDuration = $this->recurrenceDetail * 86400 * 7;
break;

case 'Month':
$repeatDuration = $this->recurrenceDetail * 86400 * 30;
break;

case 'Year':
$repeatDuration = $this->recurrenceDetail * 86400 * 365;
break;

default:
throw new InvalidArgumentException(__('Unknown repeat type'), 'recurrenceType');
}

if ($repeatDuration < $eventDuration) {
throw new InvalidArgumentException(
__('An event cannot repeat more often than the interval between its start and end date'),
'recurrenceDetail',
$eventDuration . ' seconds'
);
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Factory/LayoutFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2276,8 +2276,8 @@ public function query($sortOrder = null, $filterBy = [])
$layout->width = $parsedRow->getDouble('width');
$layout->height = $parsedRow->getDouble('height');
$layout->orientation = $layout->width >= $layout->height ? 'landscape' : 'portrait';
$layout->createdDt = $parsedRow->getDate('createdDt');
$layout->modifiedDt = $parsedRow->getDate('modifiedDt');
$layout->createdDt = $parsedRow->getString('createdDt');
$layout->modifiedDt = $parsedRow->getString('modifiedDt');
$layout->displayOrder = $parsedRow->getInt('displayOrder');
$layout->statusMessage = $parsedRow->getString('statusMessage');
$layout->enableStat = $parsedRow->getInt('enableStat');
Expand Down
2 changes: 1 addition & 1 deletion lib/Helper/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
class Environment
{
public static $WEBSITE_VERSION_NAME = '3.3.5';
public static $WEBSITE_VERSION_NAME = '3.3.6';
public static $XMDS_VERSION = '6';
public static $XLF_VERSION = 3;
public static $VERSION_REQUIRED = '7.2.9';
Expand Down
8 changes: 4 additions & 4 deletions lib/Middleware/Theme.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Copyright (C) 2019 Xibo Signage Ltd
/*
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
Expand Down Expand Up @@ -128,7 +128,7 @@ public static function setTheme(ContainerInterface $container, Request $request,
'maxSize' => ByteFormatter::toBytes(Environment::getMaxUploadSize()),
'maxSizeMessage' => sprintf(__('This form accepts files up to a maximum size of %s'), Environment::getMaxUploadSize()),
'validExt' => implode('|', $container->get('moduleFactory')->getValidExtensions()),
'validImageExt' => implode('|', $container->get('moduleFactory')->getValidExtensions(['type' => 'image']))
'validImageExt' => implode('|', $container->get('moduleFactory')->getValidExtensions(['type' => 'image'])),
];
$view['ckeditorConfig'] = $container->get('mediaService')->setUser($container->get('user'))->fontCKEditorConfig(RouteContext::fromRequest($request)->getRouteParser());
$view['version'] = Environment::$WEBSITE_VERSION_NAME;
Expand Down
12 changes: 10 additions & 2 deletions lib/Widget/Agenda.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand All @@ -23,6 +23,7 @@
namespace Xibo\Widget;

use Carbon\Carbon;
use Carbon\CarbonInterval;
use ICal\ICal;
use Respect\Validation\Validator as v;
use Slim\Http\Response as Response;
Expand Down Expand Up @@ -794,7 +795,14 @@ public function isValid()

if ($customInterval != '') {
// Try to create a date interval from it
$dateInterval = \DateInterval::createFromDateString($customInterval);
$dateInterval = CarbonInterval::createFromDateString($customInterval);

if ($dateInterval === false) {
throw new InvalidArgumentException(
__('That is not a valid date interval, please use natural language such as 1 week'),
'customInterval'
);
}

// Use now and add the date interval to it
$now = Carbon::now();
Expand Down
12 changes: 10 additions & 2 deletions lib/Widget/Calendar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand All @@ -23,6 +23,7 @@
namespace Xibo\Widget;

use Carbon\Carbon;
use Carbon\CarbonInterval;
use ICal\ICal;
use Respect\Validation\Validator as v;
use Slim\Http\Response as Response;
Expand Down Expand Up @@ -873,7 +874,14 @@ public function isValid()

if ($customInterval != '') {
// Try to create a date interval from it
$dateInterval = \DateInterval::createFromDateString($customInterval);
$dateInterval = CarbonInterval::createFromDateString($customInterval);

if ($dateInterval === false) {
throw new InvalidArgumentException(
__('That is not a valid date interval, please use natural language such as 1 week'),
'customInterval'
);
}

// Use now and add the date interval to it
$now = Carbon::now();
Expand Down
4 changes: 2 additions & 2 deletions lib/Widget/Dashboard.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand All @@ -24,7 +24,6 @@

use Slim\Http\Response;
use Slim\Http\ServerRequest as Request;
use Xibo\Event\XmdsConnectorFileEvent;
use Xibo\Event\XmdsConnectorTokenEvent;
use Xibo\Helper\DateFormatHelper;
use Xibo\Support\Exception\ConfigurationException;
Expand Down Expand Up @@ -294,6 +293,7 @@ public function installOrUpdate($moduleFactory)
$module->defaultDuration = 60;
$module->settings = [];
$module->viewPath = '../modules';
$module->installName = 'dashboard';

// Set the newly created module and then call install
$this->setModule($module);
Expand Down
14 changes: 9 additions & 5 deletions lib/Widget/PlayerSoftware.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Copyright (C) 2020 Xibo Signage Ltd
/*
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
Expand Down Expand Up @@ -149,6 +149,11 @@ public function postProcess($media, PlayerVersionFactory $factory = null)
$type = 'sssp';
}

// if we were given media name on upload use that.
if ($media->name !== $media->fileName) {
$playerShowVersion = $media->name;
}

return $factory->create($type, $version, $code, $media->mediaId, $playerShowVersion);
}

Expand All @@ -159,5 +164,4 @@ public function getValidExtensions()
{
return $this->module->validExtensions;
}

}
}
Binary file modified locale/af.mo
Binary file not shown.
Binary file modified locale/ar.mo
Binary file not shown.
Binary file modified locale/bg.mo
Binary file not shown.
Binary file modified locale/ca.mo
Binary file not shown.
Binary file modified locale/cs.mo
Binary file not shown.
Binary file modified locale/da.mo
Binary file not shown.
Binary file modified locale/de.mo
Binary file not shown.
Loading

0 comments on commit 591c039

Please sign in to comment.