YaWK  24.1
Yet another WebKit
disconnect-friend.php
Go to the documentation of this file.
1 <?php
2 include '../../system/classes/db.php';
3 include '../../system/classes/sys.php';
4 include '../../system/classes/user.php';
5 include '../../system/classes/alert.php';
6 include '../../system/classes/settings.php';
7 /* set database object */
8 if (!isset($db))
9 { // create new db object
10  $db = new \YAWK\db();
11 }
12 // prepare vars
13 $id = $_POST['id'];
14 $uid = $_POST['friendUID'];
15 $requestUsername = $_POST['requestUsername'];
16 $sessionUID = $_POST['sessionUID'];
17 $sessionUsername = \YAWK\user::getUserNameFromID($db, $sessionUID);
18 // SET friendship status to confirmed
19 if ($sql = $db->query("DELETE FROM {friends} WHERE id='".$id."'"))
20 { // success
21  echo "friendship disconnected";
22 }
23 else
24 { // q failed
25  echo \YAWK\alert::draw("warning","Warning!", "Could not disconnect friendship status. Please try again.",'',4200);
26 }
27 
28 // NOTIFY + SYSLOG ENTRY
29 // \YAWK\sys::setNotification($db, 3, "$sessionUsername disconnected your friendship.", $sessionUID, $uid, 0, 0);
30 \YAWK\sys::setNotification($db, 3, 0, $sessionUID, $uid, 0, 0,0);
31 \YAWK\sys::setSyslog($db, 17, 0,"$sessionUsername ended friendship with $requestUsername", $uid, $sessionUID, 0, 0);
if(!isset($db)) $id
$sessionUsername
$requestUsername
$sql
Definition: message-new.php:32