Esempio n. 1
0
function jeedomPluginAutoload($classname)
{
    $plugin = null;
    try {
        $plugin = plugin::byId($classname);
    } catch (Exception $e) {
        if (!is_object($plugin)) {
            if (strpos($classname, 'Real') !== false) {
                $plugin = plugin::byId(substr($classname, 0, -4));
            }
            if (!is_object($plugin) && strpos($classname, 'Cmd') !== false) {
                $classname = str_replace('Cmd', '', $classname);
                try {
                    $plugin = plugin::byId($classname);
                } catch (Exception $e) {
                    if (strpos($classname, '_') !== false && strpos($classname, 'com_') === false) {
                        $plugin = plugin::byId(substr($classname, 0, strpos($classname, '_')));
                    }
                }
            }
            if (!is_object($plugin) && strpos($classname, '_') !== false && strpos($classname, 'com_') === false) {
                $plugin = plugin::byId(substr($classname, 0, strpos($classname, '_')));
            }
        }
    }
    try {
        if (is_object($plugin)) {
            if ($plugin->isActive() == 1) {
                $include = $plugin->getInclude();
                include_file('core', $include['file'], $include['type'], $plugin->getId());
            }
        }
    } catch (Exception $e) {
    }
}
Esempio n. 2
0
 private static function getClass($_id)
 {
     if (get_called_class() != __CLASS__) {
         return get_called_class();
     }
     $values = array('id' => $_id);
     $sql = 'SELECT plugin,isEnable
             FROM eqLogic
             WHERE eqReal_id=:id';
     $result = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
     $eqTyme_name = $result['plugin'];
     if ($result['isEnable'] == 0) {
         try {
             $plugin = null;
             if ($eqTyme_name != '') {
                 $plugin = plugin::byId($eqTyme_name);
             }
             if (!is_object($plugin) || $plugin->isActive() == 0) {
                 return __CLASS__;
             }
         } catch (Exception $e) {
             return __CLASS__;
         }
     }
     if (class_exists($eqTyme_name)) {
         if (method_exists($eqTyme_name, 'getClassCmd')) {
             return $eqTyme_name::getClassCmd();
         }
     }
     if (class_exists($eqTyme_name . 'Real')) {
         return $eqTyme_name . 'Real';
     }
     return __CLASS__;
 }
Esempio n. 3
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('denonavr');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>

<div class="row row-overflow">
  <div class="col-lg-2 col-md-3 col-sm-4">
    <div class="bs-sidebar">
      <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
        <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un template}}</a>
        <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
        <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
     </ul>
   </div>
 </div>

 <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
  <legend>{{Mes Denons}}
  </legend>

  <div class="eqLogicThumbnailContainer">
    <div class="cursor eqLogicAction" data-action="add" style="background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
