require_once('common.inc.php');
$sql = "SELECT * FROM `node` where `status` = '1' AND `type` = 'book' ORDER BY `id` DESC, `publishing_date` DESC LIMIT 0,10";
$rs = $db->query($sql);
$f = 0;
$list = "";
while($row=$db->fetch_array($rs)){
$photo = get_attachment("node",$row['id'],"cover");
if(file_exists("./".$photo["path"].'original/'.$photo["file_name"])){
list($width, $height, $type, $attr) = getimagesize("./".$photo["path"].'original/'.$photo["file_name"]);
if($height<=$width){
$imgset = 'width="119"';
}else{
$imgset = 'height="149"';
}
$img = '';
} else {
if($row['cover']!=0&&$row['cover']!='')
{
$sql_cover = "SELECT * FROM `file_managed` WHERE `fid` = '".$row['cover']."' AND `status` = '1' LIMIT 0,1";
$row_cover = $db->getrow($sql_cover);
if($row_cover['filename']!=''){
if( file_exists('./upload/products/original/'.$row_cover['filename'])){
list($width, $height, $type, $attr) = getimagesize('./upload/products/original/'.$row_cover['filename']);
if($height<=$width){
$imgset = 'width="119"';
}else{
$imgset = 'height="149"';
}
$img = '
';
} else {
$img = '
';
}
} else {
$img = '
';
}
} else
{
$img = '
';
}
}
if ($f == 0) {
$list .= '
| '.$img.' |
| '.$row['title'].' |
';
}
} else {
$img = '
';
}
} else
{
$img = '
';
}
}
$popular_list .= '|
'.$row['author'].'
|
|