com web/doc: User module removed: include/lib_auth.inc.ph p include/lib_general.inc.php scripts/setup_users _database.php sql/users.sql www/users.php

From: Date: Sun, 16 Mar 2014 18:31:33 +0000
Subject: com web/doc: User module removed: include/lib_auth.inc.ph p include/lib_general.inc.php scripts/setup_users _database.php sql/users.sql www/users.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-2308@lists.php.net to get a copy of this message
Commit: 2af64f28a0fc5329d528b6b1bde3e5866157b706 Author: Sobak <msobaczewski@gmail.com> Sun, 16 Mar 2014 16:02:34 +0100 Parents: 6a96934dcddf8d2616a12318486a19cadbaba514 Branches: master Link: http://git.php.net/?p=web/doc.git;a=commitdiff;h=2af64f28a0fc5329d528b6b1bde3e5866157b706 Log: User module removed Changed paths: M include/lib_auth.inc.php M include/lib_general.inc.php D scripts/setup_users_database.php D sql/users.sql D www/users.php Diff: diff --git a/include/lib_auth.inc.php b/include/lib_auth.inc.php index da5c33d..f3669b9 100644 --- a/include/lib_auth.inc.php +++ b/include/lib_auth.inc.php @@ -17,15 +17,10 @@ * | Nuno Lopes <nlopess@php.net> | * +----------------------------------------------------------------------+ * - * $Id$ */ require_once 'cvs-auth.inc'; -if (!$idx = sqlite_open(SQLITE_DIR . 'users.sqlite')) { - die ('auth DB not available'); -} - $user = null; // Register globals... //list of docweb admins that have 'special' rights @@ -69,24 +64,6 @@ function is_admin() return in_array($GLOBALS['user'], $GLOBALS['admins']); } - -/** - * read user info from the DB - */ -function user_info($u = false) -{ - global $idx, $user; - - $u = $u ? $u : $user; - $result = @sqlite_unbuffered_query($idx, "SELECT * FROM users WHERE username='" . sqlite_escape_string($u) . "'"); - if (!$result) { - return false; - } - - return sqlite_fetch_array($result, SQLITE_ASSOC); -} - - /** * returns the user's real name */ diff --git a/include/lib_general.inc.php b/include/lib_general.inc.php index 760b112..5e71f0a 100644 --- a/include/lib_general.inc.php +++ b/include/lib_general.inc.php @@ -180,14 +180,7 @@ function get_resource_url($url = '') // particular page the user is viewing currently function site_nav_provider() { - $links = array( - 'subsite-homepage' => BASE_URL .'/', -// 'request-for-comments' => BASE_URL .'/rfc/rfc-overview.php', - 'userlist' => BASE_URL .'/users.php', - ); -// if (strpos($_SERVER['REQUEST_URI'], 'rfc') !== false) { -// $links['submit-rfc'] = BASE_URL .'/rfc/rfc-proposal-edit.php'; -// } + $links['subsite-homepage'] = BASE_URL . '/'; if (in_array(SITE, array('gtk', 'pear', 'php'))) { $links['rev-check'] = BASE_URL .'/revcheck.php'; } diff --git a/scripts/setup_users_database.php b/scripts/setup_users_database.php deleted file mode 100755 index 4cbead5..0000000 --- a/scripts/setup_users_database.php +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/local/bin/php -<?php -/** - * +----------------------------------------------------------------------+ - * | PHP Documentation Site Source Code | - * +----------------------------------------------------------------------+ - * | Copyright (c) 1997-2011 The PHP Group | - * +----------------------------------------------------------------------+ - * | This source file is subject to version 3.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/3_0.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 | - * | license@php.net so we can mail you a copy immediately. | - * +----------------------------------------------------------------------+ - * | Authors: Jacques Marneweck <jacques@php.net> | - * +----------------------------------------------------------------------+ - * - * $Id$ - */ - -$PWD = dirname(__FILE__) .. "/"; -$idx = sqlite_open("$PWD../sqlite/users.sqlite", 0666); -if (!$idx) { - die("could not open $PWD../sqlite/users.sqlite"); -} -sqlite_query($idx, file_get_contents($PWD ."../sql/users.sql")); -sqlite_close($idx); - -/* vim: set noet ts=4 sw=4 ft=php: : */ diff --git a/sql/users.sql b/sql/users.sql deleted file mode 100755 index 91829c6..0000000 --- a/sql/users.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE auth ( - username TEXT PRIMARY KEY, - password TEXT, - time INT -); - -CREATE TABLE users ( - username TEXT PRIMARY KEY, - name TEXT, - country TEXT, - site TEXT, - wishlist TEXT -); diff --git a/www/users.php b/www/users.php deleted file mode 100644 index 5bf3ef0..0000000 --- a/www/users.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/* $Id$ */ - -include '../include/init.inc.php'; -require_once '../include/lib_auth.inc.php'; - -// show the users list -if (empty($userid)) { - $q = sqlite_query('SELECT * FROM users ORDER BY username', $idx); - $data = sqlite_fetch_all($q, SQLITE_ASSOC); - - echo site_header('docweb.common.header.users'); - echo DocWeb_Template::get('userlist.tpl.php'); - echo site_footer(); - exit; -} - - -if(!is_string($userid) || !ctype_alnum($userid)) { - echo site_header('docweb.common.header.users'); - echo '<h3>No such user found</h3>'; - echo site_footer(); - exit; -} - -if (!$info = user_info($userid)) { - $info[ 'name' ] = master_user_name($userid); - $info['username'] = $userid; - $info['country' ] = $info['site'] = $info['wishlist'] = ''; -} - -if (isset($_POST['editSubmit'])) { - -$sql = 'UPDATE users SET - name = "'.sqlite_escape_string(htmlspecialchars($_POST['name'])).'", - country = "'.sqlite_escape_string(htmlspecialchars($_POST['country'])).'", - site = "'.sqlite_escape_string(htmlspecialchars($_POST['site'])).'", - wishlist = "'.sqlite_escape_string(htmlspecialchars($_POST['wishlist'])).'" - WHERE username = "'.sqlite_escape_string($info['username']).'"'; -$result = sqlite_query($sql, $idx); -if (!$result) { - sqlite_error_string(sqlite_last_error($idx)); -} - - if (isset($_POST['deletephoto']) && $_POST['deletephoto'] == 'on') { - if (is_file($_SERVER['DOCUMENT_ROOT'] . '/images/users/' . $info['username'] . '.jpg')) { - unlink($_SERVER['DOCUMENT_ROOT'] . '/images/users/' . $info['username'] . '.jpg'); - } - } - - if (!empty($_FILES['photo']['name'])) { - // this will need some more security checks - $img = getimagesize($_FILES['photo']['tmp_name']); - if ($_FILES['photo']['size'] >= round((300 * 1024)) or !$img or $img[0] >= 500 or $img[1] >= 500 or $img['mime'] != 'image/jpeg') { - $pictureError = 'format'; - unlink($_FILES['photo']['tmp_name']); - } else { - move_uploaded_file($_FILES['photo']['tmp_name'], - $_SERVER['DOCUMENT_ROOT'].'/images/users/' .. $info['username'] . '.jpg'); - } - } -if (empty($pictureError)) { - $pictureError = 'succes'; -} -unset($info); -$info = user_info($userid); -} - -if (isset($doEdit)) { - auth(); - echo site_header('docweb.common.header.users.edit'); -} else { - echo site_header('docweb.common.header.users'); -} - echo DocWeb_Template::get('users.tpl.php'); - echo site_footer(); - -?>

« previous php.doc.web (#2308) next »