[geeklog-cvs] geeklog: Remove old lib-custom.php.dist, rename lib-custom.php t...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Fri Apr 10 16:17:56 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/df0c8f451f9a
changeset: 6905:df0c8f451f9a
user: Dirk Haun <dirk at haun-online.de>
date: Fri Apr 10 20:29:58 2009 +0200
description:
Remove old lib-custom.php.dist, rename lib-custom.php to lib-custom.php.dist
diffstat:
2 files changed, 24 insertions(+), 545 deletions(-)
system/lib-custom.php | 526 --------------------------------------------
system/lib-custom.php.dist | 43 ++-
diffs (truncated from 640 to 300 lines):
diff -r f178f2b167ae -r df0c8f451f9a system/lib-custom.php
--- a/system/lib-custom.php Fri Apr 10 18:59:22 2009 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,526 +0,0 @@
-<?php
-
-/* Reminder: always indent with 4 spaces (no tabs). */
-// +---------------------------------------------------------------------------+
-// | Geeklog 1.5 |
-// +---------------------------------------------------------------------------+
-// | 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 guaranteed that the Geeklog developers will |
-// | NOT add required 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-2008 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.43 2008/09/21 08:37:11 dhaun Exp $
-
-if (strpos(strtolower($_SERVER['PHP_SELF']), 'lib-custom.php') !== false) {
- die('This file can not be used on its own!');
-}
-
-// 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;
-}
-
-
-/**
-* Include any code in this function that will be called by the internal CRON API
-* The interval between runs is determined by $_CONF['cron_schedule_interval']
-*/
-function CUSTOM_runScheduledTask() {
-
-}
-
-
-/**
-* Example of custom function that can be used to handle a login error.
-* Only active with custom registration mode enabled
-* Used if you have a custom front page and need to trap and reformat any error messages
-* This example redirects to the front page with a extra passed variable plus the message
-* Note: Message could be a string but in this case maps to $MESSAGE[81] as a default - edit in language file
-*/
-function CUSTOM_loginErrorHandler($msg='') {
- global $_CONF,$MESSAGE;
-
- if ($msg > 0) {
- $msg = $msg;
- } elseif ($msg == '') {
- $msg = 81;
- }
- $retval = COM_refresh($_CONF['site_url'] .'/index.php?mode=loginfail&msg='.$msg);
- echo $retval;
- exit;
-}
-
-
-/**
-* Include any code in this function to add custom template variables.
-* Initially, this function is only called in the COM_siteHeader function to set
-* header.thtml variables
-*/
-function CUSTOM_templateSetVars ($templatename, &$template)
-{
- if ($templatename == 'header') {
- // define a {hello_world} variable which displays "Hello, world!"
- $template->set_var ('hello_world', 'Hello, world!');
- }
-}
-
-
-/* Sample Custom Member Functions to create and update Custom Membership registration and profile
-
- Note1: Enable CustomRegistration Feature in the configuration
- $_CONF['custom_registration'] = true; // Set to true if you have custom code
-
- Note2: This example requires a template file called memberdetail.thtml to be
- located under the theme_dir/custom directory.
- Sample is provided under /system with the distribution.
-
- Note3: Optional parm $bulkimport added so that if your using the [Batch Add] feature,
- you can execute different logic if required.
-
- 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 member's 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} variables
- - 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,$bulkimport=false)
-{
- global $_CONF, $_TABLES;
-
- // Ensure all data is prepared correctly before inserts, quotes may need to
- // be escaped with addslashes()
- $email = '';
- if (isset ($_POST['email'])) {
- $email = COM_applyFilter ($_POST['email']);
- $email = addslashes ($email);
- }
-
- $homepage = '';
- if (isset ($_POST['homepage'])) {
- $homepage = COM_applyFilter ($_POST['homepage']);
- $homepage = addslashes ($homepage);
- }
-
- $fullname = '';
- if (isset ($_POST['fullname'])) {
- // COM_applyFilter would strip special characters, e.g. quotes, so
- // we only strip HTML
- $fullname = strip_tags ($_POST['fullname']);
- $fullname = addslashes ($fullname);
- }
-
- // Note: In this case, we can trust the $uid variable to contain the new
- // account's uid.
- DB_query("UPDATE {$_TABLES['users']} SET email = '$email', homepage = '$homepage', fullname = '$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.
- * 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;
-
- $var = "Value from custom table";
- $retval .= '<tr>
- <td align="right"><b>Custom Fields:</b></td>
- <td>' . $var .'</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 $_CONF, $_TABLES;
-
- $var = "Value from custom table";
- $cookietimeout = DB_getitem($_TABLES['users'], 'cookietimeout', $uid);
- $selection = '<select name="cooktime">' . LB;
- $selection .= COM_optionList ($_TABLES['cookiecodes'], 'cc_value,cc_descr', $cookietimeout, 0);
- $selection .= '</select>';
- $retval .= '<tr>
- <td align="right">Remember user for:</td>
- <td>' . $selection .'</td>
- </tr>';
- $retval .= '<tr>
- <td align="right"><b>Custom Fields:</b></td>
- <td><input type="text" name="custom1" size="50" value="' . $var .'"' . XHTML . '></td>
- </tr>';
- $retval .= '<tr><td colspan="2"><hr' . XHTML . '></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;
-
- $cooktime = 0;
- if (isset ($_POST['cooktime'])) {
- $cooktime = COM_applyFilter ($_POST['cooktime'], true);
- if ($cooktime < 0) {
- $cooktime = 0;
- }
-
- DB_query("UPDATE {$_TABLES['users']} SET cookietimeout = $cooktime 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 ($msg = '')
-{
- global $_CONF, $_TABLES, $LANG04;
-
- if (!empty ($msg) && ($msg != 'new')) {
- $retval .= COM_startBlock($LANG04[21]) . $msg . COM_endBlock();
- }
-
- $post_url = $_CONF['site_url'] . '/users.php';
- $postmode = 'create';
- $submitbutton = '<input type="submit" value="Register Now!"' . XHTML . '>';
- $message = "<blockquote style=\"padding-top:10px;\"><b>Please complete the application below. Once you have completed the application, click the Register Now! button and the application will be processed immediately.</b></blockquote>";
-
- $user_templates = new Template ($_CONF['path_layout'] . 'custom');
- $user_templates->set_file('memberdetail', 'memberdetail.thtml');
- $user_templates->set_var( 'xhtml', XHTML );
- $user_templates->set_var('site_url', $_CONF['site_url']);
- $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', $LANG04[2]);
- $user_templates->set_var('USERNAME_HELP', "Name to be used when accessing this site");
More information about the geeklog-cvs
mailing list