コード例 #1
0
ファイル: fw.php プロジェクト: pclemot/facileManager
$cron = in_array('-c', $argv) || in_array('cron', $argv) ? true : false;
/** Include shared client functions */
$fm_client_functions = dirname(dirname(__FILE__)) . '/functions.php';
if (file_exists($fm_client_functions)) {
    include_once $fm_client_functions;
} else {
    echo fM("The facileManager client scripts are not installed.\n");
    exit(1);
}
/** Check running user */
if (exec(findProgram('whoami')) != $whoami && !$dryrun) {
    echo fM("This script must run as {$whoami}.\n");
    exit(1);
}
/** Check if running supported version */
$data['server_version'] = detectFWVersion();
/** Build everything required via cron */
if ($cron) {
    $data['action'] = 'cron';
}
/** Build the server config */
if ($buildconf) {
    $data['action'] = 'buildconf';
}
/** Build the zone files */
if ($zones) {
    $data['action'] = 'zones';
}
/** Set variables to pass */
$url = $proto . '://' . FMHOST . 'buildconf.php';
$data['dryrun'] = $dryrun;
コード例 #2
0
ファイル: functions.php プロジェクト: pclemot/facileManager
function moduleAddServer($url, $data)
{
    /** Add the server to the account */
    $app = detectFWVersion(true);
    if ($app === null) {
        echo "failed\n\n";
        echo fM("Cannot find a supported firewall - please check the README document for supported firewalls.  Aborting.\n");
        exit(1);
    }
    $data['server_type'] = $app['server']['type'];
    $data['server_version'] = $app['app_version'];
    $raw_data = getPostData(str_replace('genserial', 'addserial', $url), $data);
    $raw_data = $data['compress'] ? @unserialize(gzuncompress($raw_data)) : @unserialize($raw_data);
    if (!is_array($raw_data)) {
        if (!$raw_data) {
            echo "An error occurred\n";
        } else {
            echo $raw_data;
        }
        exit(1);
    }
    return array('data' => $data, 'add_result' => "Success\n");
}