functionen return funzt nicht

Alles, was PHP betrifft, kann hier besprochen werden.

Postby llcoolj24 » 17. January 2007 00:18

jetzt ist kein Fehler gekommen aber verstehe nicht wie das jetzt Funktionieren soll wenn ich den ajfsp link einfach ins Nachrichtenfeld kopiere dann bleibt er so wie ich ihn rein habe hab ich irgendwas übersehen ?Oder stell ich mich nur an ;)
llcoolj24
 
Posts: 4
Joined: 16. January 2007 23:50

Postby red171 » 17. January 2007 00:27

weis nich wo der fehler ist, hab auch grad nich die zeit mich drum zu kümmern

adde mich im icq

111617955 und wir reden da morgen drüber dann schau ich mir das mal an.

freundin is halt grad vorbei gekommen und die brauch aufmerksamkeit.. sry ^^
red171
 

Postby llcoolj24 » 17. January 2007 00:29

Alles klar melde mich morgen abend bei dir mal

thx

ll
llcoolj24
 
Posts: 4
Joined: 16. January 2007 23:50

Postby Dummy2005 » 14. March 2007 03:05

nabend, hat ihr das problem hinbekommen?
ich frag nur da ich vor einem ählichem stehe.

das ist der orginal-link:

ajfsp://file|KretaUrlaub2006.064.jpg|bf8fea66bbbcc40f721a07f866af0c8f|429795/


der link usw. wird "optisch" sauber in einen klickbaren links umgewandelt, auch die grösse wird angegeben:

KretaUrlaub2006.064.jpg 0.41 MB




mein problem ist das der link wenn man ihn anklickt in etwa so aussieht:

http://www.css-wut.de/wrc-portal/%5BURL=ajfsp://file|KretaUrlaub2006.064.jpg|bf8fea66bbbcc40f721a07f866af0c8f|429795/%5DKretaUrlaub2006.064.jpg%20%5B/URL%5D%200.41%20MB


ps: hallo red171 dieser code dürfte von dieser, oder? *gg*




<?php
************************************************************************************//
// * Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
// * Lisense GPL
// ************************************************************************************//

