Exemple #1
0
 function Run()
 {
     $key = $this->GetParam('key', 'str');
     $title = $this->GetParam('title', 'str');
     $message = $this->GetParam('message', 'int');
     $priority = $this->GetParam('priority', 'str');
     $url = $this->GetParam('url', 'str');
     $custom = $this->GetParam('custom', 'raw');
     $message = str_replace('{custom}', $custom, $message);
     if (!strlen($priority)) {
         $priority == 0;
     }
     $result = '';
     if ($key and $title and $message) {
         require_once dirname(__FILE__) . '/class.php-prowl.php';
         $prowl = new Prowl();
         $prowl->setApiKey($key);
         //$prowl->setDebug(true);
         $result = $prowl->add($this->conf['app']['name'], $title, $priority, $message, $url);
         if ($result->success['code'] == 200) {
             $this->DisplayJson(true, array('code' => 200, 'message' => "Successfully Sent Notification : {$title}", 'api_result' => $result));
         } else {
             $this->DisplayJson(false, array('code' => 500, 'message' => "Failed to send Notification : {$title}", 'api_result' => $result));
         }
     } else {
         $this->DisplayJson(false, array('code' => 500, 'message' => "Missing some parameters!"));
     }
 }
<?php

include_once 'includes/ProwlPHP.php';
include_once 'includes/prowl.inc.php';
$keys = explode(',', $_GET['key']);
foreach ($keys as $key) {
    $prowl = new Prowl($key, false, $prowl_provider_key);
    $options = array('application' => 'VoiceGrowl', 'event' => 'Test Message', 'description' => 'This is a test message from VoiceGrowl, sent to you by ' . $_SERVER['REMOTE_ADDR'], 'priority' => 0);
    $prowl->push($options, true);
    echo $prowl->getError() . '<br />';
}
Exemple #3
0
<?php

include_once 'includes/ProwlPHP.php';
require_once 'includes/mysql.inc.php';
include_once 'includes/prowl.inc.php';
// Provider key
$res = mysql_query("SELECT * FROM `users` WHERE `prowl_api_key`!=''");
while ($row = mysql_fetch_assoc($res)) {
    echo $row['email'], ' (', $row['prowl_api_key'], '): ';
    $prowl = new Prowl($row['prowl_api_key'], false, $prowl_provider_key);
    $options = array('application' => 'VoiceGrowl', 'event' => 'Service Change', 'description' => 'VoiceGrowl users:' . "\n" . 'A recent server change means you need to change a GMail filter setting.' . "\n" . 'See http://bit.ly/5lB4hE for more info.' . "\n\n" . 'Email voicegrowl@ub3rk1tten.com or Twitter @t3hub3rk1tten for support', 'priority' => 1);
    $prowl->push($options, true);
    if ($err = $prowl->getError()) {
        echo $err;
    }
    echo '<br />';
}
 function wptouch_handle_new_user($user_id)
 {
     $settings = bnc_wptouch_get_settings();
     if (isset($settings['prowl-api']) && isset($settings['enable-prowl-users-button']) && $settings['enable-prowl-users-button'] == 1) {
         global $wpdb;
         $api_key = $settings['prowl-api'];
         require_once 'include/class.prowl.php';
         global $table_prefix;
         $sql = $wpdb->prepare("SELECT * from " . $table_prefix . "users WHERE ID = %d", $user_id);
         $user = $wpdb->get_row($sql);
         if ($user) {
             $prowl = new Prowl($api_key, $settings['header-title']);
             $result = $prowl->add(1, __("User Registration", "wptouch"), 'Name: ' . $this->wptouch_cleanup_growl(stripslashes($user->user_login)) . "\nE-Mail: " . $this->wptouch_cleanup_growl(stripslashes($user->user_email)));
         }
     }
 }
Exemple #5
0
<?php

