Merge branch 'master' into storageareas
This commit is contained in:
commit
1958351a13
|
@ -42,7 +42,7 @@ This is the recommended method to install ZoneMinder onto your system. ZoneMinde
|
|||
|
||||
If a repository that hosts ZoneMinder packages is not available for your distro, then you are encouraged to build your own package, rather than build from source. While each distro is different in ways that set it apart from all the others, they are often similar enough to allow you to adapt another distro's package building instructions to your own.
|
||||
|
||||
### Building a ZoneMinder Package
|
||||
### Building a ZoneMinder Package ###
|
||||
|
||||
Building ZoneMinder into a package is not any harder than building from source. As a matter of fact, if you have successfully built ZoneMinder from source in the past, then you may find these steps to be easier.
|
||||
|
||||
|
|
|
@ -13,6 +13,13 @@ The API is built in CakePHP and lives under the ``/api`` directory. It
|
|||
provides a RESTful service and supports CRUD (create, retrieve, update, delete)
|
||||
functions for Monitors, Events, Frames, Zones and Config.
|
||||
|
||||
Enabling API
|
||||
^^^^^^^^^^^^
|
||||
A default ZoneMinder installs with APIs enabled. You can explictly enable/disable the APIs
|
||||
via the Options->System menu by enabling/disabling ``OPT_USE_API``. Note that if you intend
|
||||
to use APIs with 3rd party apps, such as zmNinja or others that use APIs, you should also
|
||||
enable ``AUTH_HASH_LOGINS``.
|
||||
|
||||
Login, Logout & API Security
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
The APIs tie into ZoneMinder's existing security model. This means if you have
|
||||
|
|
|
@ -704,6 +704,8 @@ sub Fatal( @ ) {
|
|||
if ( $SIG{TERM} and ( $SIG{TERM} ne 'DEFAULT' ) ) {
|
||||
$SIG{TERM}();
|
||||
}
|
||||
# I think if we don't disconnect we will leave sockets around in TIME_WAIT
|
||||
zmDbDisconnect();
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -292,48 +292,48 @@ sub checkFilter {
|
|||
last if $zm_terminate;
|
||||
my $Event = new ZoneMinder::Event($$event{Id}, $event);
|
||||
|
||||
Debug("Checking event $event->{Id}");
|
||||
Debug("Checking event $Event->{Id}");
|
||||
my $delete_ok = !undef;
|
||||
$dbh->ping();
|
||||
if ( $filter->{AutoArchive} ) {
|
||||
Info("Archiving event $event->{Id}");
|
||||
Info("Archiving event $Event->{Id}");
|
||||
# Do it individually to avoid locking up the table for new events
|
||||
my $sql = 'UPDATE Events SET Archived = 1 WHERE Id = ?';
|
||||
my $sth = $dbh->prepare_cached( $sql )
|
||||
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
||||
my $res = $sth->execute( $event->{Id} )
|
||||
my $res = $sth->execute( $Event->{Id} )
|
||||
or Error("Unable to execute '$sql': ".$dbh->errstr());
|
||||
}
|
||||
if ( $Config{ZM_OPT_FFMPEG} && $filter->{AutoVideo} ) {
|
||||
if ( !$event->{Videoed} ) {
|
||||
$delete_ok = undef if !generateVideo($filter, $event);
|
||||
if ( !$Event->{Videoed} ) {
|
||||
$delete_ok = undef if !generateVideo($filter, $Event);
|
||||
}
|
||||
}
|
||||
if ( $Config{ZM_OPT_EMAIL} && $filter->{AutoEmail} ) {
|
||||
if ( !$event->{Emailed} ) {
|
||||
if ( !$Event->{Emailed} ) {
|
||||
$delete_ok = undef if !sendEmail($filter, $Event);
|
||||
}
|
||||
}
|
||||
if ( $Config{ZM_OPT_MESSAGE} && $filter->{AutoMessage} ) {
|
||||
if ( !$event->{Messaged} ) {
|
||||
if ( !$Event->{Messaged} ) {
|
||||
$delete_ok = undef if !sendMessage($filter, $Event);
|
||||
}
|
||||
}
|
||||
if ( $Config{ZM_OPT_UPLOAD} && $filter->{AutoUpload} ) {
|
||||
if ( !$event->{Uploaded} ) {
|
||||
if ( !$Event->{Uploaded} ) {
|
||||
$delete_ok = undef if !uploadArchFile($filter, $Event);
|
||||
}
|
||||
}
|
||||
if ( $filter->{AutoExecute} ) {
|
||||
if ( !$event->{Executed} ) {
|
||||
$delete_ok = undef if !executeCommand($filter, $event);
|
||||
if ( !$Event->{Executed} ) {
|
||||
$delete_ok = undef if !executeCommand($filter, $Event);
|
||||
}
|
||||
}
|
||||
if ( $filter->{AutoDelete} ) {
|
||||
if ( $delete_ok ) {
|
||||
$Event->delete();
|
||||
} else {
|
||||
Error("Unable toto delete event $event->{Id} as previous operations failed");
|
||||
Error("Unable to delete event $Event->{Id} as previous operations failed");
|
||||
}
|
||||
} # end if AutoDelete
|
||||
|
||||
|
@ -364,11 +364,11 @@ sub checkFilter {
|
|||
|
||||
sub generateVideo {
|
||||
my $filter = shift;
|
||||
my $event = shift;
|
||||
my $Event = shift;
|
||||
my $phone = shift;
|
||||
|
||||
my $rate = $event->{DefaultRate}/100;
|
||||
my $scale = $event->{DefaultScale}/100;
|
||||
my $rate = $Event->{DefaultRate}/100;
|
||||
my $scale = $Event->{DefaultScale}/100;
|
||||
my $format;
|
||||
|
||||
my @ffmpeg_formats = split(/\s+/, $Config{ZM_FFMPEG_FORMATS});
|
||||
|
@ -393,7 +393,7 @@ sub generateVideo {
|
|||
my $command = join('',
|
||||
$Config{ZM_PATH_BIN},
|
||||
'/zmvideo.pl -e ',
|
||||
$event->{Id},
|
||||
$Event->{Id},
|
||||
' -r ',
|
||||
$rate,
|
||||
' -s ',
|
||||
|
@ -417,7 +417,7 @@ sub generateVideo {
|
|||
my $sql = 'UPDATE Events SET Videoed = 1 WHERE Id = ?';
|
||||
my $sth = $dbh->prepare_cached($sql)
|
||||
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
||||
my $res = $sth->execute($event->{Id})
|
||||
my $res = $sth->execute($Event->{Id})
|
||||
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
||||
if ( wantarray() ) {
|
||||
return( $format, $output );
|
||||
|
@ -467,15 +467,15 @@ sub generateImage {
|
|||
|
||||
sub uploadArchFile {
|
||||
my $filter = shift;
|
||||
my $event = shift;
|
||||
my $Event = shift;
|
||||
|
||||
if ( ! $Config{ZM_UPLOAD_HOST} ) {
|
||||
Error('Cannot upload archive as no upload host defined');
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
my $archFile = $event->{MonitorName}.'-'.$event->{Id};
|
||||
my $archImagePath = $event->Path()
|
||||
my $archFile = $Event->{MonitorName}.'-'.$Event->{Id};
|
||||
my $archImagePath = $Event->Path()
|
||||
.'/'
|
||||
.(
|
||||
( $Config{ZM_UPLOAD_ARCH_ANALYSE} )
|
||||
|
@ -540,7 +540,7 @@ sub uploadArchFile {
|
|||
return( 0 );
|
||||
} else {
|
||||
if ( $Config{ZM_UPLOAD_PROTOCOL} eq 'ftp' ) {
|
||||
Info('Uploading to '.$Config{ZM_UPLOAD_HOST}." using FTP");
|
||||
Info('Uploading to '.$Config{ZM_UPLOAD_HOST}.' using FTP');
|
||||
my $ftp = Net::FTP->new(
|
||||
$Config{ZM_UPLOAD_HOST},
|
||||
Timeout=>$Config{ZM_UPLOAD_TIMEOUT},
|
||||
|
@ -565,7 +565,7 @@ sub uploadArchFile {
|
|||
} else {
|
||||
my $host = $Config{ZM_UPLOAD_HOST};
|
||||
$host .= ':'.$Config{ZM_UPLOAD_PORT} if $Config{ZM_UPLOAD_PORT};
|
||||
Info('Uploading to '.$host." using SFTP\n");
|
||||
Info('Uploading to '.$host.' using SFTP');
|
||||
my %sftpOptions = (
|
||||
host=>$Config{ZM_UPLOAD_HOST}, user=>$Config{ZM_UPLOAD_USER}
|
||||
($Config{ZM_UPLOAD_PASS} ? (password=>$Config{ZM_UPLOAD_PASS}) : ()),
|
||||
|
@ -593,7 +593,7 @@ sub uploadArchFile {
|
|||
my $sql = 'UPDATE Events SET Uploaded = 1 WHERE Id = ?';
|
||||
my $sth = $dbh->prepare_cached($sql)
|
||||
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
||||
my $res = $sth->execute($event->{Id})
|
||||
my $res = $sth->execute($Event->{Id})
|
||||
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
||||
}
|
||||
return 1;
|
||||
|
@ -949,13 +949,13 @@ sub sendMessage {
|
|||
|
||||
sub executeCommand {
|
||||
my $filter = shift;
|
||||
my $event = shift;
|
||||
my $Event = shift;
|
||||
|
||||
my $event_path = $event->Path();
|
||||
my $event_path = $Event->Path();
|
||||
|
||||
my $command = $filter->{AutoExecuteCmd};
|
||||
$command .= " $event_path";
|
||||
$command = substituteTags($command, $filter, $event);
|
||||
$command = substituteTags($command, $filter, $Event);
|
||||
|
||||
Info("Executing '$command'");
|
||||
my $output = qx($command);
|
||||
|
@ -971,7 +971,7 @@ sub executeCommand {
|
|||
my $sql = 'UPDATE Events SET Executed = 1 WHERE Id = ?';
|
||||
my $sth = $dbh->prepare_cached($sql)
|
||||
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
||||
my $res = $sth->execute( $event->{Id} )
|
||||
my $res = $sth->execute( $Event->{Id} )
|
||||
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
||||
}
|
||||
return( 1 );
|
||||
|
|
|
@ -23,7 +23,7 @@ case $i in
|
|||
shift # past argument=value
|
||||
;;
|
||||
-d=*|--distro=*)
|
||||
DISTRO="${i#*=}"
|
||||
DISTROS="${i#*=}"
|
||||
shift # past argument=value
|
||||
;;
|
||||
-i=*|--interactive=*)
|
||||
|
@ -74,11 +74,15 @@ else
|
|||
echo "Doing $TYPE build"
|
||||
fi;
|
||||
|
||||
if [ "$DISTRO" == "" ]; then
|
||||
DISTRO=`lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`;
|
||||
echo "Defaulting to $DISTRO for distribution";
|
||||
if [ "$DISTROS" == "" ]; then
|
||||
if [ "$RELEASE" != "" ]; then
|
||||
DISTROS="xenial,bionic,trusty"
|
||||
else
|
||||
echo "Building for $DISTRO";
|
||||
DISTROS=`lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`;
|
||||
fi;
|
||||
echo "Defaulting to $DISTROS for distribution";
|
||||
else
|
||||
echo "Building for $DISTROS";
|
||||
fi;
|
||||
|
||||
# Release is a special mode... it uploads to the release ppa and cannot have a snapshot
|
||||
|
@ -116,6 +120,18 @@ else
|
|||
fi;
|
||||
fi
|
||||
|
||||
PPA="";
|
||||
if [ "$RELEASE" != "" ]; then
|
||||
# We need to use our official tarball for the original source, so grab it and overwrite our generated one.
|
||||
IFS='.' read -r -a VERSION <<< "$RELEASE"
|
||||
PPA="ppa:iconnor/zoneminder-${VERSION[0]}.${VERSION[1]}"
|
||||
else
|
||||
if [ "$BRANCH" == "" ]; then
|
||||
PPA="ppa:iconnor/zoneminder-master";
|
||||
else
|
||||
PPA="ppa:iconnor/zoneminder-$BRANCH";
|
||||
fi;
|
||||
fi;
|
||||
|
||||
# Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead.
|
||||
if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then
|
||||
|
@ -154,6 +170,11 @@ if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then
|
|||
fi;
|
||||
|
||||
DIRECTORY="zoneminder_$VERSION";
|
||||
if [ -d "$DIRECTORY.orig" ]; then
|
||||
echo "$DIRECTORY.orig already exists. Please delete it."
|
||||
exit 0;
|
||||
fi;
|
||||
|
||||
echo "Doing $TYPE release $DIRECTORY";
|
||||
mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig";
|
||||
if [ $? -ne 0 ]; then
|
||||
|
@ -161,6 +182,7 @@ if [ $? -ne 0 ]; then
|
|||
echo "Setting up build dir failed.";
|
||||
exit $?;
|
||||
fi;
|
||||
|
||||
cd "$DIRECTORY.orig";
|
||||
|
||||
# Init submodules
|
||||
|
@ -172,17 +194,26 @@ rm -rf .git
|
|||
rm .gitignore
|
||||
cd ../
|
||||
|
||||
if [ ! -e "$DIRECTORY.orig.tar.gz" ]; then
|
||||
tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig
|
||||
fi;
|
||||
|
||||
IFS=',' ;for DISTRO in `echo "$DISTROS"`; do
|
||||
echo "Generating package for $DISTRO";
|
||||
cd $DIRECTORY.orig
|
||||
|
||||
if [ -e "debian" ]; then
|
||||
rm -rf debian
|
||||
fi;
|
||||
|
||||
# Generate Changlog
|
||||
if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then
|
||||
mv distros/ubuntu1204 debian
|
||||
cp -Rpd distros/ubuntu1204 debian
|
||||
else
|
||||
if [ "$DISTRO" == "wheezy" ]; then
|
||||
mv distros/debian debian
|
||||
cp -Rpd distros/debian debian
|
||||
else
|
||||
mv distros/ubuntu1604 debian
|
||||
cp -Rpd distros/ubuntu1604 debian
|
||||
fi;
|
||||
fi;
|
||||
|
||||
|
@ -254,7 +285,7 @@ fi;
|
|||
if [ "$DEBSIGN_KEYID" != "" ]; then
|
||||
DEBUILD="$DEBUILD -k$DEBSIGN_KEYID"
|
||||
fi
|
||||
$DEBUILD
|
||||
eval $DEBUILD
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error status code is: $?"
|
||||
echo "Build failed.";
|
||||
|
@ -262,13 +293,6 @@ echo "Error status code is: $?"
|
|||
fi;
|
||||
|
||||
cd ../
|
||||
if [ "$INTERACTIVE" != "no" ]; then
|
||||
read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]"
|
||||
[[ $REPLY == [yY] ]] && { mv "$DIRECTORY.orig" zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted"; }
|
||||
echo "Done!"
|
||||
else
|
||||
rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted";
|
||||
fi
|
||||
|
||||
if [ $TYPE == "binary" ]; then
|
||||
if [ "$INTERACTIVE" != "no" ]; then
|
||||
|
@ -291,24 +315,6 @@ if [ $TYPE == "binary" ]; then
|
|||
fi;
|
||||
else
|
||||
SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes";
|
||||
PPA="";
|
||||
if [ "$RELEASE" != "" ]; then
|
||||
# We need to use our official tarball for the original source, so grab it and overwrite our generated one.
|
||||
if [ ! -e "$RELEASE.tar.gz" ]; then
|
||||
echo "Grabbing official source tarball from github."
|
||||
wget "https://github.com/ZoneMinder/zoneminder/archive/$RELEASE.tar.gz"
|
||||
fi;
|
||||
echo "Overwriting generated zoneminder_${VERSION}.orig.tar.gz with source tarball from github";
|
||||
cp "$RELEASE.tar.gz" "zoneminder_${VERSION}.orig.tar.gz"
|
||||
IFS='.' read -r -a VERSION <<< "$RELEASE"
|
||||
PPA="ppa:iconnor/zoneminder-${VERSION[0]}.${VERSION[1]}"
|
||||
else
|
||||
if [ "$BRANCH" == "" ]; then
|
||||
PPA="ppa:iconnor/zoneminder-master";
|
||||
else
|
||||
PPA="ppa:iconnor/zoneminder-$BRANCH";
|
||||
fi;
|
||||
fi;
|
||||
|
||||
dput="Y";
|
||||
if [ "$INTERACTIVE" != "no" ]; then
|
||||
|
@ -318,5 +324,14 @@ else
|
|||
fi;
|
||||
fi;
|
||||
fi;
|
||||
done; # foreach distro
|
||||
|
||||
if [ "$INTERACTIVE" != "no" ]; then
|
||||
read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]"
|
||||
[[ $REPLY == [yY] ]] && { mv "$DIRECTORY.orig" zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted"; }
|
||||
echo "Done!"
|
||||
else
|
||||
rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted";
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
@ -107,21 +107,19 @@ class HostController extends AppController {
|
|||
}
|
||||
}
|
||||
|
||||
$zm_dir_events = $this->Config->find('list', array(
|
||||
'conditions' => array('Name' => 'ZM_DIR_EVENTS'),
|
||||
'fields' => array('Name', 'Value')
|
||||
));
|
||||
$zm_dir_events = $zm_dir_events['ZM_DIR_EVENTS' ];
|
||||
$zm_dir_events = ZM_DIR_EVENTS;
|
||||
|
||||
// Test to see if $zm_dir_events is relative or absolute
|
||||
if ('/' === "" || strrpos($zm_dir_events, '/', -strlen($zm_dir_events)) !== TRUE) {
|
||||
#if ('/' === "" || strrpos($zm_dir_events, '/', -strlen($zm_dir_events)) !== TRUE) {
|
||||
if ( substr($zm_dir_events, 0, 1) != '/' ) {
|
||||
// relative - so add the full path
|
||||
$zm_dir_events = Configure::read('ZM_PATH_WEB') . '/' . $zm_dir_events;
|
||||
$zm_dir_events = ZM_PATH_WEB . '/' . $zm_dir_events;
|
||||
}
|
||||
|
||||
if ( $mid ) {
|
||||
// Get disk usage for $mid
|
||||
$usage = shell_exec ("du -sh0 $zm_dir_events/$mid | awk '{print $1}'");
|
||||
Logger::Debug("Executing du -s0 $zm_dir_events/$mid | awk '{print $1}'");
|
||||
$usage = shell_exec("du -s0 $zm_dir_events/$mid | awk '{print $1}'");
|
||||
} else {
|
||||
$monitors = $this->Monitor->find('all', array(
|
||||
'fields' => array('Id', 'Name', 'WebColour')
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
/**
|
||||
* Storage Controller
|
||||
*
|
||||
* @property Storage $Storage
|
||||
* @property PaginatorComponent $Paginator
|
||||
*/
|
||||
class StorageController extends AppController {
|
||||
|
||||
/**
|
||||
* Components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('Paginator', 'RequestHandler');
|
||||
|
||||
public function beforeFilter() {
|
||||
parent::beforeFilter();
|
||||
global $user;
|
||||
$canView = (!$user) || ($user['System'] != 'None');
|
||||
if ( !$canView ) {
|
||||
throw new UnauthorizedException(__('Insufficient Privileges'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* index method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function index() {
|
||||
$this->Storage->recursive = 0;
|
||||
|
||||
$options = '';
|
||||
$storage_areas = $this->Storage->find('all',$options);
|
||||
$this->set(array(
|
||||
'storage' => $storage_areas,
|
||||
'_serialize' => array('storage')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* view method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function view($id = null) {
|
||||
$this->Storage->recursive = 0;
|
||||
if (!$this->Storage->exists($id)) {
|
||||
throw new NotFoundException(__('Invalid storage area'));
|
||||
}
|
||||
$restricted = '';
|
||||
|
||||
$options = array('conditions' => array(
|
||||
array('Storage.' . $this->Storage->primaryKey => $id),
|
||||
$restricted
|
||||
)
|
||||
);
|
||||
$storage = $this->Storage->find('first', $options);
|
||||
$this->set(array(
|
||||
'storage' => $storage,
|
||||
'_serialize' => array('storage')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* add method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add() {
|
||||
if ( $this->request->is('post') ) {
|
||||
|
||||
global $user;
|
||||
$canEdit = (!$user) || ($user['System'] == 'Edit');
|
||||
if ( !$canEdit ) {
|
||||
throw new UnauthorizedException(__('Insufficient privileges'));
|
||||
return;
|
||||
}
|
||||
|
||||
$this->Storage->create();
|
||||
if ( $this->Storage->save($this->request->data) ) {
|
||||
# Might be nice to send it a start request
|
||||
#$this->daemonControl($this->Storage->id, 'start', $this->request->data);
|
||||
return $this->flash(__('The storage area has been saved.'), array('action' => 'index'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* edit method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function edit($id = null) {
|
||||
$this->Storage->id = $id;
|
||||
|
||||
global $user;
|
||||
$canEdit = (!$user) || ($user['System'] == 'Edit');
|
||||
if ( !$canEdit ) {
|
||||
throw new UnauthorizedException(__('Insufficient privileges'));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !$this->Storage->exists($id) ) {
|
||||
throw new NotFoundException(__('Invalid storage area'));
|
||||
}
|
||||
if ( $this->Storage->save($this->request->data) ) {
|
||||
$message = 'Saved';
|
||||
} else {
|
||||
$message = 'Error';
|
||||
}
|
||||
|
||||
$this->set(array(
|
||||
'message' => $message,
|
||||
'_serialize' => array('message')
|
||||
));
|
||||
// - restart this storage area after change
|
||||
#$this->daemonControl($this->Storage->id, 'restart', $this->request->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* delete method
|
||||
*
|
||||
* @throws NotFoundException
|
||||
* @param string $id
|
||||
* @return void
|
||||
*/
|
||||
public function delete($id = null) {
|
||||
global $user;
|
||||
$canEdit = (!$user) || ($user['System'] == 'Edit');
|
||||
if ( !$canEdit ) {
|
||||
throw new UnauthorizedException(__('Insufficient privileges'));
|
||||
return;
|
||||
}
|
||||
|
||||
$this->Storage->id = $id;
|
||||
if ( !$this->Storage->exists() ) {
|
||||
throw new NotFoundException(__('Invalid storage area'));
|
||||
}
|
||||
$this->request->allowMethod('post', 'delete');
|
||||
|
||||
#$this->daemonControl($this->Storage->id, 'stop');
|
||||
|
||||
if ( $this->Storage->delete() ) {
|
||||
return $this->flash(__('The storage area has been deleted.'), array('action' => 'index'));
|
||||
} else {
|
||||
return $this->flash(__('The storage area could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
.overlayHeader {
|
||||
float: left;
|
||||
background-color: #dddddd;
|
||||
background-color: #853131;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid #666666;
|
||||
color: black;
|
||||
|
|
|
@ -547,7 +547,7 @@ private $control_fields = array(
|
|||
} // end function Source
|
||||
|
||||
public function Url() {
|
||||
return $this->Server()->Url() .':'. ( ZM_MIN_STREAMING_PORT ? (ZM_MIN_STREAMING_PORT+$this->Id()) : $_SERVER['SERVER_PORT'] );
|
||||
return $this->Server()->Url( ZM_MIN_STREAMING_PORT ? (ZM_MIN_STREAMING_PORT+$this->Id()) : null );
|
||||
}
|
||||
|
||||
} // end class Monitor
|
||||
|
|
|
@ -38,13 +38,18 @@ class Server {
|
|||
}
|
||||
}
|
||||
|
||||
public function Url() {
|
||||
public function Url( $port = null ) {
|
||||
$url = ZM_BASE_PROTOCOL . '://';
|
||||
if ( $this->Id() ) {
|
||||
return ZM_BASE_PROTOCOL . '://'. $this->Hostname();
|
||||
$url .= $this->Hostname();
|
||||
} else {
|
||||
return ZM_BASE_PROTOCOL . '://'. $_SERVER['SERVER_NAME'];
|
||||
return '';
|
||||
$url .= $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
if ( $port ) {
|
||||
$url .= ':'.$port;
|
||||
}
|
||||
$url .= $_SERVER['PHP_SELF'];
|
||||
return $url;
|
||||
}
|
||||
public function Hostname() {
|
||||
if ( isset( $this->{'Hostname'} ) and ( $this->{'Hostname'} != '' ) ) {
|
||||
|
|
|
@ -183,12 +183,13 @@ foreach ( getSkinIncludes('skin.php') as $includeFile )
|
|||
require_once $includeFile;
|
||||
|
||||
if ( ZM_OPT_USE_AUTH ) {
|
||||
if ( ZM_AUTH_HASH_LOGINS ) {
|
||||
if ( empty($user) && ! empty($_REQUEST['auth']) ) {
|
||||
if ( ZM_AUTH_HASH_LOGINS && empty($user) && ! empty($_REQUEST['auth']) ) {
|
||||
if ( $authUser = getAuthUser($_REQUEST['auth']) ) {
|
||||
userLogin($authUser['Username'], $authUser['Password'], true);
|
||||
}
|
||||
}
|
||||
else if ( isset($_REQUEST['username']) and isset($_REQUEST['password']) ) {
|
||||
userLogin($_REQUEST['username'], $_REQUEST['password'], false);
|
||||
}
|
||||
if ( !empty($user) ) {
|
||||
// generate it once here, while session is open. Value will be cached in session and return when called later on
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
User-agent: *
|
||||
Disallow: /
|
||||
###
|
Loading…
Reference in New Issue