<? $docRoot = getenv("DOCUMENT_ROOT"); require_once $docRoot . "/mobi-config/mobi_lib_constants.php"; require_once(LIBDIR . "StellarData.php"); StellarData::init(); //print_r(StellarData::get_courses()); //print_r(StellarData::get_subjects(7)); //StellarData::get_subjects(99); //print_r(StellarData::get_announcements_xml(7.012)); //var_dump(StellarData::get_subject_id('7.012')); //print_r(StellarData::get_subject_info('7.012')); StellarData::push_subscribe('99.999', 'dummy'); print_r(StellarData::$subscriptions); //print_r(StellarData::get_announcements('7.012')); StellarData::push_unsubscribe('99.999', 'dummy'); print_r(StellarData::$subscriptions); '' ?>
$device_id = intval($_REQUEST['device_id']); $device_type = $_REQUEST['device_type']; $subject = $_REQUEST['subject']; $term = $_REQUEST['term']; if($device_type == 'apple') { if(!APNS_DB::verify_device_id($device_id, $pass_key)) { Throw new Exception("invalid {$pass_key} for {$device_id}"); } } else { Throw new Exception("Device type='${device_type}' not yet supported"); } switch($_REQUEST['action']) { case 'subscribe': StellarData::push_subscribe($subject, $term, $device_id, $device_type); $data = array('success' => True); break; case 'unsubscribe': StellarData::push_unsubscribe($subject, $term, $device_id, $device_type); $data = array('success' => True); break; } default: break; } } echo json_encode($data);
<? $docRoot = getenv("DOCUMENT_ROOT"); require_once $docRoot . "/mobi-config/mobi_web_constants.php"; require_once(LIBDIR . 'StellarData.php'); StellarData::init(); $uid = $_REQUEST['uid']; $subject = $_REQUEST['subject']; if (isset($_REQUEST['subscribe'])) { StellarData::push_subscribe($subject, $uid); } elseif (isset($_REQUEST['unsubscribe'])) { StellarData::push_unsubscribe($subject, $uid); } ?>