Example #1
0
                 Logger::log($objEx->getMessage());
             }
         }
     }
     break;
     /* GET NOTIFICATIONS */
 /* GET NOTIFICATIONS */
 case 'get_notifications':
     if (!checkLocalLogin()) {
         $arrReturnValue['response'] = 'You must be logged in order to retrieve notifications.';
     } else {
         try {
             $objYM = new Client($_SESSION['username'], $_SESSION['pwd'], APP_CONSUMER_KEY, APP_CONSUMER_SECRET);
             $objYM->setTokens($_SESSION['ym_tokens']);
             $objYM->setSession($_SESSION['ym_session']);
             $notifications = $objYM->fetchNotifications($_SESSION['ym_notifications_seq']);
             Logger::log(var_export($notifications, 1));
             $arrAjaxResponse = array();
             foreach ($notifications['responses'] as $notificationsResponse) {
                 foreach ($notificationsResponse as $notificationType => $notif) {
                     switch ($notificationType) {
                         case 'logOff':
                             $arrAjaxResponse[] = array('type' => $notificationType, 'info' => array('buddy' => htmlspecialchars($notif['buddy'])));
                             break;
                         case 'buddyInfo':
                             foreach ($notif['contact'] as $notifContact) {
                                 $info = array('buddy' => htmlspecialchars($notifContact['sender']), 'network' => isset($notifContact['network']) ? $notifContact['network'] : 'yahoo', 'presenceMessage' => '', 'presenceState' => '');
                                 if (isset($notifContact['customDNDStatus'])) {
                                     if (0 == $notifContact['customDNDStatus'] && 99 == $notifContact['presenceState']) {
                                         $notifContact['presenceState'] = Client::USER_IS_ONLINE;
                                     } elseif (1 == $notifContact['customDNDStatus'] && 99 == $notifContact['presenceState']) {