public static function configuration() { $set = self::addSwitch("set", "Set an option"); $global = self::addSwitch("global", "Set the option in global configuration"); $get = self::addSwitch("get", "Get an option"); if ($set || $get) { $keys = self::getInputs("key", "Key and value to set or search"); } self::enableHelp(); if ($set) { if (count($keys) > 1) { $val = $keys[1]; } else { $val = null; } if (strtolower($val) == "true") { $val = true; } elseif (strtolower($val) == "false") { $val = false; } elseif ((string) (int) $val == $val) { $val = (int) $val; } Options::updateConf(array(strtoupper($keys[0]) => $val), !$global); } else { $opts = Options::getAll(); ksort($opts); foreach ($opts as $key => $val) { if (!$get || strtoupper($key) == strtoupper($keys[0])) { if (is_bool($val)) { $val = $val ? "true" : "false"; } self::pln($key . ' = ' . $val); } } } }
public function preupdate() { Cli::pinfo(" * Create folders"); foreach (Options::getAll() as $key => $val) { if (substr($key, -4) == "_DIR") { System::ensureDir($val); } } }
function configure($key, $value) { Options::set($key, $value); }
* Based on Portable PHP password hashing framework. * * Version 0.3 / genuine. * * Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in * the public domain. Revised in subsequent years, still public domain. * * There's absolutely no warranty. * * The homepage URL for this framework is: * * http://www.openwall.com/phpass/ **/ use Exception; Options::set("PASSWORD_ITERATION_COUNT", 8); Options::set("PASSWORD_PORTABLE", false); class Password { private $itoa64; private $iteration_count_log2; private $portable_hashes; private $random_state; public function __construct() { $iteration_count_log2 = PASSWORD_ITERATION_COUNT; $portable_hashes = PASSWORD_PORTABLE; $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) { $iteration_count_log2 = 8; } $this->iteration_count_log2 = $iteration_count_log2;