⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 package.php

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PHP
📖 第 1 页 / 共 3 页
字号:
                    'border' => true,                    'headline' => array("Required?", "Type", "Name", "Relation", "Version"),                    );                foreach ($deps as $d) {                    if (isset($d['optional'])) {                        if ($d['optional'] == 'yes') {                            $req = 'No';                        } else {                            $req = 'Yes';                        }                    } else {                        $req = 'Yes';                    }                    if (isset($this->_deps_rel_trans[$d['rel']])) {                        $rel = $this->_deps_rel_trans[$d['rel']];                    } else {                        $rel = $d['rel'];                    }                    if (isset($this->_deps_type_trans[$d['type']])) {                        $type = ucfirst($this->_deps_type_trans[$d['type']]);                    } else {                        $type = $d['type'];                    }                    if (isset($d['name'])) {                        $name = $d['name'];                    } else {                        $name = '';                    }                    if (isset($d['version'])) {                        $version = $d['version'];                    } else {                        $version = '';                    }                    $data['data'][] = array($req, $type, $name, $rel, $version);                }            } else { // package.xml 2.0 dependencies display                require_once 'PEAR/Dependency2.php';                $deps = $info->getDependencies();                $reg = &$this->config->getRegistry();                if (is_array($deps)) {                    $d = new PEAR_Dependency2($this->config, array(), '');                    $data = array(                        'caption' => 'Dependencies for ' . $info->getPackage(),                        'border' => true,                        'headline' => array("Required?", "Type", "Name", 'Versioning', 'Group'),                        );                    foreach ($deps as $type => $subd) {                        $req = ($type == 'required') ? 'Yes' : 'No';                        if ($type == 'group') {                            $group = $subd['attribs']['name'];                        } else {                            $group = '';                        }                        if (!isset($subd[0])) {                            $subd = array($subd);                        }                        foreach ($subd as $groupa) {                            foreach ($groupa as $deptype => $depinfo) {                                if ($deptype == 'attribs') {                                    continue;                                }                                if ($deptype == 'pearinstaller') {                                    $deptype = 'pear Installer';                                }                                if (!isset($depinfo[0])) {                                    $depinfo = array($depinfo);                                }                                foreach ($depinfo as $inf) {                                    $name = '';                                    if (isset($inf['channel'])) {                                        $alias = $reg->channelAlias($inf['channel']);                                        if (!$alias) {                                            $alias = '(channel?) ' .$inf['channel'];                                        }                                        $name = $alias . '/';                                    }                                    if (isset($inf['name'])) {                                        $name .= $inf['name'];                                    } elseif (isset($inf['pattern'])) {                                        $name .= $inf['pattern'];                                    } else {                                        $name .= '';                                    }                                    if (isset($inf['uri'])) {                                        $name .= ' [' . $inf['uri'] .  ']';                                    }                                    if (isset($inf['conflicts'])) {                                        $ver = 'conflicts';                                    } else {                                        $ver = $d->_getExtraString($inf);                                    }                                    $data['data'][] = array($req, ucfirst($deptype), $name,                                        $ver, $group);                                }                            }                        }                    }                }            }            $this->ui->outputData($data, $command);            return true;        }        // Fallback        $this->ui->outputData("This package does not have any dependencies.", $command);    }    // }}}    // {{{ doSign()    function doSign($command, $options, $params)    {        require_once 'System.php';        require_once 'Archive/Tar.php';        // should move most of this code into PEAR_Packager        // so it'll be easy to implement "pear package --sign"        if (sizeof($params) != 1) {            return $this->raiseError("bad parameter(s), try \"help $command\"");        }        if (!file_exists($params[0])) {            return $this->raiseError("file does not exist: $params[0]");        }        $obj = $this->getPackageFile($this->config, $this->_debug);        $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $tar = new Archive_Tar($params[0]);        $tmpdir = System::mktemp('-d pearsign');        if (!$tar->extractList('package2.xml package.xml package.sig', $tmpdir)) {            return $this->raiseError("failed to extract tar file");        }        if (file_exists("$tmpdir/package.sig")) {            return $this->raiseError("package already signed");        }        $packagexml = 'package.xml';        if (file_exists("$tmpdir/package2.xml")) {            $packagexml = 'package2.xml';        }        if (file_exists("$tmpdir/package.sig")) {            unlink("$tmpdir/package.sig");        }        if (!file_exists("$tmpdir/$packagexml")) {            return $this->raiseError("Extracted file $tmpdir/$packagexml not found.");        }        $input = $this->ui->userDialog($command,                                       array('GnuPG Passphrase'),                                       array('password'));        if (!isset($input[0])) {            //use empty passphrase            $input[0] = '';        }        $devnull = (isset($options['verbose'])) ? '' : ' 2>/dev/null';        $gpg = popen("gpg --batch --passphrase-fd 0 --armor --detach-sign --output $tmpdir/package.sig $tmpdir/$packagexml" . $devnull, "w");        if (!$gpg) {            return $this->raiseError("gpg command failed");        }        fwrite($gpg, "$input[0]\n");        if (pclose($gpg) || !file_exists("$tmpdir/package.sig")) {            return $this->raiseError("gpg sign failed");        }        if (!$tar->addModify("$tmpdir/package.sig", '', $tmpdir)) {            return $this->raiseError('failed adding signature to file');        }        $this->ui->outputData("Package signed.", $command);        return true;    }    // }}}    /**     * For unit testing purposes     */    function &getInstaller(&$ui)    {        if (!class_exists('PEAR_Installer')) {            require_once 'PEAR/Installer.php';        }        $a = &new PEAR_Installer($ui);        return $a;    }        /**     * For unit testing purposes     */    function &getCommandPackaging(&$ui, &$config)    {        if (!class_exists('PEAR_Command_Packaging')) {            if ($fp = @fopen('PEAR/Command/Packaging.php', 'r', true)) {                fclose($fp);                include_once 'PEAR/Command/Packaging.php';            }        }                if (class_exists('PEAR_Command_Packaging')) {            $a = &new PEAR_Command_Packaging($ui, $config);        } else {            $a = null;        }        return $a;    }    // {{{ doMakeRPM()    function doMakeRPM($command, $options, $params)    {        // Check to see if PEAR_Command_Packaging is installed, and        // transparently switch to use the "make-rpm-spec" command from it        // instead, if it does. Otherwise, continue to use the old version        // of "makerpm" supplied with this package (PEAR).        $packaging_cmd = $this->getCommandPackaging($this->ui, $this->config);        if ($packaging_cmd !== null) {            $this->ui->outputData('PEAR_Command_Packaging is installed; using '.                'newer "make-rpm-spec" command instead');            return $packaging_cmd->run('make-rpm-spec', $options, $params);        } else {            $this->ui->outputData('WARNING: "pear makerpm" is no longer available; an '.              'improved version is available via "pear make-rpm-spec", which '.              'is available by installing PEAR_Command_Packaging');        }        return true;    }    function doConvert($command, $options, $params)    {        $packagexml = isset($params[0]) ? $params[0] : 'package.xml';        $newpackagexml = isset($params[1]) ? $params[1] : dirname($packagexml) .            DIRECTORY_SEPARATOR . 'package2.xml';        $pkg = &$this->getPackageFile($this->config, $this->_debug);        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);        $pf = $pkg->fromPackageFile($packagexml, PEAR_VALIDATE_NORMAL);        PEAR::staticPopErrorHandling();        if (!PEAR::isError($pf)) {            if (is_a($pf, 'PEAR_PackageFile_v2')) {                $this->ui->outputData($packagexml . ' is already a package.xml version 2.0');                return true;            }            $gen = &$pf->getDefaultGenerator();            $newpf = &$gen->toV2();            $newpf->setPackagefile($newpackagexml);            $gen = &$newpf->getDefaultGenerator();            PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);            $state = (isset($options['flat']) ? PEAR_VALIDATE_PACKAGING : PEAR_VALIDATE_NORMAL);            $saved = $gen->toPackageFile(dirname($newpackagexml), $state,                basename($newpackagexml));            PEAR::staticPopErrorHandling();            if (PEAR::isError($saved)) {                if (is_array($saved->getUserInfo())) {                    foreach ($saved->getUserInfo() as $warning) {                        $this->ui->outputData($warning['message']);                    }                }                $this->ui->outputData($saved->getMessage());                return true;            }            $this->ui->outputData('Wrote new version 2.0 package.xml to "' . $saved . '"');            return true;        } else {            if (is_array($pf->getUserInfo())) {                foreach ($pf->getUserInfo() as $warning) {                    $this->ui->outputData($warning['message']);                }            }            return $this->raiseError($pf);        }    }    // }}}}?>

⌨️ 快捷键说明

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