[geeklog-cvs] geeklog: Fixed line endings (DOS vs. Unix) - no change in content
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Jan 17 17:08:23 EST 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/c31a00d27f02
changeset: 6690:c31a00d27f02
user: Dirk Haun <dirk at haun-online.de>
date: Sat Jan 17 23:08:07 2009 +0100
description:
Fixed line endings (DOS vs. Unix) - no change in content
diffstat:
3 files changed, 3345 insertions(+), 3345 deletions(-)
public_html/users.php | 2528 +++++++++++++++++-----------------
public_html/usersettings.php | 3110 +++++++++++++++++++++---------------------
system/lib-custom.php | 1052 +++++++-------
diffs (truncated from 6702 to 300 lines):
diff -r 7e5123157b92 -r c31a00d27f02 public_html/users.php
--- a/public_html/users.php Sat Jan 17 16:51:25 2009 -0500
+++ b/public_html/users.php Sat Jan 17 23:08:07 2009 +0100
@@ -1,1264 +1,1264 @@
-<?php
-
-/* Reminder: always indent with 4 spaces (no tabs). */
-// +---------------------------------------------------------------------------+
-// | Geeklog 1.6 |
-// +---------------------------------------------------------------------------+
-// | users.php |
-// | |
-// | User authentication module. |
-// +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors: |
-// | |
-// | Authors: Tony Bibbs - tony AT tonybibbs DOT com |
-// | Mark Limburg - mlimburg AT users DOT sourceforge DOT net |
-// | Jason Whittenburg - jwhitten AT securitygeeks 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. |
-// | |
-// +---------------------------------------------------------------------------+
-
-/**
-* This file handles user authentication
-*
-* @author Tony Bibbs <tony at tonybibbs.com>
-* @author Mark Limburg <mlimburg at users.sourceforge.net>
-* @author Jason Whittenburg
-*
-*/
-
-/**
-* Geeklog common function library
-*/
-require_once 'lib-common.php';
-require_once $_CONF['path_system'] . 'lib-user.php';
-$VERBOSE = false;
-
-// Uncomment the line below if you need to debug the HTTP variables being passed
-// to the script. This will sometimes cause errors but it will allow you to see
-// the data being passed in a POST operation
-
-// echo COM_debug($_POST);
-
-/**
-* Shows a profile for a user
-*
-* This grabs the user profile for a given user and displays it
-*
-* @param int $user User ID of profile to get
-* @param int $msg Message to display (if != 0)
-* @param string $plugin optional plugin name for message
-* @return string HTML for user profile page
-*
-*/
-function userprofile($user, $msg = 0, $plugin = '')
-{
- global $_CONF, $_TABLES, $_USER, $LANG01, $LANG04, $LANG09, $LANG28, $LANG_LOGIN;
-
- $retval = '';
- if (empty ($_USER['username']) &&
- (($_CONF['loginrequired'] == 1) || ($_CONF['profileloginrequired'] == 1))) {
- $retval .= COM_siteHeader ('menu', $LANG_LOGIN[1]);
- $retval .= COM_startBlock ($LANG_LOGIN[1], '',
- COM_getBlockTemplate ('_msg_block', 'header'));
- $login = new Template($_CONF['path_layout'] . 'submit');
- $login->set_file (array ('login'=>'submitloginrequired.thtml'));
- $login->set_var ( 'xhtml', XHTML );
- $login->set_var ('login_message', $LANG_LOGIN[2]);
- $login->set_var ('site_url', $_CONF['site_url']);
- $login->set_var ('site_admin_url', $_CONF['site_admin_url']);
- $login->set_var ('layout_url', $_CONF['layout_url']);
- $login->set_var ('lang_login', $LANG_LOGIN[3]);
- $login->set_var ('lang_newuser', $LANG_LOGIN[4]);
- $login->parse ('output', 'login');
- $retval .= $login->finish ($login->get_var('output'));
- $retval .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
- $retval .= COM_siteFooter ();
-
- return $retval;
- }
-
- $result = DB_query ("SELECT {$_TABLES['users']}.uid,username,fullname,regdate,homepage,about,location,pgpkey,photo,email,status FROM {$_TABLES['userinfo']},{$_TABLES['users']} WHERE {$_TABLES['userinfo']}.uid = {$_TABLES['users']}.uid AND {$_TABLES['users']}.uid = $user");
- $nrows = DB_numRows ($result);
- if ($nrows == 0) { // no such user
- return COM_refresh ($_CONF['site_url'] . '/index.php');
- }
- $A = DB_fetchArray ($result);
-
- if ($A['status'] == USER_ACCOUNT_DISABLED && !SEC_hasRights ('user.edit')) {
- COM_displayMessageAndAbort (30, '', 403, 'Forbidden');
- }
-
- $display_name = htmlspecialchars(COM_getDisplayName($user, $A['username'],
- $A['fullname']));
-
- $retval .= COM_siteHeader ('menu', $LANG04[1] . ' ' . $display_name);
- if ($msg > 0) {
- $retval .= COM_showMessage($msg, $plugin);
- }
-
- // format date/time to user preference
- $curtime = COM_getUserDateTimeFormat ($A['regdate']);
- $A['regdate'] = $curtime[0];
-
- $user_templates = new Template ($_CONF['path_layout'] . 'users');
- $user_templates->set_file (array ('profile' => 'profile.thtml',
- 'row' => 'commentrow.thtml',
- 'strow' => 'storyrow.thtml'));
- $user_templates->set_var ('xhtml', XHTML);
- $user_templates->set_var ('site_url', $_CONF['site_url']);
- $user_templates->set_var ('start_block_userprofile',
- COM_startBlock ($LANG04[1] . ' ' . $display_name));
- $user_templates->set_var ('end_block', COM_endBlock ());
- $user_templates->set_var ('lang_username', $LANG04[2]);
-
- if ($_CONF['show_fullname'] == 1) {
- if (empty ($A['fullname'])) {
- $username = $A['username'];
- $fullname = '';
- } else {
- $username = $A['fullname'];
- $fullname = $A['username'];
- }
- } else {
- $username = $A['username'];
- $fullname = $A['fullname'];
- }
- $username = htmlspecialchars($username);
- $fullname = htmlspecialchars($fullname);
-
- if ($A['status'] == USER_ACCOUNT_DISABLED) {
- $username = sprintf ('<s title="%s">%s</s>', $LANG28[42], $username);
- if (!empty ($fullname)) {
- $fullname = sprintf ('<s title="%s">%s</s>', $LANG28[42], $fullname);
- }
- }
-
- $user_templates->set_var ('username', $username);
- $user_templates->set_var ('user_fullname', $fullname);
-
- if (SEC_hasRights ('user.edit')) {
- global $_IMAGE_TYPE, $LANG_ADMIN;
-
- $edit_icon = '<img src="' . $_CONF['layout_url'] . '/images/edit.'
- . $_IMAGE_TYPE . '" alt="' . $LANG_ADMIN['edit']
- . '" title="' . $LANG_ADMIN['edit'] . '"' . XHTML . '>';
- $edit_link_url = COM_createLink($edit_icon,
- "{$_CONF['site_admin_url']}/user.php?mode=edit&uid={$A['uid']}");
- $user_templates->set_var ('edit_icon', $edit_icon);
- $user_templates->set_var ('edit_link', $edit_link_url);
- $user_templates->set_var ('user_edit', $edit_link_url);
- }
-
- if (isset ($A['photo']) && empty ($A['photo'])) {
- $A['photo'] = '(none)'; // user does not have a photo
- }
- $photo = USER_getPhoto ($user, $A['photo'], $A['email'], -1);
- $user_templates->set_var ('user_photo', $photo);
-
- $user_templates->set_var ('lang_membersince', $LANG04[67]);
- $user_templates->set_var ('user_regdate', $A['regdate']);
- $user_templates->set_var ('lang_email', $LANG04[5]);
- $user_templates->set_var ('user_id', $user);
- $user_templates->set_var ('lang_sendemail', $LANG04[81]);
- $user_templates->set_var ('lang_homepage', $LANG04[6]);
- $user_templates->set_var ('user_homepage', COM_killJS ($A['homepage']));
- $user_templates->set_var ('lang_location', $LANG04[106]);
- $user_templates->set_var ('user_location', strip_tags ($A['location']));
- $user_templates->set_var ('lang_bio', $LANG04[7]);
- $user_templates->set_var ('user_bio', nl2br (stripslashes ($A['about'])));
- $user_templates->set_var ('lang_pgpkey', $LANG04[8]);
- $user_templates->set_var ('user_pgp', nl2br ($A['pgpkey']));
- $user_templates->set_var ('start_block_last10stories',
- COM_startBlock ($LANG04[82] . ' ' . $display_name));
- $user_templates->set_var ('start_block_last10comments',
- COM_startBlock($LANG04[10] . ' ' . $display_name));
- $user_templates->set_var ('start_block_postingstats',
- COM_startBlock ($LANG04[83] . ' ' . $display_name));
- $user_templates->set_var ('lang_title', $LANG09[16]);
- $user_templates->set_var ('lang_date', $LANG09[17]);
-
- // for alternative layouts: use these as headlines instead of block titles
- $user_templates->set_var ('headline_last10stories', $LANG04[82]);
- $user_templates->set_var ('headline_last10comments', $LANG04[10]);
- $user_templates->set_var ('headline_postingstats', $LANG04[83]);
-
- $result = DB_query ("SELECT tid FROM {$_TABLES['topics']}"
- . COM_getPermSQL ());
- $nrows = DB_numRows ($result);
- $tids = array ();
- for ($i = 0; $i < $nrows; $i++) {
- $T = DB_fetchArray ($result);
- $tids[] = $T['tid'];
- }
- $topics = "'" . implode ("','", $tids) . "'";
-
- // list of last 10 stories by this user
- if (sizeof ($tids) > 0) {
- $sql = "SELECT sid,title,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} WHERE (uid = $user) AND (draft_flag = 0) AND (date <= NOW()) AND (tid IN ($topics))" . COM_getPermSQL ('AND');
- $sql .= " ORDER BY unixdate DESC LIMIT 10";
- $result = DB_query ($sql);
- $nrows = DB_numRows ($result);
- } else {
- $nrows = 0;
- }
- if ($nrows > 0) {
- for ($i = 0; $i < $nrows; $i++) {
- $C = DB_fetchArray ($result);
- $user_templates->set_var ('cssid', ($i % 2) + 1);
- $user_templates->set_var ('row_number', ($i + 1) . '.');
- $articleUrl = COM_buildUrl ($_CONF['site_url']
- . '/article.php?story=' . $C['sid']);
- $user_templates->set_var ('article_url', $articleUrl);
- $C['title'] = str_replace ('$', '$', $C['title']);
- $user_templates->set_var ('story_title',
- COM_createLink(
- stripslashes ($C['title']),
- $articleUrl,
- array ('class'=>'b'))
- );
- $storytime = COM_getUserDateTimeFormat ($C['unixdate']);
- $user_templates->set_var ('story_date', $storytime[0]);
- $user_templates->parse ('story_row', 'strow', true);
- }
- } else {
- $user_templates->set_var ('story_row',
- '<tr><td>' . $LANG01[37] . '</td></tr>');
- }
-
- // list of last 10 comments by this user
- $sidArray = array();
- if (sizeof ($tids) > 0) {
- // first, get a list of all stories the current visitor has access to
- $sql = "SELECT sid FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW()) AND (tid IN ($topics))" . COM_getPermSQL ('AND');
- $result = DB_query($sql);
- $numsids = DB_numRows($result);
- for ($i = 1; $i <= $numsids; $i++) {
- $S = DB_fetchArray ($result);
- $sidArray[] = $S['sid'];
- }
- }
-
- $sidList = implode("', '",$sidArray);
- $sidList = "'$sidList'";
-
- // then, find all comments by the user in those stories
- $sql = "SELECT sid,title,cid,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['comments']} WHERE (uid = $user) GROUP BY sid,title,cid,UNIX_TIMESTAMP(date)";
-
- // SQL NOTE: Using a HAVING clause is usually faster than a where if the
- // field is part of the select
- // if (!empty ($sidList)) {
- // $sql .= " AND (sid in ($sidList))";
- // }
- if (!empty ($sidList)) {
- $sql .= " HAVING sid in ($sidList)";
- }
- $sql .= " ORDER BY unixdate DESC LIMIT 10";
-
- $result = DB_query($sql);
- $nrows = DB_numRows($result);
- if ($nrows > 0) {
- for ($i = 0; $i < $nrows; $i++) {
- $C = DB_fetchArray ($result);
- $user_templates->set_var ('cssid', ($i % 2) + 1);
- $user_templates->set_var ('row_number', ($i + 1) . '.');
- $C['title'] = str_replace ('$', '$', $C['title']);
- $comment_url = $_CONF['site_url'] .
- '/comment.php?mode=view&cid=' . $C['cid'];
- $user_templates->set_var ('comment_title',
- COM_createLink(
- stripslashes ($C['title']),
- $comment_url,
- array ('class'=>'b'))
- );
- $commenttime = COM_getUserDateTimeFormat ($C['unixdate']);
- $user_templates->set_var ('comment_date', $commenttime[0]);
- $user_templates->parse ('comment_row', 'row', true);
- }
- } else {
- $user_templates->set_var('comment_row','<tr><td>' . $LANG01[29] . '</td></tr>');
- }
-
- // posting stats for this user
More information about the geeklog-cvs
mailing list