Das wundert mich doch sehr. Wir müssten mal zwei Änderungen durchführen:
1. Öffne deine include/functions.inc.php
2. Suche nach "function serendipity_track_url"
3. Ändere diese Funktion in folgendes:
Code: Select all
function serendipity_track_url($list, $url, $entry_id = 0) {
global $serendipity;
$url_parts = parse_url($url);
$q = sprintf(
"UPDATE %s%s
SET count = count + 1
WHERE scheme = '%s'
AND host = '%s'
AND port = '%s'
AND path = '%s'
AND query = '%s'
AND day = '%s'
%s",
$serendipity['dbPrefix'],
$list,
serendipity_db_escape_string($url_parts['scheme']),
serendipity_db_escape_string($url_parts['host']),
serendipity_db_escape_string($url_parts['port']),
serendipity_db_escape_string($url_parts['path']),
serendipity_db_escape_string($url_parts['query']),
date('Y-m-d'),
($entry_id != 0) ? "AND entry_id = '". (int)$entry_id ."'" : ''
);
serendipity_db_query($q);
if (serendipity_db_affected_rows() == 0) {
$q2 = sprintf(
"INSERT INTO %s%s
(entry_id, day, count, scheme, host, port, path, query)
VALUES (%d, '%s', 1, '%s', '%s', '%s', '%s', '%s')",
$serendipity['dbPrefix'],
$list,
(int)$entry_id,
date('Y-m-d'),
serendipity_db_escape_string($url_parts['scheme']),
serendipity_db_escape_string($url_parts['host']),
serendipity_db_escape_string($url_parts['port']),
serendipity_db_escape_string($url_parts['path']),
serendipity_db_escape_string($url_parts['query'])
);
serendipity_db_query($q2);
}
$fp = fopen($serendipity['serendipityPath'] . 'exit.log', 'a');
fwrite($fp, $q . "\n\n" . $q2 . "\n-------------------------------------\n");
fclose($fp);
}
4. Öffne deine plugins/serendipity_plugin_entrylinks/serendipity_plugin_entrylinks.php Datei
5. Ersetze die function generate_content() mit folgendem:
Code: Select all
function generate_content(&$title)
{
global $serendipity;
$title = $this->get_config('title', $this->title);
if (!isset($serendipity['GET']['id']) || !is_numeric($serendipity['GET']['id'])) {
return false;
} else {
$id = serendipity_db_escape_string($serendipity['GET']['id']);
}
$target = '';
$newwin = $this->get_config('newwin', 'false');
$wordwrap = $this->get_config('wordwrap', 30);
$maxref = $this->get_config('maxref', 15);
$orderby = $this->get_config('orderby', 'fullcount');
if ($newwin == 'true') {
$target = ' target="_blank" ';
}
$counter = array();
if ($this->get_config('show_exits', 'true') == 'true') {
$q = "SELECT SUM(count) as fullcount, scheme, host, port, path, query, " . serendipity_db_concat("scheme, '://', host, ':', port, path, '?', query") . " AS fulllink FROM {$serendipity['dbPrefix']}exits WHERE entry_id = " . $id . " GROUP BY scheme,host,port,path,query";
$exits = serendipity_db_query($q);
if (is_array($exits)) {
foreach($exits AS $key => $row) {
$url = sprintf('%s://%s%s%s%s',
$row['scheme'],
$row['host'],
(!empty($row['port']) ? ':' . $row['port'] : ''),
$row['path'],
(!empty($row['query']) ? '?' . $row['query'] : '')
);
$counter[$url] = $row['fullcount'];
}
}
}
$references = serendipity_db_query("SELECT link, max(name) as name FROM {$serendipity['dbPrefix']}references WHERE entry_id = " . $id . " GROUP BY link");
$fp = fopen($serendipity['serendipityPath'] . 'exit.log', 'a');
fwrite($fp, $q . "\n\n" . print_r($counter, true) . "\n\n" . print_r($references, true) . "\n");
fclose($fp);
if (is_array($references)) {
$links = '<ul style="margin: 5px; padding: 10px; text-align: left">';
foreach($references AS $key => $row) {
if (empty($row['name']) || empty($row['link'])) {
continue;
}
$count = '';
if (isset($counter[$row['link']])) {
$count = '<br /><div style="text-align: right; margin: 0px">[' . $counter[$row['link']] . ']</div>';
}
$link_name = $wordwrap < 1? $row['name']: wordwrap($row['name'], $wordwrap, "<br />", 1);
$links .= '<li><a href="' . $row['link'] . '" ' . $target . '>' . $link_name . "</a>$count</li>";
}
$links .= '</ul>';
if ($this->get_config('markup', 'true') == 'true') {
$entry = array('html_nugget' => $links, 'entry_id' => $id);
serendipity_plugin_api::hook_event('frontend_display', $entry);
echo $entry['html_nugget'];
} else {
echo $links;
}
}
if ($this->get_config('show_referers', 'true') == 'true') {
$ref = serendipity_db_query("SELECT SUM(count) as fullcount, scheme, host, port, path, query, " . serendipity_db_concat("scheme, '://', host, ':', port, path, '?', query") . " AS fulllink FROM {$serendipity['dbPrefix']}referrers WHERE entry_id = " . $id . " GROUP BY scheme,host,port,path,query ORDER BY $orderby DESC LIMIT $maxref");
if (is_array($ref)) {
echo PLUGIN_ENTRYLINKS_REFERERS . '<ul style="margin: 5px; padding: 10px; text-align: left">';
foreach($ref AS $key => $row) {
$url = sprintf('%s://%s%s%s%s',
$row['scheme'],
$row['host'],
(!empty($row['port']) ? ':' . $row['port'] : ''),
$row['path'],
(!empty($row['query']) ? '?' . $row['query'] : '')
);
echo '<li><a href="' . $url . '" ' . $target . '>' . wordwrap($row['host'], $wordwrap, "<br />", 1) . '</a><br /><div style="text-align: right; margin: 0px;">[' . $row['fullcount'] . "]</div></li>";
}
echo '</ul>';
}
}
}
Wie Du vielleicht gesehen hast, sollte jetzt die Datei "exit.log" in deinem Serendipity Stammverzeichnis geschrieben werden wenn man auf einen Link klickt und wenn die Links ausgelesen werden.
Bitte klicke einmal auf einen Link und lasse dir dann den artikel nochmal anzeigen und speichere dann die exit.log Datei auf
http://nopaste.php-q.net/ so dass ich sie mir mal ansehen kann.
Viele Grüße,
Garvin