Hi Blaine,
I am currently strugglling with this modification you made. I have been working with it on and off for the last couple of weeks and can't seem to get it going.
Here is a link to the site:
hereIt all looks as though it's good to go but nothing happens once the info is filled in and submitted:
I have enabled the custom reg option to "true" in the GL config file.
Looks like the new table (gl_localuserinfo) was created successfully.
Most of the directions seemed pretty strraight forward.
I added the edited theme files as described for users and preferences. I aslo created the "custom" directory as described.
The only thing that I felt was a little ambigous was how to edit the System/lib-custom file. I am pasting my edited lib-custom bellow:
PHP Formatted Code
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog 1.3 |
// +---------------------------------------------------------------------------+
// | lib-custom.php |
// | Your very own custom Geeklog library. |
// | |
// | This is the file where you should put all of your custom code. When |
// | possible you should not alter lib-common.php but, instead, put code here. |
// | This will make upgrading to future versions of Geeklog easier for you |
// | because you will always be gauranteed that the Geeklog developers will |
// | NOT add code to this file. NOTE: we have already gone through the trouble |
// | of making sure that we always include this file when lib-common.php is |
// | included some place so you will have access to lib-common.php. It |
// | follows then that you should not include lib-common.php in this file |
// | |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2005 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
// | Blaine Lang - blaine AT portalparts DOT com |
// | Dirk Haun - dirk AT haun-online DOT de |
// +---------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
//
// $Id: lib-custom.php,v 1.11.2.1 2005/10/03 09:24:36 dhaun Exp $
// You can use this global variable to print useful messages to the errorlog
// using COM_errorLog(). To see an example of how to do this, look in
// lib-common.php and see how $_COM_VERBOSE was used throughout the code
$_CST_VERBOSE = false;
/**
* Sample PHP Block function
*
* this is a sample function used by a PHP block. This will show the rights that
* a user has in the "What you have access to" block.
*
*/
function phpblock_showrights
()
{
global $_RIGHTS, $_CST_VERBOSE;
if ($_CST_VERBOSE) {
COM_errorLog
('**** Inside phpblock_showrights in lib-custom.php ****', 1);
}
$retval .= ' ';
for ($i = 0; $i < count($_RIGHTS); $i++) {
$retval .= '<li>' . $_RIGHTS[$i] . '</li>' . LB
;
}
if ($_CST_VERBOSE) {
COM_errorLog
('**** Leaving phpblock_showrights in lib-custom.php ****', 1);
}
return $retval;
}
/***
*
* Get Bent()
*
* Php function to tell you how if your site is grossly insecure
*
**/
function phpblock_getBent
()
{
global $_CONF, $_TABLES;
$secure = true;
$retval = '';
$secure_msg = 'Could not find any gross insecurities in your site. Do not take this ';
$secure_msg .= 'as meaning your site is 100% secure, as no site ever is. I can only ';
$secure_msg .= 'check things that should be blatantly obvious.';
$insecure_msg = '';
// we don't have the path to the admin directory, so try to figure it out
// from $_CONF['site_admin_url']
$adminurl = $_CONF['site_admin_url'];
if (strrpos ($adminurl, '/') == strlen ($adminurl)) {
$adminurl = substr ($adminurl, 0, -1);
}
$pos = strrpos ($adminurl, '/');
if ($pos === false) {
// only guessing ...
$installdir = $_CONF['path_html'] . 'admin/install';
} else {
$installdir = $_CONF['path_html'] . substr ($adminurl, $pos + 1)
. '/install';
}
if (is_dir ($installdir)) {
$insecure_msg .= '<p>You should really remove the install directory <b>' . $installdir .'</b> once you have your site up and running without any errors.';
$insecure_msg .= ' Keeping it around would allow malicious users the ability to destroy your current install, take over your site, or retrieve sensitive information.';
$secure = false;
}
// check to see if any account still has 'password' as its password.
$count = DB_query
("select count(*) as count from {$_TABLES['users']} where passwd='" . md5('password') . "'");
$A = DB_fetchArray
($count);
if ( $A['count'] > 0 ) {
$secure = false;
$insecure_msg .= '<p>You still have not changed the default password from "password" on ' . $A['count'] . ' account(s). ';
$insecure_msg .= 'This will allow people to do serious harm to your site!';
}
if ($secure) {
$retval = $secure_msg;
} else {
$retval = $insecure_msg;
}
$retval = wordwrap($retval,20,' ',1);
return $retval;
}
/* Sample Custom Member Functions to create and update Custom Membership registration and profile
Note1: Enable CustomRegistration Feature in config.php
$_CONF['custom_registration'] = true; // Set to true if you have custom code
Note2: This example requries a template file called memberdetail.thtml to be
located under the theme_dir/custom directory.
Sample is provided under /system with the distribution.
Functions have been provided that are called from the Core Geeklog user and admin functions
- This works with User Moderation as well
- Admin will see the new registration info when checking a members profile only
- All other users will see the standard User profile with the optional extended custom information
- Customization requires changes to a few of the core template files to add {customfields} variable
- See notes below in the custom function about the template changes
*/
/* Create any new records in additional tables you may have added */
/* Update any fields in the core GL tables for this user as needed */
/* Called when user is first created */
function custom_usercreate
($uid) {
global $_TABLES;
$grad_year = COM_applyFilter
($_POST['cust_gradyear'],true);
$fullname = COM_applyFilter
($_POST['cust_fullname']);
// Ensure all data is prepared correctly before inserts, quotes may need to be escaped with addslashes()
DB_query
("INSERT INTO {$_TABLES['localuserinfo']} (uid,grad_year) VALUES ('$uid', '$grad_year')");
DB_query
("UPDATE {$_TABLES['users']} SET fullname = '$fullname' WHERE uid='$uid'");
return true;
}
// Delete user record from custom user info table
function custom_userdelete
($uid) {
global $_TABLES;
DB_query
("DELETE FROM {$_TABLES['localuserinfo']} WHERE uid='$uid'");
return true;
}
/* Called from users.php - when user is displaying a member profile */
/* This function can now return any extra fields that need to be shown */
/* Output is then replaced in {customfields) -- This variable needs to be added to your templates */
/* Template: path_layout/users/profile/profile.thtml */
function custom_userdisplay
($uid) {
global $_CONF,$_TABLES;
$grad_year = DB_getItem
($_TABLES['localuserinfo'], "grad_year", "uid='$uid'");
$fullname = DB_getItem
($_TABLES['users'], "fullname", "uid='$uid'");
$retval .= '<tr>
<td align="right"><b>Full Name:</b></td>
<td>' . $fullname .'</td>
</tr>';
$retval .= '<tr>
<td align="right"><b>Graduation Year:</b></td>
<td>' . $grad_year .'</td>
</tr>';
return $retval;
}
/* Function called when editing user profile. */
/* Called from usersettings.php - when user is eding their own profile */
/* and from admin/user.php when admin is editing a member profile */
/* This function can now return any extra fields that need to be shown for editing */
/* Output is then replaced in {customfields} -- This variable needs to be added to your templates */
/* User: path_layout/preferences/profile.thtml and Admin: path_layout/admin/user/edituser.thtml */
/* This example shows adding the Cookie Timeout setting and extra text field */
/* As noted: You need to add the {customfields} template variable. */
/* For the edituser.thtml - maybe it would be added about the {group_edit} variable. */
function custom_useredit
($uid) {
global $_TABLES,$_CONF;
$grad_year = DB_getItem
($_TABLES['localuserinfo'], "grad_year", "uid='$uid'");
$fullname = DB_getItem
($_TABLES['users'], "fullname", "uid='$uid'");
$retval .= '<tr>
<td align="right"><b>Full Name:</b></td>
<td><input type="text" name="cust_fullname" size="50" value="' . $fullname .'"></td>
</tr>';
$retval .= '<tr>
<td align="right"><b>Graduation Year:</b></td>
<td><input type="text" name="cust_gradyear" size="5" maxlength="4" value="' . $grad_year .'"></td>
</tr>';
$retval .= '<tr><td colspan="2"><hr></td></tr>';
return $retval;
}
/* Function called when saving the user profile. */
/* This function can now update any extra fields */
function custom_usersave
($uid) {
global $_TABLES;
$grad_year = COM_applyFilter
($_POST['cust_gradyear'],true);
$fullname = COM_applyFilter
($_POST['fullname']);
DB_query
("UPDATE {$_TABLES['users']} SET fullname='$fullname' WHERE uid='$uid'");
if ($grad_year > 0) {
DB_query
("UPDATE {$_TABLES['localuserinfo']} SET grad_year='$grad_year' WHERE uid='$uid'");
}
}
/**
* Main Form used for Custom membership when member is registering
*
* Note: Requires a file custom/memberdetail.thtml in every theme that is
* installed on the site!
*
* @param string $msg an error message to display or the word 'new'
* @return string HTML for the registration form
*
*/
function custom_userform
($uid="",$msg="") {
global $_CONF,$_TABLES, $LANG04;
if (!empty($msg)) {
$retval .= COM_startBlock
($LANG04[21]) . $msg . COM_endBlock
();
}
$post_url = $_CONF['site_url']."/users.php";
$postmode = "create";
$submitbutton = '<input type="submit" value="Register Now!">';
$passwd_input = "";
$message = "<br><font color=black><b>Please complete the application below. Once you have completed the application, click the Submit button and the application will be processed immediately.</b></font>";
$A=array();
$user_templates = new Template
($_CONF['path_layout'] . 'custom');
$user_templates->set_file('memberdetail', 'memberdetail.thtml');
$user_templates->set_var('layout_url', $_CONF['layout_url']);
$user_templates->set_var('post_url', $post_url);
$user_templates->set_var('startblock', COM_startBlock
("Custom Registration Example"));
$user_templates->set_var('message', $message);
$user_templates->set_var('USERNAME', "Username");
$user_templates->set_var('USERNAME_HELP', "Name to be used when accessing this site");
$user_templates->set_var('username', $A['username']);
$user_templates->set_var('passwd_input', $passwd_input);
$user_templates->set_var('EMAIL', "Email Address");
$user_templates->set_var('EMAIL_HELP', "Valid email address");
$user_templates->set_var('email', $A['email']);
$user_templates->set_var('FULLNAME', "Full Name");
$user_templates->set_var('FULLNAME_HELP', "First and Last Name");
$user_templates->set_var('fullname', $A['fullname']);
$user_templates->set_var('GRADYEAR', "Graduation Year");
$user_templates->set_var('GRADYEAR_HELP', "That big year!");
$user_templates->set_var('grad_year', "");
$user_templates->set_var('user_id', $user);
$user_templates->set_var('postmode', $postmode);
$user_templates->set_var('submitbutton', $submitbutton);
$user_templates->set_var('endblock', COM_endBlock
());
$user_templates->parse('output', 'memberdetail');
$retval .= $user_templates->finish($user_templates->get_var('output'));
return $retval;
}
/**
* Check if it's okay to create a new user.
*
* Geeklog is about to create a new user with the given username and email
* address. This is the custom code's last chance to prevent that,
* e.g. to check if all required data has been entered.
*
* @param string $username username that Geeklog would use for the new user* @param string $email email address of that user
* @return string an error message or an empty string for "OK"
*
*/
function custom_usercheck
($username, $email)
{
$msg = '';
// Example, check that the full name has been entered
// and complain if it's missing
if (empty ($_POST['fullname'])) {
$msg = 'Please enter your full name!';
}
return $msg;
}
/**
* Custom function to retrieve and return a formatted list of blocks
* Can be used when calling COM_siteHeader or COM_SiteFooter
* Example:
* 1: Setup an array of blocks to display
* 2: Call COM_siteHeader or COM_siteFooter
*
* $myblocks = array ('site_menu','site_news','poll_block');
* COM_siteHeader( array('COM_showCustomBlocks',$myblocks) ) ;
* COM_siteFooter( true, array('COM_showCustomBlocks',$myblocks));
* @param array $showblocks An array of block names to retrieve and format
* @return string Formated HTML containing site footer and optionally right blocks
*/
function custom_showBlocks
($showblocks)
{
global $_CONF, $_TABLES;
$retval = '';
foreach($showblocks as $block) {
$sql = "SELECT bid, name,type,title,content,rdfurl,phpblockfn,help FROM {$_TABLES['blocks']} WHERE name='$block'";
$result = DB_query
($sql);
if (DB_numRows
($result) == 1) {
$A = DB_fetchArray
($result);
$retval .= COM_formatBlock
($A);
}
}
return $retval;
}
/**
* This is an example of a custom email function. When this function is NOT
* commented out, Geeklog would send all emails through this function
* instead of sending them through COM_mail in lib-common.php.
*
* This is basically a re-implementation of the way emails were sent
* prior to Geeklog 1.3.9 (Geeklog uses PEAR::Mail as of version 1.3.9).
*
*/
/*
function CUSTOM_mail($to, $subject, $message, $from = '', $html = false, $priority = 0)
{
global $_CONF, $LANG_CHARSET;
if (empty ($LANG_CHARSET)) {
$charset = $_CONF['default_charset'];
if (empty ($charset)) {
$charset = 'iso-8859-1';
}
} else {
$charset = $LANG_CHARSET;
}
if (empty ($from)) {
$from = $_CONF['site_name'] . ' <' . $_CONF['site_mail'] . '>';
}
$headers = 'From: ' . $from . "rn"
. 'X-Mailer: Geeklog ' . VERSION . "rn";
if ($priority > 0) {
$headers .= 'X-Priority: ' . $priority . "rn";
}
if ($html) {
$headers .= "Content-Type: text/html; charset={$charset}rn"
. 'Content-Transfer-Encoding: 8bit';
} else {
$headers .= "Content-Type: text/plain; charset={$charset}";
}
return mail ($to, $subject, $message, $headers);
}
*/
/**
* This is an example of a function that returns menu entries to be used for
* the 'custom' entry in $_CONF['menu_elements'] (see config.php).
*
*/
/*
function CUSTOM_menuEntries ()
{
global $_CONF, $_USER;
$myentries = array ();
// Sample link #1: Link to Gallery
$myentries[] = array ('url' => $_CONF['site_url'] . '/gallery/',
'label' => 'Gallery');
// Sample link #2: Link to the Personal Calendar - only visible for
// logged-in users
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) {
$myentries[] = array ('url' => $_CONF['site_url']
. '/calendar.php?mode=personal',
'label' => 'My Calendar');
}
return $myentries;
}
*/
?>
Let me say that I do not know PHP or MYsql but I am learning it at snails pace:
THis is my Lib-database.php file:
PHP Formatted Code
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog 1.3 |
// +---------------------------------------------------------------------------+
// | lib-database.php |
// | |
// | Geeklog database library. |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2004 by the following authors: |
// | |
// | Authors: Tony Bibbs, tony@tonybibbs.com |
// +---------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
//
// $Id: lib-database.php,v 1.33 2004/11/20 17:55:07 dhaun Exp $
/**
* This is the high-level database layer for Geeklog (for the low-level stuff,
* see the system/databases directory).
*
* NOTE: As of Geeklog 1.3.5 you should not have to edit this file any more.
*/
// +---------------------------------------------------------------------------+
// | Table definitions, these are used by the install program to create the |
// | database schema. If you don't like the tables names, change them PRIOR |
// | to running the install after running the install program DO NOT TOUCH |
// | these. You have been warned! Also, these variables are used in the core |
// | Geeklog code |
// +---------------------------------------------------------------------------+
$_TABLES['access'] = $_DB_table_prefix . 'access';
$_TABLES['article_images'] = $_DB_table_prefix . 'article_images';
$_TABLES['blocks'] = $_DB_table_prefix . 'blocks';
$_TABLES['commentcodes'] = $_DB_table_prefix . 'commentcodes';
$_TABLES['commentmodes'] = $_DB_table_prefix . 'commentmodes';
$_TABLES['comments'] = $_DB_table_prefix . 'comments';
$_TABLES['cookiecodes'] = $_DB_table_prefix . 'cookiecodes';
$_TABLES['dateformats'] = $_DB_table_prefix . 'dateformats';
$_TABLES['events'] = $_DB_table_prefix . 'events';
$_TABLES['eventsubmission'] = $_DB_table_prefix . 'eventsubmission';
$_TABLES['featurecodes'] = $_DB_table_prefix . 'featurecodes';
$_TABLES['features'] = $_DB_table_prefix . 'features';
$_TABLES['frontpagecodes'] = $_DB_table_prefix . 'frontpagecodes';
$_TABLES['group_assignments'] = $_DB_table_prefix . 'group_assignments';
$_TABLES['groups'] = $_DB_table_prefix . 'groups';
$_TABLES['links'] = $_DB_table_prefix . 'links';
$_TABLES['linksubmission'] = $_DB_table_prefix . 'linksubmission';
$_TABLES['maillist'] = $_DB_table_prefix . 'maillist';
$_TABLES['personal_events'] = $_DB_table_prefix . 'personal_events';
$_TABLES['plugins'] = $_DB_table_prefix . 'plugins';
$_TABLES['pollanswers'] = $_DB_table_prefix . 'pollanswers';
$_TABLES['pollquestions'] = $_DB_table_prefix . 'pollquestions';
$_TABLES['pollvoters'] = $_DB_table_prefix . 'pollvoters';
$_TABLES['postmodes'] = $_DB_table_prefix . 'postmodes';
$_TABLES['sessions'] = $_DB_table_prefix . 'sessions';
$_TABLES['sortcodes'] = $_DB_table_prefix . 'sortcodes';
$_TABLES['speedlimit'] = $_DB_table_prefix . 'speedlimit';
$_TABLES['statuscodes'] = $_DB_table_prefix . 'statuscodes';
$_TABLES['stories'] = $_DB_table_prefix . 'stories';
$_TABLES['storysubmission'] = $_DB_table_prefix . 'storysubmission';
$_TABLES['syndication'] = $_DB_table_prefix . 'syndication';
$_TABLES['topics'] = $_DB_table_prefix . 'topics';
$_TABLES['tzcodes'] = $_DB_table_prefix . 'tzcodes';
$_TABLES['usercomment'] = $_DB_table_prefix . 'usercomment';
$_TABLES['userindex'] = $_DB_table_prefix . 'userindex';
$_TABLES['userinfo'] = $_DB_table_prefix . 'userinfo';
$_TABLES['userprefs'] = $_DB_table_prefix . 'userprefs';
$_TABLES['users'] = $_DB_table_prefix . 'users';
$_TABLES['vars'] = $_DB_table_prefix . 'vars';
$_TABLES['localuserinfo'] = $_DB_table_prefix . 'localuserinfo';
// the static pages plugin has become an integral part of Geeklog anyway ...
$_TABLES['staticpage'] = $_DB_table_prefix . 'staticpage';
// ditto for spamx
$_TABLES['spamx'] = $_DB_table_prefix . 'spamx';
// these tables aren't used by Geeklog any more, but the table names are needed
// when upgrading from old versions
$_TABLES['commentspeedlimit'] = $_DB_table_prefix . 'commentspeedlimit';
$_TABLES['submitspeedlimit'] = $_DB_table_prefix . 'submitspeedlimit';
$_TABLES['userevent'] = $_DB_table_prefix . 'userevent';
// +---------------------------------------------------------------------------+
// | DO NOT TOUCH ANYTHING BELOW HERE |
// +---------------------------------------------------------------------------+
if (eregi ('lib-database.php', $HTTP_SERVER_VARS['PHP_SELF'])) {
die ('This file can not be used on its own.');
}
/**
* Include appropriate DBMS object
*
*/
require_once($_CONF['path_system'] . 'databases/'. $_DB_dbms . '.class.php');
// Instantiate the database object
$_DB = new database
($_DB_host,$_DB_name,$_DB_user,$_DB_pass,'COM_errorLog');
// +---------------------------------------------------------------------------+
// | These are the library functions. In all cases they turn around and make |
// | calls to the DBMS specific functions. These ARE to be used directly in |
// | the code...do NOT use the $_DB methods directly
// +---------------------------------------------------------------------------+
/**
* Turns debug mode on for the database library
*
* Setting this to true will cause the database code to print out
* various debug messages. Setting it to false will supress the
* messages (is false by default). NOTE: Gl developers have put many
* useful debug messages into the mysql implementation of this. If
* you are using something other than MySQL and if the GL team did
* not write it then you may or may not get something useful by turning
* this on.
*
* @param boolean $flag true or false
*
*/
function DB_setdebug
($flag)
{
global $_DB;
$_DB->setVerbose($flag);
}
/**
* Executes a query on the db server
*
* This executes the passed SQL and returns the recordset or errors out
*
* @param string $sql SQL to be executed
* @param int $ignore_errors If 1 this function supresses any error messages
* @return object Returns results from query
*
*/
function DB_query
($sql, $ignore_errors=0)
{
global $_DB;
return $_DB->dbQuery($sql,$ignore_errors);
}
/**
* Saves information to the database
*
* This will use a REPLACE INTO to save a record into the
* database. NOTE: this function is going to change in the near future
* to remove dependency of REPLACE INTO. Please use DB_query if you can
*
* @param string $table The table to save to
* @param string $fields Comma demlimited list of fields to save
* @param string $values Values to save to the database table
* @param string $return_page URL to send user to when done
*
*/
function DB_save
($table,$fields,$values,$return_page='')
{
global $_DB,$_TABLES,$_CONF;
$_DB->dbSave($table,$fields,$values);
if (!empty($return_page)) {
print COM_refresh
("$return_page");
}
}
/**
* Deletes data from the database
*
* This will delete some data from the given table where id = value
*
* @param string $table Table to delete data from
* @param array|string $id field name(s) to use in where clause
* @param array|string $value value(s) to use in where clause
* @param string $return_page page to send user to when done
*
*/
function DB_delete
($table,$id,$value,$return_page='')
{
global $_DB,$_TABLES,$_CONF;
$_DB->dbDelete($table,$id,$value);
if (!empty($return_page)) {
print COM_refresh
("$return_page");
}
}
/**
* Gets a single item from the database
*
* @param string $table Table to get item from
* @param string $what field name to get
* @param string $selection Where clause to use in SQL
* @return mixed Returns value sought
*
*/
function DB_getItem
($table,$what,$selection='')
{
if (!empty($selection)) {
$result = DB_query
("SELECT $what FROM $table WHERE $selection");
} else {
$result = DB_query
("SELECT $what FROM $table");
}
$ITEM = DB_fetchArray
($result, true);
return $ITEM[0];
}
/**
* Changes records in a table
*
* This will change the data in the given table that meet the given criteria and will
* redirect user to another page if told to do so
*
* @param string $table Table to perform change on
* @param string $item_to_set field name to set
* @param string $value_to_set Value to set abovle field to
* @param array|string $id field name(s) to use in where clause
* @param array|string $value Value(s) to use in where clause
* @param string $return_page page to send user to when done with change
* @param boolean $supress_quotes whether or not to use single quotes in where clause
*
*/
function DB_change
($table,$item_to_set,$value_to_set,$id='',$value='',$return_page='',$supress_quotes=false)
{
global $_DB,$_TABLES,$_CONF;
$_DB->dbChange($table,$item_to_set,$value_to_set,$id,$value,$supress_quotes);
if (!empty($return_page)) {
print COM_refresh
("$return_page");
}
}
/**
* Count records in a table
*
* This will return the number of records which meet the given criteria in the
* given table.
*
* @param string $table Table to perform count on
* @param array|string $id field name(s) to use in where clause
* @param array|string $value Value(s) to use in where clause
* @return int Returns row count from generated SQL
*
*/
function DB_count
($table,$id='',$value='')
{
global $_DB;
return $_DB->dbCount($table,$id,$value);
}
/**
* Copies a record from one table to another (can be the same table)
*
* This will use a REPLACE INTO...SELECT FROM to copy a record from one table
* to another table. They can be the same table.
*
* @param string $table Table to insert record into
* @param string $fields Comma delmited list of fields to copy over
* @param string $values Values to store in database field
* @param string $tablefrom Table to get record from
* @param array|string $id Field name(s) to use in where clause
* @param array|string $value Value(s) to use in where clause
* @param string $return_page Page to send user to when done
*
*/
function DB_copy
($table,$fields,$values,$tablefrom,$id,$value,$return_page='')
{
global $_DB,$_TABLES,$_CONF;
$_DB->dbCopy($table,$fields,$values,$tablefrom,$id,$value);
if (!empty($return_page)) {
print COM_refresh
("$return_page");
}
}
/**
* Retrieves the number of rows in a recordset
*
* This returns the number of rows in a recordset
*
* @param object $recordset The recordset to operate one
* @return int Returns number of rows returned by a previously executed query
*
*/
function DB_numRows
($recordset)
{
global $_DB;
return $_DB->dbNumRows($recordset);
}
/**
* Retrieves the contents of a field
*
* This returns the contents of a field from a result set
*
* @param object $recordset The recordset to operate on
* @param int $row row to get data from
* @param string $field field to return
* @return (depends on the contents of the field)
*
*/
function DB_result
($recordset,$row,$field)
{
global $_DB;
return $_DB->dbResult($recordset,$row,$field);
}
/**
* Retrieves the number of fields in a recordset
*
* This returns the number of fields in a recordset
*
* @param object $recordset The recordset to operate on
* @return int Returns the number fields in a result set
*
*/
function DB_numFields
($recordset)
{
global $_DB;
return $_DB->dbNumFields($recordset);
}
/**
* Retrieves returns the field name for a field
*
* Returns the field name for a given field number
*
* @param object $recordset The recordset to operate on
* @param int $fnumber field number to return the name of
* @return string Returns name of specified field
*
*/
function DB_fieldName
($recordset,$fnumber)
{
global $_DB;
return $_DB->dbFieldName($recordset,$fnumber);
}
/**
* Retrieves returns the number of effected rows for last query
*
* Retrieves returns the number of effected rows for last query
*
* @param object $recordset The recordset to operate on
* @return int returns numbe of rows affected by previously executed query
*
*/
function DB_affectedRows
($recordset)
{
global $_DB;
return $_DB->dbAffectedRows($recordset);
}
/**
* Retrieves record from a recordset
*
* Gets the next record in a recordset and returns in array
*
* @param object $recordset The recordset to operate on
* @param boolean $both get both assoc and numeric indices
* @return Array Returns data for a record in an array
*
*/
function DB_fetchArray
($recordset, $both = true)
{
global $_DB;
return $_DB->dbFetchArray($recordset, $both);
}
/**
* Returns the last ID inserted
*
* Returns the last auto_increment ID generated
*
* @param resources $link_identifier identifier for opened link
* @return int Returns the last ID auto-generated
*
*/
function DB_insertId
($link_identifier = '')
{
global $_DB;
return $_DB->dbInsertId($link_identifier);
}
/**
* returns a database error string
*
* Returns an database error message
*
* @return string Returns database error message
*
*/
function DB_error
()
{
global $_DB;
return $_DB->dbError();
}
/**
* Creates database structures for fresh installation
*
* This may not be used by Geeklog currently
*
* @return boolean returns true on success otherwise false
*
*/
function DB_createDatabaseStructures
()
{
global $_DB;
return $_DB->dbCreateStructures();
}
/**
* Executes the sql upgrade script(s)
*
* @param string $current_gl_version version of geeklog to upgrade from
* @return boolean returns true on success otherwise false
*
*/
function DB_doDatabaseUpgrade
($current_gl_version)
{
global $_DB;
return $_DB->dbDoDatabaseUpgrade($current_gl_version);
}
?>
Not really sure what I messed up with