Esempio n. 4
0
require_once dirname(__FILE__) . "/core.inc.php";
if (isset($argv)) {
    foreach ($argv as $arg) {
        $argList = explode('=', $arg);
        if (isset($argList[0]) && isset($argList[1])) {
            $_GET[$argList[0]] = $argList[1];
        }
    }
}
try {
    set_time_limit(config::byKey('maxExecTimeScript', 10));
    $plugin_id = init('plugin_id');
    if ($plugin_id == '') {
        throw new Exception(__('Le plugin ID ne peut être vide', __FILE__));
    }
    $plugin = plugin::byId($plugin_id);
    if (!is_object($plugin)) {
        throw new Exception(__('Plugin non trouvé : ', __FILE__) . init('plugin_id'));
    }
    $function = init('function');
    if ($function == '') {
        throw new Exception(__('La fonction ne peut être vide', __FILE__));
    }
    if (!class_exists($plugin_id) || !method_exists($plugin_id, $function)) {
        throw new Exception(__('Il n\'existe aucune méthode : ', __FILE__) . $plugin_id . '::' . $function);
    }
    //  log::add(init('plugin_id', 'plugin'), 'info', __('Lancement de ', __FILE__) . $plugin_id . '::' . $function . '()');
    $plugin_id::$function();
} catch (Exception $e) {
    log::add(init('plugin_id', 'plugin'), 'error', $e->getMessage());
    die($e->getMessage());
Esempio n. 5
0
    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>


<a class="btn btn-success pull-right" style="color : white;" id="bt_sendToMarket"><i class="fa fa-cloud-upload"></i> {{Envoyer}}</a>
Esempio n. 6
0
        if (count($matches) == 4 && @is_numeric($matches[1][0]) && @$matches[1][0] != '' && @is_numeric($matches[2][0]) && @$matches[2][0] != '' && @is_numeric($matches[3][0]) && @$matches[3][0] != '') {
            $value = 'data[0].' . $value;
        }
        $cmd->setConfiguration('value', $value);
        if ($eqLogic->getConfiguration('device') == 'fibaro.fgrm221') {
            if ($cmd->getConfiguration('class') == '0x25' && $this->getConfiguration('data[0].val') && $this->getType() == 'info') {
                $cmd->setConfiguration('class', '0x26');
            }
        }
        if ($eqLogic->getConfiguration('device') == 'fibaro.fgs221') {
            if ($cmd->getConfiguration('instanceId') == 1) {
                $cmd->setConfiguration('instanceId', 0);
            }
            if ($cmd->getConfiguration('instanceId') == 2) {
                $cmd->setConfiguration('instanceId', 1);
            }
        }
        $cmd->save();
    }
}
$cron = cron::byClassAndFunction('zwave', 'pull');
if (is_object($cron)) {
    $cron->halt();
    $cron->remove();
}
$plugin = plugin::byId('zwave');
if (is_object($plugin)) {
    $plugin->setIsEnable(0);
}
echo "\nFin de la migration vers openzwave!!!!!!";
echo "\n/!\\IL EST VIVEMENT CONSEILLE DE REDEMARRER JEEDOM/!\\ ";
Esempio n. 7
0
 public function remove()
 {
     $cache = cache::byKey('market::info::' . $this->getLogicalId());
     if (is_object($cache)) {
         $cache->remove();
     }
     switch ($this->getType()) {
         case 'plugin':
             try {
                 $plugin = plugin::byId($this->getLogicalId());
                 if (is_object($plugin)) {
                     try {
                         $plugin->setIsEnable(0);
                     } catch (Exception $e) {
                     }
                     foreach (eqLogic::byType($this->getLogicalId()) as $eqLogic) {
                         try {
                             $eqLogic->remove();
                         } catch (Exception $e) {
                         }
                     }
                 }
                 config::remove('*', $this->getLogicalId());
             } catch (Exception $e) {
             }
             try {
                 $cibDir = dirname(__FILE__) . '/../../plugins/' . $this->getLogicalId();
                 if (file_exists($cibDir)) {
                     rrmdir($cibDir);
                 }
             } catch (Exception $e) {
             }
             break;
         default:
             $type = $this->getType();
             if (class_exists($type) && method_exists($type, 'removeFromMarket')) {
                 $type::removeFromMarket($this);
             }
             break;
     }
     $update = update::byTypeAndLogicalId($this->getType(), $this->getLogicalId());
     if (is_object($update)) {
         $update->remove();
     }
 }
Esempio n. 8
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('ecowatt');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>

<div class="row row-overflow">
    <div class="col-lg-2 col-md-3 col-sm-4">
        <div class="bs-sidebar">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
                <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un ecowatt}}</a>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
                <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
           </ul>
       </div>
   </div>

   <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
     <legend>{{Mes Eco 2 Watts}}
     </legend>
     <div class="eqLogicThumbnailContainer">
        <div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
            <i class="fa fa-plus-circle" style="font-size : 7em;color:#94ca02;"></i>
Esempio n. 9
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('nabaztag');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>

