Example #1
0
 * Favicon
 */
$favicon = MOD_PATH . '/' . $module . '/assets/i/favicon.png';
if (!is_file(ROOT . '/' . $favicon)) {
    $favicon = 'assets/i/favicon.png';
}
$favicon = BASEURL . '/' . $favicon;
/****************************************************************
 * Notices
 ****************************************************************/
$notices = array();
if (isset($_SESSION['_notices'])) {
    $notices = $_SESSION['_notices'];
    unset($_SESSION['_notices']);
}
/****************************************************************
 * Module Engine
 ****************************************************************/
$loader = new Twig_Loader_Filesystem([ROOT . '/templates', MOD_DIR . '/' . $module . '/templates']);
$twig = new Twig_Environment($loader, array('cache' => ROOT . '/cache/twig', 'debug' => true));
/****************************************************************
 * Rendering
 ****************************************************************/
/**
 * Load controller
 */
$render = array();
require $view;
if (isset($engine) && $engine === false) {
    //echo file_get_contents(MOD_DIR.'/'.$module.'/templates/'.$page.'html')
    exit;
Example #2
0
<?php

use rpi\core\Pages;
/**
 * Declare pages
 */
Pages::i()->register('modules', 'index', 'Modules Manager');
Example #3
0
<?php

use rpi\core\Pages;
WS_print(Pages::i()->pages());
Example #4
0
<?php

use rpi\core\Pages;
use rpi\core\Content;
use rpi\core\gui\ModuleButton;
use rpi\cpu\ProcessorInfos;
use rpi\hardware\disk\DiskInfos;
define('CPU_TEMP_MAX', 90);
/**
 * Vars
 */
$model = Pages::i()->get("index");
$procinfo = new ProcessorInfos();
$sdcard = DiskInfos::getInfo('/media/sdcard');
/**
 * Info processing
 */
$infos = [['label' => 'Uptime', 'value' => $procinfo->uptime], ['label' => 'Users', 'value' => $procinfo->users, 'error' => $procinfo->users > 1], ['label' => 'Load', 'value' => $procinfo->load, 'error' => floatval($procinfo->load) > 1], ['label' => 'CPU', 'value' => $procinfo->temperature, 'unit' => '°C', 'min' => 0, 'max' => CPU_TEMP_MAX, 'warning' => $procinfo->temperature >= CPU_TEMP_MAX / 2, 'error' => $procinfo->temperature >= CPU_TEMP_MAX]];
if (!empty($sdcard)) {
    $used = $sdcard->used();
    $infos[] = ['label' => 'HDD', 'value' => $used->valueForUnit(), 'unit' => $used->unit(), 'min' => 0, 'max' => $sdcard->size()->valueForUnit()];
}
/**
 * Add model
 */
$model->addContent('old.info', [50 => 'Uptime : <span class="label label-default">' . $procinfo->uptime . '</span>', 51 => 'Users : <span class="label label-' . ($procinfo->users > 1 ? 'danger' : 'success') . '">' . $procinfo->users . '</span>', 52 => 'Load : <span class="label label-' . (floatval($procinfo->load) > 1 ? 'danger' : 'success') . '">' . $procinfo->load . '</span>', 53 => 'CPU : <span class="label label-' . ($procinfo->temperature > 60 ? 'danger' : 'success') . '">' . $procinfo->temperature . ' °C</span>'])->addContent('info', $infos)->addContent('action', [new ModuleButton('cpu', 'Off', 'shutdown', 'power.png'), new ModuleButton('cpu', 'Reboot', 'reboot', 'refresh.png')]);
Example #5
0
           * Zone T411 info ratio
           * /
          if ($tor->connected()) {
              $p = $tor->profile();
          	$ratio = ($p->uploaded / $p->downloaded);
      		$torrent = '% <span class="label label-' . ($ratio < 0.75 ? 'danger' : 'success') .'">'. round($ratio, 4). '</span>';
      	} else {
              $torrent = '<span class="label label-danger">Non connecté.</span>';
      	}    
          
          return 'T411 : '. $torrent;
      }
  ]);*/
/**
 * Get T411 stats
 */
/*
 * User logged, get ratio
 */
if ($tor->connected()) {
    $ratio = $tor->ratio();
    $info = ['label' => 'T411', 'value' => $ratio, 'max' => T411_SHARE_RATIO_GOAL, 'error' => $ratio < T411_SHARE_WEAK_RATIO];
} else {
    $info = ['label' => 'T411', 'value' => 'Non connecté', 'error' => true, 'msg' => $tor->getLastError()];
}
$model->addContent('info', [999 => $info]);
/**
 * Declare pages
 */
Pages::i()->register('t411', 'search', 'T411');
Example #6
0
<?php

use rpi\core\Pages;
Pages::i()->register('proxify', 'index', 'Proxify');
Example #7
0
<?php

use rpi\core\Pages;
$page = @$_GET['page'] ?: 'index';
$zone = @$_GET['zone'];
$model = Pages::i()->get($page);
$contents = $model->getContents($zone);
WS_print(array_values($contents));
Example #8
0
<?php

use rpi\modules\ServiceLoader;
use rpi\core\Pages;
use rpi\core\gui\ModuleButton;
ServiceLoader::load($config->services);
Pages::i()->get('index')->addContent('action', [new ModuleButton('services', 'Fix NAT', 'fixnat', 'net.png')]);