public static function add($_type, $_message, $_action = '', $_logicalId = '') { $list_plugin = config::byKey('message::disallowPlugin', 'core', array()); if (in_array($_type, $list_plugin)) { return; } $message = new message(); $message->setPlugin(secureXSS($_type)); $message->setMessage(secureXSS($_message)); $message->setAction(secureXSS($_action)); $message->setDate(date('Y-m-d H:i:m')); $message->setLogicalId(secureXSS($_logicalId)); $message->save(); }
<a class="btn btn-success pull-right" id="bt_downloadLog"><i class="fa fa-cloud-download"></i> {{Télécharger}}</a> <a class="btn btn-primary pull-right" id="bt_refreshLog"><i class="fa fa-refresh"></i> {{Rafraîchir}}</a> <select id="sel_log" class="pull-left form-control" style="width: 200px;"> <?php foreach ($list_logfile as $file) { if ($file == $logfile) { echo '<option value="' . $file . '" selected>' . $file . '</option>'; } else { echo '<option value="' . $file . '">' . $file . '</option>'; } } ?> </select> <br/><br/> <div id="div_logDisplay" style="overflow: scroll;"><pre><?php echo secureXSS(shell_exec('cat ' . dirname(__FILE__) . '/../../log/' . $logfile)); ?> </pre></div> <script> $(function() { $('#div_logDisplay').height($(window).height() - $('header').height() - $('footer').height() - 90); $('#div_logDisplay').scrollTop(999999999); $('#bt_downloadLog').click(function() { window.open('core/php/downloadFile.php?pathfile=log/' + $('#sel_log').value(), "_blank", null); }); $("#sel_log").on('change', function() { log = $('#sel_log').value(); $('#div_pageContainer').empty().load('index.php?v=d&p=log&logfile=' + log+'&ajax=1',function(){ initPage(); });
<a class="cursor tooltips" target="_blank" href="https://jeedom.fr/doc/documentation/plugins/<?php echo init('m'); ?> /fr_FR/<?php echo init('m'); ?> .html" title="{{Aide sur la page en cours}}"><i class="fa fa-question-circle" ></i></a> <?php } else { if (init('p') == 'scenarioAssist') { echo '<a class="cursor tooltips" target="_blank" href="https://jeedom.fr/doc/documentation/core/fr_FR/doc-core-scenario.html" title="{{Aide sur la page en cours}}"><i class="fa fa-question-circle" ></i></a>'; } else { if (init('p') == 'view_edit') { echo '<a class="cursor tooltips" target="_blank" href="https://jeedom.fr/doc/documentation/core/fr_FR/doc-core-view.html" title="{{Aide sur la page en cours}}"><i class="fa fa-question-circle" ></i></a>'; } else { echo '<a class="cursor tooltips" target="_blank" href="https://jeedom.fr/doc/documentation/core/fr_FR/doc-core-' . secureXSS(init('p')) . '.html" title="{{Aide sur la page en cours}}"><i class="fa fa-question-circle" ></i></a>'; } } } ?> </li> <?php if (hasRight('reportsend', true)) { ?> <li> <a class="bt_reportBug cursor tooltips" title="{{Envoyer un rapport de bug}}"> <i class="fa fa-exclamation-circle" ></i> </a> </li> <?php }
/** * Renvoi les x derniere ligne du fichier de log * @param int $_maxLigne nombre de ligne voulu * @return string Ligne du fichier de log */ public static function get($_log = 'core', $_begin, $_nbLines) { $replace = array('>' => '>', ''' => ''); self::chunk($_log); $page = array(); if (!file_exists($_log) || !is_file($_log)) { $path = self::getPathToLog($_log); if (!file_exists($path)) { return false; } } else { $path = $_log; } $log = new SplFileObject($path); if ($log) { $log->seek($_begin); //Seek to the begening of lines $linesRead = 0; while ($log->valid() && $linesRead != $_nbLines) { $line = $log->current(); //get current line $explode = explode("|", $line); if (count($explode) == 3) { $explode[2] = secureXSS($explode[2]); array_unshift($page, array_map('trim', $explode)); } else { if (trim($line) != '') { $lineread = array(); $lineread[0] = ''; $lineread[1] = ''; $lineread[2] = str_replace(array_keys($replace), $replace, htmlspecialchars($line)); $lineread[2] = $line; array_unshift($page, $lineread); } } $log->next(); //go to next line $linesRead++; } } return $page; }
* You should have received a copy of the GNU General Public License * along with Jeedom. If not, see <http://www.gnu.org/licenses/>. */ if (!isConnect('admin')) { throw new Exception('401 Unauthorized'); } ?> <div style="display: none;width : 100%" id="div_alertTrainsLog"></div> <a class="btn btn-danger pull-right" id="bt_trainsLogEmpty"><i class="fa fa-trash"></i> {{Vider les logs}}</a> <a class="btn btn-success pull-right" id="bt_trainsLogDownload"><i class="fa fa-cloud-download"></i> {{Télécharger}}</a> <a class="btn btn-primary pull-right" id="bt_trainsLogRefresh"><i class="fa fa-refresh"></i> {{Rafraîchir}}</a> <br/><br/> <div id="div_logDisplay" style="overflow: scroll;"> <pre> <?php echo secureXSS(shell_exec('cat ' . dirname(__FILE__) . '/../../../../log/trains')); ?> </pre> </div> <script> $(function() { $('#div_logDisplay').height($(window).height() - $('header').height() - $('footer').height() - 90); $('#div_logDisplay').scrollTop(999999999); $('#bt_trainsLogDownload').click(function() { window.open('core/php/downloadFile.php?pathfile=log/trains', "_blank", null); }); $('#bt_trainsLogRefresh').on('click', function() { $('#md_modal').load('index.php?v=d&plugin=trains&modal=show.log').dialog('open'); }); $("#bt_trainsLogEmpty").on('click', function(event) {
network::dns_start(); $jsonrpc->makeSuccess(); } if ($jsonrpc->getMethod() == 'network::stopNgrok') { config::save('market::allowDNS', 0); network::dns_stop(); $jsonrpc->makeSuccess(); } if ($jsonrpc->getMethod() == 'network::ngrokRun') { if (!isset($params['proto'])) { $params['proto'] = 'https'; } if (!isset($params['port'])) { $params['port'] = 80; } if (!isset($params['name'])) { $params['name'] = ''; } $jsonrpc->makeSuccess(network::dns_run()); } /* * ************************************************************************ */ } throw new Exception('Aucune méthode correspondante : ' . secureXSS($jsonrpc->getMethod()), -32500); /* * *********Catch exeption*************** */ } catch (Exception $e) { $message = $e->getMessage(); $jsonrpc = new jsonrpc(init('request')); $errorCode = is_numeric($e->getCode()) ? -32000 - $e->getCode() : -32599; $jsonrpc->makeError($errorCode, $message); } }