ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPlainTextHandler Class Reference
+ Inheritance diagram for ilPlainTextHandler:
+ Collaboration diagram for ilPlainTextHandler:

Public Member Functions

 withExclusionList (array $exclusion_list)
 
 handle ()
 Last missing method from HandlerInterface. More...
 

Data Fields

const KEY_SPACE = 25
 

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

Private Member Functions

 hideSensitiveData (array $super_global)
 
 shortenPHPSessionId (array $server)
 Shorts the php session id. More...
 

Private Attributes

 $exclusion_list = []
 

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

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

Referenced by handle().

53  {
54  return $this->pageHeader()
55  . $this->exceptionContent()
56  . $this->tablesContent()
57  ;
58  }
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 75 of file class.ilPlainTextHandler.php.

Referenced by content().

76  {
77  return Formatter::formatExceptionPlain($this->getInspector());
78  }
+ Here is the caller graph for this function:

◆ handle()

ilPlainTextHandler::handle ( )

Last missing method from HandlerInterface.

Returns
null

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

References content().

40  {
41  header("Content-Type: text/plain");
42  echo "<pre>\n";
43  echo $this->content();
44  echo "</pre>\n";
45  }
content()
Assemble the output for this handler.
+ Here is the call graph for this function:

◆ hideSensitiveData()

ilPlainTextHandler::hideSensitiveData ( array  $super_global)
private
Parameters
array<string,mixed>$super_global
Returns
array<string, mixed>

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

Referenced by tables().

143  : array
144  {
145  foreach ($this->exclusion_list as $parameter) {
146  if (isset($super_global[$parameter])) {
147  $super_global[$parameter] = 'REMOVED FOR SECURITY';
148  }
149 
150  if (isset($super_global['post_vars'][$parameter])) {
151  $super_global['post_vars'][$parameter] = 'REMOVED FOR SECURITY';
152  }
153  }
154 
155  return $super_global;
156  }
+ Here is the caller graph for this function:

◆ pageHeader()

ilPlainTextHandler::pageHeader ( )
protected

Get the header for the page.

Returns
string

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

Referenced by content().

66  {
67  return "";
68  }
+ 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 165 of file class.ilPlainTextHandler.php.

References $server.

Referenced by tables().

166  {
167  $cookie_content = $server["HTTP_COOKIE"];
168  $cookie_content = explode(";", $cookie_content);
169 
170  foreach ($cookie_content as $key => $content) {
171  $content_array = explode("=", $content);
172  if (trim($content_array[0]) == session_name()) {
173  $content_array[1] = substr($content_array[1], 0, 5) . " (SHORTENED FOR SECURITY)";
174  $cookie_content[$key] = implode("=", $content_array);
175  }
176  }
177 
178  $server["HTTP_COOKIE"] = implode(";", $cookie_content);
179 
180  return $server;
181  }
$server
+ 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 120 of file class.ilPlainTextHandler.php.

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

Referenced by tablesContent().

121  {
122  $post = $_POST;
123  $server = $_SERVER;
124 
125  $post = $this->hideSensitiveData($post);
128 
129  return array( "GET Data" => $_GET
130  , "POST Data" => $post
131  , "Files" => $_FILES
132  , "Cookies" => $_COOKIE
133  , "Session" => isset($_SESSION) ? $_SESSION : array()
134  , "Server/Request Data" => $server
135  , "Environment Variables" => $_ENV
136  );
137  }
$_SESSION["AccountId"]
$_GET["client_id"]
shortenPHPSessionId(array $server)
Shorts the php session id.
hideSensitiveData(array $super_global)
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$server
$_COOKIE[session_name()]
Definition: xapitoken.php:37
$_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 85 of file class.ilPlainTextHandler.php.

References $ret, and tables().

Referenced by content().

86  {
87  $ret = "";
88  foreach ($this->tables() as $title => $content) {
89  $ret .= "\n\n-- $title --\n\n";
90  if (count($content) > 0) {
91  foreach ($content as $key => $value) {
92  $key = str_pad($key, self::KEY_SPACE);
93 
94  // indent multiline values, first print_r, split in lines,
95  // indent all but first line, then implode again.
96  $first = true;
97  $indentation = str_pad("", self::KEY_SPACE);
98  $value = implode("\n", array_map(function ($line) use (&$first, $indentation) {
99  if ($first) {
100  $first = false;
101  return $line;
102  }
103  return $indentation . $line;
104  }, explode("\n", print_r($value, true))));
105 
106  $ret .= "$key: $value\n";
107  }
108  } else {
109  $ret .= "empty\n";
110  }
111  }
112  return $ret;
113  }
tables()
Get the tables that should be rendered.
$ret
Definition: parser.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ withExclusionList()

ilPlainTextHandler::withExclusionList ( array  $exclusion_list)
Parameters
list<string>$exclusion_list

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

References $exclusion_list.

27  : self
28  {
29  $clone = clone $this;
30  $clone->exclusion_list = $exclusion_list;
31  return $clone;
32  }

Field Documentation

◆ $exclusion_list

ilPlainTextHandler::$exclusion_list = []
private

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

Referenced by withExclusionList().

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