You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(32) |
Sep
|
Oct
|
Nov
(100) |
Dec
(22) |
|---|
|
From: <jhe...@us...> - 2002-08-08 13:52:36
|
Update of /cvsroot/upcase-project/UpCase/lib In directory usw-pr-cvs1:/tmp/cvs-serv1865 Added Files: PEAR.php Log Message: Needed for server-side handling of tarballs --- NEW FILE: PEAR.php --- <?php // // +----------------------------------------------------------------------+ // | PHP version 4.0 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2001 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 2.0 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 | // | li...@ph... so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Authors: Sterling Hughes <ste...@ph...> | // | Stig Bakken <ss...@fa...> | // | Tomas V.V.Cox <co...@id...> | // | | // +----------------------------------------------------------------------+ // // $Id: PEAR.php,v 1.1 2002/08/08 13:52:32 jherfurth Exp $ // define('PEAR_ERROR_RETURN', 1); define('PEAR_ERROR_PRINT', 2); define('PEAR_ERROR_TRIGGER', 4); define('PEAR_ERROR_DIE', 8); define('PEAR_ERROR_CALLBACK', 16); if (substr(PHP_OS, 0, 3) == 'WIN') { define('OS_WINDOWS', true); define('OS_UNIX', false); define('PEAR_OS', 'Windows'); } else { define('OS_WINDOWS', false); define('OS_UNIX', true); define('PEAR_OS', 'Unix'); // blatant assumption } $GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; $GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; $GLOBALS['_PEAR_default_error_callback'] = ''; $GLOBALS['_PEAR_destructor_object_list'] = array(); // // Tests needed: - PEAR inheritance // - destructors // /** * Base class for other PEAR classes. Provides rudimentary * emulation of destructors. * * If you want a destructor in your class, inherit PEAR and make a * destructor method called _yourclassname (same name as the * constructor, but with a "_" prefix). Also, in your constructor you * have to call the PEAR constructor: $this->PEAR();. * The destructor method will be called without parameters. Note that * at in some SAPI implementations (such as Apache), any output during * the request shutdown (in which destructors are called) seems to be * discarded. If you need to get any debug information from your * destructor, use error_log(), syslog() or something similar. * * @since PHP 4.0.2 * @author Stig Bakken <ss...@fa...> */ class PEAR { // {{{ properties /** * Whether to enable internal debug messages. * * @var bool * @access private */ var $_debug = false; /** * Default error mode for this object. * * @var int * @access private */ var $_default_error_mode = null; /** * Default error options used for this object when error mode * is PEAR_ERROR_TRIGGER. * * @var int * @access private */ var $_default_error_options = null; /** * Default error handler (callback) for this object, if error mode is * PEAR_ERROR_CALLBACK. * * @var string * @access private */ var $_default_error_handler = ''; /** * Which class to use for error objects. * * @var string * @access private */ var $_error_class = 'PEAR_Error'; /** * An array of expected errors. * * @var array * @access private */ var $_expected_errors = array(); // }}} // {{{ constructor /** * Constructor. Registers this object in * $_PEAR_destructor_object_list for destructor emulation if a * destructor object exists. * * @param string (optional) which class to use for error objects, * defaults to PEAR_Error. * @access public * @return void */ function PEAR($error_class = null) { $classname = get_class($this); if ($this->_debug) { print "PEAR constructor called, class=$classname\n"; } if ($error_class !== null) { $this->_error_class = $error_class; } while ($classname) { $destructor = "_$classname"; if (method_exists($this, $destructor)) { global $_PEAR_destructor_object_list; $_PEAR_destructor_object_list[] = &$this; break; } else { $classname = get_parent_class($classname); } } } // }}} // {{{ destructor /** * Destructor (the emulated type of...). Does nothing right now, * but is included for forward compatibility, so subclass * destructors should always call it. * * See the note in the class desciption about output from * destructors. * * @access public * @return void */ function _PEAR() { if ($this->_debug) { printf("PEAR destructor called, class=%s\n", get_class($this)); } } // }}} // {{{ isError() /** * Tell whether a value is a PEAR error. * * @param mixed the value to test * @access public * @return bool true if parameter is an error */ function isError($data) { return (bool)(is_object($data) && (get_class($data) == 'pear_error' || is_subclass_of($data, 'pear_error'))); } // }}} // {{{ setErrorHandling() /** * Sets how errors generated by this DB object should be handled. * Can be invoked both in objects and statically. If called * statically, setErrorHandling sets the default behaviour for all * PEAR objects. If called in an object, setErrorHandling sets * the default behaviour for that object. * * @param int $mode * One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or * PEAR_ERROR_CALLBACK. * * @param mixed $options * When $mode is PEAR_ERROR_TRIGGER, this is the error level (one * of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). * * When $mode is PEAR_ERROR_CALLBACK, this parameter is expected * to be the callback function or method. A callback * function is a string with the name of the function, a * callback method is an array of two elements: the element * at index 0 is the object, and the element at index 1 is * the name of the method to call in the object. * * When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is * a printf format string used when printing the error * message. * * @access public * @return void * @see PEAR_ERROR_RETURN * @see PEAR_ERROR_PRINT * @see PEAR_ERROR_TRIGGER * @see PEAR_ERROR_DIE * @see PEAR_ERROR_CALLBACK * * @since PHP 4.0.5 */ function setErrorHandling($mode = null, $options = null) { if (isset($this)) { $setmode = &$this->_default_error_mode; $setoptions = &$this->_default_error_options; //$setcallback = &$this->_default_error_callback; } else { $setmode = &$GLOBALS['_PEAR_default_error_mode']; $setoptions = &$GLOBALS['_PEAR_default_error_options']; //$setcallback = &$GLOBALS['_PEAR_default_error_callback']; } switch ($mode) { case PEAR_ERROR_RETURN: case PEAR_ERROR_PRINT: case PEAR_ERROR_TRIGGER: case PEAR_ERROR_DIE: case null: $setmode = $mode; $setoptions = $options; break; case PEAR_ERROR_CALLBACK: $setmode = $mode; if ((is_string($options) && function_exists($options)) || (is_array($options) && method_exists(@$options[0], @$options[1]))) { $setoptions = $options; } else { trigger_error("invalid error callback", E_USER_WARNING); } break; default: trigger_error("invalid error mode", E_USER_WARNING); break; } } // }}} // {{{ expectError() /** * This method is used to tell which errors you expect to get. * Expected errors are always returned with error mode * PEAR_ERROR_RETURN. Expected error codes are stored in a stack, * and this method pushes a new element onto it. The list of * expected errors are in effect until they are popped off the * stack with the popExpect() method. * * @param mixed a single error code or an array of error codes * to expect * * @return int the new depth of the "expected errors" stack */ function expectError($code = "*") { if (is_array($code)) { array_push($this->_expected_errors, $code); } else { array_push($this->_expected_errors, array($code)); } return sizeof($this->_expected_errors); } // }}} // {{{ popExpect() /** * This method pops one element off the expected error codes * stack. * * @return array the list of error codes that were popped */ function popExpect() { return array_pop($this->_expected_errors); } // }}} // {{{ raiseError() /** * This method is a wrapper that returns an instance of the * configured error class with this object's default error * handling applied. If the $mode and $options parameters are not * specified, the object's defaults are used. * * @param $message a text error message or a PEAR error object * * @param $code a numeric error code (it is up to your class * to define these if you want to use codes) * * @param $mode One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, * PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE or * PEAR_ERROR_CALLBACK. * * @param $options If $mode is PEAR_ERROR_TRIGGER, this parameter * specifies the PHP-internal error level (one of * E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). * If $mode is PEAR_ERROR_CALLBACK, this * parameter specifies the callback function or * method. In other error modes this parameter * is ignored. * * @param $userinfo If you need to pass along for example debug * information, this parameter is meant for that. * * @param $error_class The returned error object will be instantiated * from this class, if specified. * * @param $skipmsg If true, raiseError will only pass error codes, * the error message parameter will be dropped. * * @access public * @return object a PEAR error object * @see PEAR::setErrorHandling * @since PHP 4.0.5 */ function &raiseError($message = null, $code = null, $mode = null, $options = null, $userinfo = null, $error_class = null, $skipmsg = false) { // The error is yet a PEAR error object if (is_object($message)) { $code = $message->getCode(); $userinfo = $message->getUserInfo(); $error_class = $message->getType(); $message = $message->getMessage(); } if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) { if ($exp[0] == "*" || (is_int(reset($exp)) && in_array($code, $exp)) || (is_string(reset($exp)) && in_array($message, $exp))) { $mode = PEAR_ERROR_RETURN; } } if ($mode === null) { if (isset($this) && isset($this->_default_error_mode)) { $mode = $this->_default_error_mode; } else { $mode = $GLOBALS['_PEAR_default_error_mode']; } } if ($mode == PEAR_ERROR_TRIGGER && $options === null) { if (isset($this)) { if (isset($this->_default_error_options)) { $options = $this->_default_error_options; } } else { $options = $GLOBALS['_PEAR_default_error_options']; } } if ($mode == PEAR_ERROR_CALLBACK) { if (!is_string($options) && !(is_array($options) && sizeof($options) == 2 && is_object($options[0]) && is_string($options[1]))) { if (isset($this) && isset($this->_default_error_options)) { $options = $this->_default_error_options; } else { $options = $GLOBALS['_PEAR_default_error_options']; } } } else { if ($options === null) { if (isset($this)) { if (isset($this->_default_error_options)) { $options = $this->_default_error_options; } } else { $options = $GLOBALS['_PEAR_default_error_options']; } } } if ($error_class !== null) { $ec = $error_class; } elseif (isset($this) && isset($this->_error_class)) { $ec = $this->_error_class; } else { $ec = 'PEAR_Error'; } if ($skipmsg) { return new $ec($code, $mode, $options, $userinfo); } else { return new $ec($message, $code, $mode, $options, $userinfo); } } // }}} // {{{ pushErrorHandling() /** * Push a new error handler on top of the error handler options stack. With this * you can easely override the actual error handler for some code and restore * it later with popErrorHandling. * * @param $mode mixed (same as setErrorHandling) * @param $options mixed (same as setErrorHandling) * * @return bool Always true * * @see PEAR::setErrorHandling */ function pushErrorHandling($mode, $options = null) { $stack = &$GLOBALS['_PEAR_error_handler_stack']; if (!is_array($stack)) { if (isset($this)) { $def_mode = &$this->_default_error_mode; $def_options = &$this->_default_error_options; // XXX Used anywhere? //$def_callback = &$this->_default_error_callback; } else { $def_mode = &$GLOBALS['_PEAR_default_error_mode']; $def_options = &$GLOBALS['_PEAR_default_error_options']; // XXX Used anywhere? //$def_callback = &$GLOBALS['_PEAR_default_error_callback']; } $stack = array(); $stack[] = array($def_mode, $def_options); } if (isset($this)) { $this->setErrorHandling($mode, $options); } else { PEAR::setErrorHandling($mode, $options); } $stack[] = array($mode, $options); return true; } // }}} // {{{ popErrorHandling() /** * Pop the last error handler used * * @return bool Always true * * @see PEAR::pushErrorHandling */ function popErrorHandling() { $stack = &$GLOBALS['_PEAR_error_handler_stack']; array_pop($stack); list($mode, $options) = $stack[sizeof($stack) - 1]; if (isset($this)) { $this->setErrorHandling($mode, $options); } else { PEAR::setErrorHandling($mode, $options); } return true; } // }}} } // {{{ _PEAR_call_destructors() function _PEAR_call_destructors() { global $_PEAR_destructor_object_list; if (is_array($_PEAR_destructor_object_list) && sizeof($_PEAR_destructor_object_list)) { reset($_PEAR_destructor_object_list); while (list($k, $objref) = each($_PEAR_destructor_object_list)) { $classname = get_class($objref); while ($classname) { $destructor = "_$classname"; if (method_exists($objref, $destructor)) { $objref->$destructor(); break; } else { $classname = get_parent_class($classname); } } } // Empty the object list to ensure that destructors are // not called more than once. $_PEAR_destructor_object_list = array(); } } // }}} class PEAR_Error { // {{{ properties var $error_message_prefix = ''; var $mode = PEAR_ERROR_RETURN; var $level = E_USER_NOTICE; var $code = -1; var $message = ''; var $userinfo = ''; // Wait until we have a stack-groping function in PHP. //var $file = ''; //var $line = 0; // }}} // {{{ constructor /** * PEAR_Error constructor * * @param $message error message * * @param $code (optional) error code * * @param $mode (optional) error mode, one of: PEAR_ERROR_RETURN, * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER or * PEAR_ERROR_CALLBACK * * @param $level (optional) error level, _OR_ in the case of * PEAR_ERROR_CALLBACK, the callback function or object/method * tuple. * * @access public * */ function PEAR_Error($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { if ($mode === null) { $mode = PEAR_ERROR_RETURN; } $this->message = $message; $this->code = $code; $this->mode = $mode; $this->userinfo = $userinfo; if ($mode & PEAR_ERROR_CALLBACK) { $this->level = E_USER_NOTICE; $this->callback = $options; } else { if ($options === null) { $options = E_USER_NOTICE; } $this->level = $options; $this->callback = null; } if ($this->mode & PEAR_ERROR_PRINT) { if (is_null($options) || is_int($options)) { $format = "%s"; } else { $format = $options; } printf($format, $this->getMessage()); } if ($this->mode & PEAR_ERROR_TRIGGER) { trigger_error($this->getMessage(), $this->level); } if ($this->mode & PEAR_ERROR_DIE) { $msg = $this->getMessage(); if (is_null($options) || is_int($options)) { $format = "%s"; if (substr($msg, -1) != "\n") { $msg .= "\n"; } } else { $format = $options; } die(sprintf($format, $msg)); } if ($this->mode & PEAR_ERROR_CALLBACK) { if (is_string($this->callback) && strlen($this->callback)) { call_user_func($this->callback, $this); } elseif (is_array($this->callback) && sizeof($this->callback) == 2 && is_object($this->callback[0]) && is_string($this->callback[1]) && strlen($this->callback[1])) { @call_user_method($this->callback[1], $this->callback[0], $this); } } } // }}} // {{{ getMode() /** * Get the error mode from an error object. * * @return int error mode * @access public */ function getMode() { return $this->mode; } // }}} // {{{ getCallback() /** * Get the callback function/method from an error object. * * @return mixed callback function or object/method array * @access public */ function getCallback() { return $this->callback; } // }}} // {{{ getMessage() /** * Get the error message from an error object. * * @return string full error message * @access public */ function getMessage () { return ($this->error_message_prefix . $this->message); } // }}} // {{{ getCode() /** * Get error code from an error object * * @return int error code * @access public */ function getCode() { return $this->code; } // }}} // {{{ getType() /** * Get the name of this error/exception. * * @return string error/exception name (type) * @access public */ function getType () { return get_class($this); } // }}} // {{{ getUserInfo() /** * Get additional user-supplied information. * * @return string user-supplied information * @access public */ function getUserInfo () { return $this->userinfo; } // }}} // {{{ getDebugInfo() /** * Get additional debug information supplied by the application. * * @return string debug information * @access public */ function getDebugInfo () { return $this->getUserInfo(); } // }}} // {{{ addUserInfo() function addUserInfo($info) { if (empty($this->userinfo)) { $this->userinfo = $info; } else { $this->userinfo .= " ** $info"; } } // }}} // {{{ toString() /** * Make a string representation of this object. * * @return string a string with an object summary * @access public */ function toString() { $modes = array(); $levels = array(E_USER_NOTICE => 'notice', E_USER_WARNING => 'warning', E_USER_ERROR => 'error'); if ($this->mode & PEAR_ERROR_CALLBACK) { if (is_array($this->callback)) { $callback = get_class($this->callback[0]) . '::' . $this->callback[1]; } else { $callback = $this->callback; } return sprintf('[%s: message="%s" code=%d mode=callback '. 'callback=%s prefix="%s" info="%s"]', get_class($this), $this->message, $this->code, $callback, $this->error_message_prefix, $this->userinfo); } if ($this->mode & PEAR_ERROR_CALLBACK) { $modes[] = 'callback'; } if ($this->mode & PEAR_ERROR_PRINT) { $modes[] = 'print'; } if ($this->mode & PEAR_ERROR_TRIGGER) { $modes[] = 'trigger'; } if ($this->mode & PEAR_ERROR_DIE) { $modes[] = 'die'; } if ($this->mode & PEAR_ERROR_RETURN) { $modes[] = 'return'; } return sprintf('[%s: message="%s" code=%d mode=%s level=%s '. 'prefix="%s" info="%s"]', get_class($this), $this->message, $this->code, implode("|", $modes), $levels[$this->level], $this->error_message_prefix, $this->userinfo); } // }}} } register_shutdown_function("_PEAR_call_destructors"); /* * Local Variables: * mode: php * tab-width: 4 * c-basic-offset: 4 * End: */ ?> |
|
From: <jhe...@us...> - 2002-08-08 13:50:20
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv1193
Modified Files:
uc_accounts.php
Log Message:
added methods to UcUser to set user's first name, last name and email
Index: uc_accounts.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_accounts.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** uc_accounts.php 5 Aug 2002 08:15:24 -0000 1.3
--- uc_accounts.php 8 Aug 2002 13:50:17 -0000 1.4
***************
*** 11,14 ****
--- 11,17 ----
var $groups;
var $db;
+ var $firstName;
+ var $lastName;
+ var $email;
function UcUser()
***************
*** 83,86 ****
--- 86,115 ----
}
+ function setFirstName($name)
+ {
+ global $ucsql_userfirstname;
+ $query = sprintf($ucsql_userfirstname, $name, $this->uid);
+ $this->db->Execute($query) or die("Unable to set user's first name: "
+ . $this->db->ErrorMsg());
+ $this->firstName = $name;
+ }
+
+ function setLastName($name)
+ {
+ global $ucsql_userlastname;
+ $query = sprintf($ucsql_userlastname, $name, $this->uid);
+ $this->db->Execute($query) or die("Unable to set user's last name : "
+ . $this->db->ErrorMsg());
+ $this->lastName = $name;
+ }
+
+ function setEmail($email)
+ {
+ global $ucsql_useremail;
+ $query = sprintf($ucsql_useremail, $email, $this->uid);
+ $this->db->Execute($query) or die("Unable to set user's email: "
+ . $this->db->ErrorMsg());
+ $this->email = $email;
+ }
}
***************
*** 111,114 ****
--- 140,146 ----
$user->lang = $o->PREFERRED_LANG;
$user->groups = $user->getSecondaryGroups();
+ $user->firstName = $o->FIRSTNAME;
+ $user->lastName = $o->LASTNAME;
+ $user->email = $o->EMAIL;
return $user;
|
|
From: <jhe...@us...> - 2002-08-08 13:49:03
|
Update of /cvsroot/upcase-project/UpCase/admin/messages
In directory usw-pr-cvs1:/tmp/cvs-serv807
Modified Files:
badlogin.php
Log Message:
fixed include
Index: badlogin.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/admin/messages/badlogin.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** badlogin.php 16 Jul 2002 15:31:53 -0000 1.1.1.1
--- badlogin.php 8 Aug 2002 13:49:00 -0000 1.2
***************
*** 1,3 ****
--- 1,5 ----
<?php
+
+ include_once("../../config/uc_config.inc");
include_once("lib/uc_page.php");
$page = new UcPage();
|
|
From: <jhe...@us...> - 2002-08-08 13:47:51
|
Update of /cvsroot/upcase-project/UpCase/admin
In directory usw-pr-cvs1:/tmp/cvs-serv32655
Modified Files:
useredit.php
Log Message:
modified to use global config object rather than array as previous, completed
the data input with user's first and last names, email address
Index: useredit.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/admin/useredit.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** useredit.php 16 Jul 2002 15:31:53 -0000 1.1.1.1
--- useredit.php 8 Aug 2002 13:47:48 -0000 1.2
***************
*** 1,3 ****
--- 1,13 ----
<?php
+ // input from client :
+ // $primarygroup : numeric id of the primary group
+ // $preflang : preferred language for this user (2 letters code)
+ // $secondarygroups[] : array of numeric id the user is member of
+ // $password : the new password for the user
+ // $firstname : the first name of the user
+ // $lastname : the lastname of the user
+ // $email : the email of the user
+
+ include_once("../config/uc_config.inc");
include_once("lib/uc_page.php");
***************
*** 5,22 ****
$page->open();
include("config/uc_templates.inc");
! $tmpl = new ModeliXe($uc_config["USER_EDIT"]);
$tmpl->SetModeliXe();
! $user = $page->session->user;
!
! $query = $ucsql_allgroups;
! $db = new UcSql();
! $res = $db->Execute($query) or die("Unable to fetch groups: "
! . $db->ErrorMsg());
! while ($o = $res->FetchNextObject(TRUE))
{
! $groups[$o->GID] = $o->GROUPNAME;
}
$tmpl->MxText("username", $user->name);
--- 15,45 ----
$page->open();
+ session_register("user");
+
include("config/uc_templates.inc");
! $tmpl = new ModeliXe($uc_tmpl["USER_EDIT"]);
$tmpl->SetModeliXe();
! if (isset($username))
{
! $user = getUser($username, '');
}
+ else
+ {
+ $db = new UcSql();
+ $user->db = $db;
+ $user->setPrimaryGroup($primarygroup);
+ $user->setLanguage($preflang);
+ if (isset($secondarygroups))
+ $user->setSecondaryGroups($secondarygroups);
+ if (strlen($password) > 0)
+ $user->setPassword($password);
+
+ $user->setFirstName($firstname);
+ $user->setLastName($lastname);
+ $user->setEmail($email);
+ }
+
+ $groups = getAllGroups();
$tmpl->MxText("username", $user->name);
***************
*** 24,30 ****
$user->gid, $groups);
$tmpl->MxSelect("secondarygroups", "secondarygroups",
! array_keys($user->groups), $groups, "--", 5);
$tmpl->MxSelect("preflang", "preflang",
! $user->lang, $uc_config["lang"]);
$tmpl->MxAttribut("userupdate", "userupdate.php");
$tmpl->MxWrite();
--- 47,57 ----
$user->gid, $groups);
$tmpl->MxSelect("secondarygroups", "secondarygroups",
! $user->groups, $groups, "", 5);
$tmpl->MxSelect("preflang", "preflang",
! $user->lang, $ucConfig->languages);
! $tmpl->MxText("firstname", $user->firstName);
! $tmpl->MxText("lastname", $user->lastName);
! $tmpl->MxText("email", $user->email);
!
$tmpl->MxAttribut("userupdate", "userupdate.php");
$tmpl->MxWrite();
|
|
From: <jhe...@us...> - 2002-08-08 12:03:42
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv13957
Modified Files:
uc_sql-mysql.inc
Log Message:
added request to set user's firstname, lastname and email
Index: uc_sql-mysql.inc
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_sql-mysql.inc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** uc_sql-mysql.inc 5 Aug 2002 08:43:59 -0000 1.2
--- uc_sql-mysql.inc 8 Aug 2002 12:03:39 -0000 1.3
***************
*** 33,37 ****
. " SET password='%s' WHERE uid='%s'";
!
$ucsql_memberadd = "INSERT INTO $members_tbl (gid, uid) VALUES ('%s', '%s')";
$ucsql_memberdel = "DELETE FROM $members_tbl WHERE gid = '%s' AND uid = '%s'";
--- 33,42 ----
. " SET password='%s' WHERE uid='%s'";
! $ucsql_userfirstname = "UPDATE $users_tbl"
! . " SET firstname='%s' WHERE uid='%s'";
! $ucsql_userlastname = "UPDATE $users_tbl"
! . " SET lastname='%s' WHERE uid='%s'";
! $ucsql_useremail = "UPDATE $users_tbl"
! . "SET email='%s' WHERE uid='%s'";
$ucsql_memberadd = "INSERT INTO $members_tbl (gid, uid) VALUES ('%s', '%s')";
$ucsql_memberdel = "DELETE FROM $members_tbl WHERE gid = '%s' AND uid = '%s'";
|
|
From: <jhe...@us...> - 2002-08-08 10:09:56
|
Update of /cvsroot/upcase-project/UpCase/cache In directory usw-pr-cvs1:/tmp/cvs-serv13327/cache Log Message: Directory /cvsroot/upcase-project/UpCase/cache added to the repository |
|
From: <jhe...@us...> - 2002-08-08 10:09:34
|
Update of /cvsroot/upcase-project/UpCase/admin/messages
In directory usw-pr-cvs1:/tmp/cvs-serv13194
Modified Files:
newobject.php
Log Message:
added include of config for include path setting
Index: newobject.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/admin/messages/newobject.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** newobject.php 16 Jul 2002 15:31:53 -0000 1.1.1.1
--- newobject.php 8 Aug 2002 10:09:31 -0000 1.2
***************
*** 1,3 ****
--- 1,4 ----
<?php
+ include_once("../../config/uc_config.inc");
include_once("lib/uc_page.php");
$page = new UcPage();
|
|
From: <jhe...@us...> - 2002-08-08 10:08:09
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv12917
Modified Files:
uc_session.php
Log Message:
Get the table prefix for session data table from config rather than hard-coded
Index: uc_session.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_session.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** uc_session.php 5 Aug 2002 08:39:10 -0000 1.2
--- uc_session.php 8 Aug 2002 10:08:06 -0000 1.3
***************
*** 1,9 ****
<?php
-
- include_once("config/uc_config.inc");
include_once("lib/uc_accounts.php");
include_once("lib/uc_login.php");
! $SESSION_DATA = "uc1_session_data";
include_once("lib/uc_session_handler.php");
--- 1,7 ----
<?php
include_once("lib/uc_accounts.php");
include_once("lib/uc_login.php");
! $SESSION_DATA = $ucConfig->tblPrefix . "session_data";
include_once("lib/uc_session_handler.php");
|
|
From: <jhe...@us...> - 2002-08-08 10:00:50
|
Update of /cvsroot/upcase-project/UpCase/config
In directory usw-pr-cvs1:/tmp/cvs-serv11126
Modified Files:
uc_tables.inc
Log Message:
corrected tables script creation, add a default user admin
Index: uc_tables.inc
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/config/uc_tables.inc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_tables.inc 16 Jul 2002 15:32:14 -0000 1.1.1.1
--- uc_tables.inc 8 Aug 2002 10:00:42 -0000 1.2
***************
*** 1,27 ****
<?php
! $tables = array(
! "CREATE TABLE " . $tblprefix . "groupmembers (
gid int(4) default NULL,
uid int(4) default NULL
) TYPE=MyISAM;",
!
! "CREATE TABLE " . $tblprefix . "groups (
gid int(4) NOT NULL auto_increment,
groupname varchar(50) NOT NULL default '',
! PRIMARY KEY (gid)
) TYPE=MyISAM;",
!
! "CREATE TABLE " . $tblprefix . "sessions (
sessid varchar(50) NOT NULL default '',
uid int(4) default NULL,
start_time int(10) default NULL,
! last_access_time int(10) default NULL,
ip varchar(16) default NULL,
logged_in int(4) default '0',
PRIMARY KEY (sessid)
) TYPE=MyISAM;",
!
! "CREATE TABLE " . $tblprefix . "users (
uid int(4) NOT NULL auto_increment,
groupid int(4) NOT NULL default '0',
--- 1,34 ----
<?php
! $tables_create = array(
! "CREATE TABLE ${tblprefix}groupmembers (
gid int(4) default NULL,
uid int(4) default NULL
) TYPE=MyISAM;",
! "CREATE TABLE ${tblprefix}groups (
gid int(4) NOT NULL auto_increment,
groupname varchar(50) NOT NULL default '',
! PRIMARY KEY (gid),
! UNIQUE KEY groupname (groupname)
) TYPE=MyISAM;",
! "CREATE TABLE ${tblprefix}permissions (
! oid varchar(50) NOT NULL default '',
! gid int(4) default NULL
! ) TYPE=MyISAM;",
! "CREATE TABLE ${tblprefix}session_data (
! sessid varchar(50) NOT NULL default '',
! data text,
! PRIMARY KEY (sessid)
! ) TYPE=MyISAM;",
! "CREATE TABLE ${tblprefix}sessions (
sessid varchar(50) NOT NULL default '',
uid int(4) default NULL,
start_time int(10) default NULL,
! expiry int(10) default NULL,
ip varchar(16) default NULL,
logged_in int(4) default '0',
PRIMARY KEY (sessid)
) TYPE=MyISAM;",
! "CREATE TABLE ${tblprefix}users (
uid int(4) NOT NULL auto_increment,
groupid int(4) NOT NULL default '0',
***************
*** 29,34 ****
password varchar(50) NOT NULL default '',
preferred_lang char(2) default NULL,
! PRIMARY KEY (uid)
! ) TYPE=MyISAM;"
);
--- 36,50 ----
password varchar(50) NOT NULL default '',
preferred_lang char(2) default NULL,
! PRIMARY KEY (uid),
! UNIQUE KEY username (username)
! ) TYPE=MyISAM;",
! );
!
!
! $tables_insert = array(
! "INSERT INTO ${tblprefix}groups VALUES (0,'admins');",
! "UPDATE ${tblprefix}groups SET gid='0' WHERE groupname='admins';",
! "INSERT INTO ${tblprefix}groups VALUES (-1,'all');",
! "INSERT INTO ${tblprefix}users VALUES (1,0,'admin','admin','en');",
);
|
|
From: <jhe...@us...> - 2002-08-05 08:51:12
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv8215
Modified Files:
uc_sql.php
Log Message:
Adapted to new config object
Index: uc_sql.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_sql.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_sql.php 16 Jul 2002 15:31:56 -0000 1.1.1.1
--- uc_sql.php 5 Aug 2002 08:51:09 -0000 1.2
***************
*** 1,23 ****
<?php
include_once("config/uc_config.inc");
include_once("lib/adodb/adodb.inc.php");
! if ($uc_config[engine] == "MySQL")
{
include_once("lib/uc_sql-mysql.inc");
}
! class UcSQL
{
var $db;
! function UcSQL()
{
! global $uc_config;
! $this->db = NewADOConnection($uc_config["engine"]);
! $this->db->PConnect($uc_config["host"],
! $uc_config["user"],
! $uc_config["password"],
! $uc_config["name"]) or
die("Unable to connect to database: " . $this->db->ErrorMsg());
}
--- 1,25 ----
<?php
+
include_once("config/uc_config.inc");
include_once("lib/adodb/adodb.inc.php");
! if ($ucConfig->dbType == "MySQL")
{
include_once("lib/uc_sql-mysql.inc");
}
! class UcSql
{
var $db;
! function UcSql()
{
! global $ucConfig;
!
! $this->db = NewADOConnection($ucConfig->dbType);
! $this->db->PConnect($ucConfig->dbHost,
! $ucConfig->dbUser,
! $ucConfig->dbPasswd,
! $ucConfig->dbName) or
die("Unable to connect to database: " . $this->db->ErrorMsg());
}
|
|
From: <jhe...@us...> - 2002-08-05 08:44:02
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv6046
Modified Files:
uc_sql-mysql.inc
Log Message:
Fixed typo's, some requests are simplified, etc ....
Index: uc_sql-mysql.inc
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_sql-mysql.inc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_sql-mysql.inc 16 Jul 2002 15:31:56 -0000 1.1.1.1
--- uc_sql-mysql.inc 5 Aug 2002 08:43:59 -0000 1.2
***************
*** 2,8 ****
// ACCOUNTS AND GROUPS
! $groups_tbl = $uc_config["prefix"] . $uc_config["table"]["groups"];
! $users_tbl = $uc_config["prefix"] . $uc_config["table"]["users"];
! $members_tbl = $uc_config["prefix"] . $uc_config["table"]["memberships"];
$ucsql_groupadd = "INSERT INTO $groups_tbl (groupname) VALUES ('%s')";
--- 2,8 ----
// ACCOUNTS AND GROUPS
! $groups_tbl = $ucConfig->tblPrefix . "groups";
! $users_tbl = $ucConfig->tblPrefix . $ucConfig->dbTables["users"];
! $members_tbl = $ucConfig->tblPrefix . "groupmembers";
$ucsql_groupadd = "INSERT INTO $groups_tbl (groupname) VALUES ('%s')";
***************
*** 14,40 ****
$ucsql_useradd = "INSERT INTO $users_tbl (username) VALUES ('%s')";
$ucsql_userdel = "DELETE FROM $users_tbl WHERE username='%s'";
! $ucsql_userget = "SELECT u.*, g.groupname AS gidname"
! . " FROM $users_tbl AS u, $groups_tbl AS g"
! . " WHERE (u.username='%s' or u.uid='%s')"
! . " AND u.groupid = g.gid";
! $ucsql_usergroups = "SELECT $groups_tbl.gid,$groups_tbl.groupname"
! . " FROM $users_tbl, $members_tbl, $groups_tbl"
! . " WHERE $users_tbl.uid = '%s'"
! . " AND $users_tbl.uid = $members_tbl.uid"
! . " AND $groups_tbl.gid = $members_tbl.gid";
$ucsql_usercheckpw = "SELECT * FROM $users_tbl"
. " WHERE username = '%s' AND password = '%s'";
! $ucsql_allusers = "SELECT * FROM $users_tbl";
- $ucsql_memberadd = "INSERT INTO $tbl (gid, uid) VALUES ('%s', '%s')";
- $ucsql_memberdel = "DELETE FROM $tbl WHERE gid = '%s' AND uid = '%s'";
// OBJECT PERMISSIONS
! $perm_tbl = $uc_config["prefix"] . "permissions";
! $obj_tbl = $uc_config["prefix"] . "objects";
$ucsql_permadd = "INSERT INTO $perm_tbl (oid, gid) VALUES ('%s', '-1')";
--- 14,45 ----
$ucsql_useradd = "INSERT INTO $users_tbl (username) VALUES ('%s')";
$ucsql_userdel = "DELETE FROM $users_tbl WHERE username='%s'";
!
! $ucsql_userget = "SELECT u.* FROM $users_tbl AS u"
! . " WHERE (u.username='%s' or u.uid='%s')";
!
! $ucsql_usergroups = "SELECT gid"
! . " FROM $members_tbl WHERE uid = '%s'";
!
$ucsql_usercheckpw = "SELECT * FROM $users_tbl"
. " WHERE username = '%s' AND password = '%s'";
! $ucsql_allusers = "SELECT * FROM $users_tbl ORDER BY username";
+ $ucsql_usersetlang = "UPDATE $users_tbl"
+ . " SET preferred_lang='%s' WHERE uid='%s'";
+ $ucsql_usersetgid = "UPDATE $users_tbl"
+ . " SET groupid='%s' WHERE uid='%s'";
+ $ucsql_usersetpw = "UPDATE $users_tbl"
+ . " SET password='%s' WHERE uid='%s'";
+ $ucsql_memberadd = "INSERT INTO $members_tbl (gid, uid) VALUES ('%s', '%s')";
+ $ucsql_memberdel = "DELETE FROM $members_tbl WHERE gid = '%s' AND uid = '%s'";
+ $ucsql_memberrm = "DELETE FROM $members_tbl WHERE uid='%s'";
// OBJECT PERMISSIONS
! $perm_tbl = $ucConfig->tblPrefix . "permissions";
! $obj_tbl = $ucConfig->tblPrefix . "objects";
$ucsql_permadd = "INSERT INTO $perm_tbl (oid, gid) VALUES ('%s', '-1')";
***************
*** 55,59 ****
// SESSIONS
! $session_tbl = $uc_config["prefix"] . $uc_config["table"]["sessions"];
$ucsql_sessionget = "SELECT * FROM $session_tbl WHERE sessid = '%s'";
$ucsql_sessionlogin = "UPDATE $session_tbl SET logged_in = 1, uid = '%s'"
--- 60,64 ----
// SESSIONS
! $session_tbl = $ucConfig->tblPrefix . $ucConfig->dbTables["sessions"];
$ucsql_sessionget = "SELECT * FROM $session_tbl WHERE sessid = '%s'";
$ucsql_sessionlogin = "UPDATE $session_tbl SET logged_in = 1, uid = '%s'"
|
|
From: <jhe...@us...> - 2002-08-05 08:42:06
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv5383
Modified Files:
uc_session_handler.php
Log Message:
Don't depend on uc_config.inc anymore, use a DbData object instead
Index: uc_session_handler.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_session_handler.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_session_handler.php 16 Jul 2002 15:31:56 -0000 1.1.1.1
--- uc_session_handler.php 5 Aug 2002 08:42:04 -0000 1.2
***************
*** 1,25 ****
<?php
! include_once("config/uc_config.inc");
include_once("lib/adodb/adodb.inc.php");
$DB_CONN = "";
$IP = "";
! $SESSIONS = $uc_config["prefix"] . $uc_config["table"]["sessions"];
// set it to the name of the table that hold session data
assert(!empty($SESSION_DATA));
function uc_session_open($save_path, $session_name)
{
! global $uc_config;
global $DB_CONN;
global $IP;
!
! $DB_CONN = NewADOConnection($uc_config["engine"]);
! $DB_CONN->PConnect($uc_config["host"],
! $uc_config["user"],
! $uc_config["password"],
! $uc_config["name"]) or
die("Unable to connect to Session database: " . $DB_CONN->ErrorMsg());
--- 1,29 ----
<?php
! include_once("lib/uc_dbdata.php");
include_once("lib/adodb/adodb.inc.php");
+
+ $dbdata = new DbData("/var/www/vhosts/test1/UpCase/config/upcase.xml");
+
$DB_CONN = "";
$IP = "";
! $SESSIONS = $dbdata->tblPrefix . $dbdata->dbTables["sessions"];
// set it to the name of the table that hold session data
assert(!empty($SESSION_DATA));
+
function uc_session_open($save_path, $session_name)
{
! global $dbdata;
global $DB_CONN;
global $IP;
!
! $DB_CONN = NewADOConnection($dbdata->dbType);
! $DB_CONN->PConnect($dbdata->dbHost,
! $dbdata->dbUser,
! $dbdata->dbPasswd,
! $dbdata->dbName) or
die("Unable to connect to Session database: " . $DB_CONN->ErrorMsg());
***************
*** 51,55 ****
! $res = $DB_CONN->Execute($query) or die("Error unable to get sessio: "
. $DB_CONN->ErrorMsg());
if ($res->RecordCount() == 1)
--- 55,59 ----
! $res = $DB_CONN->Execute($query) or die("Error unable to get session: "
. $DB_CONN->ErrorMsg());
if ($res->RecordCount() == 1)
|
|
From: <jhe...@us...> - 2002-08-05 08:39:13
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv3913
Modified Files:
uc_session.php
Log Message:
Moved checkPassword as a method of UcSession
Index: uc_session.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_session.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_session.php 16 Jul 2002 15:31:57 -0000 1.1.1.1
--- uc_session.php 5 Aug 2002 08:39:10 -0000 1.2
***************
*** 3,23 ****
include_once("config/uc_config.inc");
include_once("lib/uc_accounts.php");
! $SESSION_DATA = "uc_session_data";
include_once("lib/uc_session_handler.php");
- function checkPassword($username, $password)
- {
- global $ucsql_usercheckpw;
- $query = sprintf($ucsql_usercheckpw, $username, $password);
- $db = new UcSQL();
- $res = $db->Execute($query) or die("Unable to check password: "
- . $db->ErrorMsg());
- if ($res->RowCount() != 1)
- {
- return false;
- }
- return true;
- }
--- 3,11 ----
include_once("config/uc_config.inc");
include_once("lib/uc_accounts.php");
+ include_once("lib/uc_login.php");
! $SESSION_DATA = "uc1_session_data";
include_once("lib/uc_session_handler.php");
***************
*** 84,89 ****
// No IP set in the session, do it now
$query = sprintf($ucsql_sessionsetip, $ip, $this->sessid);
! $this->db->Execute($query) or die("Unable to set IP for the session: "
! . $this->db->ErrorMsg());
return true;
}
--- 72,78 ----
// No IP set in the session, do it now
$query = sprintf($ucsql_sessionsetip, $ip, $this->sessid);
! $res = $this->db->Execute($query) or
! die("Unable to set IP for the session: " . $this->db->ErrorMsg());
!
return true;
}
***************
*** 98,103 ****
// retrieve the uid associated with this session from the db
$query = sprintf($ucsql_sessionget, $this->sessid);
! $res = $this->db->Execute($query) or die("Unable to get session info: "
! . $this->db->ErrorMsg());
$o = $res->FetchNextObject(true);
--- 87,92 ----
// retrieve the uid associated with this session from the db
$query = sprintf($ucsql_sessionget, $this->sessid);
! $res = $this->db->Execute($query) or
! die("Unable to get session info: " . $this->db->ErrorMsg());
$o = $res->FetchNextObject(true);
***************
*** 113,117 ****
{
// we have the password/login
! if (checkPassword($username, $password))
{
// good, update session with user
--- 102,106 ----
{
// we have the password/login
! if ($this->checkPassword($username, $password))
{
// good, update session with user
***************
*** 127,131 ****
else
{
! // we don't have password/lohin, ask for it
uc_login($this->returnPath);
exit();
--- 116,120 ----
else
{
! // we don't have password/login, ask for it
uc_login($this->returnPath);
exit();
***************
*** 141,157 ****
$this->user = $user;
$query = sprintf($ucsql_sessionlogin, $this->user->uid, $this->sessid);
! $this->db->Execute($query) or die("Unable to set session uid: " .
! $this->db->ErrorMsg());
}
! // function addVar($varname, $initialValue)
! // {
! // if (!session_is_registered($varname))
! // {
! // session_register($varname);
! // $$varname = $initialValue;
! // }
! // }
!
}
--- 130,150 ----
$this->user = $user;
$query = sprintf($ucsql_sessionlogin, $this->user->uid, $this->sessid);
! $res = $this->db->Execute($query) or
! die("Unable to set session uid: " . $this->db->ErrorMsg());
}
! function checkPassword($username, $password)
! {
! global $ucsql_usercheckpw;
! $query = sprintf($ucsql_usercheckpw, $username, $password);
! $res = $this->db->Execute($query) or
! die("Error while checking password: " . $this->db->ErrorMsg());
! if ($res->RowCount() != 1)
! {
! return false;
! }
! return true;
! }
!
}
|
|
From: <jhe...@us...> - 2002-08-05 08:35:06
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv2379
Modified Files:
uc_page.php
Log Message:
Use global config object
Index: uc_page.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_page.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_page.php 16 Jul 2002 15:31:56 -0000 1.1.1.1
--- uc_page.php 5 Aug 2002 08:35:02 -0000 1.2
***************
*** 1,7 ****
<?php
! include_once("config/uc_config.inc");
include_once("lib/uc_sql.php");
- include_once("lib/uc_accounts.php");
- include_once("lib/uc_login.php");
include_once("lib/uc_object.php");
include_once("lib/uc_session.php");
--- 1,5 ----
<?php
! include_once("uc_config.inc");
include_once("lib/uc_sql.php");
include_once("lib/uc_object.php");
include_once("lib/uc_session.php");
***************
*** 19,22 ****
--- 17,21 ----
global $REQUEST_URI;
global $uc_info;
+ global $ucConfig;
$this->oid = $pageId;
***************
*** 28,32 ****
// Open the session
$this->session = new UcSession($this->path);
! $this->session->lang = $uc_config["defaultlang"];
if (!$pageId)
--- 27,31 ----
// Open the session
$this->session = new UcSession($this->path);
! $this->session->lang = $ucConfig->defaultlang;
if (!$pageId)
***************
*** 77,81 ****
// get user's secondary groups gid
! $userGroups = array_keys($user->groups);
// add the user's primary group gid
--- 76,80 ----
// get user's secondary groups gid
! $userGroups = $user->groups;
// add the user's primary group gid
***************
*** 84,88 ****
// set the lang for this user
$uc_lang = $user->lang;
-
// is it an admin ?
if (in_array(0, $userGroups))
--- 83,86 ----
|
|
From: <jhe...@us...> - 2002-08-05 08:32:03
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv1142
Modified Files:
uc_packages.php
Log Message:
Removed ftp recursive download, download a tgz archive and untar with PEAR
Index: uc_packages.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_packages.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_packages.php 16 Jul 2002 15:31:53 -0000 1.1.1.1
--- uc_packages.php 5 Aug 2002 08:32:01 -0000 1.2
***************
*** 1,5 ****
<?php
! include_once("lib/uc_ftp.php");
class UcPackage
--- 1,5 ----
<?php
! include_once("lib/Tar.php");
class UcPackage
***************
*** 12,15 ****
--- 12,54 ----
var $tarball;
var $status;
+ var $setup;
+
+ function install($destDir)
+ {
+ global $ucConfig;
+
+ $ar = parse_url($this->tarball);
+ $tbname = basename($ar["path"]);
+
+ $from_fd = fopen($this->tarball, "rb");
+ $to_fd = fopen($destDir . "/" . $tbname, "wb");
+ $buffer = '';
+
+ while ($buffer = fread($from_fd, 1024))
+ {
+ $res = fwrite($to_fd, $buffer, 1024);
+ flush();
+ if ($res < 1024)
+ {
+ break;
+ }
+ }
+
+ fclose($from_fd);
+ fclose($to_fd);
+
+ if ($res > -1)
+ {
+ flush();
+ $tar = new Archive_Tar($destDir . "/" . $tbname, true);
+ $tar->extract($destDir);
+ symlink($destDir . "/" . basename($tbname, ".tar.gz"),
+ $destDir . "/" . $this->name);
+ }
+
+ $setupPage = $ucConfig->wwwRoot . "/modules/" . $this->name
+ . "/" . $this->setup;
+ header("Location: $setupPage");
+ }
}
***************
*** 30,55 ****
}
- function download_package($local_dir, $package_url)
- {
- $ar = parse_url($package_url);
- //if ($ar[scheme] == "ftp://")
- //{
- $conn_id = ftp_connect($ar[host]);
- if (!$conn_id)
- {
- return FALSE;
- }
-
- //ftp_set_option($conn_id, FTP_TIMEOUT_SEC, 5);
-
- $login_res = ftp_login($conn_id, "anonymous", "blah");
- if (!$login_res)
- {
- return FALSE;
- }
-
- return ftp_recursive_download($conn_id, $local_dir, $ar[path]);
- //}
- }
class UcPackageListParser
--- 69,72 ----
***************
*** 150,153 ****
--- 167,171 ----
if (trim($data) == "" || trim($data) == "<?xml version=\"1.0\"?>")
{
+ $this->xml_data = "";
return;
}
|
|
From: <jhe...@us...> - 2002-08-05 08:29:05
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv455
Modified Files:
uc_object.php
Log Message:
Use global config object
Index: uc_object.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_object.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_object.php 16 Jul 2002 15:31:56 -0000 1.1.1.1
--- uc_object.php 5 Aug 2002 08:29:02 -0000 1.2
***************
*** 46,53 ****
function getDescription($lang)
{
! global $uc_config;
if (strlen($this->description->$lang) == 0)
{
! $lang = $uc_config["defaultlang"];
}
--- 46,53 ----
function getDescription($lang)
{
! global $ucConfig;
if (strlen($this->description->$lang) == 0)
{
! $lang = $ucConfig->defaultLang;
}
|
|
From: <jhe...@us...> - 2002-08-05 08:27:47
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv32522
Modified Files:
uc_login.php
Log Message:
use global config object
Index: uc_login.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_login.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_login.php 16 Jul 2002 15:31:56 -0000 1.1.1.1
--- uc_login.php 5 Aug 2002 08:27:44 -0000 1.2
***************
*** 4,9 ****
function uc_login($backTo)
{
! global $lang;
global $uc_tmpl;
$page = new ModeliXe($uc_tmpl["LOGIN_PAGE"]);
$page->SetModeliXe();
--- 4,10 ----
function uc_login($backTo)
{
! global $ucConfig;
global $uc_tmpl;
+
$page = new ModeliXe($uc_tmpl["LOGIN_PAGE"]);
$page->SetModeliXe();
|
|
From: <jhe...@us...> - 2002-08-05 08:22:54
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv31169
Added Files:
uc_dbdata.php
Log Message:
Database configuration information
--- NEW FILE: uc_dbdata.php ---
<?php
include_once("lib/uc_xmlparser.php");
class DbData
{
var $dbName;
var $dbHost;
var $dbUser;
var $dbPasswd;
var $dbType;
var $dbTables;
function dbData($file)
{
$this->dbTables = array();
$p = new UcXmlParser();
$tree = $p->parse($file);
$ar = $tree->getElements("database");
$dbNode = $ar[0];
$ar = $dbNode->getElements("host");
$this->dbHost = $ar[0]->textElements[0];
$ar = $dbNode->getElements("name");
$this->dbName = $ar[0]->textElements[0];
$ar = $dbNode->getElements("user");
$this->dbUser = $ar[0]->textElements[0];
$ar = $dbNode->getElements("password");
$this->dbPasswd = $ar[0]->textElements[0];
$ar = $dbNode->getElements("prefix");
$this->tblPrefix = $ar[0]->textElements[0];
$ar = $dbNode->getElements("engine");
$this->dbType = $ar[0]->textElements[0];
$ar = $dbNode->getElements("table");
foreach ($ar as $tblNode)
{
$data = $tblNode->attributes["data"];
$this->dbTables[$data] = $tblNode->textElements[0];
}
}
}
?>
|
|
From: <jhe...@us...> - 2002-08-05 08:21:09
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv30610
Modified Files:
uc_config.php
Log Message:
Use parser from uc_xmlparser.php
Index: uc_config.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_config.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** uc_config.php 16 Jul 2002 15:31:56 -0000 1.1.1.1
--- uc_config.php 5 Aug 2002 08:21:07 -0000 1.2
***************
*** 1,115 ****
<?php
- include_once("config/uc_config.inc");
! class UcConfig
! {
! var $db_name;
! var $db_host;
! var $db_user;
! var $db_passwd;
! var $tbl_users;
! var $tbl_sessions;
! var $tbl_groups;
! var $tbl_memberships;
! var $tbl_prefix;
!
! function UcConfig()
! {
! $parser = new UcConfigParser();
! $ar = $parser->parse($mainconfig);
! $this->db_name = $ar[name];
! $this->db_host = $ar[host];
! $this->db_user = $ar[user];
! $this->tbl_sessions = $ar[prefix] . $ar[table][sessions];
! $this->tbl_users = $ar[prefix] . $ar[table][users];
! $this->tbl_groups = $ar[prefix] . $ar[table][groups];
! $this->tbl_memberships = $ar[prefix] . $ar[table][memberships];
! $this->tbl_prefix = $ar[prefix];
! }
! }
! class UcConfigParser
{
! var $parser;
! var $config_data;
! var $xml_data;
! var $db_data;
! var $in_comment;
!
! function UcConfigParser()
! {
! $this->parser = xml_parser_create();
! xml_set_object($this->parser, &$this);
! xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
! xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
! xml_set_default_handler($this->parser, "default_handler");
! xml_set_element_handler($this->parser, "tag_open", "tag_close");
! }
! function parse($config_file)
! {
! $this->in_comment = FALSE;
! $this->config_data = implode("", file($config_file));
! xml_parse($this->parser, $this->config_data, TRUE);
! print_r($this->db_data);
! }
! function tag_open($parser, $tag, $attribs)
! {
! if ($tag == "table")
! {
! $this->table_name = $attribs[data];
! }
! }
!
! function tag_close($parser, $tag)
! {
! if ($tag == "database" || $tag == "upcase")
! {
! return;
! }
! if ($tag == "table")
! {
! $this->db_data[table][$this->table_name] = $this->xml_data;
! return;
! }
! $this->db_data[$tag] = $this->xml_data;
! }
! function default_handler($parser, $data)
{
! if (trim($data) == "" || trim($data) == "<?xml version=\"1.0\"?>")
! {
! return;
! }
! // Handle comments
! if (strpos($data, "<!--") && !$this->in_comment)
! {
! if (strpos($data, "-->") !== FALSE)
! {
! return;
! }
- $this->in_comment = TRUE;
- return;
- }
! if (strpos($data, "-->") && $this->in_comment)
! {
! $this->in_comment = FALSE;
! return;
! }
! if (!$this->in_comment)
{
! $this->xml_data = trim($data);
! }
}
!
! } // UcConfigParser
?>
--- 1,102 ----
<?php
! include_once("lib/uc_dbdata.php");
! include_once("lib/uc_xmlparser.php");
! class UcConfig extends DbData
{
+ /**
+ * The root url for the whole site
+ *
+ * @var string
+ * @access public
+ */
+ var $wwwRoot;
! /**
! * The root for the physiqual files on disk
! *
! * @var string
! * @access public
! */
! var $filesRoot;
! /**
! * The root url to access installed modules
! *
! * @var string
! * @access public
! */
! var $wwwModules;
! /**
! * The directory where the modules are stored on disk
! *
! * @var string
! * @access public
! */
! var $modulesRoot;
! /**
! * The default language for the site
! *
! * @var string
! * @access public
! */
! var $defaultLang;
! /**
! * The supported languages in the site
! *
! * @var array
! * @access public
! */
! var $languages;
! /**
! * Constructor for UcConfig object.
! *
! * This create a UcConfig object filled with all the value read
! * from the xml config file.
! *
! * @param string $configFile The xml config file
! */
! function UcConfig($configFile)
{
! DbData::DbData($configFile);
! $parser = new UcXmlParser();
! $tree = $parser->parse($configFile);
!
! $ar = $tree->getElements("paths");
! $pathNode = $ar[0];
!
! $ar = $pathNode->getElements("rooturl");
! $this->wwwRoot = $ar[0]->textElements[0];
! $ar = $pathNode->getElements("modsurl");
! $this->wwwModules = $ar[0]->textElements[0];
! $ar = $pathNode->getElements("docroot");
! $this->filesRoot = $ar[0]->textElements[0];
!
! $ar = $pathNode->getElements("modules");
! $this->modulesRoot = $ar[0]->textElements[0];
!
! $ar = $tree->getElements("languages");
! $langNode = $ar[0];
!
! $ar = $langNode->getElements("defaultlang");
! $this->defaultLang = $ar[0]->textElements[0];
!
! $langs = $langNode->getElements("lang");
! $this->languages = array();
! foreach ($langs as $l)
{
! $this->languages[$l->attributes["id"]] = $l->textElements[0];
! }
}
! }
?>
|
|
From: <jhe...@us...> - 2002-08-05 08:17:05
|
Update of /cvsroot/upcase-project/UpCase/lib In directory usw-pr-cvs1:/tmp/cvs-serv29420 Removed Files: uc_cfgparser.php Log Message: Replaced by a more generic parser in uc_xmlparser.php --- uc_cfgparser.php DELETED --- |
|
From: <jhe...@us...> - 2002-08-05 08:15:27
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv28948
Modified Files:
uc_accounts.php
Log Message:
Added some methods to user object, added global function to create a user
in the db and one to retrieve groups from the db.
Index: uc_accounts.php
===================================================================
RCS file: /cvsroot/upcase-project/UpCase/lib/uc_accounts.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** uc_accounts.php 17 Jul 2002 10:58:25 -0000 1.2
--- uc_accounts.php 5 Aug 2002 08:15:24 -0000 1.3
***************
*** 10,25 ****
var $lang;
var $groups;
function UcUser()
{
$this->groups = array();
}
}
// Fill a user object with data retrieved from the database
function getUser($username, $uid)
{
global $ucsql_userget;
- global $ucsql_usergroups;
$db = new UcSQL();
--- 10,93 ----
var $lang;
var $groups;
+ var $db;
function UcUser()
{
$this->groups = array();
+ $this->db = new UcSql();
}
+
+ function getSecondaryGroups()
+ {
+ global $ucsql_usergroups;
+ $query = sprintf($ucsql_usergroups, $this->uid);
+
+ $res = $this->db->Execute($query) or
+ die("Unable to get groups: " . $db->ErrorMsg());
+
+ unset($this->groups);
+ $this->groups = array();
+
+ while ($o = $res->FetchNextObject(true))
+ $this->groups[] = $o->GID;
+ return $this->groups;
+ }
+
+ function setPassword($passwd)
+ {
+ global $ucsql_usersetpw;
+
+ $query = sprintf($ucsql_usersetpw, $passwd, $this->uid);
+ $this->db->Execute($query) or die("Unable to set user password: "
+ . $this->db->ErrorMsg());
+ }
+
+ function setLanguage($lang)
+ {
+ global $ucsql_usersetlang;
+
+ $query = sprintf($ucsql_usersetlang, $lang, $this->uid);
+ $this->db->Execute($query) or die("Unable to set user lang: "
+ . $this->db->ErrorMsg());
+
+ $this->lang = $lang;
+ }
+
+ function setPrimaryGroup($gid)
+ {
+ global $ucsql_usersetgid;
+
+ $query = sprintf($ucsql_usersetgid, $gid, $this->uid);
+ $res = $this->db->Execute($query)
+ or die("Unable to set user primary group: "
+ . $this->db->ErrorMsg());
+ $this->gid = $gid;
+ }
+
+ function setSecondaryGroups($gids)
+ {
+ global $ucsql_memberrm;
+ global $ucsql_memberadd;
+
+ $query = sprintf($ucsql_memberrm, $this->uid);
+ $this->db->Execute($query) or die("Unable to reset user memberships: "
+ . $this->db->ErrorMsg());
+ foreach ($gids as $gid)
+ {
+ $query = sprintf($ucsql_memberadd, $gid,$this->uid);
+ $this->db->Execute($query) or die("Unable to add membership: "
+ . $thid->db->ErrorMsg());
+ }
+
+ $this->groups = $gids;
+ }
+
}
+
// Fill a user object with data retrieved from the database
function getUser($username, $uid)
{
global $ucsql_userget;
$db = new UcSQL();
***************
*** 31,34 ****
--- 99,103 ----
if ($res->RecordCount() != 1)
{
+ print("FOUND: " . $res->RecordCount() . "<br>");
die("Problem with your database: more than one user with same uid");
}
***************
*** 40,61 ****
$user->uid = $o->UID;
$user->gid = $o->GROUPID;
- $user->gidname = $o->GIDNAME;
$user->lang = $o->PREFERRED_LANG;
!
! // groups
! $query = sprintf($ucsql_usergroups, $user->uid);
! $res = $db->Execute($query) or
! die("Unable to get groups: " . $db->ErrorMsg());
!
! while (!$res->EOF)
! {
! $user->groups[$res->fields[0]] = $res->fields[1];
! $res->MoveNext();
! }
return $user;
}
?>
--- 109,148 ----
$user->uid = $o->UID;
$user->gid = $o->GROUPID;
$user->lang = $o->PREFERRED_LANG;
! $user->groups = $user->getSecondaryGroups();
return $user;
}
+ // Create a new user in the database
+ function createUser($username)
+ {
+ global $ucsql_useradd;
+ global $ucsql_userget;
+
+ $db = new UcSql();
+ $query = sprintf($ucsql_useradd, $username);
+ $db->Execute($query) or die("Unable to create new user: "
+ . $db->ErrorMsg());
+
+ return getUser($username, '');
+ }
+
+
+ function getAllGroups()
+ {
+ global $ucsql_allgroups;
+ $db = new UcSql();
+ $query = $ucsql_allgroups;
+ $res = $db->Execute($query) or die("Unable to get group list: "
+ . $db->ErrorMsg());
+ $groups = array();
+ while ($o = $res->FetchNextObject(TRUE))
+ {
+ $groups[$o->GID] = $o->GROUPNAME;
+ }
+ return $groups;
+ }
?>
|
|
From: <jhe...@us...> - 2002-08-05 08:11:04
|
Update of /cvsroot/upcase-project/UpCase/lib
In directory usw-pr-cvs1:/tmp/cvs-serv27897
Added Files:
sql2php.sh
Log Message:
helper script that convert a sql file in a php file
--- NEW FILE: sql2php.sh ---
echo '<?php
$tables_create = array('
sed -e 's/uc_/${tblprefix}/g' \
-e 's/CREATE/"CREATE/' \
-e 's/MyISAM;/MyISAM;",/g' \
-n -e '/CREATE/,/MyISAM/p' $1
echo ');
'
echo '$table_insert = array('
grep INSERT $1 | sed -e 's/uc_/${tblprefix}/g' \
-e 's/INSERT/"INSERT/g' \
-e 's/);/);",/g'
echo ');
'
echo '?>'
|
|
From: <jhe...@us...> - 2002-08-05 08:09:23
|
Update of /cvsroot/upcase-project/UpCase/lib In directory usw-pr-cvs1:/tmp/cvs-serv25978 Removed Files: Mxconf.php Log Message: Don't need it here, generated by install script in config directory --- Mxconf.php DELETED --- |
|
From: <jhe...@us...> - 2002-08-05 08:02:14
|
Update of /cvsroot/upcase-project/UpCase/config In directory usw-pr-cvs1:/tmp/cvs-serv25380 Removed Files: uc_config.inc Log Message: Generated by install script --- uc_config.inc DELETED --- |
|
From: <jhe...@us...> - 2002-08-05 08:00:37
|
Update of /cvsroot/upcase-project/UpCase/config In directory usw-pr-cvs1:/tmp/cvs-serv24693 Removed Files: upcase.xml Log Message: Generated by install script, dont' need to be in cvs --- upcase.xml DELETED --- |