class parse {
var $search = array();
var $replace = array();
var $replace2 = array();

var $smilie_search = array();
var $smilie_replace = array();
var $smilie_search2 = array();
var $smilie_replace2 = array();

var $wrapwidth = 75;
var $hilight = '';
var $showimages = 0;
var $docensor = 0;
var $censorwords = array();
var $censorcover = '';
var $imgsearch = '';
var $imgreplace = '';
var $imgsearch2 = '';
var $imgreplace2 = '';
var $censorsearch = array();
var $censorreplace = array();

var $done = array();
var $cuturls = 0;
var $linenumbers = 1;

// (php - ) & code parse
var $usecode = 0;
var $index = array();
var $hash = '';
var $tempsave = array();

var $hilightSearch = '';
var $hilightReplace = '';

var $useCaching = 0;
var $urlCache = array();
var $breakChar = '';

function parse($docensor = 0, $wrapwidth = 0, $showimages = 0, $hilight = '', $usecode = 1, $cuturls = 1, $useCaching = 0) {
if (ENCODING == 'UTF-8') $this->breakChar = utf8_encode(chr(160));
else $this->breakChar = chr(160);
$this->done = array('bbcode' => 0, 'smilies' => 0);
$this->useCaching = $useCaching;

if ($hilight) $this->hilight = urldecode($hilight);
if ($docensor == 1) {
$this->docensor = 1;
global $censorwords, $censorcover;
$this->censorwords = explode("\n", preg_replace("/\s*\n\s*/", "\n", wbb_trim($censorwords)));
$this->censorcover = $censorcover;
}
if ($wrapwidth) $this->wrapwidth = $wrapwidth;
if ($showimages) $this->showimages = $showimages;
$this->prepareimages();
$this->cuturls = $cuturls;

if ($usecode == 1) $this->usecode = 1;

$this->generateHash();
}

function getsmilies() {
global $db, $n, $lang;
$i = 0;
$result = $db->unbuffered_query("SELECT smilieid, smiliecode, smiliepath, smilietitle FROM bb".$n."_smilies ORDER BY smilieorder ASC");
while ($row = $db->fetch_array($result)) {
$row['smilietitle'] = getlangvar($row['smilietitle'], $lang);

$this->smilie_search[] = "/".$this->preg_quote($row['smiliecode'])."/";
$this->smilie_replace[] = $this->breakChar . "{".$this->hash."_".$row['smilieid']."}" . $this->breakChar;

$this->smilie_search2[] = "/{".$this->hash."_".$row['smilieid']."}/";
if ($this->useCaching) $row['smiliepath'] = str_replace("{imagefolder}", "@@@imagefolder@@@", $row['smiliepath']);
$this->smilie_replace2[] = makeimgtag($row['smiliepath'], $row['smilietitle'], 0) . "\n";
}

$this->done['smilies'] = 1;
}


function getHilight($forBBCode = false) {
global $minwordlength;

if ($this->done['hilight'] == 1 && $forBBCode) {
if ($this->hilightSearch != '') {
$this->search[] = $this->hilightSearch;
$this->replace[] = $this->hilightReplace;
$this->replace2[] = '\\0';
}

return;
}

if ($this->hilight) {
$hilightwords = preg_replace("/[\/:;'\"\(\)\[\]?!#{}%\-+\\\\]/s", "", str_replace("/", "\/", quotemeta($this->hilight)));
$hilightwords = preg_replace("/\s{2,}/", " ", $hilightwords);
$hilightwords = preg_split("/[\s]/", wbb_strtolower($hilightwords), - 1, PREG_SPLIT_NO_EMPTY);
while (list($key, $word) = each($hilightwords)) {
if ($word == "and" || $word == "or" || $word == "not" || wbb_strlen($word) < $minwordlength) continue;

$word = addcslashes($word, '.|$=<>^');

$word = str_replace("*", "[0-9a-z]*", $word);
$word = str_replace("_", "[0-9a-z]{1}", $word);

if (!isset($hilightstring)) $hilightstring = $word;
else $hilightstring .= "|".$word;
}
if (isset($hilightstring)) {
$this->hilightSearch = "/(^|\s|\]|>|\")($hilightstring)(([,\.]{1}[\s[\"<$]+)|\s|\[|\"|<|$)/i";;
$this->hilightReplace = "\\1<span class=\"highlight\">\\2</span>\\3";

if ($forBBCode) {
$this->search[] = $this->hilightSearch;
$this->replace[] = $this->hilightReplace;
$this->replace2[] = '\\0';
}
}
}

$this->done['hilight'] = 1;
}


function insertBreakChar($text) {
$text = preg_replace("/([^\n\r ]{".($this->wrapwidth - 1)."})/i", "\\1$this->breakChar", $text);
return $text;
}


function getbbcode() {
global $db, $n, $style, $lang;

$this->search[] = "/\[list=(&quot;|['\"]?)([^\"']+)\\1](.+)\[\/list((=\\1[^\"']+\\1])|(\]))/esiU";
$this->replace[] = "\$this->formatlist('\\3', '\\2')";
$this->search[] = "/\
    (.+)\[\/list\]/esiU";
    $this->replace[] = "\$this->formatlist('\\1')";
    $this->search[] = "/\[url=(&quot;|['\"]?)([^\"']+)\\1](.+)\[\/url\]/esiU";
    $this->replace[] = "\$this->formaturl('\\2','\\3')";
    $this->search[] = "/\[url]([^\"\[]+)\[\/url\]/eiU";
    $this->replace[] = "\$this->formaturl('\\1')";
    $this->search[] = "/javascript:/i";
    $this->replace[] = "java script:";
    $this->search[] = "/vbscript:/i";
    $this->replace[] = "vb script:";
    $this->search[] = "/about:/i";
    $this->replace[] = "about :";

    // avoid wrapping
    $this->replace2[] = "'$this->breakChar[list=\\1$this->breakChar\\2$this->breakChar\\1]$this->breakChar'.\$this->stripSlashes('\\3').'$this->breakChar[/list=\\1$this->breakChar\\2$this->breakChar\\1]$this->breakChar'";
    $this->replace2[] = "'$this->breakChar
      $this->breakChar'.\$this->stripSlashes('\\1').'$this->breakChar
$this->breakChar'";
$this->replace2[] = "'$this->breakChar[url=\\1$this->breakChar'.\$this->insertBreakChar('\\2').'$this->breakChar\\1]$this->breakChar'.\$this->stripSlashes('\\3').'$this->breakChar[/url]$this->breakChar'";
$this->replace2[] = "'$this->breakChar[url]$this->breakChar' . \$this->insertBreakChar('\\1') . '$this->breakChar[/url]$this->breakChar'";
$this->replace2[] = "\\0";
$this->replace2[] = "\\0";
$this->replace2[] = "\\0";

$this->getHilight(true);

$threeparams = "/\[%s=(&quot;|['\"]?)(%s),(%s)\\1](%s)\[\/%s\]/siU";
$twoparams = "/\[%s=(&quot;|['\"]?)(%s)\\1](%s)\[\/%s\]/siU";
$oneparam = "/\[%s](%s)\[\/%s\]/siU";

$result = $db->unbuffered_query("SELECT bbcodetag, bbcodereplacement, params, multiuse, pattern1, pattern2, pattern3, eval_replacement FROM bb".$n."_bbcodes ORDER BY params ASC");

while ($row = $db->fetch_array($result)) {
if ($row['params'] == 1) {
if (!$row['pattern1']) $row['pattern1'] = ".*";
$search = sprintf($oneparam, $row['bbcodetag'], $row['pattern1'], $row['bbcodetag']);

$replace2 = "$this->breakChar[".$row['bbcodetag']."]$this->breakChar\\1$this->breakChar[/".$row['bbcodetag']."]$this->breakChar";
}
if ($row['params'] == 2) {
if (!$row['pattern1']) $row['pattern1'] = "[^\"']+";
if (!$row['pattern2']) $row['pattern2'] = ".*";
$search = sprintf($twoparams, $row['bbcodetag'], $row['pattern1'], $row['pattern2'], $row['bbcodetag']);

$replace2 = "$this->breakChar[".$row['bbcodetag']."=\\1$this->breakChar\\2$this->breakChar\\1]$this->breakChar\\3$this->breakChar[/".$row['bbcodetag']."]$this->breakChar";
}
if ($row['params'] == 3) {
if (!$row['pattern1']) $row['pattern1'] = "[^\"']+";
if (!$row['pattern2']) $row['pattern2'] = "[^\"']+";
if (!$row['pattern3']) $row['pattern3'] = ".*";
$search = sprintf($threeparams, $row['bbcodetag'], $row['pattern1'], $row['pattern2'], $row['pattern3'], $row['bbcodetag']);

$replace2 = "$this->breakChar[".$row['bbcodetag']."=\\1$this->breakChar\\2$this->breakChar,$this->breakChar\\3$this->breakChar\\1]$this->breakChar\\4$this->breakChar[/".$row['bbcodetag']."]$this->breakChar";
}

if ($row['eval_replacement'] == 1) {
eval("\$row['bbcodereplacement'] = \"".addcslashes($row['bbcodereplacement'], "\"\\")."\";");
}

for ($i = 0; $i < $row['multiuse']; $i++) {
$this->search[] = $search;
$this->replace[] = $row['bbcodereplacement'];
$this->replace2[] = $replace2;
}
}
$this->done['bbcode'] = 1;
}

function prepareimages() {
global $allowdynimg;

if ($allowdynimg == 1) $this->imgsearch = "/\[img]([^\"]+)\[\/img\]/siU";
else $this->imgsearch = "/\[img]([^\"\?\&]+\.(gif|jpg|jpeg|bmp|png))\[\/img\]/siU";
if ($this->showimages == 1) $this->imgreplace = "<img src=\"\\1\" alt=\"\" border=\"0\" class=\"resizeImage\" />";
else $this->imgreplace = "<a href=\"\\1\" target=\"_blank\">\\1</a>";

if ($allowdynimg == 1) $this->imgsearch2 = "/\[img]([^\"]+)\[\/img\]/esiU";
else $this->imgsearch2 = "/\[img]([^\"\?\&]+\.(gif|jpg|jpeg|bmp|png))\[\/img\]/esiU";
$this->imgreplace2 = "'$this->breakChar[img]$this->breakChar'%20.%20\$this->insertBreakChar('\\1')%20.%20'$this->breakChar[/img]$this->breakChar'";
}

function censor($post) {
if (count($this->censorsearch) == 0 || count($this->censorreplace) == 0) {
reset($this->censorwords);
while (list($key, $censor) = each($this->censorwords)) {
$censor = wbb_trim($censor);
if (!$censor) continue;

if (preg_match("/\{([^=]+)=([^=]*)\}/si", $censor, $exp)) {
$this->censorsearch[] = "/(^|\s|\]|>|\")(".$this->preg_quote($exp[1]).")(([,\.]{1}[\s[\"<$]+)|\s|\[|\"|<|$)/i";
$this->censorreplace[] = "\\1".$exp[2]."\\3";
}
elseif (preg_match("/\{([^=]+)\}/si", $censor, $exp)) {
$this->censorsearch[] = "/(^|\s|\]|>|\")(".$this->preg_quote($exp[1]).")(([,\.]{1}[\s[\"<$]+)|\s|\[|\"|<|$)/i";
$this->censorreplace[] = "\\1".str_repeat($this->censorcover, wbb_strlen($exp[1]))."\\3";
}
elseif (preg_match("/([^=]+)=([^=]*)/si", $censor, $exp)) {
$this->censorsearch[] = "/".$this->preg_quote($exp[1])."/i";
$this->censorreplace[] = $exp[2];
}
else {
$this->censorsearch[] = "/".$this->preg_quote($censor)."/i";
$this->censorreplace[] = str_repeat($this->censorcover, wbb_strlen($censor));
}
}
}
if (count($this->censorsearch) > 0 && count($this->censorreplace) > 0) return preg_replace($this->censorsearch, $this->censorreplace, $post);
else return $post;
}

//function doparse($post, $allowsmilies, $allowhtml, $allowbbcode, $allowimages) {
function doparse($post, $allowsmilies, $allowhtml, $allowbbcode, $allowimages, $selfposted=false, $threadstarter=false, $selfthx=false) {
// censorship
if ($this->docensor == 1) $post = $this->censor($post);

// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
// Lisense GPL ***Part 1***
$post = parse_ajfsp_links($post,0);
// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
// Lisense GPL ***END Part ***

// cache code
if ($this->usecode == 1 && $allowbbcode == 1) {
$this->tempsave['php'] = array();
$this->tempsave['code'] = array();
$this->index['php'] = -1;
$this->index['code'] = -1;
$post = preg_replace("/(\[(php|code)\])(.*)(\[\/\\2\])/seiU", "\$this->cachecode('\\3','\\2')", $post);
}

// avoid bbcode wrapping
if ($allowbbcode == 1) {
if ($this->done['bbcode'] != 1) $this->getbbcode();
$post = preg_replace($this->search, $this->replace2, $post);
if ($allowimages != 0) $post = preg_replace($this->imgsearch2, $this->imgreplace2, $post);
}

// cache smilies
if ($allowsmilies == 1) {
if ($this->done['smilies'] != 1) $this->getsmilies();

$post = preg_replace($this->smilie_search, $this->smilie_replace, $post);
}

// wrap text
$post = $this->textwrap($post);

// remove break chars
if ($allowbbcode == 1) {
$post = str_replace($this->breakChar, '', $post);
}

// remove tab
$post = str_replace("\t", " ", $post);

// html
if ($allowhtml == 0) {
$post = htmlconverter($post);
$post = nl2br($post);
}
else $post = preg_replace("/<([\/]?)script([^>]*)>/i", "&lt;\\1script\\2&gt;", $post);

// bbcodes
if ($allowbbcode == 1) {
if ($this->done['bbcode'] != 1) $this->getbbcode();
$post = preg_replace($this->search, $this->replace, $post);
}
else {
$post = preg_replace("/javascript:/i", "java script:", $post);
$post = preg_replace("/vbscript:/i", "vb script:", $post);
}

// images
if ($allowimages != 0) $post = preg_replace($this->imgsearch, $this->imgreplace, $post);

// replace smilies
if ($allowsmilies == 1) $post = preg_replace($this->smilie_search2, $this->smilie_replace2, $post);

// insert code
if ($this->usecode == 1 && $allowbbcode == 1 && ($this->index['php'] != -1 || $this->index['code'] != -1)) $post = $this->replacecode($post);

return $post;
}

function textwrap($text) {
if ($text && wbb_strlen($text) > $this->wrapwidth) {
$text = preg_replace("/([^\n\r$this->breakChar ]{".$this->wrapwidth."})/i", " \\1\n", $text);
return $text;
}
else return $text;
}


function cachecode($code, $mode) {
$mode = wbb_strtolower($mode);
$this->index[$mode]++;
$this->tempsave[$mode][$this->index[$mode]] = $code;
return "{".$this->hash."_".$mode."_".$this->index[$mode]."}";
}

function replacecode($post) {
reset($this->tempsave);
while (list($mode, $val) = each($this->tempsave)) {
while (list($varnr, $code) = each($val)) $post = str_replace("{".$this->hash."_".$mode."_".$varnr."}", $this->codeformat($code, $mode), $post);
}
return $post;
}

function stripSlashes($text) {
return str_replace("\\\"", "\"", $text);
}

function codeformat($code, $mode) {
global $tpl, $phpversion, $style, $lang, $filename;

if ($mode == "php") {
$phptags = 0;
$code = $this->stripSlashes($code);

if (!wbb_strpos($code, "<?") && wbb_substr($code, 0, 2) != "<?") {
$phptags = 1;
$code = "<?php ".wbb_trim($code)." ?>";
}
ob_start();
$oldlevel = error_reporting(0);
highlight_string($code);
error_reporting($oldlevel);
$buffer = ob_get_contents();
ob_end_clean();

$buffer = str_replace("<code>", "", $buffer);
$buffer = str_replace("</code>", "", $buffer);

if ($phptags == 1) {
if (version_compare($phpversion, "4.3.0") == -1 || version_compare($phpversion, "5.0.5") >= 0) $buffer = preg_replace("/([^\\2]*)(&lt;\?php&nbsp;)(.*)(&nbsp;.*\?&gt;)([^\\4]*)/si", "\\1\\3\\5", $buffer);
else if (version_compare($phpversion, "5.0.0RC1") == -1) $buffer = preg_replace("/([^\\2]*)(&lt;\?php )(.*)( .*\?&gt;)([^\\4]*)/si", "\\1\\3\\5", $buffer);
else {
$buffer = preg_replace("/([^\\2]*)(&lt;\?php )(.*)(\?&gt;)([^\\4]*)/si", "\\1\\3\\5", $buffer);
}
}

$buffer = preg_replace("/<font color=\"([^\"]*)\">/i", "<span style=\"color: \\1\">", str_replace("</font>", "</span>", $buffer));
if ($phptags == 1 && version_compare($phpversion, "4.3.0") != -1) $buffer = str_replace("<font</span>", "", $buffer);
$buffer = preg_replace("/<span style=\"([^\"]*)\">/i", "<span style='\\1'>", $buffer);
$buffer = str_replace("\"", "&quot;", $buffer);
$buffer = str_replace("{", "{", $buffer);
$buffer = str_replace("}", "}", $buffer);
$buffer = str_replace("\n", "", $buffer);
$buffer = str_replace("<br />", "\n", $buffer);

$linecount = wbb_substr_count($buffer, "\n") + 1;
$height = ($style['smallfontsize'] + 3) * $linecount + 50;

if ($this->linenumbers == 1) $linenumbers = $this->makeLineNumbers($buffer);
else $linenumbers = '';

eval("\$code = \"".$tpl->get("codephptag")."\";");
}
else {
$code = $this->stripSlashes($code);
$code = htmlconverter($code);
//$code = str_replace(" ", "&nbsp;", $code);
//$code = nl2br($code);

$code = str_replace("{", "{", $code);
$code = str_replace("}", "}", $code);

$linecount = wbb_substr_count($code, "\n") + 1;
$height = ($style['smallfontsize'] + 3) * $linecount + 50;

if ($this->linenumbers == 1) $linenumbers = $this->makeLineNumbers($code);
else $linenumbers = '';

eval("\$code = \"".$tpl->get("codetag")."\";");
}

return $code;
}

function formaturl($url, $title = '', $maxwidth = 60, $width1 = 40, $width2 = -15) {
// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 open in same window
// Lisense GPL ***Part 2***
if(strstr($url,"ajfsp")!="") return "<a href=\"$url\">".$title."</a>";
// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 open in same window
// Lisense GPL ***END Part 2***
if (!wbb_trim($title)) {
$title = rehtmlconverter($url);
if (!preg_match("/[a-z]:\/\//si", $url)) $url = "http://$url";
if ($this->cuturls == 1 && wbb_strlen($title) > $maxwidth) $title = wbb_substr($title, 0, $width1)."...".wbb_substr($title, $width2);
return "<a href=\"$url\" target=\"_blank\">".htmlconverter($this->stripSlashes($title))."</a>";
}
else {
if (!preg_match("/[a-z]:\/\//si", $url)) $url = "http://$url";
return "<a href=\"$url\" target=\"_blank\">".$title."</a>";
}
}

function formatlist($list, $listtype = '') {
$listtype = wbb_trim($listtype);
$listtype = ((!$listtype) ? ("") : (" type=\"$listtype\""));

$list = wbb_trim($list);
$list = $this->stripSlashes($list);

$list = amount_str_replace("</li>", "", str_replace("[*]", "</li><li>", $list), 1);
if (strstr($list, "<li>")) $list .= "</li>";

$list = preg_replace("/^.*(<li>)/sU", "\\1", $list);

if ($listtype) return "<ol$listtype>".$list."</ol>";
else return "<ul>".$list."</ul>";
}

function preg_quote($text) {
$text = preg_quote($text);
$text = str_replace("/", "\/", $text);
return $text;
}

function makeLineNumbers($code, $split = "\n") {
$lines = explode($split, $code);

$linenumbers = '';
for ($i = 0; $i < count($lines); $i++) $linenumbers .= ($i + 1).":\n";

return $linenumbers;
}

function generateHash() {
for ($i = 0; $i < 6; $i++) {
$time = intval(wbb_substr(microtime(), 2, 8));
mt_srand($time);

$this->hash .= mt_rand(0, 9);
}
}


function parseCache($post) {
global $style;

if ($this->done['hilight'] != 1) {
$this->getHilight();
}

if ($this->hilightSearch != '') {
$post = preg_replace($this->hilightSearch, $this->hilightReplace, $post);
}

$post = str_replace("@@@imagefolder@@@", $style['imagefolder'], $post);

return $post;
}
}

// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
// Lisense GPL ***Part 3***

function parse_ajfsp_links($beitrag, $modus = 0) {
if ('' == $beitrag) {
// wenn der Beitrag leer ist gleich wieder zurück
return false;
} else {
// Suche die Links im Beitrag und mache ein Array daraus
if (0 < ($link_vorhanden = preg_match_all('|(ajfsp:\/\/file)(.*)(\/)|U', $beitrag, $links))) {
$links = $links[0];
// jeden Link im Array bearbeiten
foreach($links as $key => $value) {
// mache ein Array aus dem Link
$neuer_link[$key] = explode('|', $value);
if (array_key_exists(1, $neuer_link[$key])) {
// hole den (Link)Dateinamen aus dem Array
$linkname = $neuer_link[$key][1];
} else {
// (Link)Dateinamen ist nicht vorhanden
$linkname = '';
}
if (array_key_exists(3, $neuer_link[$key])) {
// hole die (Link)Dateigröße aus dem Array
$linkgroesse = round($neuer_link[$key][3] / 1024 / 1024, 2);
} else {
// (Link)Dateigröße ist nicht vorhanden
$linkgroesse = 0;
}
// Schreibe den neuen Link in ein Array
// $neuer_link[$key] = '<a href="'.$links[$key].'" title="'.$linkname.'">'.$linkname.'</a> '.$linkgroesse.' [MB]';

$neuer_link[$key] = '[url='.$links[$key].']'.$linkname.'[/url] '.$linkgroesse.' MB';



}
// ersetze die Links im Beitrag
$beitrag_geparsed = str_replace($links, $neuer_link, $beitrag);
}
// 2. Parameter der Funktion überprüfen
switch ($modus) {
case 0:
// wenn Parameter 0 oder nicht vorhanden, gibt den geparsten Beitrag zurück
if ($link_vorhanden) {
return $beitrag_geparsed;;
} else {
return $beitrag;
}
break;

}
}
}

// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
// Lisense GPL *** END Part 3***






?>
MfG
Dummy2005
Dummy2005
 
Posts: 2
Joined: 14. March 2007 02:17

Postby red171 » 14. March 2007 11:20

das liegt dadran das du vorher den alten link nicht via code resetest

siehe diesen post: KLICK

btw: das script ist nicht von mir, lediglich ein teil davon =)
red171
 

Postby Dummy2005 » 16. March 2007 00:24

sooo, hab nun alle dokumente durchsucht und gelöscht was mit "ajfsp" zutun hatte.

meine "linkumwandlung" im forum funzt nun !!! *freu*

es wird lediglich der eintrag in der class_parse.php benötigt.

für die diejenigen es vielleicht auch brauchen.... hier der code:

(ps: es sind 3 abschnitte die an entsprechender stelle eingefügt werden müssen, einfach nach "Part 1" bzw. "Part 2" und "Part 3" suchen)


Code: Select all

<?php


class parse {
   var $search = array();
   var $replace = array();
   var $replace2 = array();
   
   var $smilie_search = array();
   var $smilie_replace = array();
   var $smilie_search2 = array();
   var $smilie_replace2 = array();
   
   var $wrapwidth = 75;
   var $hilight = '';
   var $showimages = 0;
   var $docensor = 0;
   var $censorwords = array();
   var $censorcover = '';
   var $imgsearch = '';
   var $imgreplace = '';
   var $imgsearch2 = '';
   var $imgreplace2 = '';
   var $censorsearch = array();
   var $censorreplace = array();
   
   var $done = array();
   var $cuturls = 0;
   var $linenumbers = 1;
   
   // (php - ) & code parse
   var $usecode = 0;
   var $index = array();
   var $hash = '';
   var $tempsave = array();
   
