Файл: users/profile/subscribers/plugins/inc.php
Строк: 1
<?php
IF (ISSET($user)){
/*
---------------------
Добавить в подписчики
---------------------
*/
IF (GET('get') == "subscribe_ok"){
//Определение данных
$subscribe = DB::GET_STRING("SELECT * FROM `SUBSCRIBERS` WHERE `MY_ID` = '".$user['ID']."' AND `USER_ID` = '".INTVAL(GET('id_subscribe'))."' LIMIT 1");
IF (!ISSET($subscribe['ID']) && $user['ID'] != INTVAL(GET('id_subscribe')) && INTVAL(GET('id_subscribe')) > 0){
DB::GET_ADD("INSERT INTO `SUBSCRIBERS` (`USER_ID`, `MY_ID`) VALUES ('".INTVAL(GET('id_subscribe'))."', '".$user['ID']."')");
IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `NOTIFICATIONS_SETTINGS` WHERE `USER_ID` = '".INTVAL(GET('id_subscribe'))."' AND `SUBSCRIBERS` = '1' LIMIT 1") == 1){
DB::GET_ADD("INSERT INTO `NOTIFICATIONS` (`USER_ID`, `OBJECT_ID`, `TIME`, `TYPE`) VALUES ('".INTVAL(GET('id_subscribe'))."', '".$user['ID']."', '".TIME()."', 'subscribe_success')");
}
}
}
/*
----------------------
Удалить из подписчиков
----------------------
*/
IF (GET('get') == "subscribe_delete"){
//Определение данных
$subscribe = DB::GET_STRING("SELECT * FROM `SUBSCRIBERS` WHERE `MY_ID` = '".$user['ID']."' AND `USER_ID` = '".INTVAL(GET('id_subscribe'))."' LIMIT 1");
IF (ISSET($subscribe['ID']) && $user['ID'] != $subscribe['USER_ID'] && $subscribe['USER_ID'] > 0){
DB::GET_SET("DELETE FROM `SUBSCRIBERS` WHERE `USER_ID` = '".$subscribe['USER_ID']."' AND `MY_ID` = '".$user['ID']."' LIMIT 1");
}
}
IF (GET('get') == "subscribe_delete2"){
//Определение данных
$subscribe = DB::GET_STRING("SELECT * FROM `SUBSCRIBERS` WHERE `USER_ID` = '".$user['ID']."' AND `MY_ID` = '".INTVAL(GET('id_subscribe'))."' LIMIT 1");
IF (ISSET($subscribe['ID']) && $user['ID'] != $subscribe['MY_ID'] && $subscribe['MY_ID'] > 0){
DB::GET_SET("DELETE FROM `SUBSCRIBERS` WHERE `MY_ID` = '".$subscribe['MY_ID']."' AND `USER_ID` = '".$user['ID']."' LIMIT 1");
}
}
}
?>