
<?php


include $_SERVER['DOCUMENT_ROOT']."/head.php"; // $_SERVER['DOCUMENT_ROOT'] - указывает корневую директорию сайта

?>
		  <style>
   .layer1 {
 
    padding: 5px; /* Поля вокруг текста */
    float: left; /* Обтекание по правому краю */
    width: 20%; /* Ширина слоя */
   }
   .layer2 {
padding: 5px;
    width: 75%;
    float: left;
    margin-left: 13px;
   }
   .clear {
    clear: left; /* Отмена обтекания */
   }
   
   .texrteat {
  
    width: 90%;
    height: 111px !important;
    border: 2px solid #d1d1d19c;
    border-radius: 10px;
       color: #393939;
    padding: 20px;
}
   
   
.texrteat:hover {
  
    width: 90%;
    height: 111px !important;
    border: 2px solid #ffb851;
    box-shadow: 0 0 3px #ffb851;
    border-radius: 10px;
        color: #393939;
    padding: 20px;
}
   
   
.texrteat:active {
   
    width: 90%;
    height: 111px !important;
    border: 2px solid #ffb851;
    box-shadow: 0 0 3px #ffb851;
    border-radius: 10px;
        color: #393939;
    padding: 20px;
}
   
.texrteat:focus {
 
    width: 90%;
    height: 111px !important;
    border: 2px solid #ffb851;
    box-shadow: 0 0 3px #ffb851;
    border-radius: 10px;
        color: #393939;
    padding: 20px;
}
  </style> 
		
		  <div id="main">
        <section class="politcal-section offerings-section">
            <div class="container">
			
			
                <div class="heading">  <div class="ggg">
				
                    <strong class="subtitle">Ваше мнение очень важно для нас</strong>
                    <h2 class="title">Отзывы пользователей</h2>
                </div></div>
				
				 
<div class="faq section-pad-md section-pad nopb">
		<div class="container">
		
		
	<div class="faq section-pad-md section-pad nopb" >
		<div class="container">
	 
<div class="main_bottom">
            <div class="main_news">
				<br>
			 
<?php
if(USER_LOGGED){

$can_post=0;
if($reviews_c==1){
$roq=mysql_query("SELECT oid FROM operations WHERE ologin='$u_login' LIMIT 1");
if(mysql_num_rows($roq)>0){
$can_post=1;
}
}
else{
$can_post=1;
}

if($u_login=='admin'){
$can_post=1;
}

// ПРИЁМ ДАННЫХ

if($can_post==1 && !empty($_POST['review']) && $d_reviews_mode!=2 && $_SESSION['can_review']>$time){
echo '<br><center>
<input type="submit" class="btn btn-info" value="Следующий отзыв можно оставить через '.($_SESSION['can_review']-$time).' секунд" style="
    box-shadow: 0 7px 13px 0 rgba(0,35,160,0.18);
    font-size: 17px;
    line-height: 0.4;
    letter-spacing: 0.3px;
    padding: 16px 27px 23px;
    width: 100%;
"></center>';
}
if($can_post==1 && !empty($_POST['review']) && $d_reviews_mode!=2 && $_SESSION['can_review']<$time){
$_SESSION['can_review']=$time+$reviews_t;
$review=$_POST['review'];
$review=str_replace("\r\n", ' ',$review);
$review=str_replace("\n", ' ',$review);
$review=preg_replace('#[^a-zA-ZА-Яа-яёЁ\ \!\-\_\%\@\#\$\:\;\.\,\?\=\<\>\+\(\)\{\}\[\]\'\"\*0-9\/]+#m','',$review);
$review=str_replace('<', '&lt;',$review);
$review=str_replace('>', '&gt;',$review);
$review=str_replace("'",'&quot;',$review);
$review=str_replace('"','&quot;',$review);
$review=preg_replace('# +#',' ',$review);
$review=trim($review);
$review=substr($review,0,499);
if(strlen($review)>5){
$rfq=mysql_query("SELECT rid FROM reviews WHERE rlogin='".$u_login."' AND rpost='".$review."'");
if(mysql_num_rows($rfq)==0){
mysql_query("INSERT INTO reviews (rlogin,rpost,rdate,rcan) VALUES ('$u_login','$review','$time','$d_reviews_mode')");
if($d_reviews_mode!=1){
mysql_query("UPDATE data SET reviews_count=(SELECT COUNT(rid) FROM reviews WHERE rcan!=1)");
}
$review_show=0;
}
}
}

}

