예제 #1
0
파일: index.php 프로젝트: GaelGRIFFON/core
												<?php 
    }
    ?>
											</ul>

											<ul class="nav navbar-nav navbar-right">
												<?php 
    $displayMessage = message::nbMessage() > 0 ? '' : 'display : none;';
    ?>
												<li><a href="index.php?v=d&p=message">
													<span class="label label-warning" id="span_nbMessage" style="<?php 
    echo $displayMessage;
    ?>
">
														<i class="fa fa-envelope"></i> <?php 
    echo message::nbMessage();
    ?>
 {{message(s)}}
													</span>
												</a>
											</li>
											<li>
												<a href="#">
													<i class="fa fa-clock-o"></i> <span id="horloge"><?php 
    echo date('H:i:s');
    ?>
</span>
												</a>
											</li>
											<li class="dropdown">
												<a class="dropdown-toggle" data-toggle="dropdown" href="#">
예제 #2
0
파일: jeeApi.php 프로젝트: GaelGRIFFON/core
         $scenario->setIsActive(0);
         $jsonrpc->makeSuccess($scenario->save());
     }
     throw new Exception('La paramètre "state" ne peut être vide et doit avoir pour valeur [run,stop,enable;disable]');
 }
 /*             * ************************JeeNetwork*************************** */
 if ($jsonrpc->getMethod() == 'jeeNetwork::handshake') {
     if (config::byKey('jeeNetwork::mode') != 'slave') {
         throw new Exception('Impossible d\'ajouter une box jeedom non esclave à un réseau Jeedom');
     }
     $auiKey = config::byKey('auiKey');
     if ($auiKey == '') {
         $auiKey = config::genKey(255);
         config::save('auiKey', $auiKey);
     }
     $return = array('mode' => config::byKey('jeeNetwork::mode'), 'nbUpdate' => update::nbNeedUpdate(), 'version' => jeedom::version(), 'nbMessage' => message::nbMessage(), 'auiKey' => $auiKey, 'jeedom::url' => config::byKey('jeedom::url'), 'ngrok::port' => config::byKey('ngrok::port'));
     if (!filter_var(network::getNetworkAccess('external', 'ip'), FILTER_VALIDATE_IP) && network::getNetworkAccess('external', 'ip') != '') {
         $return['jeedom::url'] = network::getNetworkAccess('internal');
     }
     foreach (plugin::listPlugin(true) as $plugin) {
         if ($plugin->getAllowRemote() == 1) {
             $return['plugin'][] = $plugin->getId();
         }
     }
     $address = isset($params['address']) && $params['address'] != '' ? $params['address'] : getClientIp();
     config::save('jeeNetwork::master::ip', $address);
     config::save('jeeNetwork::master::apikey', $params['apikey_master']);
     config::save('jeeNetwork::slave::id', $params['slave_id']);
     if (config::byKey('internalAddr') == '') {
         config::save('internalAddr', $params['slave_ip']);
     }
예제 #3
0
 public static function getJsonRpc()
 {
     if (config::byKey('market::address') == '') {
         throw new Exception(__('Aucune addresse n\'est renseignée pour le market', __FILE__));
     }
     if (config::byKey('market::username') != '' && config::byKey('market::password') != '') {
         $params = array('username' => config::byKey('market::username'), 'password' => config::byKey('market::password'), 'password_type' => 'sha1', 'jeedomversion' => jeedom::version(), 'hwkey' => jeedom::getHardwareKey(), 'addrComplement' => config::byKey('externalComplement'), 'information' => array('nbMessage' => message::nbMessage(), 'hardware' => method_exists('jeedom', 'getHardwareName') ? jeedom::getHardwareName() : ''));
         if (config::byKey('market::allowDNS') != 1) {
             $params['addr'] = config::byKey('externalAddr');
             $params['addrProtocol'] = config::byKey('externalProtocol');
             $params['addrPort'] = config::byKey('externalPort');
         }
         $jsonrpc = new jsonrpcClient(config::byKey('market::address') . '/core/api/api.php', '', $params);
     } else {
         $jsonrpc = new jsonrpcClient(config::byKey('market::address') . '/core/api/api.php', '', array('jeedomversion' => jeedom::version(), 'hwkey' => jeedom::getHardwareKey()));
     }
     $jsonrpc->setCb_class('market');
     $jsonrpc->setCb_function('postJsonRpc');
     return $jsonrpc;
 }
예제 #4
0
 *
 * You should have received a copy of the GNU General Public License
 * 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()) {
        throw new Exception(__('401 - Accès non autorisé', __FILE__));
    }
    if (init('action') == 'clearMessage') {
        message::removeAll(init('plugin'));
        ajax::success();
    }
    if (init('action') == 'nbMessage') {
        ajax::success(message::nbMessage());
    }
    if (init('action') == 'all') {
        if (init('plugin') == '') {
            $messages = utils::o2a(message::all());
        } else {
            $messages = utils::o2a(message::byPlugin(init('plugin')));
        }
        foreach ($messages as &$message) {
            $message['message'] = htmlentities($message['message']);
        }
        ajax::success($messages);
    }
    if (init('action') == 'removeMessage') {
        $message = message::byId(init('id'));
        if (!is_object($message)) {