kann das leider nicht finden in der index.php
<?php
//Benötigte Dateien und Variablen von phpBB
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, LINKS);
init_userprefs($userdata);
if (!isset($HTTP_GET_VARS['id']) && !isset($HTTP_GET_VARS['vote'])) {
$page_title = 'Links';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'links_body.tpl'
)
);
$folder_weblink = $images['folder_weblink'];
$vote_link = $images['folder_weblink'];
$vote_weblink_up = $images['vote_weblink_up'];
$vote_weblink_down = $images['vote_weblink_down'];
$template->assign_block_vars('links', array(
'LINKS' => $lang['Links'],
'FOLDER_WEBLINK_IMG' => $folder_weblink,
'VOTE_WEBLINK_UP_IMG' => $vote_weblink_up,
'VOTE_WEBLINK_DOWN_IMG' => $vote_weblink_down,
'NAME_DESC' => $lang['Name_Desc'],
'VISITS' => $lang['Visits'],
'POINTS' => $lang['Points'],
));
$sql='SELECT * FROM ' . LINKS_TABLE . '';
if(!$result = $db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not obtain links', '', __LINE__, __FILE__, $sql);
}
while($row = $db->sql_fetchrow($result))
{
$template->assign_block_vars('links.linkrow', array(
'LINKNAME' => $row['name'],
'LINKDESCRIPTION' => $row['description'],
'LINKVISITS' => $row['visits'],
'LINKPOINTS' => $row['points'],
'SHOWLINK' => ''.$_SERVER['PHP_SELF'].'?id='.$row['id'].'',
'UPLINK' => ''.$_SERVER['PHP_SELF'].'?id='.$row['id'].'&vote=up',
'DOWNLINK' => ''.$_SERVER['PHP_SELF'].'?id='.$row['id'].'&vote=down',
));
}
$template->pparse('body');
//Footer - nur dann weglassen, wenn du auch den Header weglässt
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
}
elseif (isset($HTTP_GET_VARS['id']) && !isset($HTTP_GET_VARS['vote'])) {
$id = $HTTP_GET_VARS['id'];
$sql= 'SELECT visits,url FROM ' . LINKS_TABLE . ' WHERE id = '.$id.'';
if(!$result = $db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not obtain information for this link', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$url = $row['url'];
$old_visits = $row['visits'];
$new_visits = $old_visits + 1;
$sql = 'UPDATE '. LINKS_TABLE .'
SET visits = '.$new_visits.'
WHERE id = '.$id.'';
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not obtain link information', '', __LINE__, __FILE__, $sql);
}
else {
header('Location:'.$url.'');
}
}
elseif (isset($HTTP_GET_VARS['vote'])) {
$id = $HTTP_GET_VARS['id'];
$vote = $HTTP_GET_VARS['vote'];
$sql= 'SELECT points FROM ' . LINKS_TABLE . ' WHERE id = '.$id.'';
if(!$result = $db->sql_query($sql)) {
message_die(GENERAL_ERROR, 'Could not obtain information for this link', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$points = $row['points'];
if ($vote == 'up') {
$new_points = $points + 1;
}
elseif ($vote == 'down') {
$new_points = $points - 1;
}
$sql = 'UPDATE '. LINKS_TABLE .'
SET points = '.$new_points.'
WHERE id = '.$id.'';
if ( !$db->sql_query($sql, BEGIN_TRANSACTION) )
{
message_die(GENERAL_ERROR, 'Could not obtain link information', '', __LINE__, __FILE__, $sql);
}
else {
header('Location:'.$_SERVER['PHP_SELF'].'');
}
}
?>
