mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
26 lines
730 B
PHP
26 lines
730 B
PHP
<?php
|
|
// gettig the mobile submited value
|
|
if (empty($_POST) && !empty($_GET)) {
|
|
foreach ($_GET as $key => $value) {
|
|
$_POST[$key]=$value;
|
|
}
|
|
}
|
|
require_once 'subscribe.php';
|
|
header('Content-Type: application/json');
|
|
$obj = new stdClass();
|
|
$obj->error = '';
|
|
$obj->subscribe = '';
|
|
if (!User::isLogged()) {
|
|
$obj->error = "Must be logged";
|
|
die(json_encode($obj));
|
|
}
|
|
|
|
$_POST['email'] = User::getEmail_();
|
|
if (empty($_POST['user_id'])) {
|
|
$obj->error = __("User can not be blank");
|
|
die(json_encode($obj));
|
|
}
|
|
$subscribe = new Subscribe(0, $_POST['email'], $_POST['user_id'], User::getId());
|
|
$subscribe->notifyToggle();
|
|
$obj->notify = $subscribe->getNotify();
|
|
die(json_encode($obj));
|