   var $hilightSearch = '';
   var $hilightReplace = '';
   
   var $useCaching = 0;
   var $urlCache = array();
   var $breakChar = '';
   
   function parse($docensor = 0, $wrapwidth = 0, $showimages = 0, $hilight = '', $usecode = 1, $cuturls = 1, $useCaching = 0) {
      if (ENCODING == 'UTF-8') $this->breakChar = utf8_encode(chr(160));
      else $this->breakChar = chr(160);
      $this->done = array('bbcode' => 0, 'smilies' => 0); 
      $this->useCaching = $useCaching;
      
      if ($hilight) $this->hilight = urldecode($hilight);
      if ($docensor == 1) {
         $this->docensor = 1;
         global $censorwords, $censorcover;
         $this->censorwords = explode("\n", preg_replace("/\s*\n\s*/", "\n", wbb_trim($censorwords)));
         $this->censorcover = $censorcover;
      }
      if ($wrapwidth) $this->wrapwidth = $wrapwidth;
      if ($showimages) $this->showimages = $showimages;
      $this->prepareimages();
      $this->cuturls = $cuturls;
      
      if ($usecode == 1) $this->usecode = 1;
      
      $this->generateHash();
   }
   
   function getsmilies() {
      global $db, $n, $lang;
      $i = 0;
      $result = $db->unbuffered_query("SELECT smilieid, smiliecode, smiliepath, smilietitle FROM bb".$n."_smilies ORDER BY smilieorder ASC");
      while ($row = $db->fetch_array($result)) {
         $row['smilietitle'] = getlangvar($row['smilietitle'], $lang);
         
         $this->smilie_search[] = "/".$this->preg_quote($row['smiliecode'])."/";
         $this->smilie_replace[] = $this->breakChar . "{".$this->hash."_".$row['smilieid']."}" . $this->breakChar;
         
         $this->smilie_search2[] = "/{".$this->hash."_".$row['smilieid']."}/";
         if ($this->useCaching) $row['smiliepath'] = str_replace("{imagefolder}", "@@@imagefolder@@@", $row['smiliepath']);
         $this->smilie_replace2[] = makeimgtag($row['smiliepath'], $row['smilietitle'], 0) . "\n";
      }
      
      $this->done['smilies'] = 1;
   }
   
   
   function getHilight($forBBCode = false) {
      global $minwordlength;
      
      if ($this->done['hilight'] == 1 && $forBBCode) {
         if ($this->hilightSearch != '') {         
            $this->search[] = $this->hilightSearch;
            $this->replace[] = $this->hilightReplace;
            $this->replace2[] = '\\0';
         }
      
         return;
      }

      if ($this->hilight) {
         $hilightwords = preg_replace("/[\/:;'\"\(\)\[\]?!#{}%\-+\\\\]/s", "", str_replace("/", "\/", quotemeta($this->hilight)));
         $hilightwords = preg_replace("/\s{2,}/", " ", $hilightwords);
         $hilightwords = preg_split("/[\s]/", wbb_strtolower($hilightwords), - 1, PREG_SPLIT_NO_EMPTY);
         while (list($key, $word) = each($hilightwords)) {
            if ($word == "and" || $word == "or" || $word == "not" || wbb_strlen($word) < $minwordlength) continue;
            
            $word = addcslashes($word, '.|$=<>^');
            
            $word = str_replace("*", "[0-9a-z]*", $word);
            $word = str_replace("_", "[0-9a-z]{1}", $word);
            
            if (!isset($hilightstring)) $hilightstring = $word;
            else $hilightstring .= "|".$word;
         }
         if (isset($hilightstring)) {
            $this->hilightSearch = "/(^|\s|\]|>|\")($hilightstring)(([,\.]{1}[\s[\"<$]+)|\s|\[|\"|<|$)/i";;
            $this->hilightReplace = "\\1<span class=\"highlight\">\\2</span>\\3";
            
            if ($forBBCode) {
               $this->search[] = $this->hilightSearch;
               $this->replace[] = $this->hilightReplace;
               $this->replace2[] = '\\0';
            }
         }
      }
      
      $this->done['hilight'] = 1;
   }
   
   
   function insertBreakChar($text) {
      $text = preg_replace("/([^\n\r ]{".($this->wrapwidth - 1)."})/i", "\\1$this->breakChar", $text);
      return $text;
   }
   
   
   function getbbcode() {
      global $db, $n, $style, $lang;
      
      $this->search[] = "/\[list=(&quot;|['\"]?)([^\"']+)\\1](.+)\[\/list((=\\1[^\"']+\\1])|(\]))/esiU";
      $this->replace[] = "\$this->formatlist('\\3', '\\2')";
      $this->search[] = "/\[list](.+)\[\/list\]/esiU";   
      $this->replace[] = "\$this->formatlist('\\1')";
      $this->search[] = "/\[url=(&quot;|['\"]?)([^\"']+)\\1](.+)\[\/url\]/esiU";
      $this->replace[] = "\$this->formaturl('\\2','\\3')";
      $this->search[] = "/\[url]([^\"\[]+)\[\/url\]/eiU";
      $this->replace[] = "\$this->formaturl('\\1')";
      $this->search[] = "/javascript:/i";
      $this->replace[] = "java script:";
      $this->search[] = "/vbscript:/i";
      $this->replace[] = "vb script:";
      $this->search[] = "/about:/i";
      $this->replace[] = "about :";
      
      // avoid wrapping
      $this->replace2[] = "'$this->breakChar[list=\\1$this->breakChar\\2$this->breakChar\\1]$this->breakChar'.\$this->stripSlashes('\\3').'$this->breakChar[/list=\\1$this->breakChar\\2$this->breakChar\\1]$this->breakChar'";
      $this->replace2[] = "'$this->breakChar[list]$this->breakChar'.\$this->stripSlashes('\\1').'$this->breakChar[/list]$this->breakChar'";
      $this->replace2[] = "'$this->breakChar[url=\\1$this->breakChar'.\$this->insertBreakChar('\\2').'$this->breakChar\\1]$this->breakChar'.\$this->stripSlashes('\\3').'$this->breakChar[/url]$this->breakChar'";
      $this->replace2[] = "'$this->breakChar[url]$this->breakChar' . \$this->insertBreakChar('\\1') . '$this->breakChar[/url]$this->breakChar'";
      $this->replace2[] = "\\0";
      $this->replace2[] = "\\0";
      $this->replace2[] = "\\0";
      
      $this->getHilight(true);
      
      $threeparams = "/\[%s=(&quot;|['\"]?)(%s),(%s)\\1](%s)\[\/%s\]/siU";
      $twoparams = "/\[%s=(&quot;|['\"]?)(%s)\\1](%s)\[\/%s\]/siU";
      $oneparam = "/\[%s](%s)\[\/%s\]/siU";
      
      $result = $db->unbuffered_query("SELECT bbcodetag, bbcodereplacement, params, multiuse, pattern1, pattern2, pattern3, eval_replacement FROM bb".$n."_bbcodes ORDER BY params ASC");
      
      while ($row = $db->fetch_array($result)) {
         if ($row['params'] == 1) {
            if (!$row['pattern1']) $row['pattern1'] = ".*";
            $search = sprintf($oneparam, $row['bbcodetag'], $row['pattern1'], $row['bbcodetag']);
            
            $replace2 = "$this->breakChar[".$row['bbcodetag']."]$this->breakChar\\1$this->breakChar[/".$row['bbcodetag']."]$this->breakChar";
         }
         if ($row['params'] == 2) {
            if (!$row['pattern1']) $row['pattern1'] = "[^\"']+";
            if (!$row['pattern2']) $row['pattern2'] = ".*";
            $search = sprintf($twoparams, $row['bbcodetag'], $row['pattern1'], $row['pattern2'], $row['bbcodetag']);
            
            $replace2 = "$this->breakChar[".$row['bbcodetag']."=\\1$this->breakChar\\2$this->breakChar\\1]$this->breakChar\\3$this->breakChar[/".$row['bbcodetag']."]$this->breakChar";
         }
         if ($row['params'] == 3) {
            if (!$row['pattern1']) $row['pattern1'] = "[^\"']+";
            if (!$row['pattern2']) $row['pattern2'] = "[^\"']+";
            if (!$row['pattern3']) $row['pattern3'] = ".*";
            $search = sprintf($threeparams, $row['bbcodetag'], $row['pattern1'], $row['pattern2'], $row['pattern3'], $row['bbcodetag']);
            
            $replace2 = "$this->breakChar[".$row['bbcodetag']."=\\1$this->breakChar\\2$this->breakChar,$this->breakChar\\3$this->breakChar\\1]$this->breakChar\\4$this->breakChar[/".$row['bbcodetag']."]$this->breakChar";
         }
         
         if ($row['eval_replacement'] == 1) {
            eval("\$row['bbcodereplacement'] = \"".addcslashes($row['bbcodereplacement'], "\"\\")."\";");
         }
         
         for ($i = 0; $i < $row['multiuse']; $i++) {
            $this->search[] = $search;
            $this->replace[] = $row['bbcodereplacement'];
            $this->replace2[] = $replace2;
         }
      }
      $this->done['bbcode'] = 1;
   }
   

