php_setup.inc 11.72 KiB
<?php
/*
  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
  Copyright (C) 2003-2010  Cajus Pollmeier
  Copyright (C) 2011-2018  FusionDirectory
  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
/*!
 * \file php_setup.inc
 * Source code for php_setup
require_once("variables.inc");
/*!
 * \brief Escape string for HTML output
function htmlescape ($str)
  return htmlspecialchars($str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
/*!
 * \brief Unescape string for HTML output, reverse of htmlescape
function htmlunescape ($html)
  return html_entity_decode($html, ENT_QUOTES | ENT_HTML5, 'UTF-8');
function html_trace ($errstr = "")
  static $hideArgs = [
    'ldap_init'         => [3],
    'ldap_login_user'   => [1],
    'change_password'   => [1],
    'cred_decrypt'      => [0,1],
    'LDAP/__construct'  => [1],
  if (!function_exists ('debug_backtrace')) {
    return  ['', ''];
  $trace = array_slice(debug_backtrace(), 1);
  $loc = '';
  if (isset($trace[0]['file'])) {
    $loc = ' - '._('File').': '.$trace[0]['file'];
    if (isset($trace[0]['line'])) {
      $loc .= ' ('._('Line').' '.$trace[0]['line'].')';
  $return_html    = '<table width="100%" style="background-color:#402005;color:white;border:2px solid red;border-spacing:0;border-collapse:collapse;">'.
                    '<tr><td colspan="3">'.
                    '<h1 style="color:white">'._('PHP error').' "'.$errstr.'"'.$loc.'</h1>'.
                    '</td></tr>';