Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 **/
$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. */
$db =& DB::connect($conf['sql']);
if (is_a($db, 'PEAR_Error')) {
    var_dump($db);
    exit;
}