ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $post)
 Replace passwort from post 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 37 of file class.ilPlainTextHandler.php.

37 {
38 return $this->pageHeader()
39 .$this->exceptionContent()
40 .$this->tablesContent()
41 ;
42 }
pageHeader()
Get the header for the page.

References pageHeader().

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 58 of file class.ilPlainTextHandler.php.

58 {
59 return Formatter::formatExceptionPlain($this->getInspector());
60 }

References Whoops\Handler\Handler\getInspector().

+ Here is the call graph for this function:

◆ handle()

ilPlainTextHandler::handle ( )

Last missing method from HandlerInterface.

Returns
null

Implements Whoops\Handler\HandlerInterface.

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

25 {
26 header("Content-Type: text/plain");
27 echo "<pre>\n";
28 echo $this->content();
29 echo "</pre>\n";
30 }
content()
Assemble the output for this handler.

References content().

+ Here is the call graph for this function:

◆ hidePassword()

ilPlainTextHandler::hidePassword ( array  $post)
private

Replace passwort from post array with security message.

Parameters
array$post
Returns
array

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

127 {
128 if(isset($post["password"])) {
129 $post["password"] = "REMOVED FOR SECURITY";
130 }
131
132 return $post;
133 }

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 49 of file class.ilPlainTextHandler.php.

49 {
50 return "";
51 }

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 142 of file class.ilPlainTextHandler.php.

142 {
143 $cookie_content = $server["HTTP_COOKIE"];
144 $cookie_content = explode(";", $cookie_content);
145
146 foreach ($cookie_content as $key => $content) {
147 $content_array = explode("=", $content);
148 if(trim($content_array[0]) == session_name()) {
149 $content_array[1] = substr($content_array[1], 0, 5)." (SHORTENED FOR SECURITY)";
150 $cookie_content[$key] = implode("=", $content_array);
151 }
152 }
153
154 $server["HTTP_COOKIE"] = implode(";", $cookie_content);
155
156 return $server;
157 }
$server

References $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 102 of file class.ilPlainTextHandler.php.

102 {
103 $post = $_POST;
105
106 $post = $this->hidePassword($post);
108
109 return array
110 ( "GET Data" => $_GET
111 , "POST Data" => $post
112 , "Files" => $_FILES
113 , "Cookies" => $_COOKIE
114 , "Session" => isset($_SESSION) ? $_SESSION : array()
115 , "Server/Request Data" => $server
116 , "Environment Variables" => $_ENV
117 );
118 }
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
hidePassword(array $post)
Replace passwort from post array with security message.
shortenPHPSessionId(array $server)
Shorts the php session id.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_COOKIE, $_GET, $_POST, $_SERVER, $_SESSION, $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 67 of file class.ilPlainTextHandler.php.

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

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

+ Here is the call graph for this function:

Field Documentation

◆ KEY_SPACE

const ilPlainTextHandler::KEY_SPACE = 25

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


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