Current File : //root/panel/bin/setso
#!/usr/bin/php
<?php
/**
 * @copyright 2014-2015 Sentora Project (http://www.sentora.org/) 
 * Sentora is a GPL fork of the ZPanel Project whose original header follows:
 *
 * SETSO - The ZPanel CLI System Option Tool.
 * @package zpanelx
 * @subpackage core -> setso
 * @author Bobby Allen (ballen@bobbyallen.me)
 * @copyright ZPanel Project (http://www.zpanelcp.com/)
 * @link http://www.zpanelcp.com/
 * @license GPL (http://www.gnu.org/licenses/gpl.html)
 */
$rawPath = str_replace("\\", "/", dirname(__FILE__));
$rootPath = str_replace("/bin", "/", $rawPath);
chdir($rootPath);

set_time_limit(0);
//ini_set('memory_limit', '256M');
ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', 'On');
ini_set('log_errors', 'Off');

require_once 'dryden/loader.inc.php';
require_once 'cnf/db.php';
require_once 'inc/dbc.inc.php';

if (!runtime_controller::IsCLI())
    exit(1);

if ((isset($argv[1])) && ($argv[1] == '--set')) {
    if (isset($argv[2]) && isset($argv[3])) {
        ctrl_options::SetSystemOption($argv[2], $argv[3], false);
    }
}

if ((isset($argv[1])) && ($argv[1] == '--show')) {
    if (isset($argv[2])) {
        echo ctrl_options::GetSystemOption($argv[2])."\n";
    }
}

if ((!isset($argv[1])) || ($argv[1] == 'help') || ($argv[1] == '-h') || ($argv[1] == '--help')) {
    fwrite(STDOUT, "\nSentora Sytem Option Tool\n");
    fwrite(STDOUT, "Copyright (c) 2014 Sentora Project\n");
    fwrite(STDOUT, "http://sentora.org/\n");
    fwrite(STDOUT, "Copyright (c) 2008 - 2014 ZPanel Project\n");
    fwrite(STDOUT, "http://www.zpanelcp.com/\n");
    fwrite(STDOUT, "Usage: setso [options] [name] [value]\n");
    fwrite(STDOUT, "Options:\n");
    fwrite(STDOUT, "  --set - Sets a value of a named system option.\n");
    fwrite(STDOUT, "  --show - Displays the value of a named system option.\n");
    fwrite(STDOUT, "  --help - Displays this text.\n\n");
    exit(0);
}
?>