FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
core-debug-user.php
1 <?php
2 /***********************************************************
3  Copyright (C) 2008-2013 Hewlett-Packard Development Company, L.P.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License
7  version 2 as published by the Free Software Foundation.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 ***********************************************************/
18 
19 define("TITLE_debug_user", _("Debug User"));
20 
25 class debug_user extends FO_Plugin
26 {
27  function __construct()
28  {
29  $this->Name = "debug_user";
30  $this->Title = TITLE_debug_user;
31  $this->MenuList = "Help::Debug::Debug User";
32  $this->DBaccess = PLUGIN_DB_ADMIN;
33  parent::__construct();
34  }
35 
40  public function Output()
41  {
42  $V = "";
43  global $PG_CONN;
44  $sql = "SELECT * FROM users WHERE user_pk = '" . @$_SESSION['UserId'] . "';";
45  $result = pg_query($PG_CONN, $sql);
46  DBCheckResult($result, $sql, __FILE__, __LINE__);
47  $R = pg_fetch_assoc($result);
48  pg_free_result($result);
49  $text = _("User Information");
50  $V .= "<H2>$text</H2>\n";
51  $V .= "<table border=1>\n";
52  $text = _("Field");
53  $text1 = _("Value");
54  $V .= "<tr><th>$text</th><th>$text1</th></tr>\n";
55  foreach($R as $Key => $Val)
56  {
57  if (empty($Key)) {
58  continue;
59  }
60  $V .= "<tr><td>" . htmlentities($Key) . "</td><td>" . htmlentities($Val) . "</td></tr>\n";
61  }
62  $V .= "</table>\n";
63 
64  return $V;
65  }
66 }
67 $NewPlugin = new debug_user;
68 $NewPlugin->Initialize();
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
Definition: libfossology.h:51
Plugin to print debug information about current user.
Output()
This function is called when user output is requested. This function is responsible for content...
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:67
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
Definition: common-db.php:198