FOSSology  4.4.0
Open Source License Compliance by Open Source Software
core-debug-user.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2008-2013 Hewlett-Packard Development Company, L.P.
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 define("TITLE_debug_user", _("Debug User"));
9 
14 class debug_user extends FO_Plugin
15 {
16  function __construct()
17  {
18  $this->Name = "debug_user";
19  $this->Title = TITLE_debug_user;
20  $this->MenuList = "Help::Debug::Debug User";
21  $this->DBaccess = PLUGIN_DB_ADMIN;
22  parent::__construct();
23  }
24 
29  public function Output()
30  {
31  $V = "";
32  global $PG_CONN;
33  $sql = "SELECT * FROM users WHERE user_pk = '" . @$_SESSION['UserId'] . "';";
34  $result = pg_query($PG_CONN, $sql);
35  DBCheckResult($result, $sql, __FILE__, __LINE__);
36  $R = pg_fetch_assoc($result);
37  pg_free_result($result);
38  $text = _("User Information");
39  $V .= "<H2>$text</H2>\n";
40  $V .= "<table border=1>\n";
41  $text = _("Field");
42  $text1 = _("Value");
43  $V .= "<tr><th>$text</th><th>$text1</th></tr>\n";
44  foreach($R as $Key => $Val)
45  {
46  if (empty($Key)) {
47  continue;
48  }
49  $V .= "<tr><td>" . htmlentities($Key) . "</td><td>" . htmlentities($Val) . "</td></tr>\n";
50  }
51  $V .= "</table>\n";
52 
53  return $V;
54  }
55 }
56 $NewPlugin = new debug_user;
57 $NewPlugin->Initialize();
This is the Plugin class. All plugins should:
Definition: FO_Plugin.php:57
Plugin to print debug information about current user.
Output()
This function is called when user output is requested. This function is responsible for content....
__construct()
base constructor. Most plugins will just use this
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
Definition: common-db.php:187
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
Definition: libfossology.h:39
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN