当前位置: 首页>>代码示例>>PHP>>正文


PHP jeedom类代码示例

本文整理汇总了PHP中jeedom的典型用法代码示例。如果您正苦于以下问题:PHP jeedom类的具体用法?PHP jeedom怎么用?PHP jeedom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了jeedom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute($_options = array())
 {
     $replace = array();
     switch ($this->getSubType()) {
         case 'slider':
             $replace['#slider#'] = $_options['slider'];
             break;
         case 'color':
             $replace['#color#'] = $_options['color'];
             break;
         case 'message':
             $replace['#title#'] = $_options['title'];
             $replace['#message#'] = $_options['message'];
             break;
     }
     $eqLogic = $this->getEqLogic();
     $url = 'https://maker.ifttt.com/trigger/' . $this->getConfiguration('event', 'jeedom') . '/with/key/' . $eqLogic->getConfiguration('key') . '?';
     if ($this->getConfiguration('value1') != '') {
         $url .= 'value1=' . urlencode(jeedom::evaluateExpression(str_replace(array_keys($replace), $replace, $this->getConfiguration('value1')))) . '&';
     }
     if ($this->getConfiguration('value2') != '') {
         $url .= 'value2=' . urlencode(jeedom::evaluateExpression(str_replace(array_keys($replace), $replace, $this->getConfiguration('value2')))) . '&';
     }
     if ($this->getConfiguration('value3') != '') {
         $url .= 'value3=' . urlencode(jeedom::evaluateExpression(str_replace(array_keys($replace), $replace, $this->getConfiguration('value3')))) . '&';
     }
     $url = trim($url, '&');
     $request_http = new com_http($url);
     $request_http->exec(5, 3);
 }
开发者ID:jeedom,项目名称:plugin-ifttt,代码行数:30,代码来源:ifttt.class.php

示例2: save

 /**
  * Ajoute une clef à la config
  * @param string $_key nom de la clef
  * @param string $_value valeur de la clef
  * @return boolean vrai si ok faux sinon
  */
 public static function save($_key, $_value, $_plugin = 'core')
 {
     if (is_object($_value) || is_array($_value)) {
         $_value = json_encode($_value, JSON_UNESCAPED_UNICODE);
     }
     if (isset(self::$cache[$_plugin . '::' . $_key])) {
         unset(self::$cache[$_plugin . '::' . $_key]);
     }
     $defaultConfiguration = self::getDefaultConfiguration($_plugin);
     if (isset($defaultConfiguration[$_plugin][$_key]) && $_value == $defaultConfiguration[$_plugin][$_key]) {
         self::remove($_key, $_plugin);
         return true;
     }
     $jeedomConfig = jeedom::getConfiguration($_key, true);
     if ($jeedomConfig != '' && $jeedomConfig == $_value) {
         self::remove($_key);
         return true;
     }
     $values = array('plugin' => $_plugin, 'key' => $_key, 'value' => $_value);
     $sql = 'REPLACE config
             SET `key`=:key,
                 `value`=:value,
                  plugin=:plugin';
     return DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:config.class.php

示例3: openzwave_update

function openzwave_update()
{
    if (openzwave::deamonRunning()) {
        echo 'Stop zwave network...';
        openzwave::stopDeamon();
        echo "OK\n";
    }
    echo 'Stop cron...';
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (config::byKey('jeeNetwork::mode') != 'slave') {
        if (!is_object($cron)) {
            $cron = new cron();
        }
        $cron->setClass('openzwave');
        $cron->setFunction('pull');
        $cron->setEnable(1);
        $cron->setDeamon(1);
        $cron->setDeamonSleepTime(0.5);
        $cron->setTimeout(1440);
        $cron->setSchedule('* * * * *');
        $cron->save();
        $cron->stop();
    } else {
        if (is_object($cron)) {
            $cron->remove();
        }
    }
    echo "OK\n";
    echo 'Check zwave system...';
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    if (config::byKey('port', 'openzwave', 'none') != 'none') {
        if (method_exists('openzwave', 'getVersion')) {
            if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
                if (jeedom::getHardwareName() == 'Jeedomboard') {
                    config::save('allowStartDeamon', 0, 'openzwave');
                    openzwave::updateOpenzwave(false);
                    config::save('allowStartDeamon', 1, 'openzwave');
                } else {
                    log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
                }
            }
        }
    }
    if (config::byKey('jeeNetwork::mode') == 'master') {
        foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
            try {
                if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
                    if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
                        log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
                    }
                }
            } catch (Exception $e) {
            }
        }
    }
    echo "OK\n";
}
开发者ID:stef3569,项目名称:plugin-openzwave,代码行数:59,代码来源:install.php