   function prepareimages() {
      global $allowdynimg;
      
      if ($allowdynimg == 1) $this->imgsearch = "/\[img]([^\"]+)\[\/img\]/siU";
      else $this->imgsearch = "/\[img]([^\"\?\&]+\.(gif|jpg|jpeg|bmp|png))\[\/img\]/siU";
      if ($this->showimages == 1) $this->imgreplace = "<img src=\"\\1\" alt=\"\" border=\"0\" class=\"resizeImage\" />";
      else $this->imgreplace = "<a href=\"\\1\" target=\"_blank\">\\1</a>";
      
      if ($allowdynimg == 1) $this->imgsearch2 = "/\[img]([^\"]+)\[\/img\]/esiU";
      else $this->imgsearch2 = "/\[img]([^\"\?\&]+\.(gif|jpg|jpeg|bmp|png))\[\/img\]/esiU";
      $this->imgreplace2 = "'$this->breakChar[img]$this->breakChar' . \$this->insertBreakChar('\\1') . '$this->breakChar[/img]$this->breakChar'";
   }
   
   function censor($post) {
      if (count($this->censorsearch) == 0 || count($this->censorreplace) == 0) {
         reset($this->censorwords);
         while (list($key, $censor) = each($this->censorwords)) {
            $censor = wbb_trim($censor);
            if (!$censor) continue;
            
            if (preg_match("/\{([^=]+)=([^=]*)\}/si", $censor, $exp)) { 
               $this->censorsearch[] = "/(^|\s|\]|>|\")(".$this->preg_quote($exp[1]).")(([,\.]{1}[\s[\"<$]+)|\s|\[|\"|<|$)/i";                      
               $this->censorreplace[] = "\\1".$exp[2]."\\3";
            }
            elseif (preg_match("/\{([^=]+)\}/si", $censor, $exp)) {
               $this->censorsearch[] = "/(^|\s|\]|>|\")(".$this->preg_quote($exp[1]).")(([,\.]{1}[\s[\"<$]+)|\s|\[|\"|<|$)/i";
               $this->censorreplace[] = "\\1".str_repeat($this->censorcover, wbb_strlen($exp[1]))."\\3";
            }
            elseif (preg_match("/([^=]+)=([^=]*)/si", $censor, $exp)) {
               $this->censorsearch[] = "/".$this->preg_quote($exp[1])."/i";
               $this->censorreplace[] = $exp[2];
            }
            else {
               $this->censorsearch[] = "/".$this->preg_quote($censor)."/i";
               $this->censorreplace[] = str_repeat($this->censorcover, wbb_strlen($censor));
            }
         }
      }
      if (count($this->censorsearch) > 0 && count($this->censorreplace) > 0) return preg_replace($this->censorsearch, $this->censorreplace, $post);
      else return $post;
   }
   
