当前位置: 首页>>代码示例>>PHP>>正文


PHP ini_get_bool函数代码示例

本文整理汇总了PHP中ini_get_bool函数的典型用法代码示例。如果您正苦于以下问题:PHP ini_get_bool函数的具体用法?PHP ini_get_bool怎么用?PHP ini_get_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ini_get_bool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: url_get

/**
 * Retrieve the contents of a remote URL.
 * First tries using built-in PHP modules (OpenSSL and cURL), then attempts 
 * system call as last resort.
 * @param string URL
 * @return null|string URL contents (NULL in case of errors)
 */
function url_get($p_url)
{
    # Generic PHP call
    if (ini_get_bool('allow_url_fopen')) {
        $t_data = @file_get_contents($p_url);
        if ($t_data !== false) {
            return $t_data;
        }
        # If the call failed (e.g. due to lack of https wrapper)
        # we fall through to attempt retrieving URL with another method
    }
    # Use the PHP cURL extension
    if (function_exists('curl_init')) {
        $t_curl = curl_init($p_url);
        curl_setopt($t_curl, CURLOPT_RETURNTRANSFER, true);
        # @todo It may be useful to provide users a way to define additional
        # custom options for curl module, e.g. proxy settings and authentication.
        # This could be stored in a global config option.
        $t_data = curl_exec($t_curl);
        curl_close($t_curl);
        if ($t_data !== false) {
            return $t_data;
        }
    }
    # Last resort system call
    $t_url = escapeshellarg($p_url);
    return shell_exec('curl ' . $t_url);
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:35,代码来源:url_api.php

示例2: url_get

/**
 * Retrieve the contents of a remote URL.
 * First tries using built-in PHP modules (OpenSSL and cURL), then attempts
 * system call as last resort.
 * @param string $p_url The URL to fetch.
 * @return null|string URL contents (NULL in case of errors)
 */
function url_get($p_url)
{
    # Generic PHP call
    if (ini_get_bool('allow_url_fopen')) {
        $t_data = @file_get_contents($p_url);
        if ($t_data !== false) {
            return $t_data;
        }
        # If the call failed (e.g. due to lack of https wrapper)
        # we fall through to attempt retrieving URL with another method
    }
    # Use the PHP cURL extension
    if (function_exists('curl_init')) {
        $t_curl = curl_init($p_url);
        # cURL options
        $t_curl_opt[CURLOPT_RETURNTRANSFER] = true;
        # @todo It may be useful to provide users a way to define additional
        # custom options for curl module, e.g. proxy settings and authentication.
        # This could be stored in a global config option.
        # Default User Agent (Mantis version + php curl extension version)
        $t_vers = curl_version();
        $t_curl_opt[CURLOPT_USERAGENT] = 'mantisbt/' . MANTIS_VERSION . ' php-curl/' . $t_vers['version'];
        # Set the options
        curl_setopt_array($t_curl, $t_curl_opt);
        # Retrieve data
        $t_data = curl_exec($t_curl);
        curl_close($t_curl);
        if ($t_data !== false) {
            return $t_data;
        }
    }
    # Last resort system call
    $t_url = escapeshellarg($p_url);
    return shell_exec('curl ' . $t_url);
}
开发者ID:gtn,项目名称:mantisbt,代码行数:42,代码来源:url_api.php

示例3: preInit

 public function preInit()
 {
     //! вызывается только для публичных страниц только если prolog.php подключался (нет, если prolog_before.php)
     if (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/html_pages/.enabled")) {
         define("BITRIX_STATIC_PAGES", true);
         require_once dirname(__FILE__) . "/../classes/general/cache_html.php";
         \CHTMLPagesCache::startCaching();
     }
     //!
     define("START_EXEC_PROLOG_BEFORE_1", microtime());
     $GLOBALS["BX_STATE"] = "PB";
     if (isset($_REQUEST["BX_STATE"])) {
         unset($_REQUEST["BX_STATE"]);
     }
     if (isset($_GET["BX_STATE"])) {
         unset($_GET["BX_STATE"]);
     }
     if (isset($_POST["BX_STATE"])) {
         unset($_POST["BX_STATE"]);
     }
     if (isset($_COOKIE["BX_STATE"])) {
         unset($_COOKIE["BX_STATE"]);
     }
     if (isset($_FILES["BX_STATE"])) {
         unset($_FILES["BX_STATE"]);
     }
     // вызывается только для админских страниц
     if (defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
         define("NEED_AUTH", true);
         if (isset($_REQUEST['bxpublic']) && $_REQUEST['bxpublic'] == 'Y' && !defined('BX_PUBLIC_MODE')) {
             define('BX_PUBLIC_MODE', 1);
         }
     }
     //
     // <start.php>
     if (!isset($USER)) {
         global $USER;
     }
     if (!isset($APPLICATION)) {
         global $APPLICATION;
     }
     if (!isset($DB)) {
         global $DB;
     }
     error_reporting(E_COMPILE_ERROR | E_ERROR | E_CORE_ERROR | E_PARSE);
     define("START_EXEC_TIME", microtime(true));
     define("B_PROLOG_INCLUDED", true);
     require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/version.php";
     require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/tools.php";
     if (version_compare(PHP_VERSION, "5.0.0") >= 0 && @ini_get_bool("register_long_arrays") != true) {
         $GLOBALS["HTTP_POST_FILES"] = $_FILES;
         $GLOBALS["HTTP_SERVER_VARS"] = $_SERVER;
         $GLOBALS["HTTP_GET_VARS"] = $_GET;
         $GLOBALS["HTTP_POST_VARS"] = $_POST;
         $GLOBALS["HTTP_COOKIE_VARS"] = $_COOKIE;
         $GLOBALS["HTTP_ENV_VARS"] = $_ENV;
     }
     UnQuoteAll();
     FormDecode();
 }
开发者ID:Satariall,项目名称:izurit,代码行数:60,代码来源:oldpage.php

示例4: addRawImage

 protected function addRawImage($m)
 {
     $url = $m[3];
     if (isset($this->addedImage[$url])) {
         return $m[0];
     }
     if (isset(self::$imageCache[$url])) {
         $data =& self::$imageCache[$url];
     } else {
         if (ini_get_bool('allow_url_fopen')) {
             $data = file_get_contents($url);
         } else {
             $data = new HTTP_Request($url);
             $data->sendRequest();
             $data = $data->getResponseBody();
         }
         self::$imageCache[$url] =& $data;
     }
     switch (strtolower($m[4])) {
         case 'png':
             $mime = 'image/png';
             break;
         case 'gif':
             $mime = 'image/gif';
             break;
         default:
             $mime = 'image/jpeg';
     }
     $this->addHtmlImage($data, $mime, $url, false);
     $this->addedImage[$url] = true;
     return $m[0];
 }
开发者ID:nicolas-grekas,项目名称:Patchwork,代码行数:32,代码来源:agent.php

示例5: php_check_register_globals

/**
 * This function will look for the risky PHP setting register_globals
 * in order to inform about. MDL-12914
 *
 * @param object $result the environment_results object to be modified
 * @return mixed null if the test is irrelevant or environment_results object with
 *               status set to true (test passed) or false (test failed)
 */
function php_check_register_globals($result)
{
    /// Check for register_globals. If enabled, security warning
    if (ini_get_bool('register_globals')) {
        $result->status = false;
    } else {
        $result = null;
    }
    return $result;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:18,代码来源:customcheckslib.php

示例6: compress_start_handler

/**
 * Start compression handler if required
 * @return void
 * @access public
 */
function compress_start_handler()
{
    if (compress_handler_is_enabled()) {
        # Before doing anything else, start output buffering so we don't prevent
        # headers from being sent if there's a blank line in an included file
        ob_start('compress_handler');
    } else {
        if (ini_get_bool('zlib.output_compression') == true) {
            if (defined('COMPRESSION_DISABLED')) {
                return;
            }
            ob_start();
        }
    }
}
开发者ID:pkdevboxy,项目名称:mantisbt,代码行数:20,代码来源:compress_api.php

示例7: url_get

/**
 * Retrieve the contents of a remote URL.
 * First tries using built-in PHP modules, then
 * attempts system calls as last resort.
 * @param string URL
 * @return string URL contents
 */
function url_get($p_url)
{
    # Generic PHP call
    if (ini_get_bool('allow_url_fopen')) {
        return @file_get_contents($p_url);
    }
    # Use the PHP cURL extension
    if (function_exists('curl_init')) {
        $t_curl = curl_init($p_url);
        curl_setopt($t_curl, CURLOPT_RETURNTRANSFER, true);
        $t_data = curl_exec($t_curl);
        curl_close($t_curl);
        return $t_data;
    }
    # Last resort system call
    $t_url = escapeshellarg($p_url);
    return shell_exec('curl ' . $t_url);
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:25,代码来源:url_api.php

示例8: report_security_check_globals

/**
 * Verifies register globals PHP setting.
 * @param bool $detailed
 * @return object result
 */
function report_security_check_globals($detailed = false)
{
    $result = new object();
    $result->issue = 'report_security_check_globals';
    $result->name = get_string('check_globals_name', 'report_security');
    $result->info = null;
    $result->details = null;
    $result->status = null;
    $result->link = null;
    if (ini_get_bool('register_globals')) {
        $result->status = REPORT_SECURITY_CRITICAL;
        $result->info = get_string('check_globals_error', 'report_security');
    } else {
        $result->status = REPORT_SECURITY_OK;
        $result->info = get_string('check_globals_ok', 'report_security');
    }
    if ($detailed) {
        $result->details = get_string('check_globals_details', 'report_security');
    }
    return $result;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:26,代码来源:lib.php

示例9: disable_output_buffering

/**
 * Try to disable all output buffering and purge
 * all headers.
 *
 * @access private to be called only from lib/setup.php !
 * @return void
 */
function disable_output_buffering()
{
    $olddebug = error_reporting(0);
    // disable compression, it would prevent closing of buffers
    if (ini_get_bool('zlib.output_compression')) {
        ini_set('zlib.output_compression', 'Off');
    }
    // try to flush everything all the time
    ob_implicit_flush(true);
    // close all buffers if possible and discard any existing output
    // this can actually work around some whitespace problems in config.php
    while (ob_get_level()) {
        if (!ob_end_clean()) {
            // prevent infinite loop when buffer can not be closed
            break;
        }
    }
    // disable any other output handlers
    ini_set('output_handler', '');
    error_reporting($olddebug);
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:28,代码来源:setuplib.php

示例10: debugging

/**
 * Standard Debugging Function
 *
 * Returns true if the current site debugging settings are equal or above specified level.
 * If passed a parameter it will emit a debugging notice similar to trigger_error(). The
 * routing of notices is controlled by $CFG->debugdisplay
 * eg use like this:
 *
 * 1)  debugging('a normal debug notice');
 * 2)  debugging('something really picky', DEBUG_ALL);
 * 3)  debugging('annoying debug message only for developers', DEBUG_DEVELOPER);
 * 4)  if (debugging()) { perform extra debugging operations (do not use print or echo) }
 *
 * In code blocks controlled by debugging() (such as example 4)
 * any output should be routed via debugging() itself, or the lower-level
 * trigger_error() or error_log(). Using echo or print will break XHTML
 * JS and HTTP headers.
 *
 * It is also possible to define NO_DEBUG_DISPLAY which redirects the message to error_log.
 *
 * @uses DEBUG_NORMAL
 * @param string $message a message to print
 * @param int $level the level at which this debugging statement should show
 * @param array $backtrace use different backtrace
 * @return bool
 */
function debugging($message = '', $level = DEBUG_NORMAL, $backtrace = null)
{
    global $CFG, $USER, $UNITTEST;
    $forcedebug = false;
    if (!empty($CFG->debugusers)) {
        $debugusers = explode(',', $CFG->debugusers);
        $forcedebug = in_array($USER->id, $debugusers);
    }
    if (!$forcedebug and empty($CFG->debug) || $CFG->debug < $level) {
        return false;
    }
    if (!isset($CFG->debugdisplay)) {
        $CFG->debugdisplay = ini_get_bool('display_errors');
    }
    if ($message) {
        if (!$backtrace) {
            $backtrace = debug_backtrace();
        }
        $from = format_backtrace($backtrace, CLI_SCRIPT);
        if (!empty($UNITTEST->running)) {
            // When the unit tests are running, any call to trigger_error
            // is intercepted by the test framework and reported as an exception.
            // Therefore, we cannot use trigger_error during unit tests.
            // At the same time I do not think we should just discard those messages,
            // so displaying them on-screen seems like the only option. (MDL-20398)
            echo '<div class="notifytiny">' . $message . $from . '</div>';
        } else {
            if (NO_DEBUG_DISPLAY) {
                // script does not want any errors or debugging in output,
                // we send the info to error log instead
                error_log('Debugging: ' . $message . $from);
            } else {
                if ($forcedebug or $CFG->debugdisplay) {
                    if (!defined('DEBUGGING_PRINTED')) {
                        define('DEBUGGING_PRINTED', 1);
                        // indicates we have printed something
                    }
                    if (CLI_SCRIPT) {
                        echo "++ {$message} ++\n{$from}";
                    } else {
                        echo '<div class="notifytiny">' . $message . $from . '</div>';
                    }
                } else {
                    trigger_error($message . $from, E_USER_NOTICE);
                }
            }
        }
    }
    return true;
}
开发者ID:hatone,项目名称:moodle,代码行数:76,代码来源:weblib.php

示例11: optional_param

$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
$showallplugins = optional_param('showallplugins', 0, PARAM_BOOL);
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
$fetchupdates = optional_param('fetchupdates', 0, PARAM_BOOL);
// Check some PHP server settings
$PAGE->set_url('/admin/index.php');
$PAGE->set_pagelayout('admin');
// Set a default pagelayout
$documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
if (ini_get_bool('session.auto_start')) {
    print_error('phpvaroff', 'debug', '', (object) array('name' => 'session.auto_start', 'link' => $documentationlink));
}
if (ini_get_bool('magic_quotes_runtime')) {
    print_error('phpvaroff', 'debug', '', (object) array('name' => 'magic_quotes_runtime', 'link' => $documentationlink));
}
if (!ini_get_bool('file_uploads')) {
    print_error('phpvaron', 'debug', '', (object) array('name' => 'file_uploads', 'link' => $documentationlink));
}
if (is_float_problem()) {
    print_error('phpfloatproblem', 'admin', '', $documentationlink);
}
// Set some necessary variables during set-up to avoid PHP warnings later on this page
if (!isset($CFG->release)) {
    $CFG->release = '';
}
if (!isset($CFG->version)) {
    $CFG->version = '';
}
$version = null;
$release = null;
require "{$CFG->dirroot}/version.php";
开发者ID:numbas,项目名称:moodle,代码行数:31,代码来源:index.php

示例12: print_test_row

if (!is_blank(config_get_global('default_timezone'))) {
    if (print_test_row('Checking if a timezone is set in config.inc.php....', !is_blank(config_get_global('default_timezone')), config_get_global('default_timezone'))) {
        print_test_row('Checking if timezone is valid from config.inc.php....', in_array(config_get_global('default_timezone'), timezone_identifiers_list()), config_get_global('default_timezone'));
    }
} else {
    if (print_test_row('Checking if timezone is set in php.ini....', ini_get('date.timezone') !== '')) {
        print_test_row('Checking if timezone is valid in php.ini....', in_array(ini_get('date.timezone'), timezone_identifiers_list()), ini_get('date.timezone'));
    }
}
test_database_utf8();
print_test_row('Checking Register Globals is set to off', !ini_get_bool('register_globals'));
print_test_row('Checking CRYPT_FULL_SALT is NOT logon method', !(CRYPT_FULL_SALT == config_get_global('login_method')));
print_test_warn_row('Warn if passwords are stored in PLAIN text', !(PLAIN == config_get_global('login_method')));
print_test_warn_row('Warn if CRYPT is used (not MD5) for passwords', !(CRYPT == config_get_global('login_method')));
if (config_get_global('allow_file_upload')) {
    print_test_row('Checking that fileuploads are allowed in php (enabled in mantis config)', ini_get_bool('file_uploads'));
    print_info_row('PHP variable "upload_max_filesize"', ini_get_number('upload_max_filesize'));
    print_info_row('PHP variable "post_max_size"', ini_get_number('post_max_size'));
    print_info_row('MantisBT variable "max_file_size"', config_get_global('max_file_size'));
    print_test_row('Checking MantisBT upload file size is less than php', config_get_global('max_file_size') <= ini_get_number('post_max_size') && config_get_global('max_file_size') <= ini_get_number('upload_max_filesize'));
    switch (config_get_global('file_upload_method')) {
        case DATABASE:
            print_info_row('There may also be settings in your web server and database that prevent you from  uploading files or limit the maximum file size.  See the documentation for those packages if you need more information.');
            if (500 < min(ini_get_number('upload_max_filesize'), ini_get_number('post_max_size'), config_get_global('max_file_size'))) {
                print_info_row('<span class="error">Your current settings will most likely need adjustments to the PHP max_execution_time or memory_limit settings, the MySQL max_allowed_packet setting, or equivalent.');
            }
            break;
        case DISK:
            $t_upload_path = config_get_global('absolute_path_default_upload_folder');
            print_test_row('Checking that absolute_path_default_upload_folder has a trailing directory separator: "' . $t_upload_path . '"', DIRECTORY_SEPARATOR == substr($t_upload_path, -1, 1));
            break;
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:31,代码来源:check.php

示例13: lang_fix_value_before_save

/**
 * Fix value of the translated string before it is saved into the file
 *
 * @uses $CFG
 * @param string $value Raw string to be saved into the lang pack
 * @return string Fixed value
 */
function lang_fix_value_before_save($value = '')
{
    global $CFG;
    if ($CFG->lang != "zh_hk" and $CFG->lang != "zh_tw") {
        // Some MB languages include backslash bytes
        $value = str_replace("\\", "", $value);
        // Delete all slashes
    }
    if (ini_get_bool('magic_quotes_sybase')) {
        // Unescape escaped sybase quotes
        $value = str_replace("''", "'", $value);
    }
    $value = str_replace("'", "\\'", $value);
    // Add slashes for '
    $value = str_replace('"', "\\\"", $value);
    // Add slashes for "
    $value = str_replace("%", "%%", $value);
    // Escape % characters
    $value = str_replace("\r", "", $value);
    // Remove linefeed characters
    $value = trim($value);
    // Delete leading/trailing white space
    return $value;
}
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:lang.php

示例14:

</tr>



<!-- Checking register_globals are off -->

<tr>

	<td bgcolor="#ffffff">

		Checking for register_globals are off for DILPS

	</td>

	<?php 
    if (!ini_get_bool('register_globals')) {
        print_test_result(GOOD);
    } else {
        print_test_result(BAD);
    }
    ?>

</tr>



<!-- Checking config file is writable -->

<tr>

	<td bgcolor="#ffffff">
开发者ID:BackupTheBerlios,项目名称:dilps,代码行数:31,代码来源:install.php

示例15: debugging

/**
 * Returns true if the current site debugging settings are equal or above specified level.
 * If passed a parameter it will emit a debugging notice similar to trigger_error(). The
 * routing of notices is controlled by $CFG->debugdisplay
 * eg use like this:
 *
 * 1)  debugging('a normal debug notice');
 * 2)  debugging('something really picky', DEBUG_ALL);
 * 3)  debugging('annoying debug message only for develpers', DEBUG_DEVELOPER);
 * 4)  if (debugging()) { perform extra debugging operations (do not use print or echo) }
 *
 * In code blocks controlled by debugging() (such as example 4)
 * any output should be routed via debugging() itself, or the lower-level
 * trigger_error() or error_log(). Using echo or print will break XHTML
 * JS and HTTP headers.
 *
 *
 * @param string $message a message to print
 * @param int $level the level at which this debugging statement should show
 * @return bool
 */
function debugging($message = '', $level = DEBUG_NORMAL)
{
    global $CFG;
    if (empty($CFG->debug)) {
        return false;
    }
    if ($CFG->debug >= $level) {
        if ($message) {
            $callers = debug_backtrace();
            $from = '<ul style="text-align: left">';
            foreach ($callers as $caller) {
                if (!isset($caller['line'])) {
                    $caller['line'] = '?';
                    // probably call_user_func()
                }
                if (!isset($caller['file'])) {
                    $caller['file'] = $CFG->dirroot . '/unknownfile';
                    // probably call_user_func()
                }
                $from .= '<li>line ' . $caller['line'] . ' of ' . substr($caller['file'], strlen($CFG->dirroot) + 1);
                if (isset($caller['function'])) {
                    $from .= ': call to ';
                    if (isset($caller['class'])) {
                        $from .= $caller['class'] . $caller['type'];
                    }
                    $from .= $caller['function'] . '()';
                }
                $from .= '</li>';
            }
            $from .= '</ul>';
            if (!isset($CFG->debugdisplay)) {
                $CFG->debugdisplay = ini_get_bool('display_errors');
            }
            if ($CFG->debugdisplay) {
                if (!defined('DEBUGGING_PRINTED')) {
                    define('DEBUGGING_PRINTED', 1);
                    // indicates we have printed something
                }
                notify($message . $from, 'notifytiny');
            } else {
                trigger_error($message . $from, E_USER_NOTICE);
            }
        }
        return true;
    }
    return false;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:68,代码来源:weblib.php


注:本文中的ini_get_bool函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。