示例4: openzwave_update

function openzwave_update()
{
    log::add('openzwave', 'error', __('Après toute installation/mise à jour pensez bien à mettre à jour les dépendances Openzwave (voir documentation)', __FILE__));
    if (!file_exists(dirname(__FILE__) . '/../data')) {
        mkdir(dirname(__FILE__) . '/../data');
    }
    shell_exec('cp -R /opt/python-openzwave/xml_backups ' . dirname(__FILE__) . '/../data');
    shell_exec('cp -R /opt/python-openzwave/zwcfg_*.xml ' . dirname(__FILE__) . '/../data');
    shell_exec('rm -rf /opt/python-openzwave/xml_backups');
    shell_exec('rm -rf /opt/python-openzwave/zwcfg_*.xml');
    config::save('allowStartDeamon', 0, 'openzwave');
    echo 'Stop zwave network...';
    openzwave::stop();
    openzwave::stopDeamon();
    echo "OK\n";
    echo 'Stop cron...';
    $cron = cron::byClassAndFunction('openzwave', 'pull');
    if (is_object($cron)) {
        $cron->remove();
    }
    echo "OK\n";
    echo 'Check zwave system...';
    if (count(eqLogic::byType('zwave')) > 0) {
        log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
    }
    if (config::byKey('port', 'openzwave', 'none') != 'none') {
        if (method_exists('openzwave', 'getVersion')) {
            if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
                if (jeedom::getHardwareName() == 'Jeedomboard') {
                    openzwave::updateOpenzwave(false);
                } else {
                    log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
                }
            }
        }
    }
    if (config::byKey('jeeNetwork::mode') == 'master') {
        foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
            try {
                if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
                    if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
                        log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
                    }
                }
            } catch (Exception $e) {
            }
        }
    }
    echo "OK\n";
    echo 'Redemarrage zwave network...';
    try {
        config::save('allowStartDeamon', 1, 'openzwave');
        openzwave::runDeamon();
    } catch (Exception $e) {
    }
    echo "OK\n";
}
开发者ID:kaneda-fr,项目名称:plugin-openzwave,代码行数:57,代码来源:install.php

