hiroshimamovi
Active Member
This is the code of the module.
It worked in dle 9.5 after upgrading to 9.8 DLE does not work anymore: all the links pointing to non-existent pages that start with / 1969/12/31 /.
How I can fix it ?
Thanks Hiro
It worked in dle 9.5 after upgrading to 9.8 DLE does not work anymore: all the links pointing to non-existent pages that start with / 1969/12/31 /.
Code:
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
/*
---------------------------------------------
Ìîäóëÿ âûâîäà ñëó÷àéíîé íîâîñòè èç áàçû ñàéòà
---------------------------------------------
Àâòîð: Maxic
Îáíîâèë è èñïðàâèë: Yeti
---------------------------------------------
*/
$kol = 100; // le nombre de caracteres dans la sortie de la section nouvelles breves
$maxWidth = 150; // largeur maximale de l'image
$maxHeight = 150; // la hauteur maximale de l'image
$db->query("SELECT COUNT(*) FROM ".PREFIX ."_post");
$row = $db->get_row();
$offset = mt_rand(0, $row['COUNT(*)']-1);
$db->query("SELECT * FROM ".PREFIX ."_post LIMIT 1 OFFSET $offset");
$row = $db->get_row();
preg_match_all( '|<img[\s]+src[\s]*=[\s]*\"([^\"]*)\"|', $row['short_story'], $matches );
if ($matches[1][0] != '') {
$imageinfo = @getimagesize($matches[1][0]);
$width = $imageinfo[0];
$height = $imageinfo[1];
if ($width > $height) {
$fltRatio = floatval($maxWidth / $width);
} else {
$fltRatio = floatval($maxHeight / $height);
}
$intNewWidth = intval($fltRatio * $width);
$intNewHeight = intval($fltRatio * $height);
$pic = '<center><img src="'.$matches[1][0].'" width="'.$intNewWidth.'" height="'.$intNewHeight.'"></center>';
} else {$img = '';}
$news_r = '<b>'.ucfirst($row['title']).'</b>';
if ($pic != '') {$news_r .= '<br>'.$pic;}
$story = strip_tags($row['short_story']);
if ($config['allow_alt_url'] == "yes") {
if ($row['flag'] AND $config['seo_type']) {
if ($row['category'] AND $config['seo_type'] == 2) {
$full_link = $config['http_home_url'].get_url($row['category'])."/".$row['id']."-".$row['alt_name'].".html";
}
else {$full_link = $config['http_home_url'].$row['id']."-".$row['alt_name'].".html";}}
else {$full_link = $config['http_home_url'].date('Y/m/d/', $row['date']).$row['alt_name'].".html";}}
else { $full_link = $config['http_home_url']."index.php?newsid=".$row['id']; }
if (strlen($story) >= 0) {$news_r .= '<br>'.substr($story,0,$kol).'...<br><a href="'.$full_link.'">read news</a>';}
echo $news_r;
echo "\n<!-- Copyright by_WeBBster (http://power-dle.com) -->\r\n";
?>
How I can fix it ?
Thanks Hiro