[geeklog-cvs] geeklog-1.3/system lib-custom.php,1.11,1.12
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Mon Jan 17 04:22:14 EST 2005
Update of /var/cvs/geeklog-1.3/system
In directory www:/tmp/cvs-serv17505
Modified Files:
lib-custom.php
Log Message:
Fixed declaration of custom_userform, added an example for custom_usercheck, some minor code cleanup.
Index: lib-custom.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-custom.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** lib-custom.php 3 Nov 2004 14:54:43 -0000 1.11
--- lib-custom.php 17 Jan 2005 09:22:12 -0000 1.12
***************
*** 18,26 ****
// | |
// +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2004 by the following authors: |
// | |
! // | Authors: Tony Bibbs - tony at tonybibbs.com |
! // | Blaine Lang - blaine at portalparts.com |
! // | Dirk Haun - dirk at haun-online.de |
// +---------------------------------------------------------------------------+
// | |
--- 18,26 ----
// | |
// +---------------------------------------------------------------------------+
! // | 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 |
// +---------------------------------------------------------------------------+
// | |
***************
*** 55,59 ****
*
*/
! function phpblock_showrights() {
global $_RIGHTS, $_CST_VERBOSE;
--- 55,60 ----
*
*/
! function phpblock_showrights()
! {
global $_RIGHTS, $_CST_VERBOSE;
***************
*** 86,89 ****
--- 87,91 ----
{
global $_CONF, $_TABLES;
+
$secure = true;
***************
*** 158,175 ****
/* Update any fields in the core GL tables for this user as needed */
/* Called when user is first created */
! function custom_usercreate($uid) {
! global $_CONF,$_TABLES,$HTTP_POST_VARS;
// Ensure all data is prepared correctly before inserts, quotes may need to be escaped with addslashes()
! DB_query("UPDATE {$_TABLES['users']} SET email='{$HTTP_POST_VARS['email']}',homepage='{$HTTP_POST_VARS['homepage']}', fullname='{$HTTP_POST_VARS['fullname']}' WHERE uid=$uid");
! return true;
}
// Delete any records from custom tables you may have used
! function custom_userdelete($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 */
--- 160,179 ----
/* Update any fields in the core GL tables for this user as needed */
/* Called when user is first created */
! function custom_usercreate($uid)
! {
! global $_CONF, $_TABLES;
// Ensure all data is prepared correctly before inserts, quotes may need to be escaped with addslashes()
! DB_query("UPDATE {$_TABLES['users']} SET email='{$_POST['email']}',homepage='{$_POST['homepage']}', fullname='{$_POST['fullname']}' WHERE uid=$uid");
+ return true;
}
// Delete any records from custom tables you may have used
! function custom_userdelete($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 */
***************
*** 177,182 ****
/* Template: path_layout/users/profile/profile.thtml */
! function custom_userdisplay($uid) {
! global $_CONF,$_TABLES;
$var = "Value from custom table";
$retval .= '<tr>
--- 181,188 ----
/* Template: path_layout/users/profile/profile.thtml */
! function custom_userdisplay($uid)
! {
! global $_CONF, $_TABLES;
!
$var = "Value from custom table";
$retval .= '<tr>
***************
*** 184,189 ****
<td>' . $var .'</td>
</tr>';
- return $retval;
}
--- 190,195 ----
<td>' . $var .'</td>
</tr>';
+ return $retval;
}
***************
*** 200,205 ****
/* For the edituser.thtml - maybe it would be added about the {group_edit} variable. */
! function custom_useredit($uid) {
! global $_TABLES,$_CONF;
$var = "Value from custom table";
$cookietimeout = DB_getitem($_TABLES['users'], 'cookietimeout' ,$uid);
--- 206,213 ----
/* For the edituser.thtml - maybe it would be added about the {group_edit} variable. */
! function custom_useredit($uid)
! {
! global $_CONF, $_TABLES;
!
$var = "Value from custom table";
$cookietimeout = DB_getitem($_TABLES['users'], 'cookietimeout' ,$uid);
***************
*** 216,234 ****
</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,$_CONF, $HTTP_POST_VARS;
! DB_query("UPDATE {$_TABLES['users']} SET cookietimeout='{$HTTP_POST_VARS["cooktime"]}'");
}
! /* Main Form used for Custom membership when member is registering */
! function custom_userform($uid="",$msg="") {
! global $_CONF,$_TABLES, $LANG04;
! if (!empty($msg)) {
$retval .= COM_startBlock($LANG04[21]) . $msg . COM_endBlock();
}
--- 224,256 ----
</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 $_CONF, $_TABLES;
!
! DB_query("UPDATE {$_TABLES['users']} SET cookietimeout='{$_POST["cooktime"]}'");
}
! /**
! * 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 ($msg = '')
! {
! global $_CONF, $_TABLES, $LANG04;
!
! if (!empty ($msg) && ($msg != 'new')) {
$retval .= COM_startBlock($LANG04[21]) . $msg . COM_endBlock();
}
***************
*** 239,243 ****
$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');
--- 261,266 ----
$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 = $_POST;
$user_templates = new Template ($_CONF['path_layout'] . 'custom');
***************
*** 267,270 ****
--- 290,316 ----
}
+ /**
+ * 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 = '';
+
+ // for exmaple, require the full name to be entered
+ // and complain if it's missing
+ if (empty ($_POST['fullname'])) {
+ $msg = 'Please enter your full name!';
+ }
+
+ return $msg;
+ }
***************
*** 285,290 ****
* @return string Formated HTML containing site footer and optionally right blocks
*/
! function custom_showBlocks($showblocks) {
global $_CONF, $_TABLES;
$retval = '';
foreach($showblocks as $block) {
--- 331,338 ----
* @return string Formated HTML containing site footer and optionally right blocks
*/
! function custom_showBlocks($showblocks)
! {
global $_CONF, $_TABLES;
+
$retval = '';
foreach($showblocks as $block) {
***************
*** 296,299 ****
--- 344,348 ----
}
}
+
return $retval;
}
***************
*** 373,375 ****
*/
! ?>
\ No newline at end of file
--- 422,424 ----
*/
! ?>
More information about the geeklog-cvs
mailing list