public static function needUpdate($_refresh = false) { $return = array(); $return['currentVersion'] = market::getJeedomCurrentVersion($_refresh); $return['version'] = jeedom::version(); if (version_compare($return['currentVersion'], $return['version'], '>')) { $return['needUpdate'] = true; } else { $return['needUpdate'] = false; } return $return; }
<span class="marketAttr" data-l1key="categorie" style="font-size: 1em;font-weight: bold;"></span> <br/><br/> <?php if ($market->getPurchase() == 1) { if ($market->getStatus('stable') == 1) { echo ' <a class="btn btn-success bt_installFromMarket" data-version="stable" style="color : white;" data-market_logicalId="' . $market->getLogicalId() . '" data-market_id="' . $market->getId() . '" ><i class="fa fa-plus-circle"></i> {{Installer stable}}</a>'; } if ($market->getStatus('beta') == 1) { echo ' <a class="btn btn-warning bt_installFromMarket" data-version="beta" style="color : white;" data-market_logicalId="' . $market->getLogicalId() . '" data-market_id="' . $market->getId() . '" ><i class="fa fa-plus-circle"></i> {{Installer beta}}</a>'; } } else { if ($market->getPrivate() == 1) { echo '<div class="alert alert-info">{{Ce plugin est pour le moment privé. Vous devez attendre qu\'il devienne public ou avoir un code pour y accèder}}</div>'; } else { if (config::byKey('market::apikey') != '' || config::byKey('market::username') != '' && config::byKey('market::password') != '') { $purchase_info = market::getPurchaseInfo(); if (isset($purchase_info['user_id']) && is_numeric($purchase_info['user_id']) && isset($purchase_info['paypal::url']) && isset($purchase_info['paypal::marchandMail'])) { ?> <a class="btn btn-default" href='https://market.jeedom.fr/index.php?v=d&p=profils' target="_blank"><i class="fa fa-eur"></i> Code promo</a> <form action="<?php echo $purchase_info['paypal::url']; ?> /cgi-bin/webscr" method="post" style="display: inline-block;position: relative;top: 5px;" target="_blank" id='form_paypal'> <input type='hidden' name="amount" value="<?php echo $market->getCost(); ?> " /> <input name="currency_code" type="hidden" value="EUR" /> <input name="shipping" type="hidden" value="0.00" /> <input name="tax" type="hidden" value="0.00" /> <input name="return" type="hidden" value="<?php
public function status() { return market::getInfo(array('logicalId' => $this->getId(), 'type' => 'plugin')); }
<?php if (!isConnect('admin')) { throw new Exception('{{401 - Accès non autorisé}}'); } sendVarToJS('market_display_info', array('logicalId' => init('logicalId'), 'name' => init('name'))); sendVarToJS('market_type', init('type')); try { if (init('logicalId') != '' && init('type') != '') { $market = market::byLogicalIdAndType(init('logicalId'), init('type')); } } catch (Exception $e) { $market = null; } if (is_object($market) && !$market->getIsAuthor()) { throw new Exception('{{Vous n\'êtes pas l\'auteur du plugin}}'); } if (init('type') == 'plugin') { $plugin = plugin::byId(init('logicalId')); if (!is_object($plugin)) { throw new Exception('{{Le plugin :}} ' . init('logicalId') . ' {{est introuvable}}'); } $plugin_info = utils::o2a($plugin); $plugin_info['logicalId'] = $plugin_info['id']; unset($plugin_info['id']); sendVarToJS('market_display_info', $plugin_info); } ?> <div style="display: none;width : 100%" id="div_alertMarketSend"></div>
?> ' placeholder="Rechercher" id="in_search" value="<?php echo $name; ?> "/> <a class="btn btn-success" id="bt_search" data-href='<?php echo buildUrl('name', ''); ?> '><i class="fa fa-search"></i></a> </div> <div class="form-group"> <?php if (config::byKey('market::username') != '') { echo '<span class="label label-info pull-right" style="font-size : 1em;">' . config::byKey('market::username'); try { market::test(); echo ' <i class="fa fa-check"></i>'; } catch (Exception $e) { echo ' <i class="fa fa-times"></i>'; } echo '</span>'; } ?> </div> </form> </div> <?php if ($name != null && strpos($name, '$') !== false) { echo '<a class="btn btn-default" id="bt_returnMarketList" style="margin-top : 50px;" data-href=' . buildUrl('name', '') . '><i class="fa fa-arrow-circle-left"></i> {{Retour}}</a>'; } ?>
$oldPassword = $user->getPassword(); $user->setPassword(sha1($newPassword)); $cmds = explode('&&', config::byKey('emailAdmin')); $found = false; try { if (count($cmds) > 0) { foreach ($cmds as $id) { $cmd = cmd::byId(str_replace('#', '', $id)); if (is_object($cmd)) { $found = true; $cmd->execCmd(array('title' => __('[JEEDOM] Récuperation de mot de passe', __FILE__), 'message' => 'Voici votre nouveau mot de passe pour votre installation jeedom : ' . $newPassword)); } } } if (!$found) { market::sendUserMessage(__('[JEEDOM] Récuperation de mot de passe', __FILE__), 'Voici votre nouveau mot de passe pour votre installation jeedom : ' . $newPassword); } } catch (Exception $e) { throw new Exception(__('Aucune commande trouvé pour envoyé le nouveau mot de passe, la demande de récupération a echouée', __FILE__)); } $user->save(); ajax::success(); } if (!isConnect()) { throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234); } if (init('action') == 'isConnect') { ajax::success(); } if (init('action') == 'logout') { logout();
* along with Jeedom. If not, see <http://www.gnu.org/licenses/>. */ try { require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php'; include_file('core', 'authentification', 'php'); if (!isConnect('admin')) { throw new Exception('401 Unauthorized'); } if (init('action') == 'get') { $widget = widget::byPath(init('path')); if (!is_object($widget)) { throw new Exception('Widget non trouvé'); } $return = utils::o2a($widget); $return['logicalId'] = $widget->getLogicalId(); $return['status'] = market::getInfo($widget->getLogicalId()); ajax::success($return); } if (init('action') == 'save') { $widget_ajax = json_decode(init('widget'), true); if (file_exists($widget['path'])) { $widget_db = widget::byPath($widget['path']); if (!is_object($widget_db)) { $widget_db = new widget(); } } else { $widget_db = new widget(); } utils::a2o($widget_db, $widget_ajax); $widget_db->save(); ajax::success(utils::o2a($widget_db));
if (init('action') == 'autoDetectModule') { $eqLogic = zwave::byId(init('id')); if (!is_object($eqLogic)) { throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id')); } $result = zwave::callRazberry('/ZWaveAPI/Run/devices[' . $eqLogic->getLogicalId() . ']', $eqLogic->getConfiguration('serverID', 1)); $data = $result['data']; if (isset($data['manufacturerId']['value']) && isset($data['manufacturerProductType']['value']) && isset($data['manufacturerProductId']['value'])) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Recherche, si nécessaire, de la configuration sur le market', __FILE__))); sleep(1); try { $market_rpc = market::getJsonRpc(); if ($market_rpc->sendRequest('market::searchZwaveModuleConf', array('manufacturerId' => $data['manufacturerId']['value'], 'manufacturerProductType' => $data['manufacturerProductType']['value'], 'manufacturerProductId' => $data['manufacturerProductId']['value']))) { foreach ($market_rpc->getResult() as $logicalId => $result) { if (isset($result['id'])) { $markets[$logicalId] = market::construct($result); } } if (count($markets) == 1) { $market = $markets[0]; $update = update::byLogicalId($market->getLogicalId()); if (!is_object($update)) { if ($market->getStatus('stable') == 1) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Configuration trouvée en stable : ', __FILE__) . $market->getName() . __(' installation en cours', __FILE__))); sleep(1); $market->install(); } else { if ($market->getStatus('beta') == 1) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Configuration trouvée en beta : ', __FILE__) . $market->getName() . __(' installation en cours', __FILE__))); sleep(1); $market->install('beta');
} } if (init('action') == 'test') { ajax::success(market::test()); } if (init('action') == 'setRating') { $market = market::byId(init('id')); if (!is_object($market)) { throw new Exception(__('Impossible de trouver l\'objet associé : ', __FILE__) . init('id')); } $market->setRating(init('rating')); ajax::success(); } if (init('action') == 'setComment') { $market = market::byId(init('id')); if (!is_object($market)) { throw new Exception(__('Impossible de trouver l\'objet associé : ', __FILE__) . init('id')); } $market->setComment(init('comment', null), init('order', null)); ajax::success(); } if (init('action') == 'sendReportBug') { $ticket = json_decode(init('ticket'), true); market::saveTicket($ticket); ajax::success(array('url' => config::byKey('market::address') . '/index.php?v=d&p=ticket')); } throw new Exception(__('Aucune méthode correspondante à : ', __FILE__) . init('action')); /* * *********Catch exeption*************** */ } catch (Exception $e) { ajax::error(displayExeption($e), $e->getCode()); }
try { $market = market::byId($params['plugin_id']); } catch (Exception $e) { $market = market::byLogicalId($params['plugin_id']); } if (!is_object($market)) { throw new Exception(__('Impossible de trouver l\'objet associé : ', __FILE__) . $params['plugin_id']); } if (!isset($params['version'])) { $params['version'] = 'stable'; } $market->install($params['version']); $jsonrpc->makeSuccess('ok'); } if ($jsonrpc->getMethod() == 'plugin::remove') { $market = market::byId($params['plugin_id']); if (!is_object($market)) { throw new Exception(__('Impossible de trouver l\'objet associé : ', __FILE__) . $params['plugin_id']); } if (!isset($params['version'])) { $params['version'] = 'stable'; } $market->remove(); $jsonrpc->makeSuccess('ok'); } /* * ************************Update*************************** */ if ($jsonrpc->getMethod() == 'update::all') { $jsonrpc->makeSuccess(utils::o2a(update::all())); } if ($jsonrpc->getMethod() == 'update::update') { jeedom::update('', 0);
<label class="col-sm-4 col-xs-6 control-label">{{Télécharger la sauvegarde}}</label> <div class="col-sm-4 col-xs-6"> <a class="btn btn-success" id="bt_downloadBackup"><i class="fa fa-cloud-download"></i> {{Télécharger}}</a> </div> </div> </fieldset> </form> <?php if (config::byKey('market::apikey') != '' || config::byKey('market::username') != '' && config::byKey('market::password') != '') { ?> <legend>{{Sauvegardes cloud}}</legend> <form class="form-horizontal"> <fieldset> <?php try { $listeCloudBackup = market::listeBackup(); } catch (Exception $e) { echo '<div class="alert alert-danger">' . $e->getMessage() . '</div>'; } ?> <div class="form-group"> <label class="col-sm-4 col-xs-6 control-label">{{Sauvegardes disponibles}}</label> <div class="col-sm-6 col-xs-6"> <select class="form-control" id="sel_restoreCloudBackup"> <?php try { foreach ($listeCloudBackup as $key => $backup) { if (is_numeric($key)) { echo '<option>' . $backup . '</option>'; } }
echo '<i class="fa fa-times pull-right tooltips" title="Widget non maintenu ou supprimé"></i>'; } if ($status['status'] == 'ok') { echo '<i class="fa fa-check pull-right tooltips" title="Widget à jour"></i>'; } if ($status['status'] == 'update') { echo '<i class="fa fa-refresh pull-right tooltips" title="Mise à jour nécessaire"></i>'; } echo '</a></li>'; } ?> <li class="nav-header">Mobile</li> <?php foreach (widget::listWidget('mobile') as $widget) { echo '<li class="cursor li_widget" data-path="' . $widget->getPath() . '"><a>' . $widget->getHumanName(); $status = market::getInfo($widget->getLogicalId()); if ($status['status'] == 'depreciated') { echo '<i class="fa fa-times pull-right" title="Widget non maintenu ou supprimé"></i>'; } if ($status['status'] == 'ok') { echo '<i class="fa fa-check pull-right" title="Widget à jour"></i>'; } if ($status['status'] == 'update') { echo '<i class="fa fa-refresh pull-right" title="Mise à jour nécessaire"></i>'; } echo '</a></li>'; } ?> </ul> </div> </div>
if (!unlink($older['file'])) { $i = 50; } $i++; if ($i > 50) { echo __("Plus de 50 sauvegardes supprimées. Je m'arrête.\n", __FILE__); break; } } echo __("OK", __FILE__) . "\n"; global $NO_CLOUD_BAKCUP; if (!isset($NO_CLOUD_BAKCUP) || $NO_CLOUD_BAKCUP == false) { if (config::byKey('backup::cloudUpload') == 1 && init('noCloudUpload', 0) == 0) { echo __('Envoi de la sauvegarde dans le cloud...', __FILE__); try { market::sendBackup($backup_dir . '/' . $bakcup_name); } catch (Exception $e) { log::add('backup', 'error', $e->getMessage()); echo '/!\\ ' . br2nl($e->getMessage()) . ' /!\\'; } echo __("OK", __FILE__) . "\n"; } } if (config::byKey('jeeNetwork::mode') == 'slave') { echo __('Envoi de la sauvegarde sur le maître...', __FILE__); try { jeeNetwork::sendBackup($backup_dir . '/' . $bakcup_name); } catch (Exception $e) { log::add('backup', 'error', $e->getMessage()); echo '/!\\ ' . br2nl($e->getMessage()) . ' /!\\'; }
public static function syncEqLogicWithRazberry($_serverId = 1) { $results = self::callRazberry('/ZWaveAPI/Data/0', $_serverId); $findDevice = array(); $include_device = ''; $razberry_id = zwave::getZwaveInfo('controller::data::nodeId::value', $_serverId); $findConfiguration = true; foreach ($results['devices'] as $nodeId => $result) { $findDevice[$nodeId] = $nodeId; if ($nodeId != $razberry_id) { if (!is_object(self::getEqLogicByLogicalIdAndServerId($nodeId, $_serverId))) { $eqLogic = new eqLogic(); $eqLogic->setEqType_name('zwave'); $eqLogic->setIsEnable(1); $eqLogic->setName('Device ' . $nodeId); $eqLogic->setLogicalId($nodeId); $eqLogic->setConfiguration('serverID', $_serverId); $eqLogic->setIsVisible(1); $eqLogic->save(); $eqLogic = zwave::byId($eqLogic->getId()); $eqLogic->InterviewForce(); for ($i = 0; $i < 30; $i++) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Pause de ', __FILE__) . (30 - $i) . __(' pour interview forcé du module', __FILE__))); sleep(1); } $include_device = $eqLogic->getId(); $findConfiguration = false; $result = self::callRazberry('/ZWaveAPI/Run/devices[' . $eqLogic->getLogicalId() . ']', $_serverId); $data = $result['data']; if (isset($data['manufacturerId']['value']) && isset($data['manufacturerProductType']['value']) && isset($data['manufacturerProductId']['value'])) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Recherche, si nécessaire, de la configuration sur le market', __FILE__))); sleep(1); try { $market_rpc = market::getJsonRpc(); if ($market_rpc->sendRequest('market::searchZwaveModuleConf', array('manufacturerId' => $data['manufacturerId']['value'], 'manufacturerProductType' => $data['manufacturerProductType']['value'], 'manufacturerProductId' => $data['manufacturerProductId']['value']))) { foreach ($market_rpc->getResult() as $logicalId => $result) { if (isset($result['id'])) { $markets[$logicalId] = market::construct($result); } } if (count($markets) == 1) { $market = $markets[0]; $update = update::byLogicalId($market->getLogicalId()); if (!is_object($update)) { if ($market->getStatus('stable') == 1) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Configuration trouvée en stable : ', __FILE__) . $market->getName() . __(' installation en cours', __FILE__))); sleep(1); $market->install(); } else { if ($market->getStatus('beta') == 1) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Configuration trouvée en beta : ', __FILE__) . $market->getName() . __(' installation en cours', __FILE__))); sleep(1); $market->install('beta'); } } } } } } catch (Exception $e) { } } /* Reconnaissance du module */ foreach (self::devicesParameters() as $device_id => $device) { if ($device['manufacturerId'] == $data['manufacturerId']['value'] && $device['manufacturerProductType'] == $data['manufacturerProductType']['value'] && $device['manufacturerProductId'] == $data['manufacturerProductId']['value']) { $findConfiguration = true; nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Périphérique reconnu : ', __FILE__) . $device['name'] . '!! (Manufacturer ID : ' . $data['manufacturerId']['value'] . ', Product type : ' . $data['manufacturerProductType']['value'] . ', Product ID : ' . $data['manufacturerProductId']['value'] . __('). Configuration en cours veuillez patienter...', __FILE__))); sleep(1); $eqLogic->setConfiguration('device', $device_id); $eqLogic->save(); for ($i = 0; $i < 5; $i++) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Pause de ', __FILE__) . (5 - $i) . __(' secondes pour synchronisation avec le module', __FILE__))); sleep(1); } nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Mise à jour forcée des valeurs des commandes', __FILE__))); $listServerZway = self::listServerZway(); if ($listServerZway[$_serverId]['isOpenZwave'] != 1) { $eqLogic->forceUpdate(); } break; } } } } } if (config::byKey('autoRemoveExcludeDevice', 'zwave') == 1 && count($findDevice) > 1) { foreach (self::byType('zwave') as $eqLogic) { if (!isset($findDevice[$eqLogic->getLogicalId()]) && $eqLogic->getConfiguration('serverID') == $_serverId) { $eqLogic->remove(); } } } nodejs::pushUpdate('zwave::includeDevice', $include_device); if (!$findConfiguration) { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => __('Votre module n\'est pas reconnu, veuillez récupérer sa configuration sur le market si celle ci est disponible', __FILE__))); } else { nodejs::pushUpdate('jeedom::alert', array('level' => 'warning', 'message' => '')); } }
} if (init('action') == 'clearDate') { $cache = cache::byKey('jeedom::lastDate'); $cache->remove(); ajax::success(); } if (init('action') == 'backup') { jeedom::backup(true, init('noCloudUpload')); ajax::success(); } if (init('action') == 'restore') { jeedom::restore(init('backup'), true); ajax::success(); } if (init('action') == 'restoreCloud') { market::retoreBackup(init('backup')); ajax::success(); } if (init('action') == 'getUpdateLog') { ajax::success(log::get('update', 0, 3000)); } if (init('action') == 'getBackupLog') { ajax::success(log::get('backup', 0, 3000)); } if (init('action') == 'getRestoreLog') { ajax::success(log::get('restore', 0, 3000)); } if (init('action') == 'removeBackup') { jeedom::removeBackup(init('backup')); ajax::success(); }
public static function getInfo($_logicalId, $_version = 'stable') { $returns = array(); if (is_array($_logicalId) && is_array($_version) && count($_logicalId) == count($_version)) { if (is_array(reset($_logicalId))) { $markets = market::byLogicalIdAndType($_logicalId); } else { $markets = market::byLogicalId($_logicalId); } $returns = array(); for ($i = 0; $i < count($_logicalId); $i++) { if (is_array($_logicalId[$i])) { $logicalId = $_logicalId[$i]['type'] . $_logicalId[$i]['logicalId']; } else { $logicalId = $_logicalId[$i]; } $return['datetime'] = '0000-01-01 00:00:00'; if ($logicalId == '' || config::byKey('market::address') == '') { $return['market'] = 0; $return['market_owner'] = 0; $return['status'] = 'ok'; return $return; } if (config::byKey('market::username') != '' && config::byKey('market::password') != '') { $return['market_owner'] = 1; } else { $return['market_owner'] = 0; } $return['market'] = 0; try { if (isset($markets[$logicalId])) { $market = $markets[$logicalId]; if (!is_object($market)) { $return['status'] = 'ok'; } else { $return['datetime'] = $market->getDatetime($_version[$i]); $return['market'] = 1; $return['market_owner'] = $market->getIsAuthor(); $update = update::byTypeAndLogicalId($market->getType(), $market->getLogicalId()); $updateDateTime = '0000-01-01 00:00:00'; if (is_object($update)) { $updateDateTime = $update->getLocalVersion(); } if ($updateDateTime < $market->getDatetime($_version[$i], $updateDateTime)) { $return['status'] = 'update'; } else { $return['status'] = 'ok'; } } } else { $return['status'] = 'ok'; } } catch (Exception $e) { log::add('market', 'debug', __('Erreur market::getinfo : ', __FILE__) . $e->getMessage()); $return['status'] = 'ok'; } $returns[$logicalId] = $return; } return $returns; } $return = array(); $return['datetime'] = '0000-01-01 00:00:00'; if (config::byKey('market::address') == '') { $return['market'] = 0; $return['market_owner'] = 0; $return['status'] = 'ok'; return $return; } if (config::byKey('market::username') != '' && config::byKey('market::password') != '') { $return['market_owner'] = 1; } else { $return['market_owner'] = 0; } $return['market'] = 0; try { if (is_array($_logicalId)) { $market = market::byLogicalIdAndType($_logicalId['logicalId'], $_logicalId['type']); } else { $market = market::byLogicalId($_logicalId); } if (!is_object($market)) { $return['status'] = 'depreciated'; } else { $return['datetime'] = $market->getDatetime($_version); $return['market'] = 1; $return['market_owner'] = $market->getIsAuthor(); $update = update::byTypeAndLogicalId($market->getType(), $market->getLogicalId()); $updateDateTime = '0000-01-01 00:00:00'; if (is_object($update)) { $updateDateTime = $update->getLocalVersion(); } if ($updateDateTime < $market->getDatetime($_version, $updateDateTime)) { $return['status'] = 'update'; } else { $return['status'] = 'ok'; } } } catch (Exception $e) { log::add('market', 'debug', __('Erreur market::getinfo : ', __FILE__) . $e->getMessage()); $return['status'] = 'ok'; } return $return; }
try { require_once dirname(__FILE__) . '/../../core/php/core.inc.php'; include_file('core', 'authentification', 'php'); if (!isConnect()) { throw new Exception(__('401 - Accès non autorisé', __FILE__)); } if (init('action') == 'getConf') { if (!isConnect('admin')) { throw new Exception(__('401 - Accès non autorisé', __FILE__)); } $plugin = plugin::byId(init('id')); $return = utils::o2a($plugin); $return['activate'] = $plugin->isActive(); $return['configurationPath'] = $plugin->getPathToConfigurationById(); $return['checkVersion'] = version_compare(jeedom::version(), $plugin->getRequire()); $return['status'] = market::getInfo(array('logicalId' => $plugin->getId(), 'type' => 'plugin')); $return['update'] = utils::o2a(update::byLogicalId($plugin->getId())); ajax::success($return); } if (init('action') == 'toggle') { if (!isConnect('admin')) { throw new Exception(__('401 - Accès non autorisé', __FILE__)); } $plugin = plugin::byId(init('id')); if (!is_object($plugin)) { throw new Exception(__('Plugin introuvable : ', __FILE__) . init('id')); } $plugin->setIsEnable(init('state')); ajax::success(); } if (init('action') == 'all') {
public function deleteObjet() { if ($this->getType() == 'core') { throw new Exception('Vous ne pouvez pas supprimer le core de Jeedom'); } else { try { $market = market::byLogicalIdAndType($this->getLogicalId(), $this->getType()); } catch (Exception $e) { $market = new market(); $market->setLogicalId($this->getLogicalId()); $market->setType($this->getType()); } try { if (is_object($market)) { $market->remove(); } } catch (Exception $e) { } $this->remove(); } }