Beispiel #1
0
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') {
Beispiel #2
0
 public function status()
 {
     return market::getInfo(array('logicalId' => $this->getId(), 'type' => 'plugin'));
 }
Beispiel #3
0
 * 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));
Beispiel #4
0
 if (init('action') == 'save') {
     $market_ajax = json_decode(init('market'), true);
     try {
         $market = market::byId($market_ajax['id']);
     } catch (Exception $e) {
         $market = new market();
     }
     if (isset($market_ajax['rating'])) {
         unset($market_ajax['rating']);
     }
     utils::a2o($market, $market_ajax);
     $market->save();
     ajax::success();
 }
 if (init('action') == 'getInfo') {
     ajax::success(market::getInfo(init('logicalId')));
 }
 if (init('action') == 'byLogicalId') {
     if (init('noExecption', 0) == 1) {
         try {
             ajax::success(utils::o2a(market::byLogicalIdAndType(init('logicalId'), init('type'))));
         } catch (Exception $e) {
             ajax::success();
         }
     } else {
         ajax::success(utils::o2a(market::byLogicalIdAndType(init('logicalId'), init('type'))));
     }
 }
 if (init('action') == 'test') {
     ajax::success(market::test());
 }
Beispiel #5
0
        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>
Beispiel #6
0
 public function checkUpdate()
 {
     if ($this->getType() == 'core') {
         $update_info = jeedom::needUpdate(true);
         $this->setLocalVersion($update_info['version']);
         $this->setRemoteVersion($update_info['currentVersion']);
         if ($update_info['needUpdate']) {
             $this->setStatus('update');
         } else {
             $this->setStatus('ok');
         }
         $this->save();
     } else {
         try {
             $market_info = market::getInfo(array('logicalId' => $this->getLogicalId(), 'type' => $this->getType()), $this->getConfiguration('version', 'stable'));
             $this->setStatus($market_info['status']);
             $this->setConfiguration('market_owner', $market_info['market_owner']);
             $this->setConfiguration('market', $market_info['market']);
             $this->setRemoteVersion($market_info['datetime']);
             $this->save();
         } catch (Exception $ex) {
         }
     }
 }