вопрос
Всем привет. Я сделал вывод всех оценок пользователя в его профиле, все вроде работает, но не хочет работать навигация. В чем моя ошибка?
Вот коды хака:
Вывод данных выводится классом .userrating
Вот коды хака:
<?php
@session_start();
@error_reporting ( E_ALL ^ E_WARNING ^ E_NOTICE );
@ini_set ( 'display_errors', true );
@ini_set ( 'html_errors', false );
@ini_set ( 'error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE );
define( 'DATALIFEENGINE', true );
define( 'ROOT_DIR', substr( dirname( __FILE__ ), 0, -12 ) );
define( 'ENGINE_DIR', ROOT_DIR . '/engine' );
include ENGINE_DIR . '/data/config.php';
if( $config['http_home_url'] == "" ) {
$config['http_home_url'] = explode( "engine/ajax/rating_profile.php", $_SERVER['PHP_SELF'] );
$config['http_home_url'] = reset( $config['http_home_url'] );
$config['http_home_url'] = "http://" . $_SERVER['HTTP_HOST'] . $config['http_home_url'];
}
require_once ENGINE_DIR . '/classes/mysql.php';
require_once ENGINE_DIR . '/data/dbconfig.php';
require_once ENGINE_DIR . '/modules/functions.php';
$name = $db->safesql(iconv("UTF-8","windows-1251//IGNORE",$_POST['name']));
$limit = 10;
$pp = max(1,intval($_POST['pp']));
$cstart = ($pp-1)*$limit;
$sql = $db->query("SELECT p.id as pid,p.date as pdate,p.title as ptitle,p.category as pcategory,p.alt_name as palt_name,l.value as logval,l.date as logdate FROM " . PREFIX . "_logs l LEFT JOIN ".PREFIX."_post p ON l.news_id=p.id WHERE l.member='$name' AND p.id ORDER BY l.date DESC LIMIT {$cstart},{$limit}");
$list = "";
while($row = $db->get_row($sql)){
if($row['logdate']){
if( date( 'Ymd', $row['logdate'] ) == date( 'Ymd', $_TIME ))
$date = $lang['time_heute'] . date( ", H:i", $row['logdate'] );
elseif( date( 'Ymd', $row['logdate'] ) == date( 'Ymd', ($_TIME - 86400)))
$date = $lang['time_gestern'] . date( ", H:i", $row['logdate'] );
else
$date = date("d.m.Y",$row['logdate']);
}
else
$date = "- - -";
if($row['logval']>0)
$stat = "plus";
elseif($row['logval']<0)
$stat = "minus";
else
$stat .= "none";
$row['pdate'] = strtotime( $row['pdate'] );
$row['pcategory'] = intval( $row['pcategory'] );
if( $config['allow_alt_url'] == "yes" ) {
if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 ) {
if( $row['pcategory'] and $config['seo_type'] == 2 )
$full_link = $config['http_home_url'] . get_url( $row['pcategory'] ) . "/" . $row['pid'] . "-" . $row['palt_name'] . ".html";
else
$full_link = $config['http_home_url'] . $row['pid'] . "-" . $row['palt_name'] . ".html";
}
else
$full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['pdate'] ) . $row['palt_name'] . ".html";
}
else
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['pid'];
if(dle_strlen($row['ptitle'], $config['charset']) > 50)
$title = strip_tags(stripslashes(dle_substr($row['ptitle'], 0, 50, $config['charset'])." ..."));
else
$title = strip_tags(stripslashes($row['ptitle']));
$list .= "<li><a href=\"{$full_link}\" class=\"ostat-{$stat}\"><span>{$date}</span>{$title}</a></li>";
}
$count = $db->super_query("SELECT COUNT(*) as count FROM ".PREFIX."_logs WHERE member='$name'");
if($count['count']>$limit){
$cstart = $pp;
$count = $count['count'];
$end_page = ceil($count/$limit);
if($cstart>$end_page) $cstart = $end_page;
if($cstart<2)
$navigation = "<span class=\"usernavistart\"></span>";
else {
$prev = $cstart - 1;
$navigation = "<a href=\"#\" onclick=\"rating_profile('{$name}',{$prev});return false;\" class=\"usernavistart\" title=\"Назад\"></a>";
}
$navigation .= "<div class=\"opages\">";
for($i=1;$i<=$end_page;$i++){
if($cstart==$i)
$navigation .= "<span class=\"usernaviposi\">{$i}</span>";
else
$navigation .= "<a href=\"#\" onclick=\"rating_profile('{$name}',{$i});return false;\">{$i}</a>";
}
$navigation .= "</div>";
if($cstart==$end_page)
$navigation .= "<span class=\"usernaviend\"></span>";
else {
$next = min($cstart+1,$end_page);
$navigation .= "<a href=\"#\" onclick=\"rating_profile('{$name}',{$next});return false;\" class=\"usernaviend\" title=\"Вперед\"></a>";
}
}
$db->close();
@header( "Content-type: text/html; charset=" . $config['charset'] );
echo '<div class="ostats_rows">
<ul>
'.$list.'
</ul>
<div class="onavi">
'.$navigation.'
</div>
</div>';
?>
function rating_profile(name, p) {
ShowLoading("");
$.post(dle_root+'engine/ajax/rating_profile.php',{name:name, pp:p},function(data){
jQuery(".userrating").fadeOut('fast', function() {jQuery(this).fadeIn('fast').html(data);})
HideLoading("");
});
return false;
}
<div class="ublock big user-page-content collapsed" style="margin-top:5px;">
<span class="minimize" onclick="ShowOrHide('urating'); rating_profile('{usertitle}', 1); return false;"> </span>
<div class="utitle">Ваши оценки новостей <span class="counter_block tipsy-right" title="Количество оценок"></span></div>
<div id="urating" class="ucontent userrating" style="display: none;"></div>
</div>
Вывод данных выводится классом .userrating