   // function doparse($post, $allowsmilies, $allowhtml, $allowbbcode, $allowimages) {
   // function doparse($post, $allowsmilies, $allowhtml, $allowbbcode, $allowimages, $selfposted=false, $threadstarter=false) {
      function doparse($post, $allowsmilies, $allowhtml, $allowbbcode, $allowimages, $selfposted=false, $threadstarter=false, $selfthx=false) {
      // censorship
      if ($this->docensor == 1) $post = $this->censor($post);
      
      // Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
    // Lisense GPL ***Part 1***
         $post = parse_ajfsp_links($post,0);
    // Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
    // Lisense GPL ***END Part ***
      
      // cache code
      if ($this->usecode == 1 && $allowbbcode == 1) {
         $this->tempsave['php'] = array();
         $this->tempsave['code'] = array();
         $this->index['php'] = -1;
         $this->index['code'] = -1;
         $post = preg_replace("/(\[(php|code)\])(.*)(\[\/\\2\])/seiU", "\$this->cachecode('\\3','\\2')", $post);
      }
      
      // avoid bbcode wrapping
      if ($allowbbcode == 1) {
         if ($this->done['bbcode'] != 1) $this->getbbcode();
         $post = preg_replace($this->search, $this->replace2, $post);
         if ($allowimages != 0) $post = preg_replace($this->imgsearch2, $this->imgreplace2, $post);
      }
      
      // cache smilies
      if ($allowsmilies == 1) {
         if ($this->done['smilies'] != 1) $this->getsmilies();
         
         $post = preg_replace($this->smilie_search, $this->smilie_replace, $post);
      }
      
      // wrap text
      $post = $this->textwrap($post);
      
      // remove break chars
      if ($allowbbcode == 1) {
         $post = str_replace($this->breakChar, '', $post);
      }
      
      // remove tab
      $post = str_replace("\t", " ", $post);
      
      // html 
      if ($allowhtml == 0) {
         $post = htmlconverter($post);
         $post = nl2br($post);
      }
      else $post = preg_replace("/<([\/]?)script([^>]*)>/i", "&lt;\\1script\\2&gt;", $post);
      
    // hidden text
// if (check_hidden_text($post)) {
// global $wbbuserdata,$lang;
// if( $wbbuserdata['can_view_hide_without_posting'] || $threadstarter ) $post = preg_replace("=\[HIDE\](.*)\[/HIDE\]=siU", $lang->get("LANG_GLOBAL_HIDE_SHOW"), $post);
// elseif( $selfposted && $wbbuserdata['can_view_hide_after_posting'] ) $post = preg_replace("=\[HIDE\](.*)\[/HIDE\]=siU", $lang->get("LANG_GLOBAL_HIDE_SHOW"), $post);
// elseif( !$selfposted && $wbbuserdata['can_view_hide_after_posting'] ) $post = preg_replace("=\[HIDE\](.*)\[/HIDE\]=siU", $lang->get("LANG_GLOBAL_HIDE_REPLY_FIRST"), $post);
// elseif( !$wbbuserdata['can_view_hide_after_posting'] && !$wbbuserdata['can_view_hide_without_posting'] ) $post = preg_replace("=\[HIDE\](.*)\[/HIDE\]=siU", $lang->get("LANG_GLOBAL_HIDE_NA"), $post);
// }

    // hidden text
   if (check_hidden_text($post)) {
   global $wbbuserdata,$lang;
   if( $wbbuserdata['can_view_hide_without_posting'] || $threadstarter ) $post = preg_replace("=\[HIDE\](.*)\[/HIDE\]=siU", $lang->get("LANG_GLOBAL_HIDE_SHOW"), $post);
   elseif( ( $selfposted || $selfthx ) && $wbbuserdata['can_view_hide_after_posting'] ) $post = preg_replace("=\[HIDE\](.*)\[/HIDE\]=siU", $lang->get("LANG_GLOBAL_HIDE_SHOW"), $post);
   elseif( !$selfthx && !$selfposted && $wbbuserdata['can_view_hide_after_posting'] ) $post = preg_replace("=\[HIDE\](.*)\[/HIDE\]=siU", $lang->get("LANG_GLOBAL_HIDE_REPLY_FIRST"), $post);
   elseif( !$wbbuserdata['can_view_hide_after_posting'] && !$wbbuserdata['can_view_hide_without_posting'] ) $post = preg_replace("=\[HIDE\](.*)\[/HIDE\]=siU", $lang->get("LANG_GLOBAL_HIDE_NA"), $post);
   }


      // bbcodes
      if ($allowbbcode == 1) {
         if ($this->done['bbcode'] != 1) $this->getbbcode();
         $post = preg_replace($this->search, $this->replace, $post);
      }
      else {
         $post = preg_replace("/javascript:/i", "java script:", $post);
         $post = preg_replace("/vbscript:/i", "vb script:", $post);
      }
   
      // images
      if ($allowimages != 0) $post = preg_replace($this->imgsearch, $this->imgreplace, $post);
      
      // replace smilies
      if ($allowsmilies == 1) $post = preg_replace($this->smilie_search2, $this->smilie_replace2, $post);
      
      // insert code
      if ($this->usecode == 1 && $allowbbcode == 1 && ($this->index['php'] != -1 || $this->index['code'] != -1)) $post = $this->replacecode($post);
      
      return $post;
   }
   
   function textwrap($text) {
      if ($text && wbb_strlen($text) > $this->wrapwidth) {
         $text = preg_replace("/([^\n\r$this->breakChar ]{".$this->wrapwidth."})/i", " \\1\n", $text);
         return $text;
      }
      else return $text;
   }
   
   
   function cachecode($code, $mode) {
      $mode = wbb_strtolower($mode);
      $this->index[$mode]++;
      $this->tempsave[$mode][$this->index[$mode]] = $code;
      return "{".$this->hash."_".$mode."_".$this->index[$mode]."}";
   }
   
   function replacecode($post) {
      reset($this->tempsave);
      while (list($mode, $val) = each($this->tempsave)) {
         while (list($varnr, $code) = each($val)) $post = str_replace("{".$this->hash."_".$mode."_".$varnr."}", $this->codeformat($code, $mode), $post);
      }
      return $post;
   }
   
   function stripSlashes($text) {
      return str_replace("\\\"", "\"", $text);
   }
   
   function codeformat($code, $mode) {
      global $tpl, $phpversion, $style, $lang, $filename;
      
      if ($mode == "php") {
         $phptags = 0;
         $code = $this->stripSlashes($code);
         
         if (!wbb_strpos($code, "<?") && wbb_substr($code, 0, 2) != "<?") {
            $phptags = 1;
            $code = "<?php ".wbb_trim($code)." ?>";
         }
         ob_start();
         $oldlevel = error_reporting(0);
         highlight_string($code);
         error_reporting($oldlevel);
         $buffer = ob_get_contents();
         ob_end_clean();
         
         $buffer = str_replace("<code>", "", $buffer);
         $buffer = str_replace("</code>", "", $buffer);
         
         if ($phptags == 1) {
            if (version_compare($phpversion, "4.3.0") == -1  || version_compare($phpversion, "5.0.5") >= 0) $buffer = preg_replace("/([^\\2]*)(&lt;\?php&nbsp;)(.*)(&nbsp;.*\?&gt;)([^\\4]*)/si", "\\1\\3\\5", $buffer);
            else if (version_compare($phpversion, "5.0.0RC1") == -1) $buffer = preg_replace("/([^\\2]*)(&lt;\?php )(.*)( .*\?&gt;)([^\\4]*)/si", "\\1\\3\\5", $buffer);
            else {
               $buffer = preg_replace("/([^\\2]*)(&lt;\?php )(.*)(\?&gt;)([^\\4]*)/si", "\\1\\3\\5", $buffer);   
            }
         }
         
         $buffer = preg_replace("/<font color=\"([^\"]*)\">/i", "<span style=\"color: \\1\">", str_replace("</font>", "</span>", $buffer));
         if ($phptags == 1 && version_compare($phpversion, "4.3.0") != -1) $buffer = str_replace("<font</span>", "", $buffer);
         $buffer = preg_replace("/<span style=\"([^\"]*)\">/i", "<span style='\\1'>", $buffer);
         $buffer = str_replace("\"", "&quot;", $buffer);
         $buffer = str_replace("{", "{", $buffer);
         $buffer = str_replace("}", "}", $buffer);
         $buffer = str_replace("\n", "", $buffer);
         $buffer = str_replace("<br />", "\n", $buffer);
         
         $linecount = wbb_substr_count($buffer, "\n") + 1;
         $height = ($style['smallfontsize'] + 3) * $linecount + 50;
         
         if ($this->linenumbers == 1) $linenumbers = $this->makeLineNumbers($buffer);
         else $linenumbers = '';
         
         eval("\$code = \"".$tpl->get("codephptag")."\";");
      }
      else {
         $code = $this->stripSlashes($code);
         $code = htmlconverter($code);
         //$code = str_replace(" ", "&nbsp;", $code);
         //$code = nl2br($code);
         
         $code = str_replace("{", "{", $code);
         $code = str_replace("}", "}", $code);
         
         $linecount = wbb_substr_count($code, "\n") + 1;
         $height = ($style['smallfontsize'] + 3) * $linecount + 50;
         
         if ($this->linenumbers == 1) $linenumbers = $this->makeLineNumbers($code);
         else $linenumbers = '';
         
         eval("\$code = \"".$tpl->get("codetag")."\";");
      }
      
      return $code;
   }
   
