diff options
author | SVN Migration <svn@php.net> | 2002-05-19 13:54:38 +0000 |
---|---|---|
committer | SVN Migration <svn@php.net> | 2002-05-19 13:54:38 +0000 |
commit | 62e263f01ef567ae3926739f37d13cac17fe7739 (patch) | |
tree | 353ff240a432d453632dcad134524cbb9e0ea610 /pear/PEAR/Command/Auth.php | |
parent | e3490f1429d8f03c16d8cef7cd835c3fb2d5b43e (diff) | |
download | php-git-php-4.3.0dev-ZendEngine2.tar.gz |
This commit was manufactured by cvs2svn to create tagphp-4.3.0dev-ZendEngine2
'php_4_3_0_dev_ZendEngine2'.
Diffstat (limited to 'pear/PEAR/Command/Auth.php')
-rw-r--r-- | pear/PEAR/Command/Auth.php | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/pear/PEAR/Command/Auth.php b/pear/PEAR/Command/Auth.php deleted file mode 100644 index 5f99b2756e..0000000000 --- a/pear/PEAR/Command/Auth.php +++ /dev/null @@ -1,131 +0,0 @@ -<?php -// -// +----------------------------------------------------------------------+ -// | PHP Version 4 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 1997-2002 The PHP Group | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 2.02 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is | -// | available at through the world-wide-web at | -// | http://www.php.net/license/2_02.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | license@php.net so we can mail you a copy immediately. | -// +----------------------------------------------------------------------+ -// | Author: Stig Bakken <ssb@fast.no> | -// +----------------------------------------------------------------------+ -// -// $Id$ - -require_once "PEAR/Command/Common.php"; -require_once "PEAR/Remote.php"; -require_once "PEAR/Config.php"; - -/** - * PEAR commands for managing configuration data. - * - */ -class PEAR_Command_Auth extends PEAR_Command_Common -{ - var $commands = array( - 'login' => array( - 'summary' => 'Connects and authenticates to remote server', - 'function' => 'doLogin', - 'options' => array(), - 'doc' => 'To use functions in the installer that require any kind -of privilege, you need to log in first. The username and password you enter -here will be stored in your per-user PEAR configuration (~/.pearrc on -Unix-like systems). After logging in, your username and password will be -passed along in every subsequent operation on the remote server. -', - ), - 'logout' => array( - 'summary' => 'Logs out from the remote server', - 'function' => 'doLogout', - 'options' => array(), - 'doc' => 'Logs out from the remote server. -This command does not actually connect to the remote -server, it only deletes the stored username and password from your -user configuration. -', - ) - - ); - - /** - * PEAR_Command_Auth constructor. - * - * @access public - */ - function PEAR_Command_Auth(&$ui, &$config) - { - parent::PEAR_Command_Common($ui, $config); - } - - /** - * Execute the 'login' command. - * - * @param string $command command name - * - * @param array $options option_name => value - * - * @param array $params list of additional parameters - * - * @return bool TRUE on success, FALSE for unknown commands, or - * a PEAR error on failure - * - * @access public - */ - function doLogin($command, $options, $params) - { - $server = $this->config->get('master_server'); - $remote = new PEAR_Remote($this->config); - $username = $this->config->get('username'); - if (empty($username)) { - $username = @$_ENV['USER']; - } - $this->ui->displayLine("Logging in to $server."); - $username = trim($this->ui->userDialog('Username', 'text', $username)); - - $this->config->set('username', $username); - $password = trim($this->ui->userDialog('Password', 'password')); - $this->config->set('password', $password); - $remote->expectError(401); - $ok = $remote->call('logintest'); - $remote->popExpect(); - if ($ok === true) { - $this->ui->displayLine("Logged in."); - $this->config->store(); - } else { - $this->ui->displayLine("Login failed!"); - } - - } - - /** - * Execute the 'logout' command. - * - * @param string $command command name - * - * @param array $options option_name => value - * - * @param array $params list of additional parameters - * - * @return bool TRUE on success, FALSE for unknown commands, or - * a PEAR error on failure - * - * @access public - */ - function doLogout($command, $options, $params) - { - $server = $this->config->get('master_server'); - $this->ui->displayLine("Logging out from $server."); - $this->config->remove('username'); - $this->config->remove('password'); - $this->config->store(); - } - -} - -?>
\ No newline at end of file |