2018-06-07 07:56:05 -04:00
|
|
|
<?php
|
|
|
|
require_once("config.php");
|
2018-11-25 11:23:07 -05:00
|
|
|
require_once("template.php");
|
2018-06-07 07:56:05 -04:00
|
|
|
require_once("classes/constellation.php");
|
2018-11-25 11:23:07 -05:00
|
|
|
require_once("classes/subscriptions.php");
|
|
|
|
require_once("classes/telegram.php");
|
2020-08-17 05:56:57 -04:00
|
|
|
require_once("classes/db-class.php");
|
|
|
|
$db = new SSDB();
|
|
|
|
define("NAME", $db->getSetting($mysqli,"name"));
|
|
|
|
define("TITLE", $db->getSetting($mysqli,"title"));
|
|
|
|
define("WEB_URL", $db->getSetting($mysqli,"url"));
|
|
|
|
define("MAILER_NAME", $db->getSetting($mysqli,"mailer"));
|
|
|
|
define("MAILER_ADDRESS", $db->getSetting($mysqli,"mailer_email"));
|
2018-11-25 11:23:07 -05:00
|
|
|
$subscription = new Subscriptions();
|
|
|
|
$telegram = new Telegram();
|
2018-06-07 09:36:57 -04:00
|
|
|
|
2018-11-25 11:23:07 -05:00
|
|
|
Template::render_header("Subscriptions");
|
2018-06-07 09:36:57 -04:00
|
|
|
|
2018-11-25 11:23:07 -05:00
|
|
|
if ( SUBSCRIBE_TELEGRAM && $_SESSION['subscriber_typeid'] == 2 ) {
|
|
|
|
$tg_user = $telegram->getTelegramUserData(); // TODO: Do we need this any longer?
|
2018-06-07 07:56:05 -04:00
|
|
|
}
|
2018-06-07 09:36:57 -04:00
|
|
|
|
2018-11-25 11:23:07 -05:00
|
|
|
if( $_SESSION['subscriber_valid'] ){
|
|
|
|
|
|
|
|
$typeID = $_SESSION['subscriber_typeid'];
|
|
|
|
$subscriberID = $_SESSION['subscriber_id'];
|
|
|
|
$userID = $_SESSION['subscriber_userid'];
|
|
|
|
$token = $_SESSION['subscriber_token'];
|
|
|
|
|
|
|
|
if(isset($_GET['add'])){
|
|
|
|
$subscription->add($subscriberID, $_GET['add']);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isset($_GET['remove'])){
|
|
|
|
$subscription->remove($subscriberID, $_GET['remove']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$subscription->render_subscribed_services($typeID, $subscriberID, $userID, $token);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$header = _("Your session has expired or you tried something we don't suppprt");
|
|
|
|
$message = _('If your session expired, retry your link or in case of Telegram use the login button in the top menu.');
|
|
|
|
$constellation->render_warning($header, $message);
|
|
|
|
|
2018-06-07 07:56:05 -04:00
|
|
|
header('Location: index.php');
|
|
|
|
}
|
|
|
|
|
2018-11-08 14:08:11 -05:00
|
|
|
Template::render_footer();
|