function license_block($dbh, $work) { global $LIC_GENIMG_CODES; $user = user_for_id($dbh, $work['user_id']); $license_name = lic_name($work['license']); $license_abbrv = lic_abbrv($work['license']); if ($work['license'] == 0) { $block = '<a href="?action=display&work_id=' . $work['work_id'] . '">' . $work['title'] . '</a> by <a href="?who&user_id=' . $user['user_id'] . '">' . $user['username'] . '</a>.'; } elseif ($work['license'] == 7) { $block = '<p xmlns:dct="http://purl.org/dc/terms/"> <a rel="license" href="http://creativecommons.org/publicdomain/zero/1.0/"> <img src="genimg/genimg.php?l=0" style="border-style: none;" alt="CC0"> </a> <br> To the extent possible under law, <a rel="dct:publisher" href="?who&user_id=' . $user['user_id'] . '"> <span property="dct:title">' . $user['username'] . '</span> </a> has waived all copyright and related or neighboring rights to <a href="?action=display&work_id=' . $work['work_id'] . '" property="dct:title">' . $work['title'] . '</a>.</p>'; } else { $block = '<a rel="license" href="http://creativecommons.org/licenses/' . $license_abbrv . '/4.0/"><img alt="Creative Commons License" style="border-width:0" src="genimg/genimg.php?l=' . $LIC_GENIMG_CODES[$work['license']] . '" /></a><br /><a href="?action=display&work_id=' . $work['work_id'] . '"><span xmlns:dct="http://purl.org/dc/terms/" href="' . work_mediatype($work) . '" property="dct:title" rel="dct:type">' . $work['title'] . '</span></a> by <a xmlns:cc="http://creativecommons.org/ns#" href="?who&user_id=' . $user['user_id'] . '" property="cc:attributionName" rel="cc:attributionURL">' . $user['username'] . '</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/' . $license_abbrv . '/4.0/">' . $license_name . ' 4.0 International License</a>.'; } return $block; }
function license_block($dbh, $base_url, $work) { $user = user_for_id($dbh, $work['user_id']); $user_id = $user['user_id']; $user_name = $user['username']; $user_url = $base_url . '?who&user_id=' . $user_id; $work_title = $work['title']; $work_id = $work['work_id']; $work_url = $base_url . '?action=display&work_id=' . $work_id; if ($work['license'] == 0) { $lic = "<a href=\"{$work_url}\">{$work_title}</a>\n by <a href=\"{$user_url}\">{$user_name}</a>."; } elseif ($work['license'] == 7) { $lic = "<p xmlns:dct=\"http://purl.org/dc/terms/\">\n <a rel=\"license\"\n href=\"http://creativecommons.org/publicdomain/zero/1.0/\">\n <img src=\"{$base_url}/genimg/genimg.php?b=ffffff&l=0\"\n style=\"border-style: none;\" alt=\"CC0\">\n </a>\n <br>\n To the extent possible under law,\n <a rel=\"dct:publisher\"\n href=\"{$user_url}\">\n <span property=\"dct:title\">{$user_name}</span>\n </a>\n has waived all copyright and related or neighboring rights to\n <a href=\"{$work_url}\"\n property=\"dct:title\">{$work_title}</a>.</p>"; } else { $license_name = lic_name($work['license']) . ' 4.0 International License'; $license_abbrv = lic_abbrv($work['license']); $mediatype_url = work_mediatype($work); $gencode = lic_genimg_code($work['license']); $icon_url = "{$base_url}/genimg/genimg.php?b=ffffff&l={$gencode}"; $license_url = "http://creativecommons.org/licenses/{$license_abbrv}/4.0/"; $lic = "<a rel=\"license\" href=\"{$license_url}\">\n <img alt=\"Creative Commons License\"\n style=\"border-width:0\" src=\"{$icon_url}\" /></a>\n <br />\n <a href=\"{$work_url}\">\n <span xmlns:dct=\"http://purl.org/dc/terms/\"\n href=\"{$mediatype_url}\" property=\"dct:title\"\n rel=\"dct:type\">{$work_title}</span></a>\n by <a xmlns:cc=\"http://creativecommons.org/ns#\"\n href=\"{$user_url}\" property=\"cc:attributionName\"\n rel=\"cc:attributionURL\">{$user_name}</a>\n is licensed under a <a rel=\"license\" href=\"{$license_url}\">\n {$license_name}</a>."; } return $lic; }