Esempio n. 1
0
        // some action for every record if required
        if ($this->mode == 'update') {
            global ${'value_' . $res[$i]['ID']};
            global ${'notes_' . $res[$i]['ID']};
            $all_settings[$res[$i]['NAME']] = ${'value_' . $res[$i]['ID']};
            $res[$i]['VALUE'] = ${'value_' . $res[$i]['ID']};
            $res[$i]['NOTES'] = htmlspecialchars(${'notes_' . $res[$i]['ID']});
            SQLUpdate('settings', $res[$i]);
        }
        if ($this->mode == 'reset') {
            $res[$i]['VALUE'] = $res[$i]['DEFAULTVALUE'];
            SQLUpdate('settings', $res[$i]);
        }
        if ($res[$i]['VALUE'] == $res[$i]['DEFAULTVALUE']) {
            $res[$i]['ISDEFAULT'] = '1';
        }
        $res[$i]['VALUE'] = htmlspecialchars($res[$i]['VALUE']);
    }
    $out['RESULT'] = $res;
}
// some action for every record if required
if ($this->mode == 'update') {
    if ($all_settings['GROWL_ENABLE']) {
        include_once ROOT . 'lib/growl/growl.gntp.php';
        $growl = new Growl($all_settings['GROWL_HOST'], $all_settings['GROWL_PASSWORD']);
        $growl->setApplication('MajorDoMo', 'Notifications');
        $growl->registerApplication('http://connect.smartliving.ru/img/logo.png');
        $growl->notify('Test!');
    }
    $this->redirect("?updated=1&filter_name=" . $this->filter_name);
}
Esempio n. 2
0
/**
* Title
*
* Description
*
* @access public
*/
function say($ph, $level = 0, $member_id = 0)
{
    global $commandLine;
    global $voicemode;
    global $noPatternMode;
    global $ignorePushover;
    global $ignorePushbullet;
    global $ignoreGrowl;
    global $ignoreTwitter;
    /*
    if ($commandLine) {
     echo utf2win($ph);
    } else {
     echo $ph;
    }
    */
    $rec = array();
    $rec['MESSAGE'] = $ph;
    $rec['ADDED'] = date('Y-m-d H:i:s');
    $rec['ROOM_ID'] = 0;
    $rec['MEMBER_ID'] = $member_id;
    if ($level > 0) {
        $rec['IMPORTANCE'] = $level;
    }
    $rec['ID'] = SQLInsert('shouts', $rec);
    if ($member_id) {
        //if (!$noPatternMode) {
        include_once DIR_MODULES . 'patterns/patterns.class.php';
        $pt = new patterns();
        $pt->checkAllPatterns($member_id);
        //}
        return;
    }
    if (defined('SETTINGS_HOOK_BEFORE_SAY') && SETTINGS_HOOK_BEFORE_SAY != '') {
        eval(SETTINGS_HOOK_BEFORE_SAY);
    }
    global $ignoreVoice;
    if ($level >= (int) getGlobal('minMsgLevel') && !$ignoreVoice && !$member_id) {
        //$voicemode!='off' &&
        $lang = 'en';
        if (defined('SETTINGS_SITE_LANGUAGE')) {
            $lang = SETTINGS_SITE_LANGUAGE;
        }
        if (defined('SETTINGS_VOICE_LANGUAGE')) {
            $lang = SETTINGS_VOICE_LANGUAGE;
        }
        if (!defined('SETTINGS_TTS_GOOGLE') || SETTINGS_TTS_GOOGLE) {
            $google_file = GoogleTTS($ph, $lang);
        } else {
            $google_file = false;
        }
        if (!defined('SETTINGS_SPEAK_SIGNAL') || SETTINGS_SPEAK_SIGNAL == '1') {
            $passed = time() - (int) getGlobal('lastSayTime');
            if ($passed > 20) {
                // play intro-sound only if more than 20 seconds passed from the last one
                setGlobal('lastSayTime', time());
                playSound('dingdong', 1, $level);
            }
        }
        if ($google_file) {
            @touch($google_file);
            playSound($google_file, 1, $level);
        } else {
            safe_exec('cscript ' . DOC_ROOT . '/rc/sapi.js ' . $ph, 1, $level);
        }
    }
    if (!$noPatternMode) {
        include_once DIR_MODULES . 'patterns/patterns.class.php';
        $pt = new patterns();
        $pt->checkAllPatterns($member_id);
    }
    if (defined('SETTINGS_PUSHOVER_USER_KEY') && SETTINGS_PUSHOVER_USER_KEY && !$ignorePushover) {
        include_once ROOT . 'lib/pushover/pushover.inc.php';
        if (defined('SETTINGS_PUSHOVER_LEVEL')) {
            if ($level >= SETTINGS_PUSHOVER_LEVEL) {
                postToPushover($ph);
            }
        } elseif ($level > 0) {
            postToPushover($ph);
        }
    }
    if (defined('SETTINGS_PUSHBULLET_KEY') && SETTINGS_PUSHBULLET_KEY && !$ignorePushbullet) {
        include_once ROOT . 'lib/pushbullet/pushbullet.inc.php';
        if (defined('SETTINGS_PUSHBULLET_PREFIX') && SETTINGS_PUSHBULLET_PREFIX) {
            $prefix = SETTINGS_PUSHBULLET_PREFIX . ' ';
        } else {
            $prefix = '';
        }
        if (defined('SETTINGS_PUSHBULLET_LEVEL')) {
            if ($level >= SETTINGS_PUSHBULLET_LEVEL) {
                postToPushbullet($prefix . $ph);
            }
        } elseif ($level > 0) {
            postToPushbullet($prefix . $ph);
        }
    }
    if (defined('SETTINGS_GROWL_ENABLE') && SETTINGS_GROWL_ENABLE && $level >= SETTINGS_GROWL_LEVEL && !$ignoreGrowl) {
        include_once ROOT . 'lib/growl/growl.gntp.php';
        $growl = new Growl(SETTINGS_GROWL_HOST, SETTINGS_GROWL_PASSWORD);
        $growl->setApplication('MajorDoMo', 'Notifications');
        //$growl->registerApplication('http://localhost/img/logo.png');
        $growl->notify($ph);
    }
    if (defined('SETTINGS_TWITTER_CKEY') && SETTINGS_TWITTER_CKEY && !$ignoreTwitter) {
        postToTwitter($ph);
    }
    if (defined('SETTINGS_HOOK_AFTER_SAY') && SETTINGS_HOOK_AFTER_SAY != '') {
        eval(SETTINGS_HOOK_AFTER_SAY);
    }
}
Esempio n. 3
0
 /**
  * Send growl message
  *
  * @param string $title   Notification title
  * @param string $message Notification message
  */
 protected function sendGrowlMessage($title, $message)
 {
     require CLITOOLS_ROOT_FS . '/vendor/jamiebicknell/Growl-GNTP/growl.gntp.php';
     $growlServer = (string) $this->getApplication()->getConfigValue('growl', 'server', null);
     $growlPassword = (string) $this->getApplication()->getConfigValue('growl', 'password', null);
     if (!empty($growlServer)) {
         $growl = new \Growl($growlServer, $growlPassword);
         $growl->setApplication('Vagrant VM', 'Vagrant Development VM');
         // Only need to use the following method on first use or change of icon
         $growl->registerApplication();
         // Basic Notification
         $growl->notify($title, $message);
     }
 }
