コード例 #1
0
function format_data($data, $id = null)
{
    /*{{{*/
    list($url, $text) = split_data($data);
    if ($url) {
        // Mobile Device PDF: Das können wir als JPG ausliefern!
        if ($id && preg_match('/\\.(?:pdf|ps)$/i', $url) && is_mobile()) {
            $url = 'image.php?data_id=' . htmlspecialchars($id);
        }
        $url = remove_authentication_from_urls($url);
        return '<a class="exercise" href="' . htmlspecialchars($url) . '">' . htmlspecialchars($text ? $text : basename($url)) . '</a>';
    } else {
        return htmlspecialchars($text);
    }
}
コード例 #2
0
		<?php 
if (isset($code['code'])) {
    if (!$can_edit) {
        $code['code'] = remove_authentication_from_urls($code['code']);
    }
    $helper = '';
    if (file_exists('local.php')) {
        $helper = '<span class="right small">(<a href="index.php?q=details&amp;show=helper">Helferfunktionen</a>)</span>';
    }
    echo '<p>Führt PHP-Code aus:' . $helper . '</p><div id="edit-code" class="code editable">';
    echo preg_replace('/&lt;\\?php/', '', str_replace(array("&nbsp;", "<br />"), array(" ", "<br>\n"), highlight_string("<?php " . $code['code'], true)));
    echo '</div>';
} else {
    if (!$can_edit) {
        $code['url'] = remove_authentication_from_urls($code['url']);
        $code['exercise'] = remove_authentication_from_urls($code['exercise']);
    }
    echo '<p>Sucht in der URL</p><p id="edit-url" class="editable url"><a href="' . htmlspecialchars($code['url']) . '">' . htmlspecialchars($code['url']) . '</a></p><p>
					nach dem regulären Ausdruck</p><pre class="editable" id="edit-search">' . htmlspecialchars($code['search']) . '</pre><p>und gibt als Übung zurück</p><pre class="editable" id="edit-exercise">' . htmlspecialchars($code['exercise']) . '</pre>';
}
?>
	</div>
	</div>
	<?php 
if ($can_edit) {
    ?>
	<p class="small buttons">
		<?php 
    if (user()->level >= 1) {
        ?>
		<a href="index.php?q=details&f=<?php