Skip to content
Permalink
Browse files

license disclaimer for xml, gpx and txt

  • Loading branch information...
following
following committed Apr 8, 2013
1 parent ce46097 commit 25d5a015817d2870574114cae321b6a559e922c6
@@ -28,10 +28,14 @@ <h2>Änderungen in Version 1.2</h2>
<li>neues Attribut <em>ispublishdate</em> bei cache.datecreated</li>
<li>Ausgabe von Nano-Cachgrößen</li>
</ul>
<p>Ab dem 7. April 2013 gibt es folgende Ergänzung:</p>
<p>Seit dem 7. April 2013 gibt es folgende Ergänzung:</p>
<ul>
<li>Wenn beim Auruf der zusätzliche Parameter "&amp;license=1" angegeben ist, wird bei Cachebeschreibungen und Logs ein zusätzliches Feld &lt;license&gt;...&lt;/license&gt; mitgeliefert, das einen Copyright-Disclaimer gemäß <a href="http://www.opencaching.de/articles.php?page=impressum#datalicense">Datenlizenz</a> enthält. Dieser ist bei der Darstellung der Daten mit anzuzeigen und bei Weitergabe mitzuliefern. Der Disclaimer bezieht sich jeweils auch auf zugehörige Bilder und ist &ndash; soweit möglich &ndash; lokalisiert.<br />
Wenn der license-Parameter <em>nicht</em> angegeben ist, wird der Disclaimer automatisch an alle Cachebeschreibungen angehängt. </li>
<li>Wenn beim Auruf der zusätzliche Parameter "&amp;license=1" angegeben ist, wird bei Cachebeschreibungen, Logs und Bildern ein zusätzliches Feld &lt;license&gt;...&lt;/license&gt; mitgeliefert, das einen Copyright-Disclaimer gemäß <a href="http://www.opencaching.de/articles.php?page=impressum#datalicense">Datenlizenz</a> enthält. Dieser ist bei der Darstellung der Daten mit anzuzeigen und bei Weitergabe mitzuliefern. Wenn der license-Parameter <em>nicht</em> angegeben ist, wird der Disclaimer automatisch an alle Cachebeschreibungen angehängt. <br />
Mit dem zusätzlichen Parameter "language" kann die Sprache des Disclaimers gewählt werden,
z.&nbsp;B. "&amp;language=de" für Deutsch. Ist "language" nicht angegeben, wird der Text
nach Möglichkeit in der Sprache der Cachebeschreibung bzw. des Logeintrags erzeugt,
ansonsten in Englisch.<br />
</li>
</ul>