示例5: connect

 /**
  * Retourne un object utilisateur (si les information de connection sont valide)
  * @param string $_login nom d'utilisateur
  * @param string $_mdp motsz de passe en sha1
  * @return user object user
  */
 public static function connect($_login, $_mdp, $_passAlreadyEncode = false)
 {
     if ($_passAlreadyEncode) {
         $sMdp = $_mdp;
     } else {
         $sMdp = sha1($_mdp);
     }
     if (config::byKey('ldap:enable') == '1') {
         log::add("connection", "debug", __('Authentification par LDAP', __FILE__));
         $ad = self::connectToLDAP();
         if ($ad !== false) {
             log::add("connection", "debug", __('Connection au LDAP OK', __FILE__));
             $ad = ldap_connect(config::byKey('ldap:host'), config::byKey('ldap:port'));
             ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
             ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
             if (!ldap_bind($ad, 'uid=' . $_login . ',' . config::byKey('ldap:basedn'), $_mdp)) {
                 log::add("connection", "info", __('Mot de passe erroné (', __FILE__) . $_login . ')');
                 return false;
             }
             log::add("connection", "debug", __('Bind user OK', __FILE__));
             $result = ldap_search($ad, 'uid=' . $_login . ',' . config::byKey('ldap:basedn'), config::byKey('ldap:filter'));
             log::add("connection", "info", __('Recherche LDAP (', __FILE__) . $_login . ')');
             if ($result) {
                 $entries = ldap_get_entries($ad, $result);
                 if ($entries['count'] > 0) {
                     $user = self::byLogin($_login);
                     if (is_object($user)) {
                         $user->setPassword($sMdp);
                         $user->setOptions('lastConnection', date('Y-m-d H:i:s'));
                         $user->save();
                         return $user;
                     }
                     $user = new user();
                     $user->setLogin($_login);
                     $user->setPassword($sMdp);
                     $user->setOptions('lastConnection', date('Y-m-d H:i:s'));
                     $user->save();
                     log::add("connection", "info", __('Utilisateur créé depuis le LDAP : ', __FILE__) . $_login);
                     jeedom::event('user_connect');
                     log::add('event', 'event', __('Connexion de l\'utilisateur ', __FILE__) . $_login);
                     return $user;
                 } else {
                     $user = self::byLogin($_login);
                     if (is_object($user)) {
                         $user->remove();
                     }
                     log::add("connection", "info", __('Utilisateur non autorisé à accéder à Jeedom (', __FILE__) . $_login . ')');
                     return false;
                 }
             } else {
                 $user = self::byLogin($_login);
                 if (is_object($user)) {
                     $user->remove();
                 }
                 log::add("connection", "info", __('Utilisateur non autorisé à accéder à Jeedom (', __FILE__) . $_login . ')');
                 return false;
             }
             return false;
         } else {
             log::add("connection", "info", __('Impossible de se connecter au LDAP', __FILE__));
         }
     }
     $values = array('login' => $_login, 'password' => $sMdp);
     $sql = 'SELECT ' . DB::buildField(__CLASS__) . '
     FROM user
     WHERE login=:login
     AND password=:password';
     $user = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW, PDO::FETCH_CLASS, __CLASS__);
     if (is_object($user)) {
         $user->setOptions('lastConnection', date('Y-m-d H:i:s'));
         $user->save();
         jeedom::event('user_connect');
         log::add('event', 'event', __('Connexion de l\'utilisateur ', __FILE__) . $_login);
         if ($user->getOptions('validity_limit') != '' && strtotime('now') > strtotime($user->getOptions('validity_limit'))) {
             $user->remove();
             return false;
         }
     }
     return $user;
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:86,代码来源:user.class.php

