From 1cfec7e3e79372616491f0da8c426c11d15753ab Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 4 Jan 2015 11:50:24 -0500 Subject: [PATCH 01/19] Move require of config.php and logger up higher --- web/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/index.php b/web/index.php index e4c00e2c7..eed7ac1b3 100644 --- a/web/index.php +++ b/web/index.php @@ -46,6 +46,9 @@ if ( false ) ob_end_clean(); } +require_once( 'includes/config.php' ); +require_once( 'includes/logger.php' ); + if ( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ) { $protocol = 'https'; @@ -98,9 +101,6 @@ if ( !isset($_SESSION['css']) || isset($_REQUEST['css']) ) { setcookie( "zmCSS", $css, time()+3600*24*30*12*10 ); } -require_once( 'includes/config.php' ); -require_once( 'includes/logger.php' ); - if ( ZM_OPT_USE_AUTH ) if ( isset( $_SESSION['user'] ) ) $user = $_SESSION['user']; From a44f83cb7d6f2a64d4e643af8b87fc08d42e2209 Mon Sep 17 00:00:00 2001 From: Steve Gilvarry Date: Mon, 5 Jan 2015 07:58:39 +1100 Subject: [PATCH 02/19] #658 Fix error message for finding arp path --- web/skins/classic/views/monitorprobe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/skins/classic/views/monitorprobe.php b/web/skins/classic/views/monitorprobe.php index 5b57abb00..0c57d6ac6 100644 --- a/web/skins/classic/views/monitorprobe.php +++ b/web/skins/classic/views/monitorprobe.php @@ -292,7 +292,7 @@ unset($output); $command = "type -p arp"; $result = exec( escapeshellcmd($command), $output, $status ); if ( $status ) - Fatal( "Unable determine arp path, status is '$status'" ); + Fatal( "Unable to determine path for arp command, type -p arp returned '$status'" ); // Now that we know where arp is, call it using the full path $command = $output[0]." -a"; unset($output); From 4508c541efa4b4f448829c30d77a57649a1bc5f3 Mon Sep 17 00:00:00 2001 From: Hannes Date: Tue, 6 Jan 2015 17:10:58 +0200 Subject: [PATCH 03/19] Update et_ee.php Fixing Some problems Parse error: syntax error, unexpected 'Parameters' (T_STRING) in /usr/share/zoneminder/lang/et_ee.php --- web/lang/et_ee.php | 66 +++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/web/lang/et_ee.php b/web/lang/et_ee.php index e79550698..f328fb9e3 100644 --- a/web/lang/et_ee.php +++ b/web/lang/et_ee.php @@ -51,7 +51,7 @@ // do this by default, uncomment this if required. // // Example -header( "Content-Type: text/html; charset=utf-8' ); +// header( "Content-Type: text/html; charset=utf-8' ); // You may need to change your locale here if your default one is incorrect for the // language described in this file, or if you have multiple languages supported. @@ -128,7 +128,7 @@ $SLANG = array( 'BadAlarmFrameCount' => 'Alarmi kaadri hulga ühik peab olema integer. Kas üks või rohkem', 'BadAlarmMaxFPS' => 'Alarmi maksimaalne FPS peab olema positiivne integer või floating point väärtus', 'BadChannel' => 'Kanal peab olema integer, null või rohkem', - 'BadColours' => 'Sihtmärgi värv peab olema pandud õige väärtus', // Added - 2011-06-15 + 'BadColours' => 'Sihtmärgi värv peab olema pandud õige väärtus', // Added - 2011-06-15 'BadDevice' => 'Seadmel peab olema õige väärtus', 'BadFPSReportInterval' => 'FPS raporteerimise intervall puhvri hulk peab olema integer, null või rohkem', 'BadFormat' => 'Formaadiks peab olema pandud õige väärtus', @@ -208,14 +208,14 @@ $SLANG = array( 'CheckMethod' => 'Alarm Check Method', 'ChooseDetectedCamera' => 'Vali tuvastatud kaamera', 'ChooseFilter' => 'Vali Filter', - 'ChooseLogFormat' => 'Choose a log format', // Added - 2011-06-17 - 'ChooseLogSelection' => 'Choose a log selection', // Added - 2011-06-17 + 'ChooseLogFormat' => 'Choose a log format', // Added - 2011-06-17 + 'ChooseLogSelection' => 'Choose a log selection', // Added - 2011-06-17 'ChoosePreset' => 'Choose Preset', - 'Clear' => 'Clear', // Added - 2011-06-16 + 'Clear' => 'Clear', // Added - 2011-06-16 'Close' => 'Sule', 'Colour' => 'Värv', 'Command' => 'Käsk', - 'Component' => 'Komponent', // Added - 2011-06-16 + 'Component' => 'Komponent', // Added - 2011-06-16 'Config' => 'Seadistus', 'ConfiguredFor' => 'Seadistatud', 'ConfirmDeleteEvents' => 'Oled sa kindel kustamaks valitud sündmused?', @@ -235,7 +235,7 @@ $SLANG = array( 'Controllable' => 'Controllable', 'Cycle' => 'Cycle', 'CycleWatch' => 'Cycle Watch', - 'DateTime' => 'Kuupäev/Aeg', // Added - 2011-06-16 + 'DateTime' => 'Kuupäev/Aeg', // Added - 2011-06-16 'Day' => 'Päevas', 'Debug' => 'Debug', 'DefaultRate' => 'Default Kiirus', @@ -248,7 +248,7 @@ $SLANG = array( 'Description' => 'Kirjeldus', 'DetectedCameras' => 'Tuvastatud kaamerad', 'Device' => 'Seade', - 'DeviceChannel' => 'Seadme Kanal, + 'DeviceChannel' => 'Seadme Kanal', 'DeviceFormat' => 'Seadme Formaat', 'DeviceNumber' => 'Seadme Number', 'DevicePath' => 'Seadme Path', @@ -256,8 +256,8 @@ $SLANG = array( 'Dimensions' => 'Mõõdud', 'DisableAlarms' => 'Keela alarmid', 'Disk' => 'Ketas', - 'Display' => 'Ekraan', // Added - 2011-03-02 - 'Displaying' => 'Väljapanek', // Added - 2011-06-16 + 'Display' => 'Ekraan', // Added - 2011-03-02 + 'Displaying' => 'Väljapanek', // Added - 2011-06-16 'Donate' => 'Palun Anneta', 'DonateAlready' => 'EI, Ma olen juba annetanud', 'DonateEnticement' => 'Sa oled juba kasutanud ZoneMinderit juba mõnda aega. Nüüd kus sa oled leidnud, et see on kasulik lisa sinu kodule või sinu töökohale. Kuigi ZoneMinder on, jääb alatiseks, vabaks ja avatud lähtekoodiks, siiski selle arendamiseks kulub aega ja raha. Kui sa soovid meid aidata, siis toeta meid tuleviku arendusteks ja uute lisade loomiseks. Palun mõelge annetuse peale. Donating is, of course, optional but very much appreciated and you can donate as much or as little as you like.

If you would like to donate please select the option below or go to http://www.zoneminder.com/donate.html in your browser.

Thank you for using ZoneMinder and don\'t forget to visit the forums on ZoneMinder.com for support or suggestions about how to make your ZoneMinder experience even better.', @@ -265,7 +265,7 @@ $SLANG = array( 'DonateRemindHour' => 'Ei veel, tuleta meelde ühe tunni pärast', 'DonateRemindMonth' => 'Ei veel, tuleta meelde ühe kuu pärast', 'DonateRemindNever' => 'EI, Ma ei taha annetada, Vahet pole', - 'DonateRemindWeek' => 'EI veel, tuleta meelde nädala pärast, + 'DonateRemindWeek' => 'EI veel, tuleta meelde nädala pärast', 'DonateYes' => 'Jah, Ma soovin annetada', 'Download' => 'Lae alla', 'DuplicateMonitorName' => 'Dubleeri Monitori Nimi', @@ -287,7 +287,7 @@ $SLANG = array( 'Events' => 'Sündmuseid', 'Exclude' => 'Jäta välja', 'Execute' => 'Käivita', - 'Export' => 'Eksport, + 'Export' => 'Eksport', 'ExportDetails' => 'Ekspordi Sündmuste Detailid', 'ExportFailed' => 'Eksportimine Ebaõnnestus', 'ExportFormat' => 'Ekspordi Faili Formaat', @@ -302,7 +302,7 @@ $SLANG = array( 'ExportVideoFiles' => 'Export Video Files (kui neid on)', 'Exporting' => 'Eksportimine', 'FPS' => 'fps', - 'FPSReportInterval' => 'FPS Raporteerimise Intervall, + 'FPSReportInterval' => 'FPS Raporteerimise Intervall', 'FTP' => 'FTP', 'Far' => 'Far', 'FastForward' => 'Fast Forward', @@ -378,22 +378,22 @@ $SLANG = array( 'Language' => 'Keel', 'Last' => 'Viimane', 'Layout' => 'Layout', - 'Level' => 'Level', // Added - 2011-06-16 - 'Libvlc' => 'Libvlc', + 'Level' => 'Level', // Added - 2011-06-16 + 'Libvlc' => 'Libvlc', 'LimitResultsPost' => 'results only', // This is used at the end of the phrase 'Limit to first N results only' 'LimitResultsPre' => 'Limit to first', // This is used at the beginning of the phrase 'Limit to first N results only' - 'Line' => 'Line', // Added - 2011-06-16 + 'Line' => 'Line', // Added - 2011-06-16 'LinkedMonitors' => 'Lingitud monitorid', 'List' => 'List', 'Load' => 'Koormus', 'Local' => 'Local', - 'Log' => 'Logi', // Added - 2011-06-16 + 'Log' => 'Logi', // Added - 2011-06-16 'LoggedInAs' => 'Sisse logitud', - 'Logging' => 'Logimine', // Added - 2011-06-16 + 'Logging' => 'Logimine', // Added - 2011-06-16 'LoggingIn' => 'Login sisse', 'Login' => 'Login', 'Logout' => 'Logi välja', - 'Logs' => 'Logid', // Added - 2011-06-17 + 'Logs' => 'Logid', // Added - 2011-06-17 'Low' => 'Madal', 'LowBW' => 'Low B/W', 'Main' => 'Pea', @@ -427,7 +427,7 @@ $SLANG = array( 'MaximumFPS' => 'Maksimaalne FPS', 'Medium' => 'Keskmine', 'MediumBW' => 'Medium B/W', - 'Message' => 'Message', // Added - 2011-06-16 + 'Message' => 'Message', // Added - 2011-06-16 'MinAlarmAreaLtMax' => 'Minimum alarm area should be less than maximum', 'MinAlarmAreaUnset' => 'You must specify the minimum alarm pixel count', 'MinBlobAreaLtMax' => 'Minimum blob area should be less than maximum', @@ -471,7 +471,7 @@ $SLANG = array( 'Monitors' => 'Monitors', 'Montage' => 'Montage', 'Month' => 'Kuus', - 'More' => 'Veel', // Added - 2011-06-16 + 'More' => 'Veel', // Added - 2011-06-16 'Move' => 'Liiguta', 'MtgDefault' => 'Default', // Added 2013.08.15. 'Mtg2widgrd' => '2-pildi ruudustik', // Added 2013.08.15. @@ -537,13 +537,13 @@ $SLANG = array( 'Pause' => 'Pause', 'Phone' => 'Telefon', 'PhoneBW' => 'Phone B/W', - 'Pid' => 'PID', // Added - 2011-06-16 + 'Pid' => 'PID', // Added - 2011-06-16 'PixelDiff' => 'Pixel Diff', 'Pixels' => 'pikslid', 'Play' => 'Play', 'PlayAll' => 'Play Kõike', 'PleaseWait' => 'Palun Oota', - 'Plugins' => 'Pluginad', + 'Plugins' => 'Pluginad', 'Point' => 'Punkt', 'PostEventImageBuffer' => 'Post Event Image Count', 'PreEventImageBuffer' => 'Pre Event Image Count', @@ -582,7 +582,7 @@ $SLANG = array( 'Rewind' => 'Rewind', 'RotateLeft' => 'Pööra vasakule', 'RotateRight' => 'Pööra paremale', - 'RunLocalUpdate' => 'Please run zmupdate.pl to update', // Added - 2011-05-25 + 'RunLocalUpdate' => 'Please run zmupdate.pl to update', // Added - 2011-05-25 'RunMode' => 'Käimis resiim', 'RunState' => 'Käimis olek', 'Running' => 'Töötab', @@ -594,8 +594,8 @@ $SLANG = array( 'Secs' => 'Secs', 'Sectionlength' => 'Section length', 'Select' => 'Selekteeri', - 'SelectFormat' => 'Selekteeri Formaat', // Added - 2011-06-17 - 'SelectLog' => 'Selekteeri logi', // Added - 2011-06-17 + 'SelectFormat' => 'Selekteeri Formaat', // Added - 2011-06-17 + 'SelectLog' => 'Selekteeri logi', // Added - 2011-06-17 'SelectMonitors' => 'Selekteeri Monitorid', 'SelfIntersecting' => 'Polygon edges must not intersect', 'Set' => 'Säti', @@ -606,7 +606,7 @@ $SLANG = array( 'ShowTimeline' => 'Näita Timeline', 'SignalCheckColour' => 'Signaali Kontroll Värv', 'Size' => 'Suurus', - 'SkinDescription' => 'Vaheta veebilehe välimus selles arvutis', // Added - 2011-03-02 + 'SkinDescription' => 'Vaheta veebilehe välimus selles arvutis', // Added - 2011-03-02 'Sleep' => 'Maga', 'SortAsc' => 'Kasvav', 'SortBy' => 'Sorteeri', @@ -638,7 +638,7 @@ $SLANG = array( 'StreamReplayBuffer' => 'Striimi Replay Pildi Puhver', 'Submit' => 'Submit', 'System' => 'Süsteem', - 'SystemLog' => 'Süsteemi Logi', // Added - 2011-06-16 + 'SystemLog' => 'Süsteemi Logi', // Added - 2011-06-16 'Tele' => 'Tele', 'Thumbnail' => 'Thumbnail', 'Tilt' => 'Tilt', @@ -656,7 +656,7 @@ $SLANG = array( 'TimestampLabelY' => 'Timestamp Label Y', 'Today' => 'Täna', 'Tools' => 'Tööriistad', - 'Total' => 'Summa', // Added - 2011-06-16 + 'Total' => 'Summa', // Added - 2011-06-16 'TotalBrScore' => 'Summa
Skoor', 'TrackDelay' => 'Jälgimise Viide', 'TrackMotion' => 'Jälgi Liikumist', @@ -671,8 +671,8 @@ $SLANG = array( 'Update' => 'Uuenda', 'UpdateAvailable' => 'Uuendus ZoneMinder-ile saadaval.', 'UpdateNotNecessary' => 'Uuendus ei ole vajalik.', - 'Updated' => 'Uuendatud', // Added - 2011-06-16 - 'Upload' => 'Üles laadimine', // Added - 2011-08-23 + 'Updated' => 'Uuendatud', // Added - 2011-06-16 + 'Upload' => 'Üles laadimine', // Added - 2011-08-23 'UseFilter' => 'Kasuta Filtrit', 'UseFilterExprsPost' => ' filter expressions', // This is used at the end of the phrase 'use N filter expressions' 'UseFilterExprsPre' => 'Use ', // This is used at the beginning of the phrase 'use N filter expressions' @@ -724,7 +724,7 @@ $SLANG = array( 'ZoneMinMaxBlobs' => 'Min/Max Blobs', 'ZoneMinMaxFiltArea' => 'Min/Max Filtered Area', 'ZoneMinMaxPixelThres' => 'Min/Max Pixel Threshold (0-255)', - 'ZoneMinderLog' => 'ZoneMinder Log', // Added - 2011-06-17 + 'ZoneMinderLog' => 'ZoneMinder Log', // Added - 2011-06-17 'ZoneOverloadFrames' => 'Overload Frame Ignore Count', 'ZoneExtendAlarmFrames' => 'Extend Alarm Frame Count', 'Zones' => 'Tsoone', @@ -742,7 +742,7 @@ $CLANG = array( 'MonitorCount' => '%1$s %2$s', // For example '4 Monitors' (from Vlang below) 'MonitorFunction' => 'Monitor %1$s Function', 'RunningRecentVer' => 'You are running the most recent version of ZoneMinder, v%s.', - 'VersionMismatch' => 'Version mismatch, system is version %1$s, database is %2$s.', // Added - 2011-05-25 + 'VersionMismatch' => 'Version mismatch, system is version %1$s, database is %2$s.', // Added - 2011-05-25 ); // The next section allows you to describe a series of word ending and counts used to From 6f42f1c6d8b740ad16901f4b14b93f3d93162463 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 6 Jan 2015 20:49:33 -0500 Subject: [PATCH 04/19] add version command line argument to zmc --- src/zmc.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/zmc.cpp b/src/zmc.cpp index 2d25822b4..397468140 100644 --- a/src/zmc.cpp +++ b/src/zmc.cpp @@ -45,6 +45,7 @@ void Usage() fprintf( stderr, " -f, --file : For local images, jpg file to access.\n" ); fprintf( stderr, " -m, --monitor : For sources associated with a single monitor\n" ); fprintf( stderr, " -h, --help : This screen\n" ); + fprintf( stderr, " -v, --version : Report the installed version of ZoneMinder\n" ); exit( 0 ); } @@ -71,6 +72,7 @@ int main( int argc, char *argv[] ) {"file", 1, 0, 'f'}, {"monitor", 1, 0, 'm'}, {"help", 0, 0, 'h'}, + {"version", 0, 0, 'v'}, {0, 0, 0, 0} }; @@ -78,7 +80,7 @@ int main( int argc, char *argv[] ) { int option_index = 0; - int c = getopt_long (argc, argv, "d:H:P:p:f:m:h", long_options, &option_index); + int c = getopt_long (argc, argv, "d:H:P:p:f:m:h:v", long_options, &option_index); if (c == -1) { break; @@ -108,6 +110,9 @@ int main( int argc, char *argv[] ) case '?': Usage(); break; + case 'v': + cout << ZM_VERSION << "\n"; + exit(0); default: //fprintf( stderr, "?? getopt returned character code 0%o ??\n", c ); break; From 85e51528a69755d180161eb5c37242aa65628511 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 6 Jan 2015 20:52:18 -0500 Subject: [PATCH 05/19] add version command line argument to zma --- src/zma.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/zma.cpp b/src/zma.cpp index 117ada241..cb6ddb4e8 100644 --- a/src/zma.cpp +++ b/src/zma.cpp @@ -31,6 +31,7 @@ void Usage() fprintf( stderr, "Options:\n" ); fprintf( stderr, " -m, --monitor : Specify which monitor to use\n" ); fprintf( stderr, " -h, --help : This screen\n" ); + fprintf( stderr, " -v, --version : Report the installed version of ZoneMinder\n" ); exit( 0 ); } @@ -45,6 +46,7 @@ int main( int argc, char *argv[] ) static struct option long_options[] = { {"monitor", 1, 0, 'm'}, {"help", 0, 0, 'h'}, + {"version", 0, 0, 'v'}, {0, 0, 0, 0} }; @@ -52,7 +54,7 @@ int main( int argc, char *argv[] ) { int option_index = 0; - int c = getopt_long (argc, argv, "m:h", long_options, &option_index); + int c = getopt_long (argc, argv, "m:h:v", long_options, &option_index); if (c == -1) { break; @@ -67,6 +69,9 @@ int main( int argc, char *argv[] ) case '?': Usage(); break; + case 'v': + cout << ZM_VERSION << "\n"; + exit(0); default: //fprintf( stderr, "?? getopt returned character code 0%o ??\n", c ); break; From 258c97f75f7f1565d1abb369a32cd6ed8ccc9dae Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 6 Jan 2015 20:54:49 -0500 Subject: [PATCH 06/19] add version command line argument to zmf --- src/zmf.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/zmf.cpp b/src/zmf.cpp index 663e57076..d97a9e5d5 100644 --- a/src/zmf.cpp +++ b/src/zmf.cpp @@ -99,6 +99,7 @@ void Usage() fprintf( stderr, "Options:\n" ); fprintf( stderr, " -m, --monitor : Specify which monitor to use\n" ); fprintf( stderr, " -h, --help : This screen\n" ); + fprintf( stderr, " -v, --version : Report the installed version of ZoneMinder\n" ); exit( 0 ); } @@ -113,6 +114,7 @@ int main( int argc, char *argv[] ) static struct option long_options[] = { {"monitor", 1, 0, 'm'}, {"help", 0, 0, 'h'}, + {"version", 0, 0, 'v'}, {0, 0, 0, 0} }; @@ -120,7 +122,7 @@ int main( int argc, char *argv[] ) { int option_index = 0; - int c = getopt_long (argc, argv, "m:h", long_options, &option_index); + int c = getopt_long (argc, argv, "m:h:v", long_options, &option_index); if (c == -1) { break; @@ -135,6 +137,9 @@ int main( int argc, char *argv[] ) case '?': Usage(); break; + case 'v': + cout << ZM_VERSION << "\n"; + exit(0); default: //fprintf( stderr, "?? getopt returned character code 0%o ??\n", c ); break; From 1adb1478998e3a69c176a612cbd052a4392ddfee Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 6 Jan 2015 20:59:03 -0500 Subject: [PATCH 07/19] add version command line argument to zmstreamer. Also add -h for consistency with other programs --- src/zmstreamer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/zmstreamer.cpp b/src/zmstreamer.cpp index 873d2fcd5..5c11cfbea 100644 --- a/src/zmstreamer.cpp +++ b/src/zmstreamer.cpp @@ -33,7 +33,7 @@ #include "zm_stream.h" // Possible command-line options -#define OPTIONS "e:o:u:f:s:b:m:d:i:?" +#define OPTIONS "e:o:u:f:s:b:m:d:i:?:h:v" // Default ZMS values #define ZMS_DEFAULT_DEBUG 0 @@ -87,6 +87,7 @@ int main(int argc, char** argv) { case 'd': debug = atoi(optarg); break; + case 'h': case 'i': case '?': printf("-e : Specify output mode: mpeg/jpg/zip/single/raw. Default = %s\n", ZMS_DEFAULT_MODE); @@ -97,8 +98,12 @@ int main(int argc, char** argv) { printf("-b : Specify bitrate. Default = %d\n", ZMS_DEFAULT_BITRATE); printf("-m : Specify monitor id. Default = %d\n", ZMS_DEFAULT_ID); printf("-d : 0 = off, 1 = no streaming, 2 = with streaming. Default = 0\n"); - printf("-i or -? : This information\n"); + printf("-i or -? or -h: This information\n"); + printf("-v : This installed version of ZoneMinder\n"); return EXIT_SUCCESS; + case 'v': + cout << ZM_VERSION << "\n"; + exit(0); } } From 71c94475ff7eddae2179f0af8afb966bd2d5db23 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 6 Jan 2015 21:08:41 -0500 Subject: [PATCH 08/19] Add -v --version command line parameters to zmaudit.pl --- scripts/zmaudit.pl.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/zmaudit.pl.in b/scripts/zmaudit.pl.in index b3dab1004..ce01b0782 100644 --- a/scripts/zmaudit.pl.in +++ b/scripts/zmaudit.pl.in @@ -69,6 +69,7 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; my $report = 0; my $interactive = 0; my $continuous = 0; +my $version; sub usage { @@ -78,6 +79,7 @@ Parameters are :- -r, --report - Just report don't actually do anything -i, --interactive - Ask before applying any changes -c, --continuous - Run continuously +-v, --version - Print the installed version of ZoneMinder "); exit( -1 ); } @@ -89,14 +91,18 @@ sub deleteSwapImage(); logInit(); logSetSignal(); -if ( !GetOptions( 'report'=>\$report, 'interactive'=>\$interactive, 'continuous'=>\$continuous ) ) +if ( !GetOptions( report=>\$report, interactive=>\$interactive, continuous=>\$continuous, version=>\$version ) ) { usage(); } +if ( $version ) { + print( ZoneMinder::Base::ZM_VERSION . "\n"); + exit(0); +} if ( ($report + $interactive + $continuous) > 1 ) { - print( STDERR "Error, only option may be specified\n" ); + print( STDERR "Error, only one option may be specified\n" ); usage(); } From 76d0dfa47556a475107c10d5d4b987d879c787ba Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 08:43:51 -0500 Subject: [PATCH 09/19] Add -v --version command line param to zmcamtool.pl --- scripts/zmcamtool.pl.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/zmcamtool.pl.in b/scripts/zmcamtool.pl.in index 6efd5deb0..cb4e036a9 100644 --- a/scripts/zmcamtool.pl.in +++ b/scripts/zmcamtool.pl.in @@ -55,15 +55,20 @@ my $noregex = 0; my $sqlfile = ''; my $dbUser = $Config{ZM_DB_USER}; my $dbPass = $Config{ZM_DB_PASS}; +my $version = 0; # Process commandline parameters with getopt long -if ( !GetOptions( 'export'=>\$export, 'import'=>\$import, 'overwrite'=>\$overwrite, 'help'=>\$help, 'topreset'=>\$topreset, 'noregex'=>\$noregex, 'user:s'=>\$dbUser, 'pass:s'=>\$dbPass ) ) { +if ( !GetOptions( 'export'=>\$export, 'import'=>\$import, 'overwrite'=>\$overwrite, 'help'=>\$help, 'topreset'=>\$topreset, 'noregex'=>\$noregex, 'user:s'=>\$dbUser, 'pass:s'=>\$dbPass, 'version'=>\$version ) ) { Usage(); } $Config{ZM_DB_USER} = $dbUser; $Config{ZM_DB_PASS} = $dbPass; +if ( $version ) { + print( ZoneMinder::Base::ZM_VERSION . "\n"); + exit(0); +} # Check to make sure commandline params make sense if ( ((!$help) && ($import + $export + $topreset) != 1 )) { print( STDERR qq/Please give only one of the following: "import", "export", or "topreset".\n/ ); From 94e0ec542a9346e8c227bcc531cded6d824c0f8a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 08:47:32 -0500 Subject: [PATCH 10/19] Add -v --version command line param to zmdc.pl --- scripts/zmdc.pl.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/zmdc.pl.in b/scripts/zmdc.pl.in index 23cd02a2e..c209ae63f 100644 --- a/scripts/zmdc.pl.in +++ b/scripts/zmdc.pl.in @@ -78,7 +78,7 @@ sub Usage Usage: zmdc.pl [daemon [options]] Parameters are :- - One of 'startup|shutdown|status|check|logrot' or - 'start|stop|restart|reload'. + 'start|stop|restart|reload|version'. [daemon [options]] - Daemon name and options, required for second group of commands "); exit( -1 ); @@ -90,7 +90,11 @@ if( !$command ) print( STDERR "No command given\n" ); Usage(); } -my $needs_daemon = $command !~ /(?:startup|shutdown|status|check|logrot)/; +if ( $command eq 'version' ) { + print ZoneMinder::Base::ZM_VERSION."\n"; + exit( 0 ); +} +my $needs_daemon = $command !~ /(?:startup|shutdown|status|check|logrot|version)/; my $daemon = shift( @ARGV ); if( $needs_daemon && !$daemon ) { From 8ea01e631b5fe079cc75bb74b62464a0f78b116a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 09:00:46 -0500 Subject: [PATCH 11/19] Add -v --version command line param to zmfilter.pl --- scripts/zmfilter.pl.in | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index ca380e539..ac5d7b6e0 100755 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -115,11 +115,12 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; my $delay = $Config{ZM_FILTER_EXECUTE_INTERVAL}; my $event_id = 0; my $filter_parm = ""; +my $version = 0; sub Usage { print( " -Usage: zmfilter.pl [-f ,--filter=] +Usage: zmfilter.pl [-f ,--filter=] | -v, --version Parameters are :- -f, --filter= - The name of a specific filter to run "); @@ -158,10 +159,14 @@ sub DateTimeToSQL return( strftime( "%Y-%m-%d %H:%M:%S", localtime( $dt_val ) ) ); } -if ( !GetOptions( 'filter=s'=>\$filter_parm ) ) +if ( !GetOptions( 'filter=s'=>\$filter_parm, version=>\$version ) ) { Usage(); } +if ( $version ) { + print ZoneMinder::Base::ZM_VERSION . "\n"; + exit(0); +} if ( ! EVENT_PATH ) { Error( "No event path defined. Config was $Config{ZM_DIR_EVENTS}\n" ); From 3013d8778332936e0500290e4f1f5c8e3de51066 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 09:05:16 -0500 Subject: [PATCH 12/19] Add -v --version command line param to zmpkg.pl --- scripts/zmpkg.pl.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/zmpkg.pl.in b/scripts/zmpkg.pl.in index cdbca5dba..084747bad 100644 --- a/scripts/zmpkg.pl.in +++ b/scripts/zmpkg.pl.in @@ -47,15 +47,20 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; logInit(); my $command = $ARGV[0]; +if ( $command eq 'version' ) { + print ZoneMinder::Base::ZM_VERSION . "\n"; + exit(0); +} my $state; -my $dbh = zmDbConnect(); +my $dbh; -if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot)$/ ) +if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot|version)$/ ) { if ( $command ) { + $dbh = zmDbConnect(); # Check to see if it's a valid run state my $sql = 'select * from States where Name = ?'; my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); @@ -78,10 +83,11 @@ if ( !$command || $command !~ /^(?:start|stop|restart|status|logrot)$/ ) } if ( !$command ) { - print( "Usage: zmpkg.pl \n" ); + print( "Usage: zmpkg.pl \n" ); exit( -1 ); } } +$dbh = zmDbConnect() if ! $dbh; # Move to the right place chdir( $Config{ZM_PATH_WEB} ) or Fatal( "Can't chdir to '".$Config{ZM_PATH_WEB}."': $!" ); From 5b79139a05c86d7e78a2a2c2f8c0a813572de9e3 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 09:07:40 -0500 Subject: [PATCH 13/19] Add version to the usage line in zmsystemctl.pl --- scripts/zmsystemctl.pl.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/zmsystemctl.pl.in b/scripts/zmsystemctl.pl.in index cb3eb74ee..450fc2189 100644 --- a/scripts/zmsystemctl.pl.in +++ b/scripts/zmsystemctl.pl.in @@ -35,10 +35,10 @@ use ZoneMinder::Logger qw(:all); my $command = $ARGV[0]; -if ( (scalar(@ARGV) == 1) && ($command =~ /^(start|stop|restart)$/ )) { +if ( (scalar(@ARGV) == 1) && ($command =~ /^(start|stop|restart|version)$/ )) { $command = $1; } else { - die(" USAGE: zmsystemctl.pl \n"); + die(" USAGE: zmsystemctl.pl \n"); } my $path = qx(which systemctl); From 7f934e0e6943b3730e251960a23462d376a16003 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 09:11:07 -0500 Subject: [PATCH 14/19] Add version to the usage line in zmvideo.pl --- scripts/zmvideo.pl.in | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/zmvideo.pl.in b/scripts/zmvideo.pl.in index 46cf83998..2b6765420 100644 --- a/scripts/zmvideo.pl.in +++ b/scripts/zmvideo.pl.in @@ -55,6 +55,7 @@ my $scale = ''; my $fps = ''; my $size = ''; my $overwrite = 0; +my $version = 0; my @formats = split( /\s+/, $Config{ZM_FFMPEG_FORMATS} ); for ( my $i = 0; $i < @formats; $i++ ) @@ -77,15 +78,21 @@ Parameters are :- -F, --fps= - Absolute frame rate, in frames per second -S, --size= - Absolute video size, WxH or other specification supported by ffmpeg -o, --overwrite - Whether to overwrite an existing file, off by default. +-v, --version - Outputs the currently installed version of ZoneMinder "); exit( -1 ); } -if ( !GetOptions( 'event=i'=>\$event_id, 'format|f=s'=>\$format, 'rate|r=f'=>\$rate, 'scale|s=f'=>\$scale, 'fps|F=f'=>\$fps, 'size|S=s'=>\$size, 'overwrite'=>\$overwrite ) ) +if ( !GetOptions( 'event=i'=>\$event_id, 'format|f=s'=>\$format, 'rate|r=f'=>\$rate, 'scale|s=f'=>\$scale, 'fps|F=f'=>\$fps, 'size|S=s'=>\$size, 'overwrite'=>\$overwrite, version=>\$version ) ) { Usage(); } +if ( $version ) { + print ZoneMinder::Base::ZM_VERSION . "\n"; + exit(0); +} + if ( !$event_id || $event_id < 0 ) { print( STDERR "Please give a valid event id\n" ); From a10f2aa31ca83fec2349ab86942e74c535943edc Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 09:14:00 -0500 Subject: [PATCH 15/19] Add version to the usage line in zmx10.pl --- scripts/zmx10.pl.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/zmx10.pl.in b/scripts/zmx10.pl.in index f661e656f..add59034d 100644 --- a/scripts/zmx10.pl.in +++ b/scripts/zmx10.pl.in @@ -63,6 +63,7 @@ Usage: zmx10.pl -c ,--command= [-u ,--unit-code=, --command= - Command to issue, one of 'on','off','dim','bright','status','shutdown' -u , --unit-code= - Unit code to act on required for all commands except 'status' (optional) and 'shutdown' +-v, --verison - Pirnts the currently installed version of ZoneMinder "); exit( -1 ); } @@ -72,11 +73,16 @@ logSetSignal(); my $command; my $unit_code; +my $version; -if ( !GetOptions( 'command=s'=>\$command, 'unit-code=i'=>\$unit_code ) ) +if ( !GetOptions( 'command=s'=>\$command, 'unit-code=i'=>\$unit_code, version=>\$version ) ) { Usage(); } +if ( $version ) { + print ZoneMinder::Base::ZM_VERSION; + exit(0); +} die( "No command given" ) unless( $command ); die( "No unit code given" ) unless( $unit_code || ($command =~ /(?:start|status|shutdown)/) ); From 2e48c2ba3def076a45aabf377364501c080a82e2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 16:24:07 -0500 Subject: [PATCH 16/19] add sendControlCommand function to do the heavy work of sending zmcontrol a command --- web/includes/control_functions.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/web/includes/control_functions.php b/web/includes/control_functions.php index 2ad782926..dcb829296 100644 --- a/web/includes/control_functions.php +++ b/web/includes/control_functions.php @@ -963,3 +963,30 @@ function buildControlCommand( $monitor ) $ctrlCommand .= " --command=".$_REQUEST['control']; return( $ctrlCommand ); } + +function sendControlCommand($mid,$command) { + // Either connects to running zmcontrol.pl or runs zmcontrol.pl to send the command. + $socket = socket_create( AF_UNIX, SOCK_STREAM, 0 ); + if ( $socket < 0 ) { + Fatal( "socket_create() failed: ".socket_strerror($socket) ); + } + $sockFile = ZM_PATH_SOCKS.'/zmcontrol-'.$mid.'.sock'; + if ( @socket_connect( $socket, $sockFile ) ) { + $options = array(); + foreach ( explode( " ", $command ) as $option ) { + if ( preg_match( '/--([^=]+)(?:=(.+))?/', $option, $matches ) ) { + $options[$matches[1]] = $matches[2]?$matches[2]:1; + } + } + $optionString = jsonEncode( $options ); + if ( !socket_write( $socket, $optionString ) ) { + Fatal( "Can't write to control socket: ".socket_strerror(socket_last_error($socket)) ); + } + socket_close( $socket ); + } else if ( $command != 'quit' ) { + $command .= ' --id='.$mid; + + // Can't connect so use script + $ctrlOutput = exec( escapeshellcmd( $command ) ); + } +} // end function sendControlCommand( $mid, $command ) From d0138af00c2bdfbfc8fe806a144b921b58b08615 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 16:24:34 -0500 Subject: [PATCH 17/19] use new sendControlCommand function to send normal commands as well as send the quit command on monitor edit. --- web/includes/actions.php | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/web/includes/actions.php b/web/includes/actions.php index bfe62190f..705f9e258 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -175,40 +175,7 @@ if ( !empty($action) ) $monitor = dbFetchOne( "select C.*,M.* from Monitors as M inner join Controls as C on (M.ControlId = C.Id) where M.Id = ?", NULL, array($mid) ); $ctrlCommand = buildControlCommand( $monitor ); - - if ( $ctrlCommand ) - { - $socket = socket_create( AF_UNIX, SOCK_STREAM, 0 ); - if ( $socket < 0 ) - { - Fatal( "socket_create() failed: ".socket_strerror($socket) ); - } - $sockFile = ZM_PATH_SOCKS.'/zmcontrol-'.$monitor['Id'].'.sock'; - if ( @socket_connect( $socket, $sockFile ) ) - { - $options = array(); - foreach ( explode( " ", $ctrlCommand ) as $option ) - { - if ( preg_match( '/--([^=]+)(?:=(.+))?/', $option, $matches ) ) - { - $options[$matches[1]] = $matches[2]?$matches[2]:1; - } - } - $optionString = jsonEncode( $options ); - if ( !socket_write( $socket, $optionString ) ) - { - Fatal( "Can't write to control socket: ".socket_strerror(socket_last_error($socket)) ); - } - socket_close( $socket ); - } - else - { - $ctrlCommand .= " --id=".$monitor['Id']; - - // Can't connect so use script - $ctrlOutput = exec( escapeshellcmd( $ctrlCommand ) ); - } - } + sendControlCommand( $monitor['Id'], $ctrlCommand ); } elseif ( $action == "settings" ) { @@ -310,6 +277,11 @@ if ( !empty($action) ) zmaControl( $monitor, "stop" ); zmcControl( $monitor, $restart?"restart":"" ); zmaControl( $monitor, "start" ); + if ( $monitor['Controllable'] ) { + require_once( 'control_functions.php' ); + sendControlCommand( $mid, 'quit' ); + } + $ctrlCommand = ZM_PATH_BIN."/zmcontrol.pl --id=$mid --command=quit"; } $refreshParent = true; } From 21ccb9b91a4370a38fe4fb16a686371eecda0253 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 16:37:26 -0500 Subject: [PATCH 18/19] introduce the quit command which makes the resident zmcontrol.pl exit --- scripts/zmcontrol.pl.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/zmcontrol.pl.in b/scripts/zmcontrol.pl.in index aac99b636..817b80cf6 100644 --- a/scripts/zmcontrol.pl.in +++ b/scripts/zmcontrol.pl.in @@ -192,8 +192,11 @@ if ( !$server_up ) #Debug( Dumper( $params ) ); my $command = $params->{command}; - $control->$command( $params ); close( CLIENT ); + if ( $command eq 'quit' ) { + last; + } + $control->$command( $params ); } else { From 74929236e31eed645ebd540fc2fa9744f58fb6f7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 7 Jan 2015 16:56:10 -0500 Subject: [PATCH 19/19] put the sendControlCommand(quit) into the right place --- web/includes/actions.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/web/includes/actions.php b/web/includes/actions.php index 705f9e258..c2d32f344 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -277,11 +277,6 @@ if ( !empty($action) ) zmaControl( $monitor, "stop" ); zmcControl( $monitor, $restart?"restart":"" ); zmaControl( $monitor, "start" ); - if ( $monitor['Controllable'] ) { - require_once( 'control_functions.php' ); - sendControlCommand( $mid, 'quit' ); - } - $ctrlCommand = ZM_PATH_BIN."/zmcontrol.pl --id=$mid --command=quit"; } $refreshParent = true; } @@ -541,6 +536,10 @@ if ( !empty($action) ) zmcControl( $monitor, "restart" ); zmaControl( $monitor, "start" ); } + if ( $monitor['Controllable'] ) { + require_once( 'control_functions.php' ); + sendControlCommand( $mid, 'quit' ); + } //daemonControl( 'restart', 'zmwatch.pl' ); $refreshParent = true; }