Пример #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;
Пример #2
0
<?php

use rpi\core\Pages;
use rpi\core\Content;
use t411\T411;
define('T411_SHARE_RATIO_GOAL', 1);
define('T411_SHARE_WEAK_RATIO', 0.75);
$tor = T411::i();
/**
 * Add contents
 */
$model = Pages::g("index");
/*$model->addContent('info', [
      999 => function() use($tor, $config) {
          /**
           * 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
 */