Example #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;
 }
Example #2
0
 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;
 }
Example #3
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;
}
Example #4
0
 function _handleFilelistTag($element, $curDir = '')
 {
     foreach ($element['children'] as $child) {
         switch ($child['name']) {
             case 'file':
                 $this->_handleFileTag($child, $curDir);
                 break;
             case 'dir':
                 $this->_handleDirTag($child, $curDir);
                 break;
             default:
                 $cli =& Horde_CLI::singleton();
                 $cli->message('Got no handler for tag: ' . $child['name'], 'cli-warning');
                 break;
         }
     }
 }
Example #5
0
 *
 * Copyright 2008-2015 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Duck <*****@*****.**>
 * @package Beatnik
 */
define('AUTH_HANDLER', true);
define('HORDE_BASE', __DIR__ . '/../../');
define('BEATNIK_BASE', HORDE_BASE . '/beatnik');
// Do CLI checks and environment setup first.
require_once HORDE_BASE . '/lib/core.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.
$cli = Horde_Cli::init();
// We accept the user name on the command-line.
require_once 'Console/Getopt.php';
try {
    Console_Getopt::getopt(Console_Getopt::readPHPArgv(), 'h:u:p:t:r', array('help', 'username='******'password='******'type=', 'rpc='));
} catch (Exception $e) {
    $error = _("Couldn't read command-line options.");
    Horde::log($error, 'DEBUG');
    $cli->fatal($error);
}
// Show help and exit if no arguments were set.
list($opts, $args) = $ret;
Example #6
0
 /**
  * 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;
 }