Esempio n. 4
0
 public function get_growl()
 {
     $growl = new Growl($this->address, $this->password);
     $growl->setApplication('Ampache', 'Now Playing');
     return $growl;
 }
Esempio n. 5
0
/**
* Title
*
* Description
*
* @access public
*/
function say($ph, $level = 0)
{
    global $commandLine;
    global $voicemode;
    /*
    if ($commandLine) {
     echo utf2win($ph);
    } else {
     echo $ph;
    }
    */
    $rec = array();
    $rec['MESSAGE'] = $ph;
    $rec['ADDED'] = date('Y-m-d H:i:s');
    $rec['ROOM_ID'] = 0;
    $rec['MEMBER_ID'] = 0;
    if ($level > 0) {
        $rec['IMPORTANCE'] = $level;
    }
    $rec['ID'] = SQLInsert('shouts', $rec);
    if (defined('SETTINGS_HOOK_BEFORE_SAY') && SETTINGS_HOOK_BEFORE_SAY != '') {
        eval(SETTINGS_HOOK_BEFORE_SAY);
    }
    if ($level >= (int) getGlobal('minMsgLevel')) {
        //$voicemode!='off' &&
        $lang = 'en';
        if (defined('SETTINGS_SITE_LANGUAGE')) {
            $lang = SETTINGS_SITE_LANGUAGE;
        }
        if (defined('SETTINGS_VOICE_LANGUAGE')) {
            $lang = SETTINGS_VOICE_LANGUAGE;
        }
        if (!defined('SETTINGS_TTS_GOOGLE') || SETTINGS_TTS_GOOGLE) {
            $google_file = GoogleTTS($ph, $lang);
        } else {
            $google_file = false;
        }
        if (!defined('SETTINGS_SPEAK_SIGNAL') || SETTINGS_SPEAK_SIGNAL == '1') {
            $passed = SQLSelectOne("SELECT (UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(ADDED)) as PASSED FROM shouts WHERE ID!='" . $rec['ID'] . "' ORDER BY ID DESC LIMIT 1");
            if ($passed['PASSED'] > 20) {
                // play intro-sound only if more than 30 seconds passed from the last one
                playSound('dingdong', 1, $level);
            }
        }
        if ($google_file) {
            @touch($google_file);
            playSound($google_file, 1, $level);
        } else {
            safe_exec('cscript ' . DOC_ROOT . '/rc/sapi.js ' . $ph, 1, $level);
        }
    }
    global $noPatternMode;
    if (!$noPatternMode) {
        include_once DIR_MODULES . 'patterns/patterns.class.php';
        $pt = new patterns();
        $pt->checkAllPatterns();
    }
    if (defined('SETTINGS_HOOK_AFTER_SAY') && SETTINGS_HOOK_AFTER_SAY != '') {
        eval(SETTINGS_HOOK_AFTER_SAY);
    }
    if (defined('SETTINGS_PUSHOVER_USER_KEY') && SETTINGS_PUSHOVER_USER_KEY) {
        include_once ROOT . 'lib/pushover/pushover.inc.php';
        if (defined('SETTINGS_PUSHOVER_LEVEL')) {
            if ($level >= SETTINGS_PUSHOVER_LEVEL) {
                postToPushover($ph);
            }
        } elseif ($level > 0) {
            postToPushover($ph);
        }
    }
    if (defined('SETTINGS_GROWL_ENABLE') && SETTINGS_GROWL_ENABLE && $level >= SETTINGS_GROWL_LEVEL) {
        include_once ROOT . 'lib/growl/growl.gntp.php';
        $growl = new Growl(SETTINGS_GROWL_HOST, SETTINGS_GROWL_PASSWORD);
        $growl->setApplication('MajorDoMo', 'Notifications');
        //$growl->registerApplication('http://localhost/img/logo.png');
        $growl->notify($ph);
    }
    postToTwitter($ph);
}