com web/master: detect if profiles are available: manage/users.php

From: Date: Mon, 26 Nov 2012 20:03:31 +0000
Subject: com web/master: detect if profiles are available: manage/users.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-15005@lists.php.net to get a copy of this message
Commit: 746e183aa267a331e5969486e6148385c9bedc59 Author: Peter Cowburn <petercowburn@gmail.com> Mon, 26 Nov 2012 20:03:27 +0000 Parents: 812ffee1f8d92da4c6dd84bc0ab518644ceaff90 Branches: master Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=746e183aa267a331e5969486e6148385c9bedc59 Log: detect if profiles are available This is only a temporary (ha!) measure to prevent the ugly error from borking the page. Changed paths: M manage/users.php Diff: diff --git a/manage/users.php b/manage/users.php index 4a20c52...32d2f5a 100644 --- a/manage/users.php +++ b/manage/users.php @@ -43,6 +43,8 @@ head("user administration"); db_connect(); +define('FEATURE_PROFILE_ENABLED', (bool) db_get_one('SELECT 1 FROM users_profile LIMIT 1')); + # ?username=whatever will look up 'whatever' by email or username if ($username && !$id) { $query = "SELECT userid FROM users" @@ -134,7 +136,9 @@ the ability to work with others. mail($userinfo['email'],"VCS Account Request: $userinfo[username]",$message,"From: PHP Group <group@php.net>", "-fnoreply@php.net"); mail($mailto . ($cc ? ",$cc" : ""),$userinfo['cvsaccess'] ? "VCS Account Deleted: $userinfo[username] deleted by $user" : "VCS Account Rejected: $userinfo[username] rejected by $user","Nuked $userinfo[username]","From: PHP Group <group@php.net>\nIn-Reply-To: <cvs-account-$id-admin@php.net>", "-fnoreply@php.net"); db_query("DELETE FROM users_note WHERE userid=$id"); - db_query("DELETE FROM users_profile WHERE userid=$id"); + if (FEATURE_PROFILE_ENABLED) { + db_query("DELETE FROM users_profile WHERE userid=$id"); + } if (!$noclose) { echo '<script language="javascript">window.close();</script>'; exit; @@ -204,7 +208,7 @@ if ($id && $in) { db_query($query); } - if(!empty($in['profile_markdown'])) { + if(FEATURE_PROFILE_ENABLED && !empty($in['profile_markdown'])) { $profile_markdown = $in['profile_markdown']; $profile_html = Markdown($profile_markdown); $profile_markdown = mysql_real_escape_string($profile_markdown); @@ -338,7 +342,7 @@ table.useredit tr { Multiple keys are allowed, separated using a newline.</p></td> </tr> <?php - if ($id) { + if (FEATURE_PROFILE_ENABLED && $id) { $res = db_query("SELECT markdown FROM users_profile WHERE userid=$id"); $row['profile_markdown'] = ''; if ($profile_row = mysql_fetch_assoc($res)) {

« previous php.webmaster (#15005) next »