예제 #1
0
 public function execute(ShellParsedCommand $args)
 {
     $this->required('name,cmd', $args);
     $opt = $args->mapargs;
     $cfg = Config::load('services');
     /*
      * Add service in config file
      */
     array_push($cfg->services, array_merge(['type' => 'Service', 'url' => null], $opt->getMap()));
     $cfg->save(true);
     return new ShellResult(0, "Service added : " . $opt->name);
 }
예제 #2
0
파일: mod.inc.php 프로젝트: Reeska/restinpi
<?php

require 'config.php';
/**
 * Affiche une page d'un module
 */
$module = $_GET['m'];
$page = $_GET['p'];
/**
 * Check if module installed
 */
if (!is_dir(MOD_DIR . '/' . $module)) {
    exit('Module inexistant : ' . $module);
}
use rpi\core\Config;
/**
 * Load config
 */
$config = Config::load($module);
$settings = json_decode(@file_get_contents(MOD_DIR . '/' . $module . '/settings.json'));
예제 #3
0
파일: all.php 프로젝트: Reeska/restinpi
<?php

use rpi\core\Config;
$modules = Config::modules();
$ws = [];
foreach ($modules as $name => $mod) {
    $wsdir = MOD_DIR . '/' . $name . '/ws';
    if (!is_dir($wsdir)) {
        continue;
    }
    $d = @opendir($wsdir);
    while ($f = readdir($d)) {
        if ($f[0] == '.') {
            continue;
        }
        $ws[] = $name . '/' . str_replace('.php', '', $f);
    }
    closedir($d);
}
WS_print($ws);
예제 #4
0
 ************************************************************************************/
$extdir = opendir(MOD_DIR);
$list = array();
$modules = array();
$extpaths = "";
while ($dir = readdir($extdir)) {
    if ($dir == '.' || $dir == '..') {
        continue;
    }
    $modules[] = $dir;
    $list[] = MOD_DIR . '/' . $dir . '/class';
}
if (!empty($list)) {
    $extpaths = implode(PATH_SEPARATOR, $list) . PATH_SEPARATOR;
}
/************************************************************************************
 * Configure autoload
 ************************************************************************************/
set_include_path($extpaths . __DIR__ . '/lib/' . PATH_SEPARATOR . get_include_path());
spl_autoload_extensions('.class.php,.lib.php');
spl_autoload_register();
/************************************************************************************
 * Init module
 ************************************************************************************/
use rpi\core\Config;
foreach ($modules as $mod) {
    if (is_file(MOD_DIR . '/' . $mod . '/init.php')) {
        $config = Config::load($mod);
        require MOD_DIR . '/' . $mod . '/init.php';
    }
}