<div class="row row-overflow">
  <div class="col-sm-2">
    <div class="bs-sidebar">
      <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
        <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un équipement}}</a>
        <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
        <?php 
foreach ($eqLogics as $eqLogic) {
    $opacity = $eqLogic->getIsEnable() ? '' : jeedom::getConfiguration('eqLogic:style:noactive');
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '" style="' . $opacity . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
     </ul>
   </div>
 </div>
 <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
  <legend>{{Mes Nabaztag}}
  </legend>
  <?php 
if (count($eqLogics) == 0) {
    echo "<br/><br/><br/><center><span style='color:#767676;font-size:1.2em;font-weight: bold;'>{{Vous n'avez pas encore de Nabaztag, cliquez sur Ajouter pour commencer}}</span></center>";
Esempio n. 10
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('karotz');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>

<div class="row row-overflow">
    <div class="col-lg-2">
        <div class="bs-sidebar">
            <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
                <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un Karotz}}</a>
                <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
                <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
           </ul>
       </div>
   </div>
   <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
    <legend>{{Mes Karotzs}}</legend>
    <div class="eqLogicThumbnailContainer">
      <div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
            <i class="fa fa-plus-circle" style="font-size : 7em;color:#94ca02;"></i>
        <br>
        <span style="font-size : 1.1em;position:relative; top : 23px;word-break: break-all;white-space: pre-wrap;word-wrap: break-word;;color:#94ca02">Ajouter</span>
Esempio n. 11
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('mode');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>

<div class="row row-overflow">
  <div class="col-lg-2 col-md-3 col-sm-4">
    <div class="bs-sidebar">
      <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
        <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un mode}}</a>
        <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
        <?php 
foreach ($eqLogics as $eqLogic) {
    $opacity = $eqLogic->getIsEnable() ? '' : jeedom::getConfiguration('eqLogic:style:noactive');
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '" style="' . $opacity . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
     </ul>
   </div>
 </div>

 <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
  <legend><i class="fa fa-th-large"></i>  {{Mes Modes}}
  </legend>
  <div class="eqLogicThumbnailContainer">
    <div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
Esempio n. 12
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('openvpn');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>

<div class="row row-overflow">
  <div class="col-lg-2 col-md-3 col-sm-4">
    <div class="bs-sidebar">
      <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
        <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un openvpn}}</a>
        <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
        <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName() . '</a></li>';
}
?>
     </ul>
   </div>
 </div>

 <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
  <legend>{{Mes openvpns}}
  </legend>

  <div class="eqLogicThumbnailContainer">
    <div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
Esempio n. 13
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('wazeintime');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>
<div class="row row-overflow">
  <div class="col-lg-2">
    <div class="bs-sidebar">
      <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
        <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un trajet}}</a>
        <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
        <?php 
