Your IP : 216.73.216.170


Current Path : /var/www/iplanru/data/old/www/i-plan.ru/modules/mod_searcharticle/
Upload File :
Current File : /var/www/iplanru/data/old/www/i-plan.ru/modules/mod_searcharticle/helper.php

<?php
defined ( '_JEXEC' ) or die ( 'Restricted access' );

class modSearchArticleHelper {
	public function getArticles($articlesCount){
		$db = &JFactory::getDBO();
		$query = "SELECT * FROM #__articles ORDER BY date DESC;";
		$db->setQuery($query);
		$result = $db->loadObjectList();
		$i=1;
		$text=$_GET['text'];
		if ($text[0]=='!'){
			$name=1; 
			$text=substr($text,1);
		}
		$text = strtr($text, "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩљЫЬЭЮЯ", "абвгдеёжзийклмнопрстуфхцчшщъыьэюя");
		$text1 = explode(' ', $text);
		echo "<table>";
		foreach ( $result as $row ) {
			include("introtext.php");
			$articletext = strip_tags($row->about.' '.$row->oglav.' '.$row->prilog);
			if ($name==1){
				$articletext = $row->title;
			}
			$articletext = strtr($articletext, "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩљЫЬЭЮЯ", "абвгдеёжзийклмнопрстуфхцчшщъыьэюя");
			foreach ($text1 as $text2){
				if (strpos($articletext, $text2) == 0){
					continue 2;
				}
			}
			if ($row->type == "mi"){
				$type = "mi";
				$type1 = "mi";
				$imgext = "gif";
			}
			else {
				$type = "";
				$type1 = "bp";
				$imgext = "png";
			}
			$price = $row->price;
			$date = $row->date;
			str_split($date);
			$date1 = $date[8].$date[9].".".$date[5].$date[6].".".$date[2].$date[3];
			$img = $type1."/".$type1."_".$row->id.".".$imgext;
			if ($i%2==1){ 
				echo "<tr><td>";
			}
			else {
				echo "<td>";
			}	
			echo "<table style=\"border: 1px solid #d2d2d2; width:300px; margin-bottom:5px;\"><tr><td width=\"164\"><a style=\"float:left\" href=\"$type1.php?id=$row->id\"><img src=\"images/stories/$img\" width=\"150\" alt=\"$row->title\" style=\"float:left; margin:5px; \"></a></td>		<td valign=\"top\"><p>Название: $row->title</p>\n<p><a href=\"$type1.php?id=$row->id\" style=\"color:red; font-weight:bold; text-decoration:underline;\">Описание</a></p><p>Дата создания: $date1</p><p style=\"font-weight:bold;\">$price</p><p>Демо-версия:</p><p><a target=\"_blank\" href=\"pdf/$row->id.pdf\" style=\"color:red; font-weight:bold; text-decoration:underline;\">Скачать</a></p><p><a href=\"".$type."buy.php?buyid=$row->id\" style=\"color:red; font-weight:bold; text-decoration:underline;\">Купить</a></p></td></tr></table>";
			if ($i%2==1){
				echo "</td>";
			}
			else {
				echo "</td></tr>";
			}
			$i++;
			if($i > $articlesCount){break;}
		}
		if ($i%2==0){ echo "</tr>";}
		echo "</table>";
		if($i==1){
			echo "К сожалению ничего не найдено, попробуйте еще раз.";
		}
	}
}
?>