info.php

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 420 行 · 第 1/2 页

PHP
420
字号
<?php/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */// +----------------------------------------------------------------------+// | PHP version 4                                                        |// +----------------------------------------------------------------------+// | Copyright (c) 1997-2002 The PHP Group                                |// +----------------------------------------------------------------------+// | This source file is subject to version 2.0 of the PHP license,       |// | that is bundled with this package in the file LICENSE, and is        |// | available at through the world-wide-web at                           |// | http://www.php.net/license/2_02.txt.                                 |// | If you did not receive a copy of the PHP license and are unable to   |// | obtain it through the world-wide-web, please send a note to          |// | license@php.net so we can mail you a copy immediately.               |// +----------------------------------------------------------------------+// | Authors: Davey Shafik <davey@pixelated-dreams.com>                   |// +----------------------------------------------------------------------+//// $Id: Info.php,v 1.19 2005/01/03 17:33:43 davey Exp $require_once 'PEAR/Remote.php';require_once 'PEAR/Registry.php';/** * PEAR_Info generate phpinfo() style PEAR information */class PEAR_Info{    /**     * PEAR_Info Constructor     * @param pear_dir string[optional]     * @return bool     * @access public     */    function PEAR_Info($pear_dir = FALSE, $pear_user_config = FALSE)    {        if($pear_user_config === FALSE) {            $this->config = new PEAR_Config();        } else {           $this->config = new PEAR_Config($pear_user_config);        }        if ($pear_dir != FALSE) {            $this->config->set('php_dir',$pear_dir);        }        if (defined('PEAR_INFO_PROXY')) {            $this->config->set('http_proxy',PEAR_INFO_PROXY);        }        $this->r = new PEAR_Remote($this->config);        $this->reg = new PEAR_Registry($this->config->get('php_dir'));        // get PEARs packageInfo to show version number at the top of the HTML        $pear = $this->reg->packageInfo("PEAR");        $this->list_options = false;        if ($this->config->get('preferred_state') == 'stable') {            $this->list_options = true;        }        ob_start();        ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">    <head>        <title>PEAR :: PEAR_Info()</title>        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />        <style type="text/css">            body {background-color: #ffffff; color: #000000; white-space: normal;}            body, td, th, h1, h2 {font-family: sans-serif;}            a:link {color: #006600; text-decoration: none;}            a:visited { color: #003300; text-decoration: none;}            a:hover {text-decoration: underline;}            table {border-collapse: collapse; width: 600px; max-width: 600px; margin-left: auto; margin-right: auto; border: 0px; padding: 0px;}            td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;}            h1 {font-size: 150%; text-align: center;}            h2 {font-size: 125%; text-align: center;}            .p {text-align: left;}            .e {background-color: #006600; font-weight: bold; color: #FFFFFF; width: 100px;}            .e a:link { color: #FFFFFF; }            .e a:visited { color: #FFFFFF; }            .h {background-color: #339900; font-weight: bold;}            .v {background-color: #D9D9D9;}            img {float: right; border: 0px;}        </style>    </head>    <body>        <table>            <tr class="h">                <td>                    <a href="http://pear.php.net/"><img src="<?php echo $_SERVER['PHP_SELF'];?>?pear_image=true" alt="PEAR Logo" /></a><h1 class="p">PEAR <?php echo $pear['version']; ?></h1>                </td>            </tr>        </table>    <?php            if (!isset($_GET['credits'])) {                echo '<h1><a href="' .$_SERVER['PHP_SELF']. '?credits=true">PEAR Credits</a></h1>';                // Get packageInfo and Show the HTML for the Packages                $this->getConfig();                echo '<br />';                $this->getPackages();            } else {                $this->getCredits();            }        ?>    </body></html>        <?php        $this->info = ob_get_contents();        ob_end_clean();        /* With later versions of this where we properly implement the CLI such and stuff        this will return the actual status of whether or not creating the PEAR_Info object worked */        return true;    }    /**     * Set PEAR http_proxy for remote calls     * @param proxy string     * @return bool     * @access public     */    function setProxy($proxy)    {        define('PEAR_INFO_PROXY',$proxy);        return true;    }    /**     * Retrieve and format PEAR Packages info     * @return void     * @access private     */    function getPackages()    {        $latest = @$this->r->call('package.listLatestReleases');        $available = $this->reg->listPackages();        if (PEAR::isError($available)) {            echo '<h1 style="font-size: 12px;">An Error occured fetching the package list. Please try again.</h1>';            return FALSE;        }        if (!is_array($available)) {            echo '<h1 style="font-size: 12px;">The package list could not be fetched from the remote server. Please try again.</h1>';            return FALSE;        }        natcasesort($available);        if ((PEAR::isError($latest)) || (!is_array($latest))) {            $latest = FALSE;        }        $packages = '';        foreach ($available as $name) {            $installed = $this->reg->packageInfo($name);            if (strlen($installed['package']) > 1) {                if (!isset($old_index)) {                    $old_index = '';                }                $current_index = $name{0};                if (strtolower($current_index) != strtolower($old_index)) {                    $packages .= '<a name="' .$current_index. '"></a>';                    $old_index = $current_index;                    $this->index[] = $current_index;                }                $packages .= '        <h2><a name="pkg_' .trim($installed['package']). '">' .trim($installed['package']). '</a></h2>        <table>            <tr class="v">                <td class="e">                    Summary                </td>                <td>                    ' .nl2br(htmlentities(trim($installed['summary']))). '                </td>            </tr>            <tr class="v">                <td class="e">                    Version                </td>                <td>                    ' .trim($installed['version']). '                </td>            </tr>            <tr class="v">                <td class="e">                    Description                </td>                <td>                    ' .nl2br(htmlentities(trim($installed['description']))). '                </td>            </tr>            <tr class="v">                <td class="e">                    State                </td>                <td>                    ' .trim($installed['release_state']). '                </td>            </tr>            <tr class="v">                <td class="e">                    Information                </td>            </tr>';            if ($latest != FALSE) {            	if (isset($latest[$installed['package']])) {                	if (version_compare($latest[$installed['package']]['version'],$installed['version'],'>')) {	                    $packages .= '<tr class="v">	                    <td class="e">	                        Latest Version	                    </td>	                    <td>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?