1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00
Oinktube/plugin/UserNotifications/getNotifications.json.php
2022-09-01 12:31:19 -03:00

20 lines
No EOL
520 B
PHP

<?php
header('Content-Type: application/json');
require_once '../../videos/configuration.php';
$obj = new stdClass();
$obj->msg = '';
$obj->error = false;
$obj->users_id = User::getId();
$obj->notifications = User_notifications::getAllForUsers_id($obj->users_id);
if(empty($obj->notifications) || !is_array($obj->notifications)){
$obj->notifications = array();
}else{
usort($obj->notifications, 'cmpNotifications');
}
echo json_encode($obj);
function cmpNotifications($a, $b) {
return $a['id']-$b['id'];
}