<p>Der XML-Doctype lautet in allen Versionen "oc11xml".</p>
@@ -0,0 +1,82 @@
<?php
/***************************************************************************
For license information see doc/license.txt
Unicode Reminder メモ
data-lice related functions
***************************************************************************/
/*
* userid: user-id of the copyright holder
* username: username of the copyright holder
* userlicense: user.date_license of the copyright holder
* cacheid: cache to which the licensed content is attached
* language: language code for translation of the license disclaimer
* logdisclaimer: append "all logs entries &copy; their authors"
*
* username and userlicense are not queried *here* for performance reasons.
*/
function getLicenseDisclaimer($userid, $username, $userlicense, $cacheid, $language,
$logdisclaimer, $html, $twolines=false)
{
global $opt, $translate, $absolute_server_URI;
$ltext = "";
$language = strtoupper($language);
if ($opt['logic']['license']['disclaimer'])
{
if ($userlicense == NEW_DATA_LICENSE_ACTIVELY_ACCEPTED ||
$userlicense == NEW_DATA_LICENSE_PASSIVELY_ACCEPTED)
{
// © $USERNAME, Opencaching.de, CC BY-NC-ND, as of $DATUM
$asof = $translate->t('as of', '', '', 0, '', 1, $language);
if (isset($opt['locale'][$language]['page']['license_url']))
$lurl = $opt['locale'][$language]['page']['license_url'];
else
$lurl = $opt['locale']['EN']['page']['license_url'];
if (isset($opt['locale'][$language]['format']['phpdate']))
$df = $opt['locale'][$language]['format']['phpdate'];
else
$df = 'd-m-Y';
$purl = parse_url($absolute_server_URI);
// may be shortened if linked to www.opencaching.de
if ($html && strpos($purl['host'],'opencaching.de'))
$purl['host'] = "Opencaching.de";
$ltext = "&copy; ";
if ($html) $ltext .= "<a href='" . $absolute_server_URI . "viewprofile.php?userid=" . $userid . "' target='_blank'>";
$ltext .= $username;
if ($html) $ltext .= "</a>";
$ltext .= ", ";
if ($html) $ltext .= "<a href='" . $absolute_server_URI . "viewcache.php?cacheid=" . $cacheid . "' target='_blank'>";
$ltext .= $purl['host'];
if ($html) $ltext .= "</a>";
$ltext .= ", ";
if ($html) $ltext .= "<a href='" . $lurl . "' target='_blank'>";
$ltext .= "CC BY-NC-ND";
if ($html) $ltext .= "</a>";
$ltext .= ", ";
$ltext .= $asof . " " . date($df);
}
if ($logdisclaimer)
{
if ($ltext != "")
if ($twolines) $ltext .= ";\r\n";
else $ltext .= "; ";
$ltext .= $translate->t('all log entries &copy; their authors', '', '', 0, '', 1, $language);
}
}
if ($html)
return $ltext;
else
return mb_ereg_replace("&copy;","©",$ltext);
}
?>
@@ -8,7 +8,7 @@
****************************************************************************/
global $content, $bUseZip, $sqldebug;
global $content, $bUseZip, $sqldebug, $locale;
$gpxHead =
'<?xml version="1.0" encoding="utf-8"?>
@@ -312,7 +312,7 @@
$rs = sql_slave("SELECT SQL_BUFFER_RESULT `gpxcontent`.`cache_id` `cacheid`, `gpxcontent`.`longitude` `longitude`, `gpxcontent`.`latitude` `latitude`,
`gpxcontent`.`state` `state`, `caches`.`wp_oc` `waypoint`, `caches`.`date_hidden` `date_hidden`, `caches`.`name` `name`,
`caches`.`country` `country`, `countries`.`name` AS `country_name`, `caches`.`terrain` `terrain`, `caches`.`difficulty` `difficulty`, `caches`.`desc_languages` `desc_languages`,
`caches`.`size` `size`, `caches`.`type` `type`, `caches`.`status` `status`, `user`.`username` `username`, `caches`.`user_id` `userid`,
`caches`.`size` `size`, `caches`.`type` `type`, `caches`.`status` `status`, `user`.`username` `username`, `caches`.`user_id` `userid`, `user`.`data_license`,
`cache_desc`.`desc` `desc`, `cache_desc`.`short_desc` `short_desc`, `cache_desc`.`hint` `hint`,
IFNULL(`stat_cache_logs`.`found`, 0) AS `found`
FROM `gpxcontent`
@@ -349,7 +349,14 @@
', $thisline);
$thisline = mb_ereg_replace('{shortdesc}', xmlentities($r['short_desc']), $thisline);
$thisline = mb_ereg_replace('{desc}', xmlentities(str_replace('<img src="images/uploads/','<img src="' . $absolute_server_URI . 'images/uploads/', $r['desc'])), $thisline);
$desc = str_replace('<img src="images/uploads/','<img src="' . $absolute_server_URI . 'images/uploads/', $r['desc']);
$license = getLicenseDisclaimer(
$r['userid'], $r['username'], $r['data_license'], $r['cacheid'], $locale, true, true);
if ($license != "")
$desc .= "<p><em>$license</em></p>";
$thisline = mb_ereg_replace('{desc}', xmlentities($desc), $thisline);
$thisline = mb_ereg_replace('{images}', xmlentities(getPictures($r['cacheid'])), $thisline);
if (isset($gpxType[$r['type']]))
@@ -15,6 +15,8 @@ functions for the search-engine
****************************************************************************/
require_once($opt['rootpath'] . 'lib/data-license.inc.php');
/* begin conversion rules */
$search_simplerules[] = array('qu', 'k');
@@ -15,7 +15,7 @@
****************************************************************************/
global $content, $bUseZip, $sqldebug;
global $content, $bUseZip, $sqldebug, $locale;
$txtLine = "Name: {cachename} von {owner}
Koordinaten: {lon} {lat}
@@ -198,7 +198,7 @@
// ok, ausgabe ...
$rs = sql_slave('SELECT SQL_BUFFER_RESULT `txtcontent`.`cache_id` `cacheid`, `txtcontent`.`longitude` `longitude`, `txtcontent`.`latitude` `latitude`, `caches`.`wp_oc` `waypoint`, `caches`.`date_hidden` `date_hidden`, `caches`.`name` `name`, `caches`.`country` `country`, `caches`.`terrain` `terrain`, `caches`.`difficulty` `difficulty`, `caches`.`desc_languages` `desc_languages`, `cache_size`.`de` `size`, `cache_type`.`de` `type`, `cache_status`.`de` `status`, `user`.`username` `username`, `cache_desc`.`desc` `desc`, `cache_desc`.`short_desc` `short_desc`, `cache_desc`.`hint` `hint`, `cache_desc`.`desc_html` `html` FROM `txtcontent`, `caches`, `user`, `cache_desc`, `cache_type`, `cache_status`, `cache_size` WHERE `txtcontent`.`cache_id`=`caches`.`cache_id` AND `caches`.`cache_id`=`cache_desc`.`cache_id` AND `caches`.`default_desclang`=`cache_desc`.`language` AND `txtcontent`.`user_id`=`user`.`user_id` AND `caches`.`type`=`cache_type`.`id` AND `caches`.`status`=`cache_status`.`id` AND `caches`.`size`=`cache_size`.`id`');
$rs = sql_slave('SELECT SQL_BUFFER_RESULT `txtcontent`.`cache_id` `cacheid`, `txtcontent`.`longitude` `longitude`, `txtcontent`.`latitude` `latitude`, `caches`.`wp_oc` `waypoint`, `caches`.`date_hidden` `date_hidden`, `caches`.`name` `name`, `caches`.`country` `country`, `caches`.`terrain` `terrain`, `caches`.`difficulty` `difficulty`, `caches`.`desc_languages` `desc_languages`, `cache_size`.`de` `size`, `cache_type`.`de` `type`, `cache_status`.`de` `status`, `user`.`username` `username`, `cache_desc`.`desc` `desc`, `cache_desc`.`short_desc` `short_desc`, `cache_desc`.`hint` `hint`, `cache_desc`.`desc_html` `html`, `user`.`user_id`, `user`.`username`, `user`.`data_license` FROM `txtcontent`, `caches`, `user`, `cache_desc`, `cache_type`, `cache_status`, `cache_size` WHERE `txtcontent`.`cache_id`=`caches`.`cache_id` AND `caches`.`cache_id`=`cache_desc`.`cache_id` AND `caches`.`default_desclang`=`cache_desc`.`language` AND `txtcontent`.`user_id`=`user`.`user_id` AND `caches`.`type`=`cache_type`.`id` AND `caches`.`status`=`cache_status`.`id` AND `caches`.`size`=`cache_size`.`id`');
while($r = sql_fetch_array($rs))
{
$thisline = $txtLine;
@@ -223,15 +223,20 @@
$thisline = mb_ereg_replace('{shortdesc}', $r['short_desc'], $thisline);
$license = getLicenseDisclaimer(
$r['user_id'], $r['username'], $r['data_license'], $r['cacheid'], $locale, true, false, true);
if ($license != "")
$license = "\r\n\r\n$license";
if ($r['html'] == 0)
{
$thisline = mb_ereg_replace('{htmlwarn}', '', $thisline);
$thisline = mb_ereg_replace('{desc}', strip_tags($r['desc']), $thisline);
$thisline = mb_ereg_replace('{desc}', strip_tags($r['desc']) . $license, $thisline);
}
else
{
$thisline = mb_ereg_replace('{htmlwarn}', ' (Vorsicht, aus HTML konvertiert)', $thisline);
$thisline = mb_ereg_replace('{desc}', html2txt($r['desc']), $thisline);
$thisline = mb_ereg_replace('{desc}', html2txt($r['desc']) . $license, $thisline);
}
$thisline = mb_ereg_replace('{type}', $r['type'], $thisline);
@@ -292,7 +292,7 @@
Für die Namensnennung ist die Form
</p>
<p style="font-weight: 800;">
&copy; $USERNAME, www.opencaching.de, CC-BY-NC-ND, Stand: $DATUM
&copy; $USERNAME, Opencaching.de, CC BY-NC-ND, Stand: $DATUM
</p>
<p>
zu verwenden, wobei das Datum sich auf den Abrufzeitpunkt von www.opencaching.de bezieht. Bei Fotos und Logeintr&auml;gen kann vom Datum abgesehen werden.
@@ -253,7 +253,7 @@
The form of attribution is:
</p>
<p style="font-weight: 800;">
&copy; $USERNAME, www.opencaching.de, CC-BY-NC-ND, as of $DATUM
&copy; $USERNAME, Opencaching.de, CC BY-NC-ND, as of $DATUM
</p>
<p>
The date refers to the day when the data was downloaded from www.opencaching.de, and it may be omitted for photos and log entries.
@@ -13,15 +13,14 @@
/* begin configuration */
if (!isset($ocxmlversion))
{
$ocxmlversion = 11;
$doctype = "oc11xml";
}
$opt['rootpath'] = '../';
require($opt['rootpath'] . 'lib/common.inc.php');
require($opt['rootpath'] . 'lib/charset.inc.php');
require($opt['rootpath'] . 'lib2/const.inc.php');
require_once($opt['rootpath'] . 'lib/common.inc.php');
require_once($opt['rootpath'] . 'lib/charset.inc.php');
require_once($opt['rootpath'] . 'lib2/const.inc.php');
require_once($opt['rootpath'] . 'lib/data-license.inc.php');
if ($error == true)
{
echo 'Unable to connect to database';
@@ -55,6 +54,7 @@
$bXmlCData = isset($_REQUEST['cdata']) ? $_REQUEST['cdata'] : '1';
$bAttrlist = isset($_REQUEST['attrlist']) ? $_REQUEST['attrlist'] : '0';
$bLicense = isset($_REQUEST['license']) ? $_REQUEST['license'] : '0';
$sLanguage = isset($_REQUEST['language']) ? strtoupper($_REQUEST['language']) : '';
if ((($bOcXmlTag != '0') && ($bOcXmlTag != '1')) ||
(($bDocType != '0') && ($bDocType != '1')) ||
@@ -302,55 +302,10 @@
/* end parameter reading */
function getLicenseDisclaimer($userid, $username, $userlicense, $cacheid, $language, $logdisclaimer)
{
global $opt, $translate, $absolute_server_URI;
$ltext = "";
if ($opt['logic']['license']['disclaimer'])
{
if ($userlicense != NEW_DATA_LICENSE_ACTIVELY_DECLINED &&
$userlicense != NEW_DATA_LICENSE_PASSIVELY_DECLINED)
{
// © $USERNAME, www.opencaching.de, CC-BY-NC-ND, as of $DATUM
$asof = $translate->t('as of', '', '', 0, '', 1, $language);
if (isset($opt['locale'][$language]['page']['license_url']))
$lurl = $opt['locale'][$language]['page']['license_url'];
else
$lurl = $opt['locale']['EN']['page']['license_url'];
if (isset($opt['locale'][$language]['format']['phpdate']))
$df = $opt['locale'][$language]['format']['phpdate'];
else
$df = $opt['locale']['DE']['format']['phpdate'];
$purl = parse_url($absolute_server_URI);
$ltext =
"&copy; " .
"<a href='" . $absolute_server_URI . "viewprofile.php?userid=" . $userid . "' target='_blank'>" . $username . "</a>, " .
"<a href='" . $absolute_server_URI . "viewcache.php?cacheid=" . $cacheid . "' target='_blank'>" . $purl['host'] . "</a>, " .
"<a href='" . $lurl . "' target='_blank'>CC BY-NC-ND</a>, " .
$asof . " " . date($df);
}
if ($logdisclaimer)
{
if ($ltext != "")
$ltext .= "; ";
$ltext .= $translate->t('all log entries &copy; their authors', '', '', 0, '', 1, $language);
}
}
return $ltext;
}
function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $ziptype)
{
global $zip_basedir, $zip_wwwdir, $sDateformat, $sDateshort, $t1, $t2, $t3, $safemode_zip, $safemode_zip, $sCharset, $bAttrlist;
global $absolute_server_URI, $bLicense;
global $absolute_server_URI, $bLicense, $sLanguage;
global $ocxmlversion;
// alle records aus tmpxml_* übertragen
@@ -571,7 +526,8 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
$desc = html_entity_decode($desc, ENT_COMPAT, 'UTF-8');
}
$disclaimer = getLicenseDisclaimer($r['user_id'], $r['username'], $r['data_license'], $r['cache_id'], $r['language'], true);
$lang = ($sLanguage != "" ? $sLanguage : $r['language']);
$disclaimer = getLicenseDisclaimer($r['user_id'], $r['username'], $r['data_license'], $r['cache_id'], $lang, true, true);
if ($bLicense)
fwrite($f, $t2 . '<license>' . xmlcdata($disclaimer) . '</license>' . "\n");
else if ($disclaimer != "")
@@ -622,7 +578,8 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
if ($bLicense)
{
$disclaimer = getLicenseDisclaimer($r['user_id'], $r['username'], $r['data_license'], $r['cache_id'], $r['language'], false);
$lang = ($sLanguage != "" ? $sLanguage : $r['language']);
$disclaimer = getLicenseDisclaimer($r['user_id'], $r['username'], $r['data_license'], $r['cache_id'], $lang, false, true);
fwrite($f, $t2 . '<license>' . xmlcdata($disclaimer) . '</license>' . "\n");
}
@@ -634,15 +591,22 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
`pictures`.`object_id` `object_id`, `pictures`.`object_type` `object_type`,
`pictures`.`date_created` `date_created`, `pictures`.`uuid` `uuid`,
`pictures`.`last_modified` `last_modified`, `pictures`.`display` `display`,
`pictures`.`spoiler` `spoiler`, `pictures`.`node` `node`,
IFNULL(`cs1`.`allow_user_view`, `cs2`.`allow_user_view`) AS `auv`
`pictures`.`spoiler` `spoiler`, `pictures`.`node` `node`,
IFNULL(`c1`.`cache_id`,`c2`.`cache_id`) AS `cache_id`,
IFNULL(`c1`.`country`,`c2`.`country`) AS `language`, /* hack */
IFNULL(`cs1`.`allow_user_view`, `cs2`.`allow_user_view`) AS `auv`,
IFNULL(`u1`.`user_id`,`u2`.`user_id`) AS `user_id`,
IFNULL(`u1`.`username`,`u2`.`username`) AS `username`,
IFNULL(`u1`.`data_license`,`u2`.`data_license`) AS `data_license`
FROM `tmpxml_pictures`
INNER JOIN `pictures` ON `tmpxml_pictures`.`id`=`pictures`.`id`
LEFT JOIN `caches` AS `c1` ON `pictures`.`object_type`=2 AND `pictures`.`object_id`=`c1`.`cache_id`
LEFT JOIN `cache_logs` ON `pictures`.`object_type`=1 AND `pictures`.`object_id`=`cache_logs`.`id`
LEFT JOIN `caches` AS `c2` ON `cache_logs`.`cache_id`=`c2`.`cache_id`
LEFT JOIN `cache_status` AS `cs1` ON `c1`.`status`=`cs1`.`id`
LEFT JOIN `cache_status` AS `cs2` ON `c2`.`status`=`cs2`.`id`');
LEFT JOIN `cache_status` AS `cs2` ON `c2`.`status`=`cs2`.`id`
LEFT JOIN `user` `u1` ON `u1`.`user_id`=`cache_logs`.`user_id`
LEFT JOIN `user` `u2` ON `u2`.`user_id`=`c1`.`user_id`');
while ($r = sql_fetch_array($rs))
{
$bAllowView = ($r['auv'] == 1);
@@ -655,6 +619,14 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
fwrite($f, $t2 . '<attributes spoiler="' . $r['spoiler'] . '" display="' . $r['display'] . '" />' . "\n");
fwrite($f, $t2 . '<datecreated>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
if ($bLicense)
{
$lang = ($sLanguage != "" ? $sLanguage : $r['language']);
$disclaimer = getLicenseDisclaimer($r['user_id'], $r['username'], $r['data_license'], $r['cache_id'], $lang, false, true);
fwrite($f, $t2 . '<license>' . xmlcdata($disclaimer) . '</license>' . "\n");
}
fwrite($f, $t1 . '</picture>' . "\n");
}
mysql_free_result($rs);

0 comments on commit 25d5a01

Please sign in to comment.
You can’t perform that action at this time.