foreach ($eqLogics as $eqLogic) {
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
     </ul>
   </div>
 </div>
 <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
  <legend><i class="fa fa-car"></i>  {{Mes Trajets}}
  </legend>
  <div class="eqLogicThumbnailContainer">
    <div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
      <i class="fa fa-plus-circle" style="font-size : 7em;color:#94ca02;"></i>
    <br>
    <span style="font-size : 1.1em;position:relative; top : 23px;word-break: break-all;white-space: pre-wrap;word-wrap: break-word;;color:#94ca02">Ajouter</span>
Esempio n. 14
0
 public static function changeMode($_mode)
 {
     switch ($_mode) {
         case 'master':
             if (config::byKey('jeeNetwork::mode') != 'master') {
                 $cron = new cron();
                 $cron->setClass('history');
                 $cron->setFunction('historize');
                 $cron->setSchedule('*/5 * * * * *');
                 $cron->setTimeout(5);
                 $cron->save();
                 $cron = new cron();
                 $cron->setClass('scenario');
                 $cron->setFunction('check');
                 $cron->setSchedule('* * * * * *');
                 $cron->setTimeout(5);
                 $cron->save();
                 $cron = new cron();
                 $cron->setClass('cmd');
                 $cron->setFunction('collect');
                 $cron->setSchedule('*/5 * * * * *');
                 $cron->setTimeout(5);
                 $cron->save();
                 $cron = new cron();
                 $cron->setClass('history');
                 $cron->setFunction('archive');
                 $cron->setSchedule('00 * * * * *');
                 $cron->setTimeout(20);
                 $cron->save();
                 config::save('jeeNetwork::mode', 'master');
             }
             break;
         case 'slave':
             if (config::byKey('jeeNetwork::mode') != 'slave') {
                 foreach (eqLogic::all() as $eqLogic) {
                     $eqLogic->remove();
                 }
                 foreach (object::all() as $object) {
                     $object->remove();
                 }
                 foreach (update::all() as $update) {
                     switch ($update->getType()) {
                         case 'core':
                             break;
                         case 'plugin':
                             try {
                                 $plugin = plugin::byId($update->getLogicalId());
                                 if (is_object($plugin) && $plugin->getAllowRemote() != 1) {
                                     $update->deleteObjet();
                                 }
                             } catch (Exception $e) {
                             }
                             break;
                         default:
                             $update->deleteObjet();
                             break;
                     }
                 }
                 foreach (view::all() as $view) {
                     $view->remove();
                 }
                 foreach (plan::all() as $plan) {
                     $plan->remove();
                 }
                 foreach (scenario::all() as $scenario) {
                     $scenario->remove();
                 }
                 foreach (listener::all() as $listener) {
                     $listener->remove();
                 }
                 $cron = cron::byClassAndFunction('history', 'historize');
                 if (is_object($cron)) {
                     $cron->remove();
                 }
                 $cron = cron::byClassAndFunction('scenario', 'check');
                 if (is_object($cron)) {
                     $cron->remove();
                 }
                 $cron = cron::byClassAndFunction('cmd', 'collect');
                 if (is_object($cron)) {
                     $cron->remove();
                 }
                 $cron = cron::byClassAndFunction('history', 'archive');
                 if (is_object($cron)) {
                     $cron->remove();
                 }
                 $user = new user();
                 $user->setLogin('jeedom_master');
                 $user->setPassword(config::genKey(255));
                 $user->setRights('admin', 1);
                 $user->save();
                 config::save('jeeNetwork::mode', 'slave');
             }
             break;
     }
 }
Esempio n. 15
0
 public static function saveTranslation()
 {
     $core = array();
     $plugins = array();
     foreach (self::getTranslation(self::getLanguage()) as $page => $translation) {
         if (strpos($page, 'plugins/') === false) {
             $core[$page] = $translation;
         } else {
             $plugin = substr($page, strpos($page, 'plugins/') + 8);
             $plugin = substr($plugin, 0, strpos($plugin, '/'));
             if (!isset($plugins[$plugin])) {
                 $plugins[$plugin] = array();
             }
             $plugins[$plugin][$page] = $translation;
         }
     }
     file_put_contents(self::getPathTranslationFile(self::getLanguage()), json_encode($core, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
     foreach ($plugins as $plugin_name => $translation) {
         try {
             $plugin = plugin::byId($plugin_name);
             $plugin->saveTranslation(self::getLanguage(), $translation);
         } catch (Exception $e) {
         }
     }
 }
Esempio n. 16
0
 public static function listPlugin($_activateOnly = false, $_orderByCaterogy = false, $_translate = true)
 {
     $listPlugin = array();
     if ($_activateOnly) {
         $sql = "SELECT plugin\n            FROM config\n            WHERE `key`='active'\n            AND `value`='1'";
         $results = DB::Prepare($sql, array(), DB::FETCH_TYPE_ALL);
         foreach ($results as $result) {
             try {
                 $listPlugin[] = plugin::byId($result['plugin'], $_translate);
             } catch (Exception $e) {
                 log::add('plugin', 'error', $e->getMessage(), 'pluginNotFound::' . $result['plugin']);
             }
         }
     } else {
         $rootPluginPath = dirname(__FILE__) . '/../../plugins';
         foreach (ls($rootPluginPath, '*') as $dirPlugin) {
             if (is_dir($rootPluginPath . '/' . $dirPlugin)) {
                 $pathInfoPlugin = $rootPluginPath . '/' . $dirPlugin . '/plugin_info/info.xml';
                 if (file_exists($pathInfoPlugin)) {
                     try {
                         $listPlugin[] = plugin::byId($pathInfoPlugin, $_translate);
                     } catch (Exception $e) {
                         log::add('plugin', 'error', $e->getMessage(), 'pluginNotFound::' . $pathInfoPlugin);
                     }
                 }
             }
         }
     }
     if ($_orderByCaterogy) {
         $return = array();
         if (count($listPlugin) > 0) {
             foreach ($listPlugin as $plugin) {
                 $category = $plugin->getCategory();
                 if ($category == '') {
                     $category = __('Autre', __FILE__);
                 }
                 if (!isset($return[$category])) {
                     $return[$category] = array();
                 }
                 $return[$category][] = $plugin;
             }
             foreach ($return as &$category) {
                 usort($category, 'plugin::orderPlugin');
             }
             ksort($return);
         }
         return $return;
     } else {
         if (isset($listPlugin) && is_array($listPlugin) && count($listPlugin) > 0) {
             usort($listPlugin, 'plugin::orderPlugin');
             return $listPlugin;
         } else {
             return array();
         }
     }
 }
Esempio n. 17
0
 if (!file_exists($cibDir) && !mkdir($cibDir, 0775, true)) {
     throw new Exception(__('Impossible de créer le dossier  : ' . $cibDir . '. Problème de droits ?', __FILE__));
 }
 log::add('update', 'update', __('Décompression de l\'archive...', __FILE__));
 $zip = new ZipArchive();
 $res = $zip->open($tmp);
 if ($res === TRUE) {
     if (!$zip->extractTo($cibDir . '/')) {
         $content = file_get_contents($tmp);
         throw new Exception(__('Impossible d\'installer le plugin. Les fichiers n\'ont pas pu être décompressés : ', __FILE__) . substr($content, 255));
     }
     $zip->close();
     log::add('update', 'update', __("OK\n", __FILE__));
     log::add('update', 'update', __('Installation de l\'objet...', __FILE__));
     try {
         $plugin = plugin::byId($logicalId);
     } catch (Exception $e) {
         throw new Exception(__('Impossible d\'installer le plugin. Le nom du plugin est différent de l\'ID ou le plugin n\'est pas correctement formé. Veuillez contacter l\'auteur.', __FILE__));
     }
     log::add('update', 'update', __("OK\n", __FILE__));
     if (is_object($plugin) && $plugin->isActive()) {
         $plugin->setIsEnable(1);
     }
 } else {
     switch ($res) {
         case ZipArchive::ER_EXISTS:
             $ErrMsg = "Le fichier existe déjà.";
             break;
         case ZipArchive::ER_INCONS:
             $ErrMsg = "L'archive zip est inconsistente.";
             break;
Esempio n. 18
0
<?php

if (!isConnect('admin')) {
    throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('networks');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>

<div class="row row-overflow">
  <div class="col-lg-2 col-md-3 col-sm-4">
    <div class="bs-sidebar">
      <ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
        <a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un networks}}</a>
        <li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
        <?php 
foreach ($eqLogics as $eqLogic) {
    $opacity = $eqLogic->getIsEnable() ? '' : jeedom::getConfiguration('eqLogic:style:noactive');
    echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '" style="' . $opacity . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
     </ul>
   </div>
 </div>

 <div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
  <legend><i class="fa fa-table"></i> {{Mes networks}}</legend>
  <div class="eqLogicThumbnailContainer">
    <div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
      <i class="fa fa-plus-circle" style="font-size : 7em;color:#94ca02;"></i>