Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Pear
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

Pear Pear programming, this is a very complex subject as with using pear with php can be a difficult task for some, so lets talk pear.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-20-2007, 7:42 PM   #1
Greg Beaver
 
Greg Beaver's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default cvs: pear-core /PEAR/Command Channels.php Channels.xml

cellog Sun May 20 00:25:55 2007 UTC

Modified files:
/pear-core/PEAR/Command Channels.xml Channels.php
Log:
re-implement Request #10579 channel-discover should support inline username/password [timj]

http://cvs.php.net/viewvc.cgi/pear-c...&diff_format=u
Index: pear-core/PEAR/Command/Channels.xml
diff -u pear-core/PEAR/Command/Channels.xml:1.2 pear-core/PEAR/Command/Channels.xml:1.3
--- pear-core/PEAR/Command/Channels.xml:1.2 Mon Jul 17 18:19:25 2006
+++ pear-core/PEAR/Command/Channels.xml Sun May 20 00:25:55 2007
@@ -87,7 +87,12 @@
<shortcut>di</shortcut>
<options />
<doc>[&lt;channel.xml&gt;|&lt;channel name&gt;]
-Initialize a Channel from its server and create the local channel.xml.
+Initialize a channel from its server and create a local channel.xml.
+If &lt;channel name&gt; is in the format &quot;&lt;username&gt;:&lt;password&gt;@&lt;channe l&gt;&quot; then
+&lt;username&gt; and &lt;password&gt; will be set as the login username/password for
+&lt;channel&gt;. Use caution when passing the username/password in this way, as
+it may allow other users on your computer to briefly view your username/
+password via the system's process list.
</doc>
</channel-discover>
</commands>
http://cvs.php.net/viewvc.cgi/pear-c...&diff_format=u
Index: pear-core/PEAR/Command/Channels.php
diff -u pear-core/PEAR/Command/Channels.php:1.54 pear-core/PEAR/Command/Channels.php:1.55
--- pear-core/PEAR/Command/Channels.php:1.54 Sun May 6 23:31:51 2007
+++ pear-core/PEAR/Command/Channels.php Sun May 20 00:25:55 2007
@@ -18,7 +18,7 @@
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: Channels.php,v 1.54 2007/05/06 23:31:51 cellog Exp $
+ * @version CVS: $Id: Channels.php,v 1.55 2007/05/20 00:25:55 cellog Exp $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
@@ -133,7 +133,12 @@
'shortcut' => 'di',
'options' => array(),
'doc' => '[<channel.xml>|<channel name>]
-Initialize a Channel from its server and creates the local channel.xml.
+Initialize a channel from its server and create a local channel.xml.
+If <channel name> is in the format "<username>:<password>@<channel>" then
+<username> and <password> will be set as the login username/password for
+<channel>. Use caution when passing the username/password in this way, as
+it may allow other users on your computer to briefly view your username/
+password via the system\'s process list.
'
),
);
@@ -671,29 +676,62 @@
strtolower($params[1]) . '"');
}

+ /**
+ * The channel-discover command
+ *
+ * @param string $command command name
+ * @param array $options option_name => value
+ * @param array $params list of additional parameters.
+ * $params[0] should contain a string with either:
+ * - <channel name> or
+ * - <username>:<password>@<channel name>
+ * @return null|PEAR_Error
+ */
function doDiscover($command, $options, $params)
{
$reg = &$this->config->getRegistry();
if (sizeof($params) != 1) {
return $this->raiseError("No channel server specified");
}
- if ($reg->channelExists($params[0])) {
- if ($reg->isAlias($params[0])) {
- return $this->raiseError("A channel alias named \"$params[0]\" " .
- 'already exists, aliasing channel "' . $reg->channelName($params[0])
+
+ // Look for the possible input format "<username>:<password>@<channel>"
+ if (preg_match('/^(.+).+)@(.+)$/', $params[0], $matches)) {
+ $username = $matches[1];
+ $password = $matches[2];
+ $channel = $matches[3];
+ } else {
+ $channel = $params[0];
+ }
+
+ if ($reg->channelExists($channel)) {
+ if ($reg->isAlias($channel)) {
+ return $this->raiseError("A channel alias named \"$channel\" " .
+ 'already exists, aliasing channel "' . $reg->channelName($channel)
. '"');
} else {
- return $this->raiseError("Channel \"$params[0]\" is already initialized");
+ return $this->raiseError("Channel \"$channel\" is already initialized");
}
}
$this->pushErrorHandling(PEAR_ERROR_RETURN);
- $err = $this->doAdd($command, $options, array('http://' . $params[0] . '/channel.xml'));
+ $err = $this->doAdd($command, $options, array('http://' . $channel . '/channel.xml'));
$this->popErrorHandling();
if (PEAR::isError($err)) {
- return $this->raiseError("Discovery of channel \"$params[0]\" failed (" .
+ return $this->raiseError("Discovery of channel \"$channel\" failed (" .
$err->getMessage() . ')');
}
- $this->ui->outputData("Discovery of channel \"$params[0]\" succeeded", $command);
+
+ // Store username/password if they were given
+ // Arguably we should do a logintest on the channel here, but since
+ // that's awkward on a REST-based channel (even "pear login" doesn't
+ // do it for those), and XML-RPC is deprecated, it's fairly pointless.
+ if (isset($username)) {
+ $this->config->set('username', $username, 'user', $channel);
+ $this->config->set('password', $password, 'user', $channel);
+ $this->config->store();
+ $this->ui->outputData("Stored login for channel \"$channel\" using username \"$username\"", $command);
+ }
+
+ $this->ui->outputData("Discovery of channel \"$channel\" succeeded", $command);
}
}
?>
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
cvs: pear-core /PEAR/Command Remote.php Greg Beaver Pear 0 05-20-2007 7:42 PM
cvs: pear-core /PEAR/Command Auth.php Greg Beaver Pear 0 05-20-2007 7:42 PM
cvs: pear-core /PEAR/Command Install.php Greg Beaver Pear 0 05-20-2007 7:42 PM
cvs: pear-core / package-PEAR.xml package2.xml /PEAR/PackageFile/Generator v2.php Greg Beaver Pear 0 05-20-2007 7:42 PM
cvs: pear-core / package-PEAR.xml package2.xml /PEAR Installer.php /PEAR/PackageFile v1.php /PEAR/PackageFile/v2 Validator.php Greg Beaver Pear 0 05-20-2007 7:42 PM


Featured Websites




All times are GMT +1. The time now is 7:43 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98