Ejemplo n.º 1
0
function MarkupToHTML($pagename, $text)
{
    # convert wiki markup text to HTML output
    global $MarkupRules, $BlockCS, $BlockVS, $K0, $K1, $RedoMarkupLine;
    array_unshift($BlockCS, array());
    array_unshift($BlockVS, '');
    $markrules = BuildMarkupRules();
    foreach ((array) $text as $l) {
        $lines[] = htmlspecialchars($l, ENT_NOQUOTES);
    }
    $out = array();
    while (count($lines) > 0) {
        $x = array_shift($lines);
        $RedoMarkupLine = 0;
        foreach ($markrules as $p => $r) {
            if (substr($p, 0, 1) == '/') {
                $x = preg_replace($p, $r, $x);
            } elseif ($p == '' || strstr($x, $p) !== false) {
                $x = eval($r);
            }
            if (isset($php_errormsg)) {
                echo "pat={$p}";
                unset($php_errormsg);
            }
            if ($RedoMarkupLine) {
                $lines = array_merge((array) $x, $lines);
                continue 2;
            }
        }
        if ($x > '') {
            $out[] = "{$x}\n";
        }
    }
    $x = Block('block');
    if ($x > '') {
        $out[] = "{$x}\n";
    }
    array_shift($BlockCS);
    array_shift($BlockVS);
    return implode('', (array) $out);
}
Ejemplo n.º 2
0
function ggtracker()
{
    rem($ref, $_ENV['yt']['ref'], refe);
    #.refe  Car déjà enregistré
    $files = "ico|eot|ttf|js|css|htc|woff|swf|xml|gif|png|bmp|flv|mp(3|4)|exe|jpe?g|aspx?";
    #bad extensions
    $bp = "~\\?(jsr?|css|rss)|Final|visuall|zsimu|contact2?\\.php|suivi|s74.fr|4Test|(zsimu|2001|admin|intranet|sql)/|z/\\!|/!|/y/|\\.({$files})\$~i";
    #bad url
    $bR = "~(a74|xzxzx|dc10)\\.fr|frontaliers\\.info|yahooapi|url=|\\.(s?html|{$files})\$~i";
    #bad referer : can't be the referer,ex:referal spam
    #shall be recorded on first step !
    if (stripos(' ' . $ref . refe, '<a href')) {
        Block(array('badref', $ref . refe));
    } elseif (h == 'cli') {
        $x = 'cli';
    } elseif (bots) {
        $x = 'bots';
    } elseif (!$GLOBALS['tracker']) {
        $x = '!tracker';
    } elseif ($GLOBALS['notracker']) {
        $x = 'notracker';
    } elseif ($_ENV['yt']['lw'] + 600 > now) {
        $x = 'lw<600';
    } elseif (Preg_Match('~SID|css|js|jsr~is', q)) {
        $x = 'badq';
    } elseif (Preg_Match("~\\.({$files})\$~is", u)) {
        $x = 'badfiletype';
    } elseif (Preg_Match("~yandsearch|saihm|seoheap|internesdedijon|(a74|xzxzxz)\\.fr~is", REFE . Q . $ref)) {
        $x = 'badref';
    } elseif (Preg_Match("~(Tag|2|zsimu|qform|contact2?)\\.php|Final|dev3|/(3p|mut|!r|\\?|sql|2001|intranet)~is", u)) {
        $x = 'badurl';
    } elseif (Preg_Match($bp, $ref, $t)) {
        $x = 'ref:badpat(u)';
    } elseif (Preg_Match($bp, u, $t2)) {
        $x = 'url:badpat';
    } elseif (Preg_Match($bR, refe . $ref, $t3)) {
        $x = 'ref:badpat(R)';
    } elseif (preg_match("~\\.(php|s?html?)\$~", u)) {
        $x = 11;
    } elseif (strpos(substr($v, -5), '.') > -1) {
        $x = 'is not php or shtml : other filetype';
    } else {
        $x = 12;
    }
    #unknown
    if (!is_numeric($x)) {
        null;
    } else {
        G2('k1');
        #si le fichier existe déjà sur le serveur, cette valeur est récupérée, puis inserée de nouveau pour marquer l'autre site avec le meme mot clés
        #$y=Preg_replace('`&(babsrc|affid|mntrid|channel|client|clientcop|source|gs_rfai|ei|btng|spell|resnum|sourceid|channel|filetype|vertical|_iceurlflag|_iceurl)=([^&]+)`is','',$y);
        $y = str_replace(array('search/z/results/', '/fr/results/index/q/', 'search/', 'search?w=tot', 'as_q=', 'custom&q=', '&aqa=', '&aqp=', '/web/', 'rdata=', 'lts/&q='), '&q=', $ref);
        $y = str_replace(array('search/srpcache', 'linkdoctor', 'toggle=1', 'sa=n', 'ei=', 'prmd=mc', 'hl=fr', 'rls=', 'org.mozilla:fr', ':official', 'firefox-a', 'http://', 'www.', 'fr.', 'search.', 'aq=', 'oq=', 'aqi=', 'fkt=', 'fsdt=', 'fr=yfp-t-703', 'meta=lr', 'source=hp', 'aql=', 'hs=', 'tbo=s', 'rlz=', 'searchal', 'utf-8', 'ie=', 'oe=', 'sourceid=', 'nabclient', 'gfns=', '/bottomnavigation', '/relevance', '%22', 'recherche google', 'ved=', 'ct=', 'sa=x', 'oi=spell', 'rlz=', 'hl=fr', 'oq=', 'linkdoctor', 'safari', 'redir_esc=', 'ie=', 'oe=', 'utf-8', 'aq=', 'rls=', 'org.mozilla:', 'fr:official', 'meta=', 'gs_rfai=', 'aqi=', 'ql=', 'navclient', 'usg=', 'vc=', 'safe=', 'active', 'com.microsoft', 'en-gb', 'searchbox', 'ecofree.org/search.php', 'pid=', 'search.daum.net', 'results&', 'itag=ody', 'search&', '&hl=fr', 'topnavigation/', 'relevance/', 'iq=true/', 'zoom=off/', '=7', '&oq=', '&aq=', '&cx=', 'partner-', 'mb-', 'pub-'), '&', $y);
        $y = trim(Preg_replace("~[&]{2,}~", '&', $y), ' &');
        $mots = kwd($y);
        #travaux de nettoyage du referrer =)
        if ($mots && !strpos($mots, 'provided') && !in_Array($mots, array('', ':'))) {
            $mots = Tridecoder($mots);
            $mots = Preg_replace("~((google|yahoo|bing|yandex|gooofullcom|vizzeo|.?chiadah|find\\.eu|ke\\.voila|voila|seexie|askpeter|iadah|yougoo|yhs4|ecosia)\\.|search;|cx=|goooful|(\\.fr)?iadah\\.com).*|\\.it\$~is", '', $mots);
            $trop = explode(',', "_,</a>,< a>,<a href=,refineobj:video,google.ca,google.ci,google.co.uk ,url ,google.fr ,google.com ,search ,hl=en,sa=t,spider.htm");
            $mots = trim(str_replace($trop, '', $mots));
            #synchronisation des bibliothècas,maintenance
            if (preg_match("~^.(ttp&%2f%2f|ttp:)~is", $mots) or strlen($mots) < 3) {
                Null;
            } elseif ($_ENV['yt']['mots'] == $mots || $_ENV['yt']['fmt']['kw'] + 600 > NOW) {
                null;
            } else {
                #Nouveau mot clé
                if (preg_match("~q=([^&]+)~is", $mots, $t)) {
                    $mots = $t[1];
                }
                if (Preg_Match_ALL("~" . BKW . "~i", $mots, $t)) {
                    Block($t[0], $mots);
                }
                #blockage de l'IP et throw 404
                if (Preg_Match("~bestof~is", U)) {
                    $mots = '';
                }
                #cancel
                if ($mots) {
                    #if(!$_ENV['yt']){$_ENV['yt']=Array();DBM('!yt',"<pre>".STARTER."-$mots</pre>",'a6');}$i=$_ENV['yt'];
                    $yt2 = array('lw' => NOW, 'date' => date("Y/m/d H:i:s"), 'mots' => $mots, array('fmt' => array('kw' => NOW)));
                    if ($_ENV['yt']['mots']) {
                        $yt2['mots-1'] = $_ENV['yt']['mots'];
                    }
                    #DBM('ggt',"<pre>$mots,".print_r($_ENV['yt'],1).'</pre>','gg9');
                    if (Preg_Match("~gclid=|aclk\\?~is", $_ENV['yt']['ref'])) {
                        $yt2['adwords'] = $mots;
                    } elseif (0) {
                        #insertions sql //todo:file_append puis écriture en lots
                        $x2 = sql5("UPDATE CSF set site='" . H . "',hits=hits+1,ip='" . IP . "',time=" . NOW . ",date=now(),Ref=\"{$ref}\" {$s1} where url=\"" . SU . "\" and keyword=\"{$mots}\" order by id ASC limit 1");
                        if ($x2 < 1) {
                            sql5("INSERT INTO CSF(ip,Ref,site,keyword,url,position,time,date)VALUES('" . IP . "',\"{$ref}\",'" . H . "',\"{$mots}\",\"" . SU . "\",'{$pos}'," . NOW . ",NOW())");
                        }
                        #INSERT INTO CSF SET key = 'key', generation = 'generation' ON DUPLICATE KEY UPDATE key = 'key', generation = (generation + 1);
                    }
                    #$_SESSION['st1']=$magic;#$_SESSION['mots']=$mots;
                    $magic = "{$mots};" . $_ENV['yt']['dlp'] . ";" . $_ENV['yt']['ref'];
                    setcookie('kw', $mots, 1484045758);
                    setcookie('dlp', $magic, 1484045758);
                }
            }
            if (is_array($yt2)) {
                $_ENV['yt'] = Array_merge($_ENV['yt'], $yt2);
                FAP(IPF, $_ENV['yt']);
            }
            redef('motcle', $mots);
        }
    }
}
Ejemplo n.º 3
0
function MarkupToHTML($pagename,$text) {
  # convert wiki markup text to HTML output
  global $MarkupPatterns,$K0,$K1;

  ksort($MarkupPatterns);
  foreach($MarkupPatterns as $n=>$a)
    foreach($a as $p=>$r) $markpats[$p]=$r;
  foreach((array)$text as $l) $lines[] = htmlspecialchars($l,ENT_NOQUOTES);
  while (count($lines)>0) {
    $x = array_shift($lines);
    foreach($markpats as $p=>$r) {
      if (substr($p,0,1)=='/') $x=preg_replace($p,$r,$x); 
      elseif ($p=='' || strstr($x,$p)!==false) $x=eval($r);
      if (is_null($x)) continue 2;
    }
    if ($x>'') $out[] = "$x\n";
  }
  $x = Block('block');
  if ($x>'') $out[] = "$x\n";
  return implode('',(array)$out);
}
Ejemplo n.º 4
0
function ReMapTree($x)
{
    if (strpos($x, '|')) {
        Block('| scan');
        return;
    }
    #construit l'arborescence manquante
    if (strpos($x, '/')) {
        $v = explode('/', $x);
        $fin = array_pop($v);
        if (is_dir(implode('/', $v))) {
            null;
        } else {
            db("mkdir {$x}");
            foreach ($v as $w) {
                if (!is_dir($w)) {
                    mkdir($w);
                }
            }
        }
    }
}