示例#1
0
    # Therefore we must extract the correct version ourselves
    # Upstream bug report: http://phplens.com/lens/lensforum/msgs.php?id=18320
    if (preg_match('/^[Vv]([0-9\\.]+)/', $ADODB_vers, $t_matches) == 1) {
        $t_adodb_version_check_ok = version_compare($t_matches[1], '5.10', '>=');
    }
}
print_test_warn_row('Checking adodb version...', $t_adodb_version_check_ok, $ADODB_vers);
print_test_row('Checking using bundled adodb with some drivers...', !(db_is_pgsql() || db_is_mssql() || db_is_db2()) || strstr($ADODB_vers, 'MantisBT Version') !== false);
$t_serverinfo = $g_db->ServerInfo();
print_info_row('Database Type (adodb)', $g_db->databaseType);
print_info_row('Database Provider (adodb)', $g_db->dataProvider);
print_info_row('Database Server Description (adodb)', $t_serverinfo['description']);
print_info_row('Database Server Description (version)', $t_serverinfo['version']);
print_test_row('Checking to see if your absolute_path config option has a trailing slash: "' . config_get_global('absolute_path') . '"', "\\" == substr(config_get_global('absolute_path'), -1, 1) || "/" == substr(config_get_global('absolute_path'), -1, 1));
// Windows-only checks
if (is_windows_server()) {
    print_test_row('validate_email (if ON) requires php 5.3 on windows...', OFF == config_get_global('validate_email') || ON == config_get_global('validate_email') && version_compare(phpversion(), '5.3.0', '>='));
    print_test_row('check_mx_record (if ON) requires php 5.3 on windows...', OFF == config_get_global('check_mx_record') || ON == config_get_global('check_mx_record') && version_compare(phpversion(), '5.3.0', '>='));
}
$t_vars = array('magic_quotes_gpc', 'include_path');
while (list($t_foo, $t_var) = each($t_vars)) {
    print_info_row($t_var, ini_get($t_var));
}
if (db_is_mssql()) {
    if ('mssql' == config_get_global('db_type')) {
        print_test_warn_row('Checking PHP support for Microsoft SQL Server driver', version_compare(phpversion(), '5.3') < 0, "'mssql' driver is no longer supported in PHP >= 5.3, please use 'mssqlnative' instead");
    }
    if (print_test_row('check mssql textsize in php.ini...', ini_get('mssql.textsize') != 4096, ini_get('mssql.textsize'))) {
        print_test_warn_row('check mssql textsize in php.ini...', ini_get('mssql.textsize') == 2147483647, ini_get('mssql.textsize'));
    }
    if (print_test_row('check mssql textsize in php.ini...', ini_get('mssql.textlimit') != 4096, ini_get('mssql.textlimit'))) {
示例#2
0
/**
 * return string of system font path
 * @access public
 * @return string representing system path to font location
 */
function get_font_path()
{
    $t_font_path = config_get_global('system_font_folder');
    if ($t_font_path == '') {
        if (is_windows_server()) {
            $t_system_root = $_SERVER['SystemRoot'];
            if (empty($t_system_root)) {
                return '';
            } else {
                $t_font_path = $t_system_root . '/fonts/';
            }
        } else {
            if (file_exists('/usr/share/fonts/corefonts/')) {
                $t_font_path = '/usr/share/fonts/corefonts/';
            } else {
                if (file_exists('/usr/share/fonts/truetype/msttcorefonts/')) {
                    $t_font_path = '/usr/share/fonts/truetype/msttcorefonts/';
                } else {
                    if (file_exists('/usr/share/fonts/msttcorefonts/')) {
                        $t_font_path = '/usr/share/fonts/msttcorefonts/';
                    } else {
                        $t_font_path = '/usr/share/fonts/truetype/';
                    }
                }
            }
        }
    }
    return $t_font_path;
}
示例#3
0
 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
 * @copyright Copyright (C) 2002 - 2010  MantisBT Team - mantisbt-dev@lists.sourceforge.net
 * @link http://www.mantisbt.org
 *
 * @uses check_api.php
 * @uses config_api.php
 * @uses utility_api.php
 */
if (!defined('CHECK_EMAIL_INC_ALLOW')) {
    return;
}
/**
 * MantisBT Check API
 */
require_once 'check_api.php';
require_api('config_api.php');
require_api('utility_api.php');
check_print_section_header_row('Email');
$t_email_options = array('webmaster_email', 'from_email', 'return_path_email');
foreach ($t_email_options as $t_email_option) {
    $t_email = config_get_global($t_email_option);
    check_print_test_row($t_email_option . ' configuration option has a valid email address specified', !preg_match('/@example\\.com$/', $t_email), array(false => 'You need to specify a valid email address for the ' . $t_email_option . ' configuration option.'));
}
check_print_test_warn_row('Email addresses are validated', config_get_global('validate_email'), array(false => 'You have disabled email validation checks. For security reasons it is suggested that you enable these validation checks.'));
if (is_windows_server() && config_get_global('validate_email') && !config_get_global('use_ldap_email')) {
    check_print_test_row('Require at least PHP 5.3.0 if the server type is Windows and the check_mx_record configuration option is enabled', config_get_global('check_mx_record') && version_compare(phpversion(), '5.3.0', '>='), array(false => 'Versions of PHP prior to 5.3.0 are unable to check MX records when validating email addresses.'));
}
check_print_test_row('send_reset_password = ON requires allow_blank_email = OFF', !config_get_global('send_reset_password') || !config_get_global('allow_blank_email'));
check_print_test_row('send_reset_password = ON requires enable_email_notification = ON', !config_get_global('send_reset_password') || config_get_global('enable_email_notification'));
check_print_test_row('allow_signup = ON requires enable_email_notification = ON', !config_get_global('allow_signup') || config_get_global('enable_email_notification'));
check_print_test_row('allow_signup = ON requires send_reset_password = ON', !config_get_global('allow_signup') || config_get_global('send_reset_password'));
示例#4
0
/**
 * Generate a nonce encoded using the base64 with URI safe alphabet approach
 * described in RFC4648. Note that the minimum length is rounded up to the next
 * number with a factor of 4 so that padding is never added to the end of the
 * base64 output. This means the '=' padding character is never present in the
 * output. Due to the reduced character set of base64 encoding, the actual
 * amount of entropy produced by this function for a given output string length
 * is 3/4 (0.75) that of raw unencoded output produced with the
 * crypto_generate_strong_random_string( $p_bytes ) function.
 * @param integer $p_minimum_length Minimum number of characters required for the nonce.
 * @return string Nonce encoded according to the base64 with URI safe alphabet approach described in RFC4648
 */
function crypto_generate_uri_safe_nonce($p_minimum_length)
{
    $t_length_mod4 = $p_minimum_length % 4;
    $t_adjusted_length = $p_minimum_length + 4 - ($t_length_mod4 ? $t_length_mod4 : 4);
    $t_raw_bytes_required = $t_adjusted_length / 4 * 3;
    if (!is_windows_server()) {
        $t_random_bytes = crypto_generate_strong_random_string($t_raw_bytes_required);
    } else {
        # It's currently not possible to generate strong random numbers
        # with PHP on Windows so we have to resort to using PHP's
        # built-in insecure PRNG.
        $t_random_bytes = crypto_generate_random_string($t_raw_bytes_required, false);
    }
    $t_base64_encoded = base64_encode($t_random_bytes);
    # Note: no need to translate trailing = padding characters because our
    # length rounding ensures that padding is never required.
    $t_random_nonce = strtr($t_base64_encoded, '+/', '-_');
    return $t_random_nonce;
}
 /**
  * Outputs a graph image or map in the specified format.
  * @param string $p_format
  * @param bool $p_headers
  * @return null
  */
 function output($p_format = 'dot', $p_headers = false)
 {
     # Check if it is a recognized format.
     if (!isset($this->formats[$p_format])) {
         trigger_error(ERROR_GENERIC, ERROR);
     }
     $t_binary = $this->formats[$p_format]['binary'];
     $t_type = $this->formats[$p_format]['type'];
     $t_mime = $this->formats[$p_format]['mime'];
     # Send Content-Type header, if requested.
     if ($p_headers) {
         header('Content-Type: ' . $t_mime);
     }
     # Retrieve the source dot document into a buffer
     ob_start();
     $this->generate();
     $t_dot_source = ob_get_contents();
     ob_end_clean();
     # There are three different ways to generate the output depending
     # on the operating system and PHP version.
     if (is_windows_server()) {
         # If we are under Windows, we use the COM interface provided
         # by WinGraphviz. Thanks Paul!
         # Issue #4625: Work around WinGraphviz bug that fails with
         # graphs with zero or one node. It is probably too much to
         # generate a graphic output just to explain it to the user,
         # so we just return a null content.
         if (count($this->nodes) <= 1) {
             return;
         }
         $t_graphviz = new COM($this->graphviz_com_module);
         # Check if we managed to instantiate the COM object.
         if (is_null($t_graphviz)) {
             # We can't display any message or trigger an error on
             # failure, since we may have already sent a Content-type
             # header potentially incompatible with the any html output.
             return;
         }
         if ($t_binary) {
             # Image formats
             $t_dot_output = $t_graphviz->ToBinaryGraph($t_dot_source, $t_type);
             if ($p_headers) {
                 # Headers were requested, use another output buffer
                 # to retrieve the size for Content-Length.
                 ob_start();
                 echo base64_decode($t_dot_output->ToBase64String());
                 header('Content-Length: ' . ob_get_length());
                 ob_end_flush();
             } else {
                 # No need for headers, send output directly.
                 echo base64_decode($ret->ToBase64String());
             }
         } else {
             # Text formats
             $t_dot_output = $t_graphviz->ToTextGraph($t_dot_source, $t_type);
             if ($p_headers) {
                 header('Content-Length: ' . utf8_strlen($t_dot_output));
             }
             echo $t_dot_output;
         }
         unset($t_graphviz);
     } else {
         # If we are not under Windows, use proc_open,
         # since it avoids the need of temporary files.
         # Start dot process
         $t_command = $this->graphviz_tool . ' -T' . $p_format;
         $t_descriptors = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('file', 'php://stderr', 'w'));
         $t_pipes = array();
         $t_proccess = proc_open($t_command, $t_descriptors, $t_pipes);
         if (is_resource($t_proccess)) {
             # Filter generated output through dot
             fwrite($t_pipes[0], $t_dot_source);
             fclose($t_pipes[0]);
             if ($p_headers) {
                 # Headers were requested, use another output buffer to
                 # retrieve the size for Content-Length.
                 ob_start();
                 while (!feof($t_pipes[1])) {
                     echo fgets($t_pipes[1], 1024);
                 }
                 header('Content-Length: ' . ob_get_length());
                 ob_end_flush();
             } else {
                 # No need for headers, send output directly.
                 while (!feof($t_pipes[1])) {
                     print fgets($t_pipes[1], 1024);
                 }
             }
             fclose($t_pipes[1]);
             proc_close($t_proccess);
         }
     }
 }