function mailto_link($email, $title = null) { $email = str_replace('@', '@', obfuscate($email)); $email = obfuscate('mailto:') . $email; $title = $title ?: $email; return $this->toHtmlString('<a href="' . $email . '">' . htmlentities($title, ENT_QUOTES, 'UTF-8', false) . '</a>'); }
function qx_mailtoencode($emailAddy, $text = '', $buildLink = true, $class = '', $style = '') { if ($buildLink) { // mailto: portion $obfuscatedMailTo = ''; $mailto = "mailto:"; $length = strlen($mailto); for ($i = 0; $i < $length; $i++) { $obfuscatedMailTo .= "&#" . ord($mailto[$i]); } // END - mailto: portion $emailLink = '<a href="'; $emailLink .= $obfuscatedMailTo; } $emailLink .= obfuscate($emailAddy); if ($buildLink) { $emailLink .= '"'; if (trim($class) != '') { $emailLink .= ' class="' . $class . '"'; } if (trim($style) != '') { $emailLink .= ' style="' . $style . '"'; } $emailLink .= '>'; if (trim($text) != '') { $newText = trim($text); $newText = str_replace('@', '@', $newText); $newText = str_replace('.', '.', $newText); $emailLink .= $newText; } else { $newText = trim($emailAddy); $newText = str_replace('@', '@', $newText); $newText = str_replace('.', '.', $newText); $emailLink .= $newText; } $emailLink .= "</a>"; } return $emailLink; }
/** * obfuscates eMail addresses (links with 'href="mailto:..."') by using * Base64 Encoding and ROT13 in combination; this will need JavaScript for * de-obfuscation on the client side! * * @access public * @param string &$content - page content to parse * @return void edits $content **/ function obfuscateEmail(&$content) { $dom = new DOMDocument(); libxml_use_internal_errors(true); @$dom->loadHTML($content); $x = new DOMXPath($dom); foreach ($x->query("//a") as $node) { if (preg_match('~^mailto:(.*)~i', $node->getAttribute("href"), $match)) { $obfuscated = obfuscate($match[1]); $content = str_replace($match[0], 'javascript:' . $obfuscated, $content); // replace any other occurance $content = str_replace($match[1], '<script type="text/javascript">document.write(' . $obfuscated . ');</script>', $content); } } // match any other occurances of email addresses preg_match_all('/\\b([A-Za-z0-9._%-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,4})\\b/D', $content, $matches, PREG_SET_ORDER); if (count($matches)) { foreach ($matches as $match) { $content = str_replace($match[1], '<script type="text/javascript">document.write(' . obfuscate($match[1]) . ');</script>', $content); } } // add JS to the header register_filter_js(CAT_URL . '/modules/blackcatFilter/js/obfuscateEmail.js'); }
/** * Return the users realname or e-mail address for use * in page footer and recent changes pages * * @author Andy Webber <dokuwiki AT andywebber DOT com> */ function editorinfo($username) { global $conf; global $auth; switch ($conf['showuseras']) { case 'username': case 'email': case 'email_link': if ($auth) { $info = $auth->getUserData($username); } break; default: return hsc($username); } if (isset($info) && $info) { switch ($conf['showuseras']) { case 'username': return hsc($info['name']); case 'email': return obfuscate($info['mail']); case 'email_link': $mail = obfuscate($info['mail']); return '<a href="mailto:' . $mail . '">' . $mail . '</a>'; default: return hsc($username); } } else { return hsc($username); } }
$parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative()); // $parser = new PhpParser\Parser(new PhpParser\Lexer); $traverser = new PhpParser\NodeTraverser(); if ($conf->obfuscate_string_literal) { $prettyPrinter = new myPrettyprinter(); } else { $prettyPrinter = new PhpParser\PrettyPrinter\Standard(); } $t_scrambler = array(); foreach (array('variable', 'function', 'method', 'property', 'class', 'class_constant', 'constant', 'namespace', 'label') as $dummy => $scramble_what) { $t_scrambler[$scramble_what] = new Scrambler($scramble_what, $conf, $process_mode == 'directory' ? $target_directory : null); } $traverser->addVisitor(new MyNodeVisitor()); switch ($process_mode) { case 'file': $obfuscated_str = obfuscate($source_file); if ($obfuscated_str === null) { exit; } if ($target_file === '') { echo $obfuscated_str . PHP_EOL; exit; } file_put_contents($target_file, $obfuscated_str . PHP_EOL); exit; case 'directory': if (isset($conf->t_skip) && is_array($conf->t_skip)) { foreach ($conf->t_skip as $key => $val) { $conf->t_skip[$key] = "{$source_directory}/{$val}"; } }
/** * Returns users realname w/o link * * @param string|null $username or null when currently logged-in user should be used * @param bool $textonly true returns only plain text, true allows returning html * @return string html or plain text(not escaped) of formatted user name * * @triggers COMMON_USER_LINK */ function userlink($username = null, $textonly = false) { global $conf, $INFO; /** @var DokuWiki_Auth_Plugin $auth */ global $auth; /** @var Input $INPUT */ global $INPUT; // prepare initial event data $data = array('username' => $username, 'name' => '', 'link' => array('target' => '', 'pre' => '', 'suf' => '', 'style' => '', 'more' => '', 'url' => '', 'title' => '', 'class' => ''), 'userlink' => '', 'textonly' => $textonly); if ($username === null) { $data['username'] = $username = $INPUT->server->str('REMOTE_USER'); if ($textonly) { $data['name'] = $INFO['userinfo']['name'] . ' (' . $INPUT->server->str('REMOTE_USER') . ')'; } else { $data['name'] = '<bdi>' . hsc($INFO['userinfo']['name']) . '</bdi> (<bdi>' . hsc($INPUT->server->str('REMOTE_USER')) . '</bdi>)'; } } $evt = new Doku_Event('COMMON_USER_LINK', $data); if ($evt->advise_before(true)) { if (empty($data['name'])) { if ($auth) { $info = $auth->getUserData($username); } if ($conf['showuseras'] != 'loginname' && isset($info) && $info) { switch ($conf['showuseras']) { case 'username': case 'username_link': $data['name'] = $textonly ? $info['name'] : hsc($info['name']); break; case 'email': case 'email_link': $data['name'] = obfuscate($info['mail']); break; } } else { $data['name'] = $textonly ? $data['username'] : hsc($data['username']); } } /** @var Doku_Renderer_xhtml $xhtml_renderer */ static $xhtml_renderer = null; if (!$data['textonly'] && empty($data['link']['url'])) { if (in_array($conf['showuseras'], array('email_link', 'username_link'))) { if (!isset($info)) { if ($auth) { $info = $auth->getUserData($username); } } if (isset($info) && $info) { if ($conf['showuseras'] == 'email_link') { $data['link']['url'] = 'mailto:' . obfuscate($info['mail']); } else { if (is_null($xhtml_renderer)) { $xhtml_renderer = p_get_renderer('xhtml'); } if (empty($xhtml_renderer->interwiki)) { $xhtml_renderer->interwiki = getInterwiki(); } $shortcut = 'user'; $exists = null; $data['link']['url'] = $xhtml_renderer->_resolveInterWiki($shortcut, $username, $exists); $data['link']['class'] .= ' interwiki iw_user'; if ($exists !== null) { if ($exists) { $data['link']['class'] .= ' wikilink1'; } else { $data['link']['class'] .= ' wikilink2'; $data['link']['rel'] = 'nofollow'; } } } } else { $data['textonly'] = true; } } else { $data['textonly'] = true; } } if ($data['textonly']) { $data['userlink'] = $data['name']; } else { $data['link']['name'] = $data['name']; if (is_null($xhtml_renderer)) { $xhtml_renderer = p_get_renderer('xhtml'); } $data['userlink'] = $xhtml_renderer->_formatLink($data['link']); } } $evt->advise_after(); unset($evt); return $data['userlink']; }
function emaillink($address, $name = NULL) { global $conf; //simple setup $link = array(); $link['target'] = ''; $link['pre'] = ''; $link['suf'] = ''; $link['style'] = ''; $link['more'] = ''; //we just test for image here - we need to encode the title our self $this->_getLinkTitle($name, $address, $isImage); if (!$isImage) { $link['class'] = 'mail JSnocheck'; } else { $link['class'] = 'media JSnocheck'; } $address = $this->_xmlEntities($address); $address = obfuscate($address); $title = $address; if (empty($name)) { $name = $address; } else { $name = $this->_xmlEntities($name); } if ($conf['mailguard'] == 'visible') { $address = rawurlencode($address); } $link['url'] = 'mailto:' . $address; $link['name'] = $name; $link['title'] = $title; //output formatted $this->doc .= $this->_formatLink($link); }
function test_visible() { global $conf; $conf['mailguard'] = 'visible'; $this->assertEqual(obfuscate('*****@*****.**'), 'jon [dash] doe [at] example [dot] com'); }
function email($email) { // Make sure the at sign is always obfuscated return str_replace('@', '@', obfuscate($email)); }
/** * Main function to determine the avatar to use */ function _getAvatarURL($user, &$title, &$size) { global $auth; if (!$size || !is_int($size)) { $size = $this->getConf('size'); } if (is_array($user)) { $mail = $user['mail']; $name = $user['name']; $user = $user['user']; } else { $mail = $user; } // check first if a local image for the given user exists $userinfo = $auth->getUserData($user); if (is_array($userinfo)) { if ($userinfo['name'] && !$title) { $title = hsc($userinfo['name']); } $ns = $this->getConf('namespace'); $formats = array('.png', '.jpg', '.gif'); foreach ($formats as $format) { $user_img = mediaFN($ns . ':' . $user . $format); $name_img = mediaFN($ns . ':' . $name . $format); if (@file_exists($user_img)) { $src = ml($ns . ':' . $user . $format, array('w' => $size, 'h' => $size)); break; } elseif (@file_exists($name_img)) { $src = ml($ns . ':' . $name . $format, array('w' => $size, 'h' => $size)); } } if (!$src) { $mail = $userinfo['mail']; } } if (!$src) { $seed = md5(utf8_strtolower($mail)); if (function_exists('imagecreatetruecolor')) { // we take the monster ID as default $file = 'monsterid.php?seed=' . $seed . '&size=' . $size . '&.png'; } else { // GDlib is not availble - resort to default images switch ($size) { case 20: case 40: case 80: $file = 'images/default_' . $size . '.png'; break; default: $file = 'images/default_120.png'; } } $default = ml(DOKU_URL . '/lib/plugins/avatar/' . $file, 'cache=recache', true, '&', true); // do not pass invalid or empty emails to gravatar site... if (mail_isvalid($mail) && $size <= 80) { $src = ml('http://www.gravatar.com/avatar.php?' . 'gravatar_id=' . $seed . '&default=' . urlencode($default) . '&size=' . $size . '&rating=' . $this->getConf('rating') . '&.jpg', 'cache=recache'); // show only default image if invalid or empty email given } else { $src = $default; } } if (!$title) { $title = obfuscate($mail); } return $src; }
/** * Deobfuscate the values even if on an array * * @param $value could be an array or a string which need to be deobfuscated * @return the element passed as parameter with deobfuscated */ function deobfuscate_deep($value) { if (is_array($value)) { return array_map('deobfuscate_deep', $value); } else { return obfuscate($value); } }
<?php require 'js_obfuscator.php'; ?> <!DOCTYPE html> <html> <head> <script type="text/javascript"> <?php obfuscate("script.js"); ?> </script> </head> <body> </body> </html>
function obfuscate_directory($source_dir, $target_dir, $keep_mode = false) { global $conf; if (!($dp = opendir($source_dir))) { fprintf(STDERR, "Error:\t [%s] directory does not exists!%s", $source_dir, PHP_EOL); exit(-1); } $t_dir = array(); $t_file = array(); while (($entry = readdir($dp)) !== false) { if ($entry == "." || $entry == "..") { continue; } $new_keep_mode = $keep_mode; $source_path = "{$source_dir}/{$entry}"; $source_stat = @lstat($source_path); $target_path = "{$target_dir}/{$entry}"; $target_stat = @lstat($target_path); if ($source_stat === false) { fprintf(STDERR, "Error:\t cannot stat [%s] !%s", $source_path, PHP_EOL); exit(-1); } if (isset($conf->t_skip) && is_array($conf->t_skip) && in_array($source_path, $conf->t_skip)) { continue; } if (is_link($source_path)) { if ($target_stat !== false && is_link($target_path) && $source_stat['mtime'] <= $target_stat['mtime']) { continue; } if ($target_stat !== false) { if (is_dir($target_path)) { directory_remove($target_path); } else { if (unlink($target_path) === false) { fprintf(STDERR, "Error:\t cannot unlink [%s] !%s", $target_path, PHP_EOL); exit(-1); } } } @symlink(readlink($source_path), $target_path); // Do not warn on non existing symbolinc link target! if (strtolower(PHP_OS) == 'linux') { $x = `touch '{$target_path}' --no-dereference --reference='{$source_path}' `; } continue; } if (is_dir($source_path)) { if ($target_stat !== false) { if (!is_dir($target_path)) { if (unlink($target_path) === false) { fprintf(STDERR, "Error:\t cannot unlink [%s] !%s", $target_path, PHP_EOL); exit(-1); } } } if (!file_exists($target_path)) { mkdir($target_path, 0777, true); } if (isset($conf->t_keep) && is_array($conf->t_keep) && in_array($source_path, $conf->t_keep)) { $new_keep_mode = true; } obfuscate_directory($source_path, $target_path, $new_keep_mode); continue; } if (is_file($source_path)) { if ($target_stat !== false && is_dir($target_path)) { directory_remove($target_path); } if ($target_stat !== false && $source_stat['mtime'] <= $target_stat['mtime']) { continue; } // do not process if source timestamp is not greater than target $extension = pathinfo($source_path, PATHINFO_EXTENSION); $keep = $keep_mode; if (isset($conf->t_keep) && is_array($conf->t_keep) && in_array($source_path, $conf->t_keep)) { $keep = true; } if (!in_array($extension, $conf->t_obfuscate_php_extension)) { $keep = true; } if ($keep) { file_put_contents($target_path, file_get_contents($source_path)); } else { $obfuscated_str = obfuscate($source_path); if ($obfuscated_str === null) { if (isset($conf->abort_on_error)) { fprintf(STDERR, "Aborting...%s", PHP_EOL); exit; } } file_put_contents($target_path, $obfuscated_str . PHP_EOL); } if ($keep) { file_put_contents($target_path, file_get_contents($source_path)); } touch($target_path, $source_stat['mtime']); continue; } } closedir($dp); }
/** * Return XHTML formated data, depending on column type * * @param $column * @param $value * @param $R Doku_Renderer_xhtml * @return string */ function _formatData($column, $value, &$R) { global $conf; $vals = explode("\n", $value); $outs = array(); foreach ($vals as $val) { $val = trim($val); if ($val == '') { continue; } $type = $column['type']; if (is_array($type)) { $type = $type['type']; } switch ($type) { case 'page': $val = $this->_addPrePostFixes($column['type'], $val); $outs[] = $R->internallink($val, null, null, true); break; case 'title': case 'pageid': list($id, $title) = explode('|', $val, 2); $id = $this->_addPrePostFixes($column['type'], $id); $outs[] = $R->internallink($id, $title, null, true); break; case 'nspage': // no prefix/postfix here $val = ':' . $column['key'] . ":{$val}"; $outs[] = $R->internallink($val, null, null, true); break; case 'mail': list($id, $title) = explode(' ', $val, 2); $id = $this->_addPrePostFixes($column['type'], $id); $id = obfuscate(hsc($id)); if (!$title) { $title = $id; } else { $title = hsc($title); } if ($conf['mailguard'] == 'visible') { $id = rawurlencode($id); } $outs[] = '<a href="mailto:' . $id . '" class="mail" title="' . $id . '">' . $title . '</a>'; break; case 'url': $val = $this->_addPrePostFixes($column['type'], $val); $outs[] = $this->external_link($val, false, 'urlextern'); break; case 'tag': // per default use keyname as target page, but prefix on aliases if (!is_array($column['type'])) { $target = $column['key'] . ':'; } else { $target = $this->_addPrePostFixes($column['type'], ''); } $outs[] = '<a href="' . wl(str_replace('/', ':', cleanID($target)), $this->_getTagUrlparam($column, $val)) . '" title="' . sprintf($this->getLang('tagfilter'), hsc($val)) . '" class="wikilink1">' . hsc($val) . '</a>'; break; case 'timestamp': $outs[] = dformat($val); break; case 'wiki': global $ID; $oldid = $ID; list($ID, $data) = explode('|', $val, 2); $data = $this->_addPrePostFixes($column['type'], $data); // Trim document_{start,end}, p_{open,close} $ins = array_slice(p_get_instructions($data), 2, -2); $outs[] = p_render('xhtml', $ins, $byref_ignore); $ID = $oldid; break; default: $val = $this->_addPrePostFixes($column['type'], $val); if (substr($type, 0, 3) == 'img') { $sz = (int) substr($type, 3); if (!$sz) { $sz = 40; } $title = $column['key'] . ': ' . basename(str_replace(':', '/', $val)); $outs[] = '<a href="' . ml($val) . '" class="media" rel="lightbox"><img src="' . ml($val, "w={$sz}") . '" alt="' . hsc($title) . '" title="' . hsc($title) . '" width="' . $sz . '" /></a>'; } else { $outs[] = hsc($val); } } } return join(', ', $outs); }
/** * Return XHTML formated data, depending on column type */ function _formatData($column, $value, &$R) { global $conf; $vals = explode("\n", $value); $outs = array(); foreach ($vals as $val) { $val = trim($val); if ($val == '') { continue; } switch ($column['type']) { case 'page': if ($column['prefix']) { $val = $column['prefix'] . $val; } else { $val = ':' . $val; } $val .= $column['postfix']; $outs[] = $R->internallink(":{$val}", NULL, NULL, true); break; case 'title': list($id, $title) = explode('|', $val, 2); $id = $column['prefix'] . $id . $column['postfix']; $outs[] = $R->internallink(":{$id}", $title, NULL, true); break; case 'nspage': // no prefix/postfix here $val = ':' . $column['key'] . ":{$val}"; $outs[] = $R->internallink($val, NULL, NULL, true); break; case 'mail': list($id, $title) = explode(' ', $val, 2); $val = $column['prefix'] . $val . $column['postfix']; $id = obfuscate(hsc($id)); if (!$title) { $title = $id; } else { $title = hsc($title); } if ($conf['mailguard'] == 'visible') { $id = rawurlencode($id); } $outs[] = '<a href="mailto:' . $id . '" class="mail" title="' . $id . '">' . $title . '</a>'; break; case 'url': $val = $column['prefix'] . $val . $column['postfix']; $outs[] = '<a href="' . hsc($val) . '" class="urlextern" title="' . hsc($val) . '">' . hsc($val) . '</a>'; break; case 'tag': #FIXME handle pre/postfix $outs[] = '<a href="' . wl(str_replace('/', ':', cleanID($column['key'])), array('dataflt' => $column['key'] . ':' . $val)) . '" title="' . sprintf($this->getLang('tagfilter'), hsc($val)) . '" class="wikilink1">' . hsc($val) . '</a>'; break; case 'wiki': global $ID; $oldid = $ID; list($ID, $data) = explode('|', $val, 2); $outs[] = p_render('xhtml', p_get_instructions($data), $ignore); $ID = $oldid; break; default: $val = $column['prefix'] . $val . $column['postfix']; if (substr($column['type'], 0, 3) == 'img') { $sz = (int) substr($type, 3); if (!$sz) { $sz = 40; } $title = $column['key'] . ': ' . basename(str_replace(':', '/', $val)); $outs[] = '<a href="' . ml($val) . '" class="media" rel="lightbox"><img src="' . ml($val, "w={$sz}") . '" alt="' . hsc($title) . '" title="' . hsc($title) . '" width="' . $sz . '" /></a>'; } else { $outs[] = hsc($val); } } } return join(', ', $outs); }
ldap_sort($ds, $sr, 'cn'); //experimental ldap_sort($ds, $sr, 'sn'); //experimental if (ldap_count_entries($ds, $sr) > 200) { echo '<h4>Your search returned too many results to display, please narrow your search.</h4>'; } else { echo '<div class="searchtext">' . ldap_count_entries($ds, $sr) . " Search Result"; echo ldap_count_entries($ds, $sr) != 1 ? 's' : ''; echo " for <strong>'" . $searchname . "'</strong></div>"; $info = ldap_get_entries($ds, $sr); for ($i = 0; $i < $info["count"]; $i++) { echo '<div class="searchBox"><div class="searchTitle">' . $info[$i]["cn"][0] . '</div><div class="searchDesc">'; $email = $info[$i]["mail"][0]; if (strpos($email, 'ee: ') == 0) { echo '<a class="showto" href="' . obfuscate('mailto:') . obfuscate($email) . '">' . obfuscate($email) . '</a><span class="showto"></span>'; } else { echo $email; } $tel = $info[$i]["telephonenumber"][0]; $tel = substr($tel, 3, strlen($tel)); echo '<br />' . $tel . '</div>'; echo '</div>'; } } ldap_close($ds); } else { echo "<h4>Unable to search at this time</h4>"; } } else { echo "<h4>Invalid Search Criterion</h4><p>Must use at least two alpha characters for a name search.</p>";
echo "Importing dictionary" . PHP_EOL; } $dict = explode(PHP_EOL, file_get_contents($dictPath)); $dictSize = count($dict) - 1; $knownNames = array(); $dom = new \DOMDocument('1.0'); $dom->loadXml(file_get_contents($file)); $dom->formatOutput = true; $xpath = new \DOMXpath($dom); if ($verbose) { echo "Replacing property names" . PHP_EOL; } foreach ($xpath->query('//sv:property') as $propertyEl) { $name = obfuscate($propertyEl->getAttribute('sv:name')); $propertyEl->setAttribute('sv:name', $name); } if ($verbose) { echo "Replacing node names" . PHP_EOL; } foreach ($xpath->query('//sv:node') as $nodeEl) { $name = obfuscate($nodeEl->getAttribute('sv:name')); $nodeEl->setAttribute('sv:name', $name); } if ($verbose) { echo "Replacing string values" . PHP_EOL; } foreach ($xpath->query('//sv:property[@sv:type="String" and not(starts-with(@sv:name, "jcr:"))]/sv:value') as $valueEl) { $name = obfuscate($valueEl->nodeValue); $valueEl->nodeValue = $name; } echo $dom->saveXml();
/** * email * standardised function to generate an email link according to obfuscation settings */ function email($email, $name = '', $class = '', $more = '') { if (!$email) { return $name; } $email = obfuscate($email); if (!$name) { $name = $email; } $class = "class='" . ($class ? $class : 'mail') . "'"; return "<a href='mailto:{$email}' {$class} title='{$email}' {$more}>{$name}</a>"; }
function emaillink($address, $name = NULL) { $name = $this->_getLinkTitle($name, '', $isImage); $address = html_entity_decode(obfuscate($address),ENT_QUOTES,'UTF-8'); if (empty($name)) { $name = $address; } $this->doc .= $name; }
/** * Render a linked E-Mail Address * * Honors $conf['mailguard'] setting * * @param string $address Email-Address * @param string|array $name name for the link, array for media file * @param bool $returnonly whether to return html or write to doc attribute */ function emaillink($address, $name = null, $returnonly = false) { global $conf; //simple setup $link = array(); $link['target'] = ''; $link['pre'] = ''; $link['suf'] = ''; $link['style'] = ''; $link['more'] = ''; $name = $this->_getLinkTitle($name, '', $isImage); if (!$isImage) { $link['class'] = 'mail'; } else { $link['class'] = 'media'; } $address = $this->_xmlEntities($address); $address = obfuscate($address); $title = $address; if (empty($name)) { $name = $address; } if ($conf['mailguard'] == 'visible') { $address = rawurlencode($address); } $link['url'] = 'mailto:' . $address; $link['name'] = $name; $link['title'] = $title; //output formatted if ($returnonly) { return $this->_formatLink($link); } else { $this->doc .= $this->_formatLink($link); } }
/** * Return XHTML formated data, depending on column type * * @param array $column * @param string $value * @param Doku_Renderer $R * @return string */ function _formatDataOld($column, $value, Doku_Renderer $R) { global $conf; $vals = explode("\n", $value); $outs = array(); //multivalued line from db result for pageid and wiki has only in first value the ID $storedID = ''; foreach ($vals as $val) { $val = trim($val); if ($val == '') { continue; } $type = $column['type']; if (is_array($type)) { $type = $type['type']; } switch ($type) { case 'page': $val = $this->_addPrePostFixes($column['type'], $val); $val = $this->ensureAbsoluteId($val); $outs[] = $R->internallink($val, null, null, true); break; case 'title': list($id, $title) = explode('|', $val, 2); $id = $this->_addPrePostFixes($column['type'], $id); $id = $this->ensureAbsoluteId($id); $outs[] = $R->internallink($id, $title, null, true); break; case 'pageid': list($id, $title) = explode('|', $val, 2); //use ID from first value of the multivalued line if ($title == null) { $title = $id; if (!empty($storedID)) { $id = $storedID; } } else { $storedID = $id; } $id = $this->_addPrePostFixes($column['type'], $id); $outs[] = $R->internallink($id, $title, null, true); break; case 'nspage': // no prefix/postfix here $val = ':' . $column['key'] . ":{$val}"; $outs[] = $R->internallink($val, null, null, true); break; case 'mail': list($id, $title) = explode(' ', $val, 2); $id = $this->_addPrePostFixes($column['type'], $id); $id = obfuscate(hsc($id)); $titleId = $id; if (!$title) { $title = $id; } else { $title = hsc($title); } if ($conf['mailguard'] == 'visible') { $id = rawurlencode($id); } $outs[] = '<a href="mailto:' . $id . '" class="mail" title="' . $titleId . '">' . $title . '</a>'; break; case 'url': $val = $this->_addPrePostFixes($column['type'], $val); $url = $val; $schemes = getSchemes(); list($scheme) = explode('://', $url); if (!in_array($scheme, $schemes)) { $url = ''; } // is there still an URL? if (!$url) { $outs[] = $val; } else { $outs[] = $this->external_link($val, false, 'urlextern'); } break; case 'tag': // per default use keyname as target page, but prefix on aliases if (!is_array($column['type'])) { $target = $column['key'] . ':'; } else { $target = $this->_addPrePostFixes($column['type'], ''); } $params = buildURLparams($this->_getTagUrlparam($column, $val)); $url = str_replace('/', ':', cleanID($target)) . '?' . $params; $outs[] = $R->internallink($url, hsc($val), true); break; case 'timestamp': $outs[] = dformat($val); break; case 'wiki': global $ID; $oldid = $ID; list($ID, $data) = explode('|', $val, 2); //use ID from first value of the multivalued line if ($data == null) { $data = $ID; $ID = $storedID; } else { $storedID = $ID; } $data = $this->_addPrePostFixes($column['type'], $data); // Trim document_{start,end}, p_{open,close} from instructions $allinstructions = p_get_instructions($data); $wraps = 1; if (isset($allinstructions[1]) && $allinstructions[1][0] == 'p_open') { $wraps++; } $instructions = array_slice($allinstructions, $wraps, -$wraps); $outs[] = p_render('xhtml', $instructions, $byref_ignore); $ID = $oldid; break; default: $val = $this->_addPrePostFixes($column['type'], $val); //type '_img' or '_img<width>' if (substr($type, 0, 3) == 'img') { $width = (int) substr($type, 3); if (!$width) { $width = $this->getConf('image_width'); } list($mediaid, $title) = explode('|', $val, 2); if ($title === null) { $title = $column['key'] . ': ' . basename(str_replace(':', '/', $mediaid)); } else { $title = trim($title); } if (media_isexternal($val)) { $html = $R->externalmedia($mediaid, $title, $align = null, $width, $height = null, $cache = null, $linking = 'direct', true); } else { $html = $R->internalmedia($mediaid, $title, $align = null, $width, $height = null, $cache = null, $linking = 'direct', true); } if (strpos($html, 'mediafile') === false) { $html = str_replace('href', 'rel="lightbox" href', $html); } $outs[] = $html; } else { $outs[] = hsc($val); } } } return join(', ', $outs); }