XML Plugin: Looks like getEventPath is broken between 1.24.2 and 1.24.3, implement getEventPathSafe to workaround

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3181 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
jaidhar 2010-11-07 04:05:16 +00:00
parent 039358e00c
commit 2a09efdfd4
2 changed files with 12 additions and 3 deletions

View File

@ -1,4 +1,13 @@
<?php
function getEventPathSafe($event)
{
if (strcmp(ZM_VERSION, "1.24.3") == 0) {
$ret = ZM_DIR_EVENTS."/".getEventPath($event);
} else {
$ret = getEventPath($event);
}
return $ret;
}
function getset($varname, $defval)
{
if (isset($_GET[$varname])) return $_GET[$varname];

View File

@ -68,10 +68,10 @@ if (isset($_GET['action'])) {
$fps = getset('fps',ceil($event['Frames'] / $event['Length']));
$vcodec = getset('vcodec', XML_EVENT_VCODEC);
$relativeURL = getEventPath($event);
$baseURL = ZM_PATH_WEB."/".ZM_DIR_EVENTS."/".getEventPath($event);
$baseURL = ZM_PATH_WEB."/".getEventPathSafe($event);
$shellCmd = "ffmpeg -y -r ".$fps." -i ".$baseURL."/%03d-capture.jpg -vcodec ".$vcodec." -r ".XML_EVENT_FPS." ".$baseURL."/capture.mov 2> /dev/null";
$shellOutput = shell_exec($shellCmd);
$url = "./".ZM_DIR_EVENTS."/".getEventPath($event)."/capture.mov";
$url = "./".getEventPathSafe($event)."/capture.mov";
header("Location: ".$url);
exit;
@ -110,7 +110,7 @@ if (isset($_GET['action'])) {
}
/* Suffix based on 'analyze' */
$fname = sprintf("%03d-%s.jpg", $frame, $suffix);
$url = "./".ZM_DIR_EVENTS."/".getEventPath($event)."/".$fname;
$url = "./".getEventPathSafe($event)."/".$fname;
if (!file_exists($url)) {
$url = "./skins/xml/views/notfound.png";
}