cvs: pearweb /include layout.php pear-auth.php pear-database.php pear-format-html.php /public_html account-request.php index.php style.css test.php

From: Date: Tue, 07 Aug 2001 21:18:37 +0000
Subject: cvs: pearweb /include layout.php pear-auth.php pear-database.php pear-format-html.php /public_html account-request.php index.php style.css test.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-436@lists.php.net to get a copy of this message
ssb Tue Aug 7 17:18:37 2001 EDT Modified files: /pearweb/include layout.php pear-auth.php pear-database.php pear-format-html.php /pearweb/public_html account-request.php index.php style.css test.php Log: * "call it the night" commit

Index: pearweb/include/layout.php diff -u pearweb/include/layout.php:1.11 pearweb/include/layout.php:1.12 --- pearweb/include/layout.php:1.11 Thu Aug 2 04:45:17 2001 +++ pearweb/include/layout.php Tue Aug 7 17:18:37 2001 @@ -1,5 +1,5 @@ <?php -/* $Id: layout.php,v 1.11 2001/08/02 08:45:17 ssb Exp $ */ +/* $Id: layout.php,v 1.12 2001/08/07 21:18:37 ssb Exp $ */ require_once 'site.php'; @@ -188,7 +188,10 @@ <?php if (isset($HTTP_SERVER_VARS['PHP_AUTH_USER'])) { - print_link('/logout.php', 'LOGOUT', false, 'class="menuBlack"'); + print '<span class="menuWhite">logged in as '; + print strtoupper($HTTP_SERVER_VARS['PHP_AUTH_USER']); + print '&nbsp;</span><br />'; + print_link('/logout.php?showmsg=1', 'LOGOUT', false, 'class="menuBlack"'); } else { print_link('/login.php', 'LOGIN', false, 'class="menuBlack"'); } @@ -288,11 +291,11 @@ <?php # TODO: should send current url above, so we can redirect to # the same page on the mirror, and do the same in our javascript. - print_link('/source.php?url='.$SCRIPT_NAME, 'show source', false, 'class="menuBlack"'); + print_link('/source.php?url='.$SCRIPT_NAME, 'SHOW SOURCE', false, 'class="menuBlack"'); echo delim(); - print_link('/credits.php', 'credits', false, 'class="menuBlack"'); + print_link('/credits.php', 'CREDITS', false, 'class="menuBlack"'); echo delim(); - print_link('/mirrors.php', 'mirror sites:', false, 'class="menuBlack"'); + print_link('/mirrors.php', 'MIRRORS:', false, 'class="menuBlack"'); echo "&nbsp;<select class=\"small\" name=\"country\" onchange=\"gotomirror(this.form)\">\n"; foreach($MIRRORS as $url=>$mirror) { Index: pearweb/include/pear-auth.php diff -u pearweb/include/pear-auth.php:1.6 pearweb/include/pear-auth.php:1.7 --- pearweb/include/pear-auth.php:1.6 Wed Aug 1 10:34:25 2001 +++ pearweb/include/pear-auth.php Tue Aug 7 17:18:37 2001 @@ -23,7 +23,28 @@ $user = $PHP_AUTH_USER; $auth_user =& new PEAR_User($dbh, $user); - if (md5($PHP_AUTH_PW) != @$auth_user->password || !$auth_user->registered) { + $ok = false; + switch (strlen(@$auth_user->password)) { + // handle old-style DES-encrypted passwords + case 13: { + $seed = substr($auth_user->password, 0, 2); + if (crypt($PHP_AUTH_PW, $seed) == @$auth_user->password) { + $ok = true; + } + break; + } + // handle new-style MD5-encrypted passwords + case 32: { + if (md5($PHP_AUTH_PW) == @$auth_user->password) { + $ok = true; + } + break; + } + } + if (empty($auth_user->registered)) { + $ok = false; + } + if (!$ok) { if (cvs_verify_password($user, $PHP_AUTH_PW)) { $auth_user = (object)array('handle' => $user); } else { Index: pearweb/include/pear-database.php diff -u pearweb/include/pear-database.php:1.7 pearweb/include/pear-database.php:1.8 --- pearweb/include/pear-database.php:1.7 Wed Aug 1 10:34:25 2001 +++ pearweb/include/pear-database.php Tue Aug 7 17:18:37 2001 @@ -109,7 +109,40 @@ "WHERE name = '$node'"; $dbh->query($query); } - return true; + return DB_OK; +} + +// }}} +// {{{ add_package() + +function add_package($data) +{ + global $dbh; + $defaults = array( + "virtual" => false, + "parent" => null, + "license" => "PHP License" + ); + foreach ($defaults as $property => $default_value) { + if (!isset($data[$property])) { + $data[$property] = $default_value; + } + } + extract($data); + + $query = "INSERT INTO packages (id,name,virtual,parent,license,summary,". + "description) VALUES(?,?,?,?,?,?,?)"; + $id = $dbh->nextId("packages"); + $sth = $dbh->prepare($query); + if (DB::isError($sth)) { + return $sth; + } + $err = $dbh->execute($sth, array($id, $name, $virtual, $parent, $license, + $summary, $desc)); + if (DB::isError($err)) { + return $err; + } + return renumber_visitations(); } // }}} @@ -330,9 +363,9 @@ class PEAR_Package extends DB_storage { - function PEAR_Package(&$dbh, $package) + function PEAR_Package(&$dbh, $package, $keycol = "id") { - $this->DB_storage("packages", "id", $dbh); + $this->DB_storage("packages", $keycol, $dbh); // XXX horrible hack until we get temporary error handlers $oldmode = $this->_default_error_mode; $this->_default_error_mode = PEAR_ERROR_RETURN; Index: pearweb/include/pear-format-html.php diff -u pearweb/include/pear-format-html.php:1.6 pearweb/include/pear-format-html.php:1.7 --- pearweb/include/pear-format-html.php:1.6 Wed Aug 1 10:34:25 2001 +++ pearweb/include/pear-format-html.php Tue Aug 7 17:18:37 2001 @@ -4,6 +4,23 @@ $GLOBALS['_style'] = ''; +function smarty_func_page_start($params) +{ + extract($params); + if (empty($title)) { + $title = "The PHP Extension and Application Repository"; + } + if (isset($sidebardata)) { + $GLOBALS['SIDEBAR_DATA'] = $sidebardata; + } + response_header($title); +} + +function smarty_func_page_end($params) +{ + response_footer(); +} + function response_header($title = 'The PHP Extension and Application Repository', $style = false) { global $_style, $_header_done; @@ -73,6 +90,42 @@ print "<FONT COLOR=\"#990000\"><B>$report</B></FONT><BR>\n"; response_footer(); exit; +} + +function smarty_func_border_box_start($params) +{ + extract($params); + if (!isset($width)) { + $width = "90%"; + } + if (!isset($indent)) { + $indent = ""; + } + print "$indent<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\" width=\"$width\">\n"; + print "$indent <tr>\n"; + print "$indent <td bgcolor=\"#000000\">\n"; + print " <table cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n"; + if (isset($title)) { + print "$indent <tr bgcolor=\"#cccccc\">\n"; + print "$indent <th>$title</th>\n"; + print "$indent </tr>\n"; + } + print "$indent <tr bgcolor=\"#ffffff\">\n"; + print "$indent <td>\n"; +} + +function smarty_func_border_box_end($params) +{ + extract($params); + if (!isset($indent)) { + $indent = ""; + } + print "$indent </td>\n"; + print "$indent </tr>\n"; + print "$indent </table>\n"; + print "$indent </td>\n"; + print "$indent </tr>\n"; + print "$indent</table>\n"; } function border_box_start($title, $width = "90%", $indent = "") Index: pearweb/public_html/account-request.php diff -u pearweb/public_html/account-request.php:1.3 pearweb/public_html/account-request.php:1.4 --- pearweb/public_html/account-request.php:1.3 Wed Aug 1 10:34:26 2001 +++ pearweb/public_html/account-request.php Tue Aug 7 17:18:37 2001 @@ -2,8 +2,6 @@ require_once "HTML/Form.php"; -$display_form = true; - function display_error($msg) { global $errorMsg; @@ -11,6 +9,9 @@ $errorMsg .= "<FONT COLOR=\"#CC0000\" SIZE=\"+1\">$msg</FONT><BR>\n"; } +$display_form = true; +$width = 60; +$errorMsg = ""; $jumpto = "handle"; do { @@ -20,7 +21,7 @@ "email" => "your email address", "purpose" => "the purpose of your PEAR account"); foreach ($required as $field => $desc) { - if (!$$field) { + if (empty($$field)) { display_error("Please enter $desc!"); $jumpto = $field; break 2; @@ -143,7 +144,6 @@ print "</TABLE>\n"; } - $width = 60; $form =& new HTML_Form($PHP_SELF, "POST"); $form->addText("handle", "Username", null, 12); $form->addText("name", "Real Name", null, $width); Index: pearweb/public_html/index.php diff -u pearweb/public_html/index.php:1.16 pearweb/public_html/index.php:1.17 --- pearweb/public_html/index.php:1.16 Wed Aug 1 10:34:26 2001 +++ pearweb/public_html/index.php Tue Aug 7 17:18:37 2001 @@ -1,11 +1,15 @@ <?php + $SIDEBAR_DATA=' -<H3>What is PEAR?</H3> -<P> -PEAR is a code repository for PHP extensions -and PHP library code inspired by TeX\'s CTAN -and Perl\'s CPAN. -</P> +<h3>What is PEAR?</h3> +<p> + +PEAR is a framework and distribution system for reusable PHP +components. + +<br /> + +</p> '; response_header(); @@ -16,6 +20,7 @@ if ($SERVER_NAME != "pear.php.net") { menu_link("Request PEAR Account", "account-request.php"); + menu_link("New Package", "package-new.php"); menu_link("Administrators", "admin.php"); menu_link("Browse Packages", "packages.php"); menu_link("Want to contribute?", "signup.php"); Index: pearweb/public_html/style.css diff -u pearweb/public_html/style.css:1.2 pearweb/public_html/style.css:1.3 --- pearweb/public_html/style.css:1.2 Thu Aug 2 04:45:17 2001 +++ pearweb/public_html/style.css Tue Aug 7 17:18:37 2001 @@ -14,12 +14,12 @@ color: #66cc66; } -A.menuWhite { - font-family: arial,helvetica,sans-serif; +.menuWhite { + font-family: fixed,arial,helvetica,sans-serif; font-size: 75%; color: #ffffff; } -A.menuBlack { +.menuBlack { font-family: fixed,arial,helvetica,sans-serif; text-decoration: none; font-size: 75%; Index: pearweb/public_html/test.php diff -u pearweb/public_html/test.php:1.2 pearweb/public_html/test.php:1.3 --- pearweb/public_html/test.php:1.2 Sat Apr 21 02:40:03 2001 +++ pearweb/public_html/test.php Tue Aug 7 17:18:37 2001 @@ -1,39 +1,19 @@ <?php -require_once "XML/RPC.php"; - -response_header("XML-RPC test"); - -ob_start(); -readfile("/home/ssb/cvs/php/pear/HTTP/HTTP-1.0.tgz"); -$data = ob_get_contents(); -ob_end_clean(); - -$f = new XML_RPC_Message('release.upload', - array(new XML_RPC_Value("HTTP", - $XML_RPC_String), - new XML_RPC_Value("1.0", - $XML_RPC_String), - new XML_RPC_Value("Initial release", - $XML_RPC_String), - new XML_RPC_Value($data, - $XML_RPC_Base64), - new XML_RPC_Value(md5($data), - $XML_RPC_String))); -$c = new XML_RPC_Client("/xmlrpc.php", "pear.localdomain", 80); -$c->setCredentials("ssb", "bing"); -$c->setDebug(1); -$r=$c->send($f); -if (!$r) { die("send failed"); } -$v=$r->value(); -if (!$r->faultCode()) { - print "return value is " . $v->scalarval() . "<BR>"; -} else { - print "Fault: "; - print "Code: " . $r->faultCode() . - " Reason '" .$r->faultString()."'<BR>"; -} - -response_footer(); +ini_set("include_path", + ini_get("include_path") . ":/home/ssb/src/Smarty-1.4.3"); +include_once "Smarty.class.php"; +$s = new Smarty; +$s->compile_check = true; +$s->debugging = false; +$s->template_dir = "../templates"; +$s->compile_dir = "../templates_c"; +$s->cache_dir = "../cache"; +$s->config_dir = "../configs"; +$s->register_function("page", "smarty_page_start"); +$s->register_function("endpage", "smarty_page_end"); +$s->register_function("box", "smarty_border_box_start"); +$s->register_function("endbox", "smarty_border_box_end"); +$s->display('test.tpl'); ?>
« previous php.pear.cvs (#436) next »