You Are Here : /var/www/virtual/tvarditsa.org/pages/ |
Current File : /var/www/virtual/tvarditsa.org/pages/news.php |
<table align="center" cellspacing="0" cellpadding="5" border="0" width="100%"><tr> <td width="15%" bgcolor="#ff0000" style="color: #ffffff;"><big><b>Актуално</b></big></td> <td bgcolor="#dedede"> <marquee SCROLLDELAY=20 SCROLLAMOUNT=1 onmouseover="this.stop()" onmouseout="this.start()" TRUESPEED><? mysql_query('SET NAMES cp1251'); $qa='SELECT * FROM new_bg WHERE status =2 ORDER BY id deSC LIMIT 0 , 1'; $qa= mysql_query($qa); while ($resa=mysql_fetch_array($qa)){ echo "<a href=\"index2.php?lang=bg&page=80&idnews=".$resa[id]."\">".$resa[title]."</a>"; }?></marquee> </td> </tr></table> <?include ("../classes/pager.class.php"); function StripStory ($story, $n = NULL, $maxc = NULL) { $strip_sent_delim = ".?!"; $strip_word_delim = ",;)}]+-=&"; $strip_more = " ..."; if ($n == NULL) $n = 6; if ($maxc == NULL) $maxc = 1800; $story_len = strlen($story); // ignore html tags $replaced_story = preg_replace( "/(<[^>]*>)/e", "str_pad(' ', strlen('\\1'))", $story ); // ignore urls $replaced_story = preg_replace("/((http|ftp|mailto):\/\/[\.\-\w^\s]*[\s^\w\.\-])/e", "str_pad(' ',strlen('\\1'))", $replaced_story); $sentences = preg_split('/['.quotemeta($strip_sent_delim).']/' , $replaced_story ); $p = 0; $counter = -1; $s_counter = 0; while (++$counter < sizeof($sentences)) { if (trim($sentences[$counter]) == '') { $p += strlen($sentences[$counter]) + 1; continue; } $s_counter++; $p += strlen($sentences[$counter]) + 1; if ($s_counter >= $n) break; if ($p > $maxc) break; } if ($p > $maxc) { return preg_replace( '/(.*)([\s'.quotemeta ($strip_sent_delim.$strip_word_delim).']+[^\s'.quotemeta ( $strip_sent_delim.$strip_word_delim ).']*)$/', "\\1", substr($story, 0, $maxc) ).$strip_more; } if (($p + 5) > $story_len) return $story; return substr($story, 0, $p - 1).$strip_more; } if((int)$_GET['idnews']!=0){ $one = new Pager(); $one->set_records (-1); $one->set_condition("id =".(int)$_GET['idnews']); $i_one=$one->create ('new_'.$language,'*'); ?> <table cellspacing="0" cellpadding="2" border="0" style="border: 1px solid Black;" width="95%" align="center"> <tr> <td align="center"><font size="2"><strong><?= $i_one['data'][0]['title']?></strong></font></td> <td align="right" ><em>Дата:<?= $i_one['data'][0]['posted']?> </em></td> </tr> <tr> <td colspan="2"><?if($i_one['data'][0]['pic']!=''){ $width=''; list($width, $height) = getimagesize("admin/pic_news/".$i_one['data'][0]['pic']); if($width>430)$width=430; ?> <table cellspacing="0" cellpadding="0" border="0" align="left"> <tr><td><img src="admin/pic_news/<?=$i_one['data'][0]['pic']?>" alt="" style="border: 1px solid Black;" width="<?=$width?>" ></td></tr> </table><? }?> <? $strz = nl2br($i_one['data'][0]['story']); echo "<span>".$strz."</span>"; ?> </td> </tr> </table> <table width="95%" align="center"> <tr> <td><img src="../img/spacer.gif" alt="" width="400" height="2" border="0"></td> </tr> </table> <br> <br> <?} $offset= (int)$_GET['offset']; $news=new Pager(); $news->set_offset ($offset); $news->set_records (10); $news->set_order ('posted DESC'); //$news->debug=true; $i = $news->create ('new_'.$language,'*');?> <table align="center" cellspacing="0" cellpadding="0" border="0" width="90%"> <tr> <td align="center"> <font size="3"><strong> Всички новини</strong></font><br> </td> </tr> <? if($i['data']) foreach($i['data'] as $br =>$data_news){?> <tr> <td bgcolor="#F7F8EF" style="border: 1px solid Black;" valign="top"> <table cellspacing="0" cellpadding="2" border="0"> <tr> <td align="center"><a href="index2.php?lang=<?=$language?>&page=<?=$_GET['page']?>&offset=<?= $_['offset'];?>&idnews=<?=$data_news['id']?>"><font size="2"><strong><?= $data_news['title']?></strong></font></a></td> </tr> <tr> <td><?if($data_news['pic']!=''){ $width=''; list($width, $height) = getimagesize("admin/pic_news/".$data_news['pic']); if($width>430)$width=430; ?> <table cellspacing="0" cellpadding="0" border="0" align="left"> <tr><td><img src="admin/pic_news/<?=$data_news['pic']?>" alt="" style="border: 1px solid Black;" width="<?=$width?>" ></td></tr> </table><? }?> <? $storito = $data_news['story']; $storito = strip_tags($storito); echo substr($storito, 0, 180); ?> <br><br><a href="index2.php?lang=<?=$language?>&page=<?=$_GET['page']?>&offset=<?= $_['offset'];?>&idnews=<?=$data_news['id']?>"><font style=" font-size: 10px;">пълният текст</font></a> | Дата:<?= $data_news['posted']?></td> </tr> </table> </td> </tr> <tr><td> </td></tr> <?}?> </table> <table align="center" width="530" border="0" cellspacing="0" cellpadding="2" bgcolor="#3A6C9C"> <tr> <td><font size="1" color="#ffffff">Новини: <strong> <?= (int)$offset+1; ?> ÷ <?= sizeof ($i['data'])+(int)$offset; ?> от <?= (int)$i['total']; ?></strong></font></td> <td align="right"><font size="1" color="#ffffff">Страници: </font><?php if ($i['prev_g'] >= 0 ) { ?><font size="1"> </font><a href="index2.php?lang=<?=$language?>&page=<?=$_GET['page']?>&offset=<?= $i['prev_g']; ?>"><font size="1" color="#ffffff">[ << ]</font></a><font size="1"> </font><?php } if ($i['prev'] >= 0 ) { ?><font size="1"> </font><a href="index2.php?lang=<?=$language?>&page=<?=$_GET['page']?>&offset=<?= $i['prev']; ?>"><font size="1" color="#ffffff">[ < ]</font></a><font size="1"> </font><?php } if (is_array($i['pages'])) foreach ($i['pages'] as $newsid => $newsof) { ?><font size="1"> </font><a href="index2.php?lang=<?=$language?>&page=<?=$_GET['page']?>&offset=<?= $newsof; ?> "><font size="1" color="<?php if ($newsof == $offset) echo "#000000"; else echo "#ffffff"; ?>"><strong>[ <?= $newsid; ?> ]</strong></font></a><font size="1"> </font><?php } if ($i['next'] > 0 ) { ?><font size="1"> </font><a href="index2.php?lang=<?=$language?>&page=<?=$_GET['page']?>&offset=<?= $i['next']; ?>"><font size="1" color="#ffffff">[ > ]</font></a><font size="1"> </font><?php } if ($i['next_g'] > 0 ) { ?><font size="1"> </font><a href="index2.php?lang=<?=$language?>&page=<?=$_GET['page']?>&offset=<?= $i['next_g']; ?>"><font size="1" color="#ffffff">[ >> ]</font></a><font size="1"> </font><?php } ?></td> </tr> </table><br>