Файл: users/profile/account/plugins/avatar.php
Строк: 28
<?php
/*
--------------------------------
Смена аватара на фото из альбома
--------------------------------
*/
IF (GET('avatar_upgrade') && DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS` WHERE `ID` = '".INTVAL(GET('avatar_upgrade'))."' AND `USER_ID` = '".$user['ID']."' LIMIT 1") == 1){
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS_SHOW` WHERE `PHOTO_ID` = '".$settings['AVATAR']."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'avatar' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `PHOTOS_SHOW` WHERE `USER_ID` = '".$user['ID']."' AND `PHOTO_ID` = '".$settings['AVATAR']."' AND `TYPE` = 'avatar'");
}
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS_SHOW` WHERE `PHOTO_ID` = '".INTVAL(GET('avatar_upgrade'))."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'avatar' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `PHOTOS_SHOW` (`USER_ID`, `PHOTO_ID`, `TYPE`) VALUES ('".$user['ID']."', '".INTVAL(GET('avatar_upgrade'))."', 'avatar')");
}
DB::GET_SET("UPDATE `USERS_SETTINGS` SET `AVATAR` = '".INTVAL(GET('avatar_upgrade'))."' WHERE `USER_ID` = '".$user['ID']."' LIMIT 1");
REDIRECT('/id'.$user['ID'].'');
}ELSEIF (GET('avatar_upgrade') && DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS` WHERE `ID` = '".INTVAL(GET('avatar_upgrade'))."' AND `USER_ID` = '".$user['ID']."' LIMIT 1") == 0){
ERROR('Неизвестная ошибка', 'session');
REDIRECT('/id'.$user['ID'].'');
}
/*
-------------------------
Удаление текущего аватара
-------------------------
*/
IF (GET('avatar_delete') && DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS` WHERE `ID` = '".INTVAL(GET('avatar_delete'))."' AND `USER_ID` = '".$user['ID']."' LIMIT 1") == 1){
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS_SHOW` WHERE `PHOTO_ID` = '".$settings['AVATAR']."' AND `USER_ID` = '".$user['ID']."' AND `TYPE` = 'avatar' LIMIT 1") == 1){
DB::GET_SET("DELETE FROM `PHOTOS_SHOW` WHERE `USER_ID` = '".$user['ID']."' AND `PHOTO_ID` = '".$settings['AVATAR']."' AND `TYPE` = 'avatar'");
}
DB::GET_SET("UPDATE `USERS_SETTINGS` SET `AVATAR` = '0' WHERE `USER_ID` = '".$user['ID']."' LIMIT 1");
REDIRECT('/id'.$user['ID'].'');
}ELSEIF (GET('avatar_delete') && DB::GET_COLUMN("SELECT COUNT(*) FROM `PHOTOS` WHERE `ID` = '".INTVAL(GET('avatar_delete'))."' AND `USER_ID` = '".$user['ID']."' LIMIT 1") == 0){
ERROR('Неизвестная ошибка', 'session');
REDIRECT('/id'.$user['ID'].'');
}
/*
------------
Вывод автара
------------
*/
ECHO "<div style='position: absolute; bottom: 5px; left: 25px;'>";
ECHO "<span style='position: relative;'>";
ECHO "<span id='avatar_upgrade'>";
USER::AVATAR($account['ID'], 85, 1);
ECHO "</span>";
//Вывод рейтинга
REQUIRE (ROOT.'/users/profile/account/plugins/rating.php');
IF ($account['ID'] == $user['ID']){
?><a id="upload-avatar" class="btn-avatar" onclick="modal_open('#avatar')" load="none"><?=ICONS('camera', 13, 'fa-fw')?></a><?
/*
-----------------------
Выгрузка новой аватарки
-----------------------
*/
ECHO "<div class='overlay'>";
ECHO "<div class='modal' id='avatar'>";
ECHO "<div class='modal-title'>";
ECHO "<b>".LG('Новый аватар')."</b>";
?><a onclick="modal_close('#avatar')" 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='upload-avatar-show'></div>";
ECHO "</div>";
ECHO "</div>";
ECHO "</div>";
ECHO "</div>";
}
ECHO "</span>";
ECHO "</div>";
?>