View file modules/blogs/inc/default.php

File size: 2.75Kb
<?
if( ! defined( 'SHCMS_ENGINE' ) ) {
    die('SHCMS Engine No access');
}

if($id_user == true) 
{
		    
	if(empty($userq['name']) or empty($userq['family']) and $id_user == true) 
	{
			    
		echo engine::error(Lang::__('Чтобы создать блог необходимо вводить Имя и Фамилию в вашем профиле'));
	
	}else 
		{
			if($userq['group'] == 15) {
				
				$viewb = '<a href="?do=newcat">'.Lang::__('Новая категория').'</a>&nbsp;|&nbsp;';
				
			}
				
				$viewb .= '<a href="?do=newblog">'.Lang::__('Создать блог').'</a>';
				
		}
}			
			
		echo '<div class="mainname">'.Lang::__('Все блоги').'<span class="time">'. $viewb .'</span></div>';
		echo '<div class="mainpost">';
		
		$row = $db->get_array($db->query("SELECT COUNT(*) FROM `blogs`")); 
		$newlist = new Navigation($row[0],25, true); 
            
        if( $row[0] > 0 ) 
		{	
		
			$viewf = $db->query( "SELECT * FROM `blogs` ORDER BY `id` DESC ". $newlist->limit()."" );
		
		}else {
		
		    echo engine::error(Lang::__('Блогов не найдено!'));
			exit;
		
		}			    
			while( $view = $db->get_array( $viewf ) ) 
			{
				$profile = $db->get_array($db->query( "SELECT * FROM `users` WHERE `id` = '".$view['id_user']."'" ));
				$id_nick = $user->users($view['id_user'],array('id'),false);
							

					$userprof  = '<a href="?do=editb&id='.$view['id'].'"><img src="/engine/template/icons/edit.png"></a>&nbsp;';
					$userprof .= '<a href="?do=deleteb&id='.$view['id'].'"><img src="/engine/template/icons/delete.png"></a>';
						
				echo  '<div class="posts_gl">';			
				echo  '<table cellspacing="0" callpadding="0" width="100%"><tr>';				
				echo'<td style="font-size:13px;" class="name" colspan="10"><b>'.$view['name'].'</b>';
				
					if($view['id_user'] == $id_user OR $userq['group'] == 15) 
					{
						echo'<span class="time">'.$userprof.'</span>';
					}
				
						echo'<div class="details">
						<span><img src="/engine/template/icons/author.png">&nbsp;Автор:&nbsp;<a href="/modules/profile.php?id='.$id_nick.'">'.$profile['name'].'&nbsp;'.$profile['family'].'</a></span>
						<span><img src="/engine/template/icons/date.png">&nbsp;'.date::make_date($view['time']).'</span><b>
						</b></div>';
						echo'</td></tr>';
			    		echo  '<tr><td class="content" colspan="10">'. engine::input_text($view['mtext']) .'<hr/><a style="text-decoration: underline;" href="?do=view&id='.$view['id'].'">Читать далее &rarr;</a></td></tr>';	
			    		echo  '</table></div>';
					
			}
									
		echo '</div>';
		
	//Вывод навигации
    echo $newlist->pagination(); 	
			
	echo engine::home(array('Назад','/index.php'));	
	
?>