Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
PHP
at commit ff8b4897
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879<?php
/** * @group console */final class DarkConsoleRequestPlugin extends DarkConsolePlugin {
public function getName() { return 'Request'; }
public function getDescription() { return 'Information about $_REQUEST and $_SERVER.'; }
public function generateData() { return array( 'Request' => $_REQUEST, 'Server' => $_SERVER, ); }
public function renderPanel() { $data = $this->getData();
$sections = array( 'Basics' => array( 'Machine' => php_uname('n'), ), );
// NOTE: This may not be present for some SAPIs, like php-fpm. if (!empty($data['Server']['SERVER_ADDR'])) { $addr = $data['Server']['SERVER_ADDR']; $sections['Basics']['Host'] = $addr; $sections['Basics']['Hostname'] = @gethostbyaddr($addr); }
$sections = array_merge($sections, $data);
$mask = array( 'HTTP_COOKIE' => true, 'HTTP_X_PHABRICATOR_CSRF' => true, );
$out = array(); foreach ($sections as $header => $map) { $rows = array(); foreach ($map as $key => $value) { if (isset($mask[$key])) { $rows[] = array( $key, phutil_tag('em', array(), '(Masked)')); } else { $rows[] = array( $key, (is_array($value) ? json_encode($value) : $value), ); } }
$table = new AphrontTableView($rows); $table->setHeaders( array( $header, null, )); $table->setColumnClasses( array( 'header', 'wide wrap', )); $out[] = $table->render(); }
return phutil_implode_html("\n", $out); }}