ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPlainTextHandler Class Reference
+ Inheritance diagram for ilPlainTextHandler:
+ Collaboration diagram for ilPlainTextHandler:

Public Member Functions

 handle ()
 Last missing method from HandlerInterface. More...
 
- Public Member Functions inherited from Whoops\Handler\Handler
 setRun (RunInterface $run)
 
 setInspector (Inspector $inspector)
 
 setException ($exception)
 

Data Fields

const KEY_SPACE = 25
 
- Data Fields inherited from Whoops\Handler\Handler
const DONE = 0x10
 
const LAST_HANDLER = 0x20
 The Handler has handled the Throwable in some way, and wishes to skip any other Handler. More...
 
const QUIT = 0x30
 The Handler has handled the Throwable in some way, and wishes to quit/stop execution. More...
 

Protected Member Functions

 content ()
 Assemble the output for this handler. More...
 
 pageHeader ()
 Get the header for the page. More...
 
 exceptionContent ()
 Get a short info about the exception. More...
 
 tablesContent ()
 Get the header for the page. More...
 
 tables ()
 Get the tables that should be rendered. More...
 
- Protected Member Functions inherited from Whoops\Handler\Handler
 getRun ()
 
 getInspector ()
 
 getException ()
 

Private Member Functions

 hidePassword (array $superGlobal)
 Replace password from super global array with security message. More...
 
 shortenPHPSessionId (array $server)
 Shorts the php session id. More...
 

Detailed Description

Definition at line 17 of file class.ilPlainTextHandler.php.

Member Function Documentation

◆ content()

ilPlainTextHandler::content ( )
protected

Assemble the output for this handler.

Returns
string

Definition at line 39 of file class.ilPlainTextHandler.php.

References exceptionContent(), pageHeader(), and tablesContent().

Referenced by handle().

40  {
41  return $this->pageHeader()
42  . $this->exceptionContent()
43  . $this->tablesContent()
44  ;
45  }
tablesContent()
Get the header for the page.
exceptionContent()
Get a short info about the exception.
pageHeader()
Get the header for the page.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exceptionContent()

ilPlainTextHandler::exceptionContent ( )
protected

Get a short info about the exception.

Returns
string

Definition at line 62 of file class.ilPlainTextHandler.php.

References Whoops\Handler\Handler\getInspector().

Referenced by content().

63  {
64  return Formatter::formatExceptionPlain($this->getInspector());
65  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handle()

ilPlainTextHandler::handle ( )

Last missing method from HandlerInterface.

Returns
null

Implements Whoops\Handler\HandlerInterface.

Definition at line 26 of file class.ilPlainTextHandler.php.

References content().

27  {
28  header("Content-Type: text/plain");
29  echo "<pre>\n";
30  echo $this->content();
31  echo "</pre>\n";
32  }
content()
Assemble the output for this handler.
+ Here is the call graph for this function:

◆ hidePassword()

ilPlainTextHandler::hidePassword ( array  $superGlobal)
private

Replace password from super global array with security message.

Parameters
array$superGlobal
Returns
array

Definition at line 132 of file class.ilPlainTextHandler.php.

Referenced by tables().

132  : array
133  {
134  if (isset($superGlobal["password"])) {
135  $superGlobal["password"] = "REMOVED FOR SECURITY";
136  }
137 
138  if (isset($superGlobal["post_vars"]) && isset($superGlobal["post_vars"]["password"])) {
139  $superGlobal["post_vars"]["password"] = "REMOVED FOR SECURITY";
140  }
141 
142  return $superGlobal;
143  }
+ Here is the caller graph for this function:

◆ pageHeader()

ilPlainTextHandler::pageHeader ( )
protected

Get the header for the page.

Returns
string

Definition at line 52 of file class.ilPlainTextHandler.php.

Referenced by content().

53  {
54  return "";
55  }
+ Here is the caller graph for this function:

◆ shortenPHPSessionId()

ilPlainTextHandler::shortenPHPSessionId ( array  $server)
private

Shorts the php session id.

Parameters
array$server
Returns
array

Definition at line 152 of file class.ilPlainTextHandler.php.

References $key, and $server.

Referenced by tables().

153  {
154  $cookie_content = $server["HTTP_COOKIE"];
155  $cookie_content = explode(";", $cookie_content);
156 
157  foreach ($cookie_content as $key => $content) {
158  $content_array = explode("=", $content);
159  if (trim($content_array[0]) == session_name()) {
160  $content_array[1] = substr($content_array[1], 0, 5) . " (SHORTENED FOR SECURITY)";
161  $cookie_content[$key] = implode("=", $content_array);
162  }
163  }
164 
165  $server["HTTP_COOKIE"] = implode(";", $cookie_content);
166 
167  return $server;
168  }
$server
Definition: sabredav.php:48
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ tables()

ilPlainTextHandler::tables ( )
protected

Get the tables that should be rendered.

Returns
array $title => $table

Definition at line 107 of file class.ilPlainTextHandler.php.

References $_COOKIE, $_GET, $_POST, $_SERVER, $_SESSION, $post, $server, hidePassword(), and shortenPHPSessionId().

Referenced by tablesContent().

108  {
109  $post = $_POST;
110  $server = $_SERVER;
111 
112  $post = $this->hidePassword($post);
113  $server = $this->hidePassword($server);
115 
116  return array( "GET Data" => $_GET
117  , "POST Data" => $post
118  , "Files" => $_FILES
119  , "Cookies" => $_COOKIE
120  , "Session" => isset($_SESSION) ? $_SESSION : array()
121  , "Server/Request Data" => $server
122  , "Environment Variables" => $_ENV
123  );
124  }
$_COOKIE['client_id']
Definition: server.php:9
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$_SESSION["AccountId"]
$_GET["client_id"]
shortenPHPSessionId(array $server)
Shorts the php session id.
hidePassword(array $superGlobal)
Replace password from super global array with security message.
$server
Definition: sabredav.php:48
$post
Definition: post.php:34
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tablesContent()

ilPlainTextHandler::tablesContent ( )
protected

Get the header for the page.

Returns
string

Definition at line 72 of file class.ilPlainTextHandler.php.

References $key, $ret, $title, and tables().

Referenced by content().

73  {
74  $ret = "";
75  foreach ($this->tables() as $title => $content) {
76  $ret .= "\n\n-- $title --\n\n";
77  if (count($content) > 0) {
78  foreach ($content as $key => $value) {
79  $key = str_pad($key, self::KEY_SPACE);
80 
81  // indent multiline values, first print_r, split in lines,
82  // indent all but first line, then implode again.
83  $first = true;
84  $indentation = str_pad("", self::KEY_SPACE);
85  $value = implode("\n", array_map(function ($line) use (&$first, $indentation) {
86  if ($first) {
87  $first = false;
88  return $line;
89  }
90  return $indentation . $line;
91  }, explode("\n", print_r($value, true))));
92 
93  $ret .= "$key: $value\n";
94  }
95  } else {
96  $ret .= "empty\n";
97  }
98  }
99  return $ret;
100  }
tables()
Get the tables that should be rendered.
$ret
Definition: parser.php:6
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ KEY_SPACE

const ilPlainTextHandler::KEY_SPACE = 25

Definition at line 19 of file class.ilPlainTextHandler.php.


The documentation for this class was generated from the following file: