示例#1
0
 public static function sendStreamMessage($host, $name, $authurl, $requesturl, $accessurl, $costumerkey, $costumersecret, $oauth_token, $oauth_token_secret, $maxlength, $unternehmenid, $text)
 {
     try {
         $connection = new StreamOAuth($host, $costumerkey, $costumersecret, $oauth_token, $oauth_token_secret);
         $connection->setURLs($authurl, $requesturl, $accessurl);
         $connection->post('statuses/update', array('status' => substr($text, 0, $maxlength)));
         if ($connection->getStatusCode() != 200) {
             if ($connection->getStatusCode() == 403) {
                 $connection->get('account/verify_credentials');
                 if ($connection->getStatusCode() == 403) {
                     self::insertError($unternehmenid, 'wrong stream account', 'Could not establish a connection to microblog account "' . $name . '" via host "' . $host . '". Is your account expired?', 1);
                 }
             }
         } else {
             self::insertEvent($unternehmenid, 'sent a message with your microblog account "' . $name . '" via host "' . $host . '"');
         }
     } catch (Exception $e) {
         self::insertError($unternehmenid, 'stream connection failed', 'Could not establish a connection to "' . $host . '"', 1);
     }
 }
示例#2
0
                 `streamurls`
             WHERE
                 `streamurlid` = ?
             AND
                 (`unternehmenid` = ?
             OR
                 `unternehmenid` = 0)', 2);
     DB::setParam($this->_post('streamurlid'), 'int');
     DB::setParam($_SESSION['unternehmenid'], 'int');
     DB::exec();
     if (DB::numRows() == 1) {
         try {
             $connection = new StreamOAuth(DB::result('apibase'), $this->_post('costumerkey'), $this->_post('costumersecret'), $this->_post('oauth_token'), $this->_post('oauth_token_secret'));
             $connection->setURLs(DB::result('authurl'), DB::result('requesturl'), DB::result('accessurl'));
             $connection->get('account/verify_credentials');
             if ($connection->getStatusCode() != 200) {
                 $this->_jsonOutput(2, 'the account could not be verified');
             }
         } catch (Exception $e) {
             $this->_jsonOutput(2, 'there could be no connection to your connection type established');
         }
     } else {
         $this->_jsonOutput(2, 'there is a wrong connection type set');
     }
 } else {
     $this->_jsonOutput(2, 'please choose a connection type');
 }
 if ($this->_post('aktion') == 'create_microblog') {
     DB::query('INSERT INTO `streaming`
                    (`unternehmenid`,
                     `name`,