From 8f0fb0843a90cd7c9b8091daa012bec62f92551e Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 30 Aug 2018 12:25:02 -0500 Subject: [PATCH] Add Privacy Statement (#2194) * initial implementation of privacy popup * split the privacy text and run it through translate * change style of toggle button, validate the form * fix copy/paste error * fix typos * display privacy view inline rather than popup * display privacy inline if show_privacy flag set * redirect to console after selection is made * typo * css formatting * update privacy verbiage * create and load default.php * fix typos * fix erroneous copy/paste --- .../lib/ZoneMinder/ConfigData.pm.in | 9 +++ scripts/zmupdate.pl.in | 5 ++ web/includes/actions.php | 23 ++++++ web/includes/lang.php | 8 +- web/index.php | 5 ++ web/lang/default.php | 44 +++++++++++ web/lang/en_gb.php | 12 +++ web/skins/classic/css/base/views/privacy.css | 14 ++++ web/skins/classic/views/js/privacy.js | 9 +++ web/skins/classic/views/privacy.php | 74 +++++++++++++++++++ 10 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 web/lang/default.php create mode 100644 web/skins/classic/css/base/views/privacy.css create mode 100644 web/skins/classic/views/js/privacy.js create mode 100644 web/skins/classic/views/privacy.php diff --git a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in index c6136717a..6a3a66dae 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in +++ b/scripts/ZoneMinder/lib/ZoneMinder/ConfigData.pm.in @@ -3882,6 +3882,15 @@ our @options = ( readonly => 1, category => 'dynamic', }, + { + name => 'ZM_SHOW_PRIVACY', + default => 'yes', + description => 'Present the privacy statment', + help => '', + type => $types{boolean}, + readonly => 1, + category => 'dynamic', + }, { name => 'ZM_SSMTP_MAIL', default => 'no', diff --git a/scripts/zmupdate.pl.in b/scripts/zmupdate.pl.in index f428ea1f9..45d45851a 100644 --- a/scripts/zmupdate.pl.in +++ b/scripts/zmupdate.pl.in @@ -922,6 +922,11 @@ if ( $version ) { zmDbDisconnect(); die( "Can't find upgrade from version '$version'" ); } + # Re-enable the privacy popup after each upgrade + my $sql = "update Config set Value = 1 where Name = 'ZM_SHOW_PRIVACY'"; + my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() ); + my $res = $sth->execute( ) or die( "Can't execute: ".$sth->errstr() ); + $sth->finish(); print( "\nDatabase upgrade to version ".ZM_VERSION." successful.\n\n" ); } zmDbDisconnect(); diff --git a/web/includes/actions.php b/web/includes/actions.php index a38515f3d..cd67fc81c 100644 --- a/web/includes/actions.php +++ b/web/includes/actions.php @@ -863,6 +863,29 @@ if ( canEdit( 'System' ) ) { } } // end switch option } + if ( $action == 'privacy' && isset($_REQUEST['option'] ) ) { + $option = $_REQUEST['option']; + switch( $option ) { + case 'decline' : + { + dbQuery( "update Config set Value = '0' where Name = 'ZM_SHOW_PRIVACY'" ); + dbQuery( "update Config set Value = '0' where Name = 'ZM_TELEMETRY_DATA'" ); + $view = 'console'; + $redirect = ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=console'; + break; + } + case 'accept' : + { + dbQuery( "update Config set Value = '0' where Name = 'ZM_SHOW_PRIVACY'" ); + dbQuery( "update Config set Value = '1' where Name = 'ZM_TELEMETRY_DATA'" ); + $view = 'console'; + $redirect = ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=console'; + break; + } + default: # Enable the privacy statement if we somehow submit something other than accept or decline + dbQuery( "update Config set Value = '1' where Name = 'ZM_SHOW_PRIVACY'" ); + } // end switch option + } if ( $action == 'options' && isset($_REQUEST['tab']) ) { $configCat = $configCats[$_REQUEST['tab']]; $changed = false; diff --git a/web/includes/lang.php b/web/includes/lang.php index 0cab566b7..0c40e7f60 100644 --- a/web/includes/lang.php +++ b/web/includes/lang.php @@ -49,8 +49,14 @@ function loadLanguage( $prefix="" ) return( false ); } -if ( $langFile = loadLanguage() ) +if ( $langFile = loadLanguage() ) { require_once( $langFile ); + require_once( 'lang/default.php' ); + foreach ($DLANG as $key => $value) { + if ( ! array_key_exists( $key, $SLANG ) ) + $SLANG[$key] = $DLANG[$key]; + } +} // diff --git a/web/index.php b/web/index.php index 7f823f1fd..69745ce3c 100644 --- a/web/index.php +++ b/web/index.php @@ -221,6 +221,11 @@ if ( ZM_OPT_USE_AUTH and ! isset($user) ) { $request = null; } +if ( ZM_SHOW_PRIVACY && canEdit('System') ) { + Logger::Debug("Redirecting to privacy" ); + $view = 'privacy'; + $request = null; +} if ( $redirect ) { header('Location: '.$redirect); diff --git a/web/lang/default.php b/web/lang/default.php new file mode 100644 index 000000000..85f27cfe1 --- /dev/null +++ b/web/lang/default.php @@ -0,0 +1,44 @@ + 'Privacy', + 'PrivacyAbout' => 'About', + 'PrivacyAboutText' => 'Since 2002, ZoneMinder has been the premier free and open-source Video Management System (VMS) solution for Linux platforms. ZoneMinder is supported by the community and is managed by those who choose to volunteer their spare time to the project. The best way to improve ZoneMinder is to get involved.', + 'PrivacyContact' => 'Contact', + 'PrivacyContactText' => 'Please contact us here for any questions regarding our privacy policy or to have your information removed.

For support, there are three primary ways to engage with the community:

Our Github forum is only for bug reporting. Please use our user forum or slack channel for all other questions or comments.

', + 'PrivacyCookies' => 'Cookies', + 'PrivacyCookiesText' => 'Whether you use a web browser or a mobile app to communicate with the ZoneMinder server, a ZMSESSID cookie is created on the client to uniquely identify a session with the ZoneMinder server. ZmCSS and zmSkin cookies are created to remember your style and skin choices.', + 'PrivacyTelemetry' => 'Telemetry', + 'PrivacyTelemetryText' => 'Because ZoneMinder is open-source, anyone can install it without registering. This makes it difficult to answer questions such as: how many systems are out there, what is the largest system out there, what kind of systems are out there, or where are these systems located? Knowing the answers to these questions, helps users who ask us these questions, and it helps us set priorities based on the majority user base.', + 'PrivacyTelemetryList' => 'The ZoneMinder Telemetry daemon collects the following data about your system:', + 'PrivacyMonitorList' => 'The following configuration parameters from each monitor are collected:', + 'PrivacyConclusionText' => 'We are NOT collecting any image specific data from your cameras. We don’t know what your cameras are watching. This data will not be sold or used for any purpose not stated herein. By clicking accept, you agree to send us this data to help make ZoneMinder a better product. By clicking decline, you can still freely use ZoneMinder and all its features.', +); + +?> + diff --git a/web/lang/en_gb.php b/web/lang/en_gb.php index ba77b156e..27357ade9 100644 --- a/web/lang/en_gb.php +++ b/web/lang/en_gb.php @@ -600,6 +600,18 @@ $SLANG = array( 'Preset' => 'Preset', 'Presets' => 'Presets', 'Prev' => 'Prev', + 'Privacy' => 'Privacy', + 'PrivacyAbout' => 'About', + 'PrivacyAboutText' => 'Since 2002, ZoneMinder has been the premier free and open-source Video Management System (VMS) solution for Linux platforms. ZoneMinder is supported by the community and is managed by those who choose to volunteer their spare time to the project. The best way to improve ZoneMinder is to get involved.', + 'PrivacyContact' => 'Contact', + 'PrivacyContactText' => 'Please contact us here for any questions regarding our privacy policy or to have your information removed.

For support, there are three primary ways to engage with the community:

Our Github forum is only for bug reporting. Please use our user forum or slack channel for all other questions or comments.

', + 'PrivacyCookies' => 'Cookies', + 'PrivacyCookiesText' => 'Whether you use a web browser or a mobile app to communicate with the ZoneMinder server, a ZMSESSID cookie is created on the client to uniquely identify a session with the ZoneMinder server. ZmCSS and zmSkin cookies are created to remember your style and skin choices.', + 'PrivacyTelemetry' => 'Telemetry', + 'PrivacyTelemetryText' => 'Because ZoneMinder is open-source, anyone can install it without registering. This makes it difficult to answer questions such as: how many systems are out there, what is the largest system out there, what kind of systems are out there, or where are these systems located? Knowing the answers to these questions, helps users who ask us these questions, and it helps us set priorities based on the majority user base.', + 'PrivacyTelemetryList' => 'The ZoneMinder Telemetry daemon collects the following data about your system:', + 'PrivacyMonitorList' => 'The following configuration parameters from each monitor are collected:', + 'PrivacyConclusionText' => 'We are NOT collecting any image specific data from your cameras. We don’t know what your cameras are watching. This data will not be sold or used for any purpose not stated herein. By clicking accept, you agree to send us this data to help make ZoneMinder a better product. By clicking decline, you can still freely use ZoneMinder and all its features.', 'Probe' => 'Probe', 'ProfileProbe' => 'Stream Probe', 'ProfileProbeIntro' => 'The list below shows the existing stream profiles of the selected camera .

Select the desired entry from the list below.

Please note that ZoneMinder cannot configure additional profiles and that choosing a camera here may overwrite any values you already have configured for the current monitor.

', diff --git a/web/skins/classic/css/base/views/privacy.css b/web/skins/classic/css/base/views/privacy.css new file mode 100644 index 000000000..f368fa110 --- /dev/null +++ b/web/skins/classic/css/base/views/privacy.css @@ -0,0 +1,14 @@ +h6 { + text-align: left; + font-weight: bold; + text-decoration: underline; +} + +p { + text-align: left; +} + +ul { + text-align: left; + list-style-type: disc; +} diff --git a/web/skins/classic/views/js/privacy.js b/web/skins/classic/views/js/privacy.js new file mode 100644 index 000000000..4b3499981 --- /dev/null +++ b/web/skins/classic/views/js/privacy.js @@ -0,0 +1,9 @@ +function submitForm( element ) { + var form = element.form; + if ( form.option.selectedIndex == 0 ) + form.view.value = currentView; + else + form.view.value = 'none'; + form.submit(); +} + diff --git a/web/skins/classic/views/privacy.php b/web/skins/classic/views/privacy.php new file mode 100644 index 000000000..1480c2973 --- /dev/null +++ b/web/skins/classic/views/privacy.php @@ -0,0 +1,74 @@ + translate('Accept'), + "decline" => translate('Decline'), +); + +$focusWindow = true; + +xhtmlHeaders(__FILE__, translate('Privacy') ); +?> + +
+ +
+
+ + +
+

+
+ +
+

+
+ +
+

+
+ +
+

+
+ +

+

+

+

+ +
+ +
+
+
+
+ +