add('name', PLUGIN_EVENT_DSGVO_GDPR_NAME);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Serendipity Team');
$propbag->add('version', '1.0.5');
$propbag->add('requirements', array(
'serendipity' => '2.0',
'smarty' => '2.6.7',
'php' => '5.3.3'
));
$propbag->add('groups', array('FRONTEND_FEATURES', 'BACKEND_FEATURES'));
$propbag->add('event_hooks',
array(
'frontend_saveComment' => true,
'frontend_comment' => true,
'entries_header' => true,
'entry_display' => true,
'genpage' => true,
'frontend_footer' => true,
'frontend_configure' => true,
'css' => true,
'backend_sidebar_admin' => true,
'backend_sidebar_entries_event_display_dsgvo' => true,
'backend_deletecomment' => true
)
);
$propbag->add('configuration', array('commentform_checkbox', 'commentform_text', 'gdpr_url', 'gdpr_info', 'gdpr_content', 'show_in_footer', 'show_in_footer_text', 'cookie_consent', 'cookie_consent_text', 'cookie_consent_path', 'anonymizeIp'));
$propbag->add('config_groups', array(
PLUGIN_EVENT_DSGVO_GDPR_MENU => array('gdpr_url', 'gdpr_info', 'gdpr_content'),
PLUGIN_EVENT_DSGVO_GDPR_COOKIE_MENU => array('cookie_consent', 'cookie_consent_text', 'cookie_consent_path')
));
}
function generate_content(&$title) {
$title = $this->title;
}
function introspect_config_item($name, &$propbag)
{
global $serendipity;
switch($name) {
case 'gdpr_url':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_URL);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_URL_DESC);
$propbag->add('default', '');
break;
case 'gdpr_content':
$propbag->add('type', 'html');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_STATEMENT);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_STATEMENT_DESC);
$propbag->add('default', "");
break;
case 'commentform_text':
$propbag->add('type', 'html');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_COMMENTFORM_TEXT);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_COMMENTFORM_TEXT_DESC);
$propbag->add('default', PLUGIN_EVENT_DSGVO_GDPR_COMMENTFORM_TEXT_DEFAULT);
break;
case 'commentform_checkbox':
$propbag->add('type','boolean');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_COMMENTFORM_CHECKBOX);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_COMMENTFORM_CHECKBOX_DESC);
$propbag->add('default', 'true');
break;
case 'anonymizeIp':
$propbag->add('type','boolean');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_ANONYMIZE);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_ANONYMIZE_DESC);
$propbag->add('default', 'true');
break;
case 'show_in_footer':
$propbag->add('type','boolean');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_SHOW_IN_FOOTER);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_SHOW_IN_FOOTER_DESC);
$propbag->add('default', 'true');
break;
case 'show_in_footer_text':
$propbag->add('type', 'html');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_SHOW_IN_FOOTER_TEXT);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_SHOW_IN_FOOTER_TEXT_DESC);
$propbag->add('default', PLUGIN_EVENT_DSGVO_GDPR_SHOW_IN_FOOTER_TEXT_DEFAULT);
break;
case 'gdpr_info':
$propbag->add('type', 'content');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_INFO);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_INFO_DESC);
$propbag->add('default', $this->inspect_gdpr());
break;
case 'cookie_consent':
$propbag->add('type','boolean');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_COOKIE_CONSENT);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_COOKIE_CONSENT_DESC);
$propbag->add('default', 'true');
break;
case 'cookie_consent_text':
$propbag->add('type', 'text');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_COOKIE_CONSENT_TEXT);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_COOKIE_CONSENT_TEXT_DESC);
$propbag->add('default', PLUGIN_EVENT_DSGVO_GDPR_COOKIE_CONSENT_TEXT_DEFAULT);
break;
case 'cookie_consent_path':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_EVENT_DSGVO_GDPR_COOKIE_CONSENT_PATH);
$propbag->add('description', PLUGIN_EVENT_DSGVO_GDPR_COOKIE_CONSENT_PATH_DESC);
$propbag->add('default', $serendipity['serendipityHTTPPath'] . 'plugins/serendipity_event_dsgvo_gdpr/');
break;
}
return true;
}
function inspect_gdpr() {
global $serendipity;
$out = PLUGIN_EVENT_DSGVO_GDPR_SERENDIPITY_CORE;
$classes = serendipity_plugin_api::enum_plugins();
foreach ($classes as $class_data) {
$pluginFile = serendipity_plugin_api::probePlugin($class_data['name'], $class_data['classname'], $class_data['pluginPath']);
$plugin =& serendipity_plugin_api::getPluginInfo($pluginFile, $class_data, 'event');
if (is_object($plugin)) {
// Object is returned when a plugin could not be cached.
$bag = new serendipity_property_bag;
$plugin->introspect($bag);
$legal = $bag->get('legal');
if (is_array($legal)) {
$out .= '
' . $class_data['classname'] . '
';
// "services" should list every service that a plugin connects to via a HTTP or other API interface,
// and describe what each service does, and which data it gets.
// Only services that are executed on visitor input must be listed; services that the blog server (instead
// of a client) connects to are nice to have, but are only required to be shown if it includes visitor (meta)data
if (is_array($legal['services']) && count($legal['services']) > 0) {
$out .= 'Web services / Third Party
';
$out .= '';
foreach($legal['services'] AS $servicename => $servicedata) {
$out .= '- ' . $servicename . ': ' . $servicedata['desc'] . '
';
}
$out .= '
';
}
// "frontend" lists descriptions what the plugin does on the frontendside and where it uses visitor data or metadata
if (is_array($legal['frontend']) && count($legal['frontend']) > 0) {
$out .= 'Frontend
';
$out .= '';
foreach($legal['frontend'] AS $servicename => $servicedata) {
$out .= '- ' . $servicedata . '
';
}
$out .= '
';
}
// "backend" lists descriptions what the plugin does on the backend and where it uses visitor data or metadata
if (is_array($legal['backend']) && count($legal['backend']) > 0) {
$out .= 'Backend
';
$out .= '';
foreach($legal['backend'] AS $servicename => $servicedata) {
$out .= '- ' . $servicedata . '
';
}
$out .= '
';
}
// "cookies" lists an array of which cookies might be set a a plugin and why. If a plugin makes use of
// session features, also mention that it relies on that session id.
if (is_array($legal['cookies']) && count($legal['cookies']) > 0) {
$out .= 'Cookies
';
$out .= '';
foreach($legal['cookies'] AS $servicename => $servicedata) {
$out .= '- ' . $servicedata . '
';
}
$out .= '
';
}
// "sessiondata" lists an array of which PHP session data values are (temporarily) saved
if (is_array($legal['sessiondata']) && count($legal['sessiondata']) > 0) {
$out .= 'Session data
';
$out .= '';
foreach($legal['sessiondata'] AS $servicename => $servicedata) {
$out .= '- ' . $servicedata . '
';
}
$out .= '
';
}
// This is a list of TRUE/FALSE boolean toggles
$out .= 'Attributes
';
$out .= '';
if ($legal['stores_user_input']) {
$out .= '- Stores user data (like names, text, preferences) to a database, file or other storage (mail)
';
} else {
$out .= '- Does not store user data (or not specified)
';
}
if ($legal['stores_ip']) {
$out .= '- Stores IP data (written to storage)
';
} else {
$out .= '- Does not store IP data (or not specified)
';
}
if ($legal['uses_ip']) {
$out .= '- Operates on IP data (read-access, also when passing through metadata)
';
} else {
$out .= '- Does not operate on IP data (or not specified)
';
}
if ($legal['transmits_user_input']) {
$out .= '- Transmits user input to services / third parties (not necessarily stored)
';
} else {
$out .= '- Does not transmit user input to services / third parties (or not specified)
';
}
$out .= '
';
}
}
}
// Themes
$stack = array();
serendipity_plugin_api::hook_event('backend_templates_fetchlist', $stack);
$themes = serendipity_fetchTemplates();
foreach($themes AS $theme) {
$stack[$theme] = serendipity_fetchTemplateInfo($theme);
}
ksort($stack);
$theme_active = '';
$theme_other = '';
$static_info = array(
'2k11' => array(
'This theme can optionally use webfonts. If enabled, webfonts are loaded from Google/CDN servers, who will receive the IP address of the visitor and his metadata (browser, referrer, user agent, possible cookies)'
),
'next' => array(
'This theme can optionally use webfonts. If enabled, webfonts are loaded from Google/CDN servers, who will receive the IP address of the visitor and his metadata (browser, referrer, user agent, possible cookies)'
),
'clean-blog' => array(
'This theme can optionally use webfonts. If enabled, webfonts are loaded from Google/CDN servers, who will receive the IP address of the visitor and his metadata (browser, referrer, user agent, possible cookies)'
),
'skeleton' => array(
'This theme can optionally use webfonts. If enabled, webfonts are loaded from Google/CDN servers, who will receive the IP address of the visitor and his metadata (browser, referrer, user agent, possible cookies)'
),
'timeline' => array(
'This theme can optionally use webfonts. If enabled, webfonts are loaded from Google/CDN servers, who will receive the IP address of the visitor and his metadata (browser, referrer, user agent, possible cookies)'
),
);
foreach ($stack as $theme => $info) {
if ( strtolower($info['engine']) == 'yes') {
continue;
}
if (file_exists($serendipity["serendipityPath"] . $serendipity["templatePath"] . $theme . "/legal.txt") || isset($static_info[$theme])) {
if ($theme == $serendipity['template']) {
$pointer = 'theme_active';
$$pointer .= 'Active Theme "' . $theme . '"
';
} else {
$pointer = 'theme_other';
$$pointer .= 'Available Theme "' . $theme . '"
';
}
$$pointer .= '';
if (isset($static_info[$theme])) {
foreach($static_info[$theme] AS $themeout) {
$$pointer .= '- ' . $themeout . '
';
}
}
if (file_exists($serendipity["serendipityPath"] . $serendipity["templatePath"] . $theme . "/legal.txt")) {
$$pointer .= '- ' . file_get_contents($serendipity["serendipityPath"] . $serendipity["templatePath"] . $theme . "/legal.txt") . '
';
}
$$pointer .= '
';
}
}
$out .= $theme_active . $theme_other;
return $out;
}
function parseText($text) {
global $serendipity;
$url = $this->get_config('gdpr_url');
if (empty($url)) {
$url = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?serendipity[subpage]=dsgvo_gdpr_privacy';
}
$text = str_replace('%gdpr_url%', $url, $text);
return $text;
}
function isActive() {
global $serendipity;
if ($serendipity['GET']['subpage'] == 'dsgvo_gdpr_privacy') {
return true;
}
return false;
}
function parseParts($string) {
$out = array();
$parts = explode("\n", $string);
foreach($parts AS $part) {
$part = trim($part);
if (empty($part)) continue;
$out[] = "'" . serendipity_db_escape_string($part) . "'";
}
return $out;
}
function showBackend() {
global $serendipity;
if ($serendipity['serendipityUserlevel'] < USERLEVEL_ADMIN) {
return false;
}
$clist = array();
if (isset($serendipity['POST']['delete']) || isset($serendipity['POST']['export'])) {
$author_list = $this->parseParts($serendipity['POST']['filter']['author']);
$email_list = $this->parseParts($serendipity['POST']['filter']['email']);
if (count($author_list) == 0 && count($email_list) == 0) {
echo '' . PLUGIN_EVENT_DSGVO_GDPR_BACKEND_DELFAIL . '
';
} else {
$where = array();
if (count($author_list) > 0) {
$where[] = 'author IN (' . implode(', ', $author_list) . ')';
}
if (count($email_list) > 0) {
$where[] = 'email IN (' . implode(', ', $email_list) . ')';
}
$clist = serendipity_db_query("SELECT *
FROM {$serendipity['dbPrefix']}comments
WHERE " . implode(' OR ', $where), false, 'assoc');
}
if (!is_array($clist) || count($clist) == 0) {
echo '' . NO_COMMENTS . '
';
} else {
if (isset($serendipity['POST']['delete'])) {
foreach($clist AS $comment) {
echo '' . sprintf(COMMENT_DELETED, $comment['id']) . '
';
serendipity_deleteComment($comment['id'], $comment['entry_id']);
}
}
if (isset($serendipity['POST']['export'])) {
header('Content-Type: application/csv; charset=' . LANG_CHARSET);
header('Content-Disposition: attachment; filename=blog-userData.csv');
header('Pragma: no-cache');
echo '#';
foreach($clist[0] AS $key => $val) {
echo '"' . $key . '";';
}
echo "\n";
foreach($clist AS $comment) {
foreach($comment AS $key => $val) {
echo '"' . $val . '";';
}
echo "\n";
}
}
}
}
echo '