   function formaturl($url, $title = '', $maxwidth = 60, $width1 = 40, $width2 = -15) {
// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 open in same window
  // Lisense GPL ***Part 2***
       if(strstr($url,"ajfsp")!="") return "<a href=\"$url\">".$title."</a>";
  // Parse aj-Links by Rocky (c)2007 vers.0.1.070115 open in same window
  // Lisense GPL ***END Part 2***
      if (!wbb_trim($title)) {
         $title = rehtmlconverter($url);
         if (!preg_match("/[a-z]:\/\//si", $url)) $url = "http://$url";
         if ($this->cuturls == 1 && wbb_strlen($title) > $maxwidth) $title = wbb_substr($title, 0, $width1)."...".wbb_substr($title, $width2);
         return "<a href=\"$url\" target=\"_blank\">".htmlconverter($this->stripSlashes($title))."</a>";
      }
      else {
         if (!preg_match("/[a-z]:\/\//si", $url)) $url = "http://$url";
         return "<a href=\"$url\" target=\"_blank\">".$title."</a>";
      }
   }
   
   function formatlist($list, $listtype = '') {
      $listtype = wbb_trim($listtype);
      $listtype = ((!$listtype) ? ("") : (" type=\"$listtype\""));
      
      $list = wbb_trim($list);
      $list = $this->stripSlashes($list);
      
      $list = amount_str_replace("</li>", "", str_replace("[*]", "</li><li>", $list), 1);
      if (strstr($list, "<li>")) $list .= "</li>";
      
      $list = preg_replace("/^.*(<li>)/sU", "\\1", $list);
      
      if ($listtype) return "<ol$listtype>".$list."</ol>";
      else return "<ul>".$list."</ul>";
   }
   
   function preg_quote($text) {
      $text = preg_quote($text);
      $text = str_replace("/", "\/", $text);
      return $text;
   }
   
   function makeLineNumbers($code, $split = "\n") {
      $lines = explode($split, $code);   
      
      $linenumbers = '';
      for ($i = 0; $i < count($lines); $i++) $linenumbers .= ($i + 1).":\n";   
      
      return $linenumbers;   
   }
   
   function generateHash() {
      for ($i = 0; $i < 6; $i++) {
         $time = intval(wbb_substr(microtime(), 2, 8));
         mt_srand($time);
         
         $this->hash .= mt_rand(0, 9);   
      }
   }
   
   
   function parseCache($post) {
      global $style;
      
      if ($this->done['hilight'] != 1) {
         $this->getHilight();
      }
      
      if ($this->hilightSearch != '') {
         $post = preg_replace($this->hilightSearch, $this->hilightReplace, $post);
      }
      
      $post = str_replace("@@@imagefolder@@@", $style['imagefolder'], $post);
      
      return $post;
   }
}

// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
// Lisense GPL ***Part 3***

function parse_ajfsp_links($beitrag, $modus = 0) {
    if ('' == $beitrag) {
        // wenn der Beitrag leer ist gleich wieder zurück
        return false;
    } else {
        // Suche die Links im Beitrag und mache ein Array daraus
        if (0 < ($link_vorhanden = preg_match_all('|(ajfsp:\/\/file)(.*)(\/)|U', $beitrag, $links))) {
            $links = $links[0];
            // jeden Link im Array bearbeiten
            foreach($links as $key => $value) {
                // mache ein Array aus dem Link
                $neuer_link[$key] = explode('|', $value);
                if (array_key_exists(1, $neuer_link[$key])) {
                    // hole den (Link)Dateinamen aus dem Array
                    $linkname = $neuer_link[$key][1];
                } else {
                    // (Link)Dateinamen ist nicht vorhanden
                    $linkname = '';
                }
                if (array_key_exists(3, $neuer_link[$key])) {
                    // hole die (Link)Dateigröße aus dem Array
                    $linkgroesse = round($neuer_link[$key][3] / 1024 / 1024, 2);
                } else {
                    // (Link)Dateigröße ist nicht vorhanden
                    $linkgroesse = 0;
                }
                // Schreibe den neuen Link in ein Array
                // $neuer_link[$key] = '<a href="'.$links[$key].'" title="'.$linkname.'">'.$linkname.'</a> '.$linkgroesse.' [MB]';

                // ORGINAL (Fetdruck & Farbe-Rot): $neuer_link[$key] = '[URL='.$links[$key].'][B][COLOR=red]'.$linkname.'[/COLOR][/URL] '.$linkgroesse.' MB[/B]';
                                                   $neuer_link[$key] = '[URL='.$links[$key].']'.$linkname.' [/URL] '.$linkgroesse.' MB';


            }
            // ersetze die Links im Beitrag
            $beitrag_geparsed = str_replace($links, $neuer_link, $beitrag);
        }
        // 2. Parameter der Funktion überprüfen
        switch ($modus) {
            case 0:
            // wenn Parameter 0 oder nicht vorhanden, gibt den geparsten Beitrag zurück
            if ($link_vorhanden) {
                return $beitrag_geparsed;;
            } else {
                return $beitrag;
            }
            break;

        }
    }
}

// Parse aj-Links by Rocky (c)2007 vers.0.1.070115 based on red171
// Lisense GPL *** END Part 3***





?>
MfG
Dummy2005
Dummy2005
 
Posts: 2
Joined: 14. March 2007 02:17

Previous

Return to PHP

Who is online

Users browsing this forum: No registered users and 2 guests