function &singleton($url) { static $instance; if (!isset($instance)) { require_once HORDE_LIBS . 'Horde/CLI.php'; if (!Horde_CLI::runningFromCLI()) { exit("Must be run from the command line\n"); } Horde_CLI::init(); $instance =& Countries::factory($url); } return $instance; }
function &singleton() { static $instance; if (!isset($instance)) { require_once HORDE_LIBS . 'Horde/CLI.php'; if (Horde_CLI::runningFromCLI()) { $interface = 'cli'; } else { $interface = 'web'; } $instance =& Setup::factory($interface); } return $instance; }
* to be moved from locked = false, to locked = true and there have already * been prefs set by the users. */ /** ** Set this to true if you want DB modifications done. **/ $live = false; // No auth. @define('AUTH_HANDLER', true); // Find the base file path of Horde. @define('HORDE_BASE', dirname(__FILE__) . '/..'); // Do CLI checks and environment setup first. require_once HORDE_BASE . '/lib/core.php'; require_once HORDE_LIBS . 'Horde/CLI.php'; // Make sure no one runs this from the web. if (!Horde_CLI::runningFromCLI()) { exit("Must be run from the command line\n"); } // Load the CLI environment - make sure there's no time limit, init // some variables, etc. Horde_CLI::init(); $cli =& new Horde_CLI(); require_once HORDE_BASE . '/lib/base.php'; require_once HORDE_LIBS . 'Horde/DataTree.php'; require_once HORDE_LIBS . 'Horde/Group.php'; require_once HORDE_LIBS . 'Horde/Share.php'; /* Make sure there's no compression. */ ob_end_clean(); $scope = $cli->prompt(_("Enter value for pref_scope:")); $name = $cli->prompt(_("Enter value for pref_name:")); /* Open the database. */
/** * Redirects to the main Horde login page on authentication failure. */ function authenticationFailureRedirect() { require_once 'Horde/CLI.php'; if (Horde_CLI::runningFromCLI()) { $cli =& Horde_CLI::singleton(); $cli->fatal(_("You are not authenticated.")); } $url = $GLOBALS['registry']->get('webroot', 'horde') . '/login.php'; $url = Util::addParameter($url, array('url' => Horde::selfUrl(true), 'nosidebar' => 1), null, false); $url = Auth::addLogoutParameters($url); header('Location: ' . Horde::url($url, true)); exit; }