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)
 
 handle ()
 
 setRun (RunInterface $run)
 
 setException ($exception)
 
 setInspector (Inspector $inspector)
 

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.

40 {
41 return $this->pageHeader()
42 . $this->exceptionContent()
43 . $this->tablesContent()
44 ;
45 }
pageHeader()
Get the header for the page.
tablesContent()
Get the header for the page.
exceptionContent()
Get a short info about the exception.

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

Referenced by handle().

+ 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.

63 {
64 return Formatter::formatExceptionPlain($this->getInspector());
65 }

References Whoops\Handler\Handler\getInspector().

Referenced by content().

+ 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.

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.

References content().

+ 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.

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 }

Referenced by tables().

+ Here is the caller graph for this function:

◆ pageHeader()

ilPlainTextHandler::pageHeader ( )
protected

Get the header for the page.

Returns
string

Reimplemented in ilTestingHandler.

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

53 {
54 return "";
55 }

Referenced by content().

+ 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.

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 }
$key
Definition: croninfo.php:18
$server
Definition: sabredav.php:48

References $key, and $server.

Referenced by tables().

+ 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.

108 {
109 $post = $_POST;
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
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
hidePassword(array $superGlobal)
Replace password from super global array with security message.
shortenPHPSessionId(array $server)
Shorts the php session id.
$post
Definition: post.php:34
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

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

Referenced by tablesContent().

+ 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.

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

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

Referenced by content().

+ 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: