Code: Select all
<?php
/*
---------------------------------------------
DataLife Engine, Word Press, Joomla And Drupal
---------------------------------------------
http://www.cms-pedia.com
---------------------------------------------
*/
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
$kol = 100; // êîëè÷åñòâî ñèìâîëîâ â âûâîäå êîðîòêîé íîâîñòè â áëîêå
$maxWidth = 150; // ìàêñèìàëüíàÿ øèðèíà èçîáðàæåíèÿ
$maxHeight = 150; // ìàêñèìàëüíàÿ âûñîòà èçîáðàæåíèÿ
$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).'...<a href="'.$full_link.'">Read More</a>';}
?>here is the whole news_r.php ..
Plz help me in solving this problem
Thanks