X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=www%2Fplugins-dist%2Fstatistiques%2Finc%2Freferenceurs.php;fp=www%2Fplugins-dist%2Fstatistiques%2Finc%2Freferenceurs.php;h=11e9ea821bf3efe4d3937376589d423ac8deb841;hb=a33c2ba9d919664b3bb0f565f8e9a8b9d8530cdb;hp=0000000000000000000000000000000000000000;hpb=8945248b3d948385798d9aa355c70e7089aca2b3;p=lhc%2Fweb%2Fclavette_www.git diff --git a/www/plugins-dist/statistiques/inc/referenceurs.php b/www/plugins-dist/statistiques/inc/referenceurs.php new file mode 100644 index 0000000..11e9ea8 --- /dev/null +++ b/www/plugins-dist/statistiques/inc/referenceurs.php @@ -0,0 +1,169 @@ + ''); + } + else { + for ($cnt = 0; $cnt0){ + if (preg_match(",".$arr_engines[$cnt][1]."([^\&]*),", $query, $vals)){ + $keywords = urldecode($vals[2]); + } + } + } else { + $keywords = ""; + } + + if (($kw_referer_host=="Google") + || ($kw_referer_host=="AOL" && strpos($query, 'enc=iso')===false) + || ($kw_referer_host=="MSN") + ){ + include_spip('inc/charsets'); + if (!isset($ie) OR !$cset = $ie) $cset = 'utf-8'; + $keywords = importer_charset($keywords, $cset); + } + $buffer["hostname"] = $kw_referer_host; + } + } + } + } + + $buffer["host"] = $host; + $buffer["scheme"] = $scheme; + if (!isset($buffer["hostname"]) OR !$buffer["hostname"]) + $buffer["hostname"] = $host; + + $buffer["path"] = substr($path, 1, strlen($path)); + $buffer["query"] = $query; + + if ($keywords!=''){ + if (strlen($keywords)>150){ + $keywords = spip_substr($keywords, 0, 148); + // supprimer l'eventuelle entite finale mal coupee + $keywords = preg_replace('/&#?[a-z0-9]*$/', '', $keywords); + } + $buffer["keywords"] = trim(entites_html(urldecode(stripslashes($keywords)))); + } + + return $buffer; + +} + +/** + * Recherche des articles pointes par le referer + * http://doc.spip.org/@referes + * + * @param $referermd5 + * @param string $serveur + * @return string + */ +function referes($referermd5, $serveur = ''){ + $retarts = sql_allfetsel('J2.id_article, J2.titre', 'spip_referers_articles AS J1 LEFT JOIN spip_articles AS J2 ON J1.id_article = J2.id_article', "(referer_md5='$referermd5' AND J1.maj>=DATE_SUB(".sql_quote(date('Y-m-d H:i:s')).", INTERVAL 2 DAY))", '', "titre", '', '', $serveur); + + foreach ($retarts as $k => $rowart){ + $titre = typo($rowart['titre']); + $url = generer_url_entite($rowart['id_article'], 'article', '', '', TRUE); + $retarts[$k] = "$titre"; + } + + if (count($retarts)>1) + return '→ '.join(',
→ ', $retarts); + if (count($retarts)==1) + return '→ '.array_shift($retarts); + return ''; +} + + +?>