//  ГЕНЕРАТОР СТРАНИЦ

$r_links='';
$sc_f=1;
if(isset($_GET['pn'])){
$_GET['pn']=preg_replace('#[^0-9]+#','',$_GET['pn']);
$_GET['pn']=preg_replace('#^[0]+#','',$_GET['pn']);
if($_GET['pn']>0 && $_GET['pn']<2000){
$sc_f=$_GET['pn'];
}
}
$reviewsq=mysql_query("SELECT * FROM reviews WHERE rcan!=1");
$sc_lim=(mysql_num_rows($reviewsq))/$reviews_pp;
if($sc_lim>1){
for($n=0;$n<$sc_lim;$n++){
if($sc_f==($n+1)){ $r_links.='
      <div class="pagination switch_page"><div class="list">
	  <a class="active">'.($n+1).'</a>'; }
else{ $r_links.='
      <div class="pagination switch_page"><div class="list">
	  <a href="/?p=comment&pn='.($n+1).'" class="active">'.($n+1).'</a>
</div></div>&nbsp;'; }
}
}

?>
<?php
if($d_reviews_mode!=2){

if(!USER_LOGGED){ echo '<br><center>
<div style="background-color: #ffb861;padding: 20px 20px 20px 20px; margin-bottom: 35px; border-radius: 10px;color: #342623;font-weight: bold;">Отзывы могут оставлять только зарегистрированные пользователи.</div></center>'; }

if(USER_LOGGED && $can_post==0){ echo '<br><center>
<input type="submit" class="btn btn-info" value="Чтобы оставить отзыв, у Вас должна быть хотя бы одна операция" style="
    box-shadow: 0 7px 13px 0 rgba(0,35,160,0.18);
    font-size: 17px;
    line-height: 0.4;
    letter-spacing: 0.3px;
    padding: 16px 27px 23px;
    width: 100%;
"></center>'; }

if(USER_LOGGED && $can_post==1){
echo '

<center><div class="the_filter" style="

"><div class="reviews_smiles">';
for($n=1;$n<$reviews_s+1;$n++){ if($n==20){ echo '<br>'; } echo "<img> "; }
echo '</div></div></center>';
?>
<ul class="page-numbers">
<?php if(isset($review_show) && $d_reviews_mode==1){
	echo '<br><center>
<input type="submit" class="btn btn-info" value="Ваш отзыв будет доступен после одобрения модераторами проекта INFINEX" style="
    box-shadow: 0 7px 13px 0 rgba(0,35,160,0.18);
    font-size: 17px;
    line-height: 0.4;
    letter-spacing: 0.3px;
    padding: 16px 27px 23px;
    width: 100%;
"></center>'; } ?>
								  
<?php if(isset($review_show) && $d_reviews_mode==0){ echo '<div class="alert alert-dismissable alert-success" style="background-color: #21F9C7;"><button type="button" class="close" data-dismiss="alert">X</button><center><strong>Ваш отзыв о проекте Invests Group успешно добавлен!</strong></center></div>'; } ?>
</ul><br>

<div style="      background-color: #fff;
    border-radius: 20px;
    padding: 50px;
    margin-bottom: 35px;">
<center>
<form id="reviews_form" style="margin:0;padding:0" action="/?p=comment" method="POST">
<textarea id="reviews_textarea" class="reviews_textarea texrteat" name="review" placeholder="Отзыв не менее 5 символов" maxlength="500" style="width: 92%; "></textarea>
	<br>
<a class="btn btn-success" href="javascript:with(document.getElementById('reviews_form')){ submit(); }" style="
    width: 90%;
    font-size: 15px;
    max-width: 100%;
    margin-top: 25px;
">Оставить свой отзыв</a>
<div style="clear:both;"></div>
</form>
</center></div>
<?php
}
}
else{
echo '<div class="reviews_offed">Функция добавления отзывов приостановлена</div>';
}
?>

<div style="    background-color: #fff;
    border-radius: 20px;
    padding: 50px;">
<?php
if(!empty($_GET['pn'])){
$r_start=preg_replace('#[^0-9]+#','',$_GET['pn']);
$r_start=preg_replace('#^[0]+#','',$r_start);
if($r_start>1 && $r_start<2000){
$r_start=$r_start*$reviews_pp-$reviews_pp;
$reviewsq=mysql_query("SELECT rlogin,rdate,rpost FROM reviews WHERE rcan!=1 ORDER BY rdate DESC LIMIT $r_start,$reviews_pp");
if(mysql_num_rows($reviewsq)==0){
$reviewsq=mysql_query("SELECT rlogin,rdate,rpost FROM reviews WHERE rcan!=1 ORDER BY rdate DESC LIMIT $reviews_pp");
}
}
else {
$reviewsq=mysql_query("SELECT rlogin,rdate,rpost FROM reviews WHERE rcan!=1 ORDER BY rdate DESC LIMIT $reviews_pp");
}
}
else{
$reviewsq=mysql_query("SELECT rlogin,rdate,rpost FROM reviews WHERE rcan!=1 ORDER BY rdate DESC LIMIT $reviews_pp");
}
while($reviewsm=mysql_fetch_row($reviewsq)){ 
// Запрос на аватар
$get_avatar_img  = "SELECT `avatar` FROM `users` WHERE `login` = '" . trim( $reviewsm[0] ) . "'";
$get_avatar_img = mysql_query( $get_avatar_img ); 
$get_avatar_img = mysql_fetch_row( $get_avatar_img );
$get_avatar_img = $get_avatar_img[0];
?>

<br>

<div style="
    background: #ffffff;
    padding: 13px 0px 13px 0px;
    width: 100%;
    height: 170px;
    margin-bottom: 33px;
    border-radius: 20px;
  border: 1px solid #eee3e3;
    box-shadow: 0 0 5px #d7d7d7;
    display: inline-table;
">
  <div class="layer1">
  <center>
<?php
												if ( trim( $get_avatar_img ) == '' )
													{
														?>
								
									
					<img src="/images/noavatar.png" class="func-um_user gravatar avatar avatar-50 um-avatar" width="150" height="150" alt="" data-lazy-loaded="true" style="display: inline; border-radius: 80px; ">
							<?php
													}
												else
													{
														?>
																			
									
					<img src="images/avatars/<?php echo trim( $get_avatar_img );?>" class="func-um_user gravatar avatar avatar-50 um-avatar" width="150" height="150" alt="" data-lazy-loaded="true" style="display: inline; border-radius: 80px; ">
													<?php
													}
												?>
<div style="
    font-size: 18px;
    font-weight: bold;
    color: #050505;
"><?php echo $reviewsm[0]; ?></div>		</center>								
  </div>
  <div class="layer2">
<p style="
    color: #333;
    font-size: 18px;
"><?php
$rew=$reviewsm[2];
$rew=wordwrap($rew,100,' ',1);
for($n=1;$n<$reviews_s+1;$n++){
$rew=str_replace('*'.$n.'*','<img src="images/smiles/'.$n.'.gif">',$rew);
}
echo $rew;
?>
</p>

<time style="color: #09090969;margin-top: 18px;"><?php echo date('j ',$reviewsm[1]).$mdate[date('n',$reviewsm[1])-1].date(' H:i',$reviewsm[1]); ?></time>
  </div>

 </div>


<?php } ?>


<ul class="page-numbers">

<?php if(!empty($r_links)){ echo '	<div class="pagination switch_page"><div class="list">'.$r_links.'</a></div></div>  '; } ?></ul>


</div>

</div></div>
		<!--  container -->
	</div>


		</div> <!--  container -->
	</div>
   </div>
            </div> </div> </div> </div>  
        </section>

    </div>
		
    </section>
	<?php


include $_SERVER['DOCUMENT_ROOT']."/footer.php"; // $_SERVER['DOCUMENT_ROOT'] - указывает корневую директорию сайта

?>