示例6: Exception

     if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploaddir . '/' . $_FILES['file']['name'])) {
         throw new Exception(__('Impossible de déplacer le fichier temporaire', __FILE__));
     }
     if (!file_exists($uploaddir . '/' . $_FILES['file']['name'])) {
         throw new Exception(__('Impossible d\'uploader le fichier (limite du serveur web ?)', __FILE__));
     }
     ajax::success();
 }
 if (init('action') == 'haltSystem') {
     ajax::success(jeedom::haltSystem());
 }
 if (init('action') == 'rebootSystem') {
     ajax::success(jeedom::rebootSystem());
 }
 if (init('action') == 'forceSyncHour') {
     ajax::success(jeedom::forceSyncHour());
 }
 if (init('action') == 'saveCustom') {
     $path = dirname(__FILE__) . '/../../';
     if (init('version') != 'desktop' && init('version') != 'mobile') {
         throw new Exception(__('La version ne peut etre que desktop ou mobile', __FILE__));
     }
     if (init('type') != 'js' && init('type') != 'css') {
         throw new Exception(__('La version ne peut etre que js ou css', __FILE__));
     }
     $path .= init('version') . '/custom/';
     if (!file_exists($path)) {
         mkdir($path);
     }
     $path .= 'custom.' . init('type');
     if (file_exists($path)) {
开发者ID:saez0pub,项目名称:core,代码行数:31,代码来源:jeedom.ajax.php

示例7: setOptions

 public function setOptions($_key, $_value)
 {
     $this->options = utils::setJsonAttr($this->options, $_key, jeedom::fromHumanReadable($_value));
 }
开发者ID:jimibi,项目名称:core,代码行数:4,代码来源:scenarioExpression.class.php

示例8: save

 public function save()
 {
     if ($this->getQuery() == '') {
         throw new Exception(__('La commande (demande) ne peut pas être vide', __FILE__));
     }
     $this->setLink_id(str_replace('#', '', jeedom::fromHumanReadable($this->getLink_id())));
     return DB::save($this);
 }
开发者ID:GaelGRIFFON,项目名称:core,代码行数:8,代码来源:interactDef.class.php

示例9: Exception

     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $scenario = scenario::byId(init('id'));
     if (!is_object($scenario)) {
         throw new Exception(__('Scénario ID inconnu', __FILE__));
     }
     ajax::success(utils::o2a($scenario->copy(init('name'))));
 }
 if (init('action') == 'get') {
     $scenario = scenario::byId(init('id'));
     if (!is_object($scenario)) {
         throw new Exception(__('Scénario ID inconnu', __FILE__));
     }
     $return = utils::o2a($scenario);
     $return['trigger'] = jeedom::toHumanReadable($return['trigger']);
     $return['forecast'] = $scenario->calculateScheduleDate();
     $return['elements'] = array();
     foreach ($scenario->getElement() as $element) {
         $return['elements'][] = $element->getAjaxElement();
     }
     ajax::success($return);
 }
 if (init('action') == 'save') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $time_dependance = 0;
     $time_keyword = array('#time#', '#seconde#', '#heure#', '#minute#', '#jour#', '#mois#', '#annee#', '#timestamp#', '#date#', '#semaine#', '#sjour#', '#njour#', '#smois#');
     foreach ($time_keyword as $keyword) {
         if (strpos(init('scenario'), $keyword) !== false) {
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:scenario.ajax.php

示例10: launch

 public function launch($_function)
 {
     if ($_function == '') {
         throw new Exception('La fonction à lancer ne peut être vide');
     }
     if (!class_exists($this->getId()) || !method_exists($this->getId(), $_function)) {
         throw new Exception('Il n\'existe aucune méthode : ' . $this->getId() . '::' . $_function . '()');
     }
     $cmd = 'php ' . dirname(__FILE__) . '/../../core/php/jeePlugin.php ';
     $cmd .= ' plugin_id=' . $this->getId();
     $cmd .= ' function=' . $_function;
     if (jeedom::checkOngoingThread($cmd) > 0) {
         return true;
     }
     exec($cmd . ' >> /dev/null 2>&1 &');
     return true;
 }
开发者ID:saez0pub,项目名称:core,代码行数:17,代码来源:plugin.class.php

示例11: Exception

<?php

if (!hasRight('sysinfo', true)) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
?>
<iframe id="frame_sysinfo" src="<?php 
echo jeedom::getCurrentSysInfoFolder();
?>
/index.php" style="width : 100%;height : 1200px;border : none;"></iframe>

<script>
  var hWindow = $(window).height() - $('header').height() - $('footer').height() - 50;
  $('#frame_sysinfo').height(hWindow);
</script>
开发者ID:GaelGRIFFON,项目名称:core,代码行数:15,代码来源:sysinfo.php

示例12: deamonRunning

 public static function deamonRunning()
 {
     $pid_file = realpath(dirname(__FILE__) . '/../../../../tmp/rfxcom.pid');
     if (!file_exists($pid_file)) {
         $pid = jeedom::retrievePidThread('rfxcmd.py');
         if ($pid != '' && is_numeric($pid)) {
             exec('kill -9 ' . $pid);
         }
         return false;
     }
     $pid = trim(file_get_contents($pid_file));
     if ($pid == '' || !is_numeric($pid)) {
         $pid = jeedom::retrievePidThread('rfxcmd.py');
         if ($pid != '' && is_numeric($pid)) {
             exec('kill -9 ' . $pid);
         }
         return false;
     }
     $result = exec('ps -p' . $pid . ' e | grep "rfxcmd" | wc -l');
     if ($result == 0) {
         unlink($pid_file);
         return false;
     }
     return true;
 }
开发者ID:Wators,项目名称:jeedom_plugins,代码行数:25,代码来源:rfxcom.class.php

示例13: toHtml

 public function toHtml($_version)
 {
     if ($this->getIsEnable() != 1) {
         return '';
     }
     if (!$this->hasRight('r')) {
         return '';
     }
     $_version = jeedom::versionAlias($_version);
     $replace = array('#id#' => $this->getId(), '#name#' => $this->getIsEnable() ? $this->getName() : '<del>' . $this->getName() . '</del>', '#background_color#' => $this->getBackgroundColor($_version), '#eqLink#' => $this->getLinkToConfiguration());
     $Departs = $this->getCmd(null, 'Departs');
     $replace['#Departs#'] = is_object($Departs) ? $Departs->execCmd() : '';
     $RefreshAction = $this->getCmd(null, 'RefreshAction');
     $replace['#refresh_id#'] = is_object($RefreshAction) ? $RefreshAction->getId() : '';
     return template_replace($replace, getTemplate('core', $_version, 'eqlogic', 'trains'));
 }
开发者ID:bemar,项目名称:jeedom_trains,代码行数:16,代码来源:trains.class.php

示例14: Exception

         throw new Exception(__('Cmd ID inconnu : ', __FILE__) . init('id'));
     }
     $return = jeedom::toHumanReadable(utils::o2a($cmd));
     $eqLogic = $cmd->getEqLogic();
     $return['eqLogic_name'] = $eqLogic->getName();
     $return['plugin'] = $eqLogic->getEqType_Name();
     if ($eqLogic->getObject_id() > 0) {
         $return['object_name'] = $eqLogic->getObject()->getName();
     }
     ajax::success($return);
 }
 if (init('action') == 'save') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $cmd_ajax = jeedom::fromHumanReadable(json_decode(init('cmd'), true));
     $cmd = cmd::byId($cmd_ajax['id']);
     if (!is_object($cmd)) {
         $cmd = new cmd();
     }
     utils::a2o($cmd, $cmd_ajax);
     $cmd->save();
     ajax::success();
 }
 if (init('action') == 'changeHistoryPoint') {
     if (!isConnect('admin')) {
         throw new Exception(__('401 - Accès non autorisé', __FILE__));
     }
     $history = history::byCmdIdDatetime(init('cmd_id'), init('datetime'));
     if (!is_object($history)) {
         throw new Exception(__('Aucun point ne correspond pour l\'historique : ', __FILE__) . init('cmd_id') . ' - ' . init('datetime'));
开发者ID:saez0pub,项目名称:core,代码行数:31,代码来源:cmd.ajax.php

示例15: count

     $result['nbInteractQuery'] = count(interactQuery::byInteractDefId($result['id']));
     $result['nbEnableInteractQuery'] = count(interactQuery::byInteractDefId($result['id'], true));
     if ($result['link_type'] == 'cmd' && $result['link_id'] != '') {
         $link_id = '';
         foreach (explode('&&', $result['link_id']) as $cmd_id) {
             $cmd = cmd::byId($cmd_id);
             if (is_object($cmd)) {
                 $link_id .= cmd::cmdToHumanReadable('#' . $cmd->getId() . '# && ');
             }
         }
         $result['link_id'] = trim(trim($link_id), '&&');
     }
     ajax::success(jeedom::toHumanReadable($result));
 }
 if (init('action') == 'save') {
     $interact_json = jeedom::fromHumanReadable(json_decode(init('interact'), true));
     if (isset($interact_json['id'])) {
         $interact = interactDef::byId($interact_json['id']);
     }
     if (!isset($interact) || !is_object($interact)) {
         $interact = new interactDef();
     }
     utils::a2o($interact, $interact_json);
     $interact->save();
     ajax::success(utils::o2a($interact));
 }
 if (init('action') == 'regenerateInteract') {
     interactDef::regenerateInteract();
     ajax::success();
 }
 if (init('action') == 'remove') {
开发者ID:GaelGRIFFON,项目名称:core,代码行数:31,代码来源:interact.ajax.php


注:本文中的jeedom类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。