Файл: _modules/friends/no/index.php
Строк: 29
<?php
# mark core v1.0
# author Drk in
# date 24.10.19
# core
require_once ( $_SERVER['DOCUMENT_ROOT']."/_core/system.php" );
# user
system::access(true);
# get
$id = isset( $_GET['id'] ) ? system::abs($_GET['id']): 0;
# check
if (cache_friends_rq::ch($id) == false)system::header('/friends/request','Сталкер заявка в друзья не найдена');
$act = cache_friends_rq::get($id);
if ($act['user'] == $user['id'])system::header('/friends/request','Сталкер нельзя добавить себя в друзья');
$friends = DB :: $dbh -> querySingle("SELECT count(id) FROM friends WHERE user = ? AND data = ?;", array($user['id'],$act['user']));
if (!empty($friends))system::header('/friends/request','Сталкер уже ваш друг');
# delete request user
$rq_us = DB :: $dbh -> queryFetch("SELECT id FROM friends_rq WHERE user = ? AND data = ? LIMIT 1;", array($user['id'],$act['user']));
if (!empty($rq_us)):
DB :: $dbh -> query("DELETE FROM friends_rq WHERE id = ? LIMIT 1;", array($rq_us['id']));
@unlink(cache."_friends_rq/".$rq_us['id'].".data");
endif;
# delete request data
$rq_dt = DB :: $dbh -> queryFetch("SELECT id FROM friends_rq WHERE user = ? AND data = ? LIMIT 1;", array($act['user'],$user['id']));
if (!empty($rq_dt)):
DB :: $dbh -> query("DELETE FROM friends_rq WHERE id = ? LIMIT 1;", array($rq_dt['id']));
@unlink(cache."_friends_rq/".$rq_dt['id'].".data");
endif;
# send mail
send::mail($act['user'],system::check($user['login']).', отклонил вашу заявку в друзья!');
# header
system::header('/friends','Заявка успешно откронена');
?>