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

📄 tpl.inc.php

📁 MyDNSConfig-1.1.0 基于LINUX内核系统的DNS解析系统
💻 PHP
📖 第 1 页 / 共 4 页
字号:
                        return false;                    }                    while($r = mysql_fetch_assoc($result)) {                        $loop_arr[] = $r;                    }                break;                case 'POSTGRESQL':                    if (get_resource_type($result) != 'pgsql result') {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    $nr = (function_exists('pg_num_rows')) ? pg_num_rows($result) : pg_numrows($result);                    for ($i=0; $i < $nr; $i++) {                        $loop_arr[] = pg_fetch_array($result, $i, PGSQL_ASSOC);                    }                break;                case 'INFORMIX':                    if (!$result) {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while($r = ifx_fetch_row($result, 'NEXT')) {                        $loop_arr[] = $r;                    }                break;                case 'INTERBASE':                    if (get_resource_type($result) != 'interbase result') {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while($r = ibase_fetch_row($result)) {                        $loop_arr[] = $r;                    }                break;                case 'INGRES':                    if (!$result) {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while($r = ingres_fetch_array(INGRES_ASSOC, $result)) {                        $loop_arr[] = $r;                    }                break;                case 'MSSQL':                    if (get_resource_type($result) != 'mssql result') {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while($r = mssql_fetch_array($result)) {                        $loop_arr[] = $r;                    }                break;                case 'MSQL':                    if (get_resource_type($result) != 'msql result') {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while($r = msql_fetch_array($result, MSQL_ASSOC)) {                        $loop_arr[] = $r;                    }                break;                case 'OCI8':                    if (get_resource_type($result) != 'oci8 statement') {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while(OCIFetchInto($result, &$r, OCI_ASSOC+OCI_RETURN_LOBS)) {                        $loop_arr[] = $r;                    }                break;                case 'ORACLE':                    if (get_resource_type($result) != 'oracle Cursor') {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while(ora_fetch_into($result, &$r, ORA_FETCHINTO_ASSOC)) {                        $loop_arr[] = $r;                    }                break;                case 'OVRIMOS':                    if (!$result) {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while(ovrimos_fetch_into($result, &$r, 'NEXT')) {                        $loop_arr[] = $r;                    }                break;                case 'SYBASE':                    if (get_resource_type($result) != 'sybase-db result') {                        vlibTemplateError::raiseError('VT_WARNING_INVALID_RESOURCE',WARNING, $db_type);                        return false;                    }                    while($r = sybase_fetch_array($result)) {                        $loop_arr[] = $r;                    }                break;            }            $this->setLoop($loopname, $loop_arr);            return true;        }        /**         * FUNCTION: newLoop         *         * Sets the name for the curent loop in the 3 step loop process.         *         * @param string $name string to define loop name         * @return boolean true/false         * @access public         */        function newLoop ($loopname) {            if (preg_match('/^[a-z_]+[a-z0-9_]*$/i', $loopname)) {                $this->_currloopname[$loopname] = $loopname;                $this->_currloop[$loopname] = array();                return true;            }            else {                return false;            }        }        /**         * FUNCTION: addRow         *         * Adds a row to the current loop in the 3 step loop process.         *         * @param array $row loop row to add to current loop         * @param string $loopname loop to which you want to add row, if not set will use last loop set using newLoop().         * @return boolean true/false         * @access public         */        function addRow ($row, $loopname=null) {            if (!$loopname) $loopname = $this->_currloopname[(count($this->_currloopname)-1)];            if (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) {                vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET',WARNING);                return false;            }            if (is_array($row)) {                $this->_currloop[$loopname][] = $row;                return true;            }            else {                return false;            }        }        /**         * FUNCTION: addLoop         *         * Completes the 3 step loop process. This assigns the rows and resets         * the variables used.         *         * @param string $loopname to commit loop. If not set, will use last loopname set using newLoop()         * @return boolean true/false         * @access public         */        function addLoop ($loopname=null) {            if ($loopname == null) { // add last loop used                if (!empty($this->_currloop)) {                    foreach ($this->_currloop as $k => $v) {                        $this->setLoop($k, $v);                        unset($this->_currloop[$k]);                    }                    $this->_currloopname = array();                    return true;                }                else {                    return false;                }            }            elseif (!isset($this->_currloop[$loopname]) || empty($this->_currloopname)) { // newLoop not yet envoked                    vlibTemplateError::raiseError('VT_WARNING_LOOP_NOT_SET',WARNING);                    return false;            }            else { // add a specific loop                $this->setLoop($loopname, $this->_currloop[$loopname]);                unset($this->_currloopname[$loopname], $this->_currloop[$loopname]);            }            return true;        }        /**         * FUNCTION: unsetLoop         *         * Unsets a loop which has already been set.         * Can only unset top level loops.         *         * @param string loop to remove use: vlibTemplate::unsetLoop(loop[, loop..])         * @return boolean true/false returns true unless called with 0 params         * @access public         */        function unsetLoop () {            $num_args = func_num_args();            if ($num_args < 1) return false;            for ($i = 0; $i < $num_args; $i++) {                $var = func_get_arg($i);                if ($this->OPTIONS['CASELESS']) $var = strtolower($var);                if (!preg_match('/^[A-Za-z_]+[A-Za-z0-9_]*$/', $var)) continue;                unset($this->_arrvars[$var]);            }            return true;        }        /**         * FUNCTION: reset         *         * Resets the vlibTemplate object. After using vlibTemplate::reset() you must         * use vlibTemplate::newTemplate(tmpl) to reuse, not passing in the options array.         *         * @return boolean true         * @access public         */        function reset () {            $this->clearVars();            $this->clearLoops();            $this->_tmplfilename = null;            $this->_tmplfile = null;            $this->_tmplfilep = null;            $this->_tmploutput = null;            $this->_parsed = false;            $this->_unknowns = array();            $this->_firstparsetime = null;            $this->_totalparsetime = null;            $this->_currloopname = null;            $this->_currloop = array();            return true;        }        /**         * FUNCTION: clearVars         *         * Unsets all variables in the template         *         * @return boolean true         * @access public         */        function clearVars () {            $this->_vars = array();            return true;        }        /**         * FUNCTION: clearLoops         *         * Unsets all loops in the template         *         * @return boolean true         * @access public         */        function clearLoops () {            $this->_arrvars = array();            $this->_currloopname = null;            $this->_currloop = array();            return true;        }        /**         * FUNCTION: clearAll         *         * Unsets all variables and loops set using setVar/Loop()         *         * @return boolean true         * @access public         */        function clearAll () {            $this->clearVars();            $this->clearLoops();            return true;        }        /**         * FUNCTION: unknownsExist         *         * Returns true if unknowns were found after parsing.         * Function MUST be called AFTER one of the parsing functions to have any relevance.         *         * @return boolean true/false         * @access public         */        function unknownsExist () {            return (!empty($this->_unknowns));        }        /**         * FUNCTION: unknowns         *         * Alias for unknownsExist.         *         * @access public         */        function unknowns () {            return $this->unknownsExist();        }        /**         * FUNCTION: getUnknowns         *         * Returns an array of all unknown vars found when parsing.         * This function is only relevant after parsing a document.         *         * @return array         * @access public         */        function getUnknowns () {            return $this->_unknowns;        }        /**         * FUNCTION: setUnknowns         *         * Sets how you want to handle variables that were found in the         * template but not set in vlibTemplate using vlibTemplate::setVar().         *         * @param  string $arg ignore, remove, print, leave or comment         * @return boolean         * @access public         */        function setUnknowns ($arg) {            $arg = strtolower(trim($arg));            if (preg_match('/^ignore|remove|print|leave|comment$/', $arg)) {                $this->OPTIONS['UNKNOWNS'] = $arg;                return true;            }            return false;        }        /**         * FUNCTION: setPath         *         * function sets the paths to use when including files.         * Use of this function: vlibTemplate::setPath(string path [, string path, ..]);         * i.e. if $tmpl is your template object do: $tmpl->setPath('/web/htdocs/templates','/web/htdocs/www');         * with as many paths as you like.         * if this function is called without any arguments, it will just delete any previously set paths.         *         * @param string path (mulitple)         * @return bool success         * @access public         */        function setPath () {            $num_args = func_num_args();            if ($num_args < 1) {                $this->OPTIONS['INCLUDE_PATHS'] = array();                return true;            }            for ($i = 0; $i < $num_args; $i++) {                $thispath = func_get_arg($i);                array_push($this->OPTIONS['INCLUDE_PATHS'], realpath($thispath));            }            return true;        }        /**         * FUNCTION: getParseTime         *         * After using one of the parse functions, this will allow you         * access the time taken to parse the template.         * see OPTION 'TIME_PARSE'.

⌨️ 快捷键说明

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