<?php 
  
/*
-----------------
Удаление заставки
-----------------
*/
  
IF (GET('get') == 'delete_screensaver'){
  
  IF (ISSET($par['ID']) && $par['ADMINISTRATION'] == 1 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
    
    CSRF::GET_CHECK_VALID(GET('get'));
    
    @UNLINK(ROOT.'/files/upload/communities/screensaver/'.$comm['SCREENSAVER'].'.jpg');
    @UNLINK(ROOT.'/files/upload/communities/screensaver/850x200/'.$comm['SCREENSAVER'].'.jpg');
    
    DB::GET_SET("UPDATE `COMMUNITIES` SET `SCREENSAVER` = '".NULL."' WHERE `ID` = '".$comm['ID']."' LIMIT 1");
    
    REDIRECT('/modules/?path=communities&section=show&id='.$comm['ID']);
  
  }

}

/*
---------------------------
Заставка на личной странице
---------------------------
*/ 

ECHO "<div style='position: relative;'>";
  
ECHO "<div id='sreensaver_upgrade'>";

IF (IS_FILE(ROOT.'/files/upload/communities/screensaver/850x200/'.$comm['SCREENSAVER'].'.jpg')){
  
  ECHO "<img src='/files/upload/communities/screensaver/850x200/".$comm['SCREENSAVER'].".jpg' style='width: 100%;'>";

}ELSE{
  
  ECHO "<img src='/files/upload/communities/screensaver/850x200/no_screensaver.jpg' style='width: 100%;'>";

}

ECHO "</div><br /><br />";

//Аватар
REQUIRE (ROOT.'/modules/communities/plugins/avatar.php');

IF (ISSET($par['ID']) && $par['ADMINISTRATION'] == 1 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
  
  ECHO '<a style="right: 50px;" href="/modules/?path=communities&section=show&get=edit&id='.$comm['ID'].'" class="btn-screensaver">'.ICONS('gear', 13, 'fa-fw').'</a>';
  
  ?><a id="upgrade-optima" action="/system/AJAX/php/screensaver_comm.php?id=<?=$comm['ID']?>" class="btn-screensaver" onclick="modal_open('#screensaver')" load="none"><?=ICONS('image', 13, 'fa-fw')?></a><?
  
  /*
  -----------------------
  Выгрузка новой заставки
  -----------------------
  */
  
  ECHO "<div class='overlay'>";
  
  ECHO "<div class='modal' id='screensaver'>";
  
  ECHO "<div class='modal-title'>";
  ECHO "<b>".LG('Новая заставка')."</b>";
  ?><a onclick="modal_close('#screensaver')" load="none" class="btn-modal-close"><?=ICONS('times', 20, 'fa-fw')?></a><?
  ECHO "</div>";
  
  ECHO "<div class='modal-optimize'>";
  
  ECHO "<div class='list-menu'>";
  
  ECHO "<div id='upgrade-optima2'></div>";

  ECHO "</div>";
  
  ECHO "</div>";
  
  ECHO "</div>";
  
  ECHO "</div>";
  
}

ECHO "</div>";
  
?>