include 'ProwlPHP.php';
$prowl = new Prowl('APIKEY');
$prowl->push(array('application' => 'Application', 'event' => 'Event', 'description' => 'Test message! \\n Sent at ' . date('H:i:s'), 'priority' => 0), true);
var_dump($prowl->getError());
// Optional
var_dump($prowl->getRemaining());
// Optional
var_dump(date('d m Y h:i:s', $prowl->getResetdate()));
// Optional
Exemple #6
0
require_once 'config.php';
if (!class_exists('XMLReader', false)) {
    die(xml_for_result(FAILURE_PHP_XMLREADER_CLASS));
}
if ($push_activated || $boxcar_activated) {
    $curl_info = curl_version();
    // Checks for cURL function and SSL version. Thanks Adrian Rollett!
    if (!function_exists('curl_exec') || empty($curl_info['ssl_version'])) {
        die(xml_for_result(FAILURE_PHP_CURL_LIB));
    }
    if ($push_prowlids != "") {
        include 'ProwlPHP.php';
        if (!class_exists('Prowl', false)) {
            die(xml_for_result(FAILURE_PHP_PROWL_CLASS));
        }
        $prowl = new Prowl($push_prowlids);
    } else {
        $push_activated = false;
    }
    if ($boxcar_uid != "" && $boxcar_pwd != "") {
        include 'class.boxcar.php';
    } else {
        $boxcar_activated = false;
    }
} else {
    $push_activated = false;
    $boxcar_activated = false;
}
function xml_for_result($result)
{
    return '<?xml version="1.0" encoding="UTF-8"?><result>' . $result . '</result>';
Exemple #7
0
 protected function twit($entry, $options)
 {
     if (isset($options['shortener']) && $options['shortener'] && strlen($entry['link']) > $options['maxurllength']) {
         if (!isset($options['shortenerObject'])) {
             $this->debug("create " . $options['shortener'] . " class");
             include_once "r2t/shortener/" . $options['shortener'] . ".php";
             $classname = "r2t_shortener_" . $options['shortener'];
             $options['shortenerObject'] = new $classname();
         }
         $this->debug("shorten " . $entry['link'] . " to ");
         $res = $options['shortenerObject']->shorten($entry['link'], $entry['title']);
         if (is_array($res)) {
             $entry['link'] = $res['url'];
             $entry['title'] = $res['text'];
         } else {
             $entry['link'] = $res;
         }
         $this->debug("    " . $entry['link']);
     }
     // check if something was posted with that link already
     include_once "HTTP/Request.php";
     if (isset($options['twitter']['user'])) {
         $req = new HTTP_Request('http://api.twitter.com/1/statuses/user_timeline.json?screen_name=' . $options['twitter']['user']);
         if ($req->sendRequest()) {
             $tweets = json_decode($req->getResponseBody());
             foreach ($tweets as $tw) {
                 if (isset($tw->text)) {
                     if (strpos($tw->text, $entry['link']) !== false) {
                         $this->debug("  already tweeted link " . $entry['link']);
                         return $options;
                     }
                 } else {
                     continue;
                 }
             }
         }
     }
     $msg = $entry['title'];
     if ($options['addAuthor']) {
         $msg .= " - " . preg_replace("/[^\\s]+@[^\\s]+/", "", $entry['author']);
     }
     $msg .= " " . $entry['link'];
     $msg = preg_replace("/[\\s]{2,}/", " ", $msg);
     if (isset($options['prefix'])) {
         $msg = $options['prefix'] . " " . $msg;
     }
     $msg = trim($msg);
     $this->debug("twit " . $msg);
     /* oauth */
     if ($options['twitter']['token'] && class_exists("OAuth")) {
         $req_url = 'http://twitter.com/oauth/request_token';
         $acc_url = 'http://twitter.com/oauth/access_token';
         $authurl = 'http://twitter.com/oauth/authorize';
         $api_url = 'http://twitter.com/statuses/update.json';
         $conskey = 'DyhAb4DLlFmc5Wn29QvL9g';
         $conssec = 'wgaBiC9YJx38sqBLklUqpkWB1Cq1ztAemp5lkfwQ';
         $oauth = new OAuth($conskey, $conssec, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
         $oauth->debug = 1;
         $oauth->setToken($options['twitter']['token'], $options['twitter']['secret']);
         $api_args = array("status" => $msg, "empty_param" => NULL);
         if (isset($entry['lat'])) {
             $api_args['lat'] = $entry['lat'];
             $api_args['long'] = $entry['long'];
         }
         $oauth->fetch($api_url, $api_args, OAUTH_HTTP_METHOD_POST, array("User-Agent" => "pecl/oauth"));
         /* end oauth */
     } else {
         include_once 'Services/Twitter.php';
         $service = new Services_Twitter($options['twitter']['user'], $options['twitter']['pass']);
         $service->statuses->update($msg);
     }
     $this->debug("prowlApiKey: " . (isset($options['prowlApiKey']) ? $options['prowlApiKey'] : 'unset'));
     if (!empty($options['prowlApiKey'])) {
         include_once 'ProwlPHP/ProwlPHP.php';
         $prowl = new Prowl($options['prowlApiKey']);
         $prowl->push(array('application' => 'rss2twi.php', 'event' => 'New Post', 'description' => $msg, 'priority' => 0), true);
     }
     return $options;
 }
    // Type of cache
    $location = $matches[4];
    // Location of this cache
    $distance = $matches[5];
    // Distance from your home co-ordinates
    $date = $matches[6];
    // Date this log was created
    $log = trim($matches[7]);
    // The log message
    $username = $matches[9];
    // Username of the Geocaching.com User
    $link_log = $matches[8];
    // ID for Link to the log message
    $link_user = $matches[10];
    // ID for Link to user profile
    // Strip through the subject to get the 'action' of this message, such as found,
    // did not find, archived, published etc
    $subject = str_replace("[GEO] Notify: ", "", $structure->headers["subject"]);
    $action = str_replace($title, "", $subject);
    $action = str_replace("(" . $type . ")", "", $action);
    $action = trim(str_replace($username, "", $action));
    // Send a notification out via Prowl
    $prowl = new Prowl();
    $prowl->setApiKey("3d6d41d6a5fb532a51ed40b3fR45tdeb97b6e86d");
    $application = "Geocaching.com";
    $event = "{$username} {$action} {$title} ({$id})";
    $text = $log;
    $url = "http://coord.info/" . $link_log;
    $priority = 0;
    $message = $prowl->push($application, $event, $text, $url, $priority);
}
 function prowl_handle_new_user($user_id)
 {
     require_once 'prowl.php';
     global $wpdb;
     global $table_prefix;
     $settings = $this->get_settings();
     if (count($settings->push_prowl_api_keys) && $settings->push_prowl_registrations) {
         foreach ($settings->push_prowl_api_keys as $api_key) {
             $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $table_prefix . "users WHERE ID = %d", $user_id));
             if ($user) {
                 $prowl = new Prowl($api_key, $settings->site_title);
                 $result = $prowl->add(1, __("User Registration", "wptouch-pro"), sprintf(__("Name: %s", "wptouch-pro") . "\n" . __("Email: %s", "wptouch-pro"), $this->wptouch_cleanup_growl(stripslashes($user->user_login)), $this->wptouch_cleanup_growl(stripslashes($user->user_email))));
             }
         }
     }
 }
Exemple #10
0
         $growl->register();
         $tries = 6;
     } catch (Net_Growl_Exception $e) {
         unset($growl);
         sleep(1);
         // Helps for temporary problems
         if ($tries == 5) {
             $growl_exception = '<div class="notice">' . $e->getMessage();
             $growl_exception .= '<br />I\'ll still try and send you notifications, though.<br />Make sure you double check your password!</div>';
         }
     }
 }
 if ($vars['prowl_api_key'] != '') {
     include_once 'includes/ProwlPHP.php';
     include_once 'includes/prowl.inc.php';
     $prowl = new Prowl();
     $keys = explode(',', $vars['prowl_api_key']);
     foreach ($keys as $key) {
         if (!$prowl->verify($key, $prowl_provider_key)) {
             $api_key_fail = true;
         }
     }
 }
 if ($vars['custom_url'] != '') {
     $url = $vars['custom_url'];
     $url = str_replace('$name', 'name', $url);
     $url = str_replace('$body', 'body', $url);
     if (!filter_var($url, FILTER_VALIDATE_URL)) {
         $custom_url_fail = true;
     }
 }