• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP viscacha_function_exists函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: load

 function load()
 {
     global $config;
     if ($this->exists() == true) {
         $this->import();
     } else {
         if (viscacha_function_exists('xml_parser_create')) {
             $rssnews = get_remote('http://version.viscacha.org/news/rss');
             include 'classes/magpie_rss/rss_fetch.inc.php';
             $rss = new MagpieRSS($rssnews);
             $news = '';
             foreach ($rss->items as $item) {
                 $news .= '<li><a href="' . htmlspecialchars($item['link']) . '" style="font-weight: bold;" target="_blank">' . htmlspecialchars($item['title']) . '</a>';
                 if (isset($item['description'])) {
                     $news .= '<br /><span style="font-size: 0.9em;">' . htmlspecialchars($item['description']) . '</span>';
                 }
                 $news .= '</li>';
             }
             if (!empty($news)) {
                 $news = '<ul>' . $news . '</ul>';
             }
         } else {
             $news = get_remote('http://version.viscacha.org/news');
         }
         $this->data = array('comp' => get_remote('http://version.viscacha.org/compare/?version=' . base64_encode($config['version'])), 'version' => get_remote('http://version.viscacha.org/version'), 'news' => $news);
         $this->export();
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:28,代码来源:version_check.inc.php


示例2: isWindows

function isWindows()
{
    if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
        return true;
    } elseif (isset($_SERVER['OS']) && strpos(strtolower($_SERVER['OS']), 'Windows') !== false) {
        return true;
    } elseif (viscacha_function_exists('php_uname') && stristr(@php_uname(), 'windows')) {
    } else {
        return false;
    }
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:11,代码来源:function.phpcore.php


示例3: DB

 function DB($host = 'localhost', $user = 'root', $pwd = '', $dbname = '', $dbprefix = '', $open = true)
 {
     $this->system = 'mysql';
     if (version_compare(PHP_VERSION, "4.3.0", ">=") && viscacha_function_exists('mysql_real_escape_string') == true) {
         $this->escaper = 'mysql_real_escape_string';
     } else {
         $this->escaper = 'mysql_escape_string';
     }
     $this->errlogfile = 'data/errlog_' . $this->system . '.inc.php';
     parent::DB_Driver($host, $user, $pwd, $dbname, $dbprefix, $open);
     $this->freeResult = $this->persistence == 1;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:12,代码来源:mysql.inc.php


示例4: CanGZIP

function CanGZIP() {
	if (headers_sent() || connection_aborted() || !extension_loaded("zlib") || !viscacha_function_exists('gzcompress')){
		return false;
	}
	if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false) {
		return "x-gzip";
	}
	if (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !== false) {
		return "gzip";
	}
	return false;
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:12,代码来源:class.docoutput.php


示例5: VeriWord

 function VeriWord()
 {
     // Get Font-Files
     $handle = opendir($this->dir_font);
     $pre = 'captcha_';
     while ($file = readdir($handle)) {
         if ($file != "." && $file != ".." && !is_dir($this->dir_font . $file)) {
             $nfo = pathinfo($this->dir_font . $file);
             $prefix = substr($nfo['basename'], 0, strlen($pre));
             if ($nfo['extension'] == 'ttf' && $prefix == $pre) {
                 $this->fonts[] = $nfo['basename'];
             }
         }
     }
     // Get Noise-Files
     $handle = opendir($this->dir_noise);
     while ($file = readdir($handle)) {
         if ($file != "." && $file != ".." && !is_dir($this->dir_noise . $file)) {
             $nfo = pathinfo($this->dir_noise . $file);
             if ($nfo['extension'] == 'jpg' || $nfo['extension'] == 'jpeg') {
                 $this->noises[] = $nfo['basename'];
             }
         }
     }
     ImageTypes();
     $lang = new lang();
     $lang->group("thumbnail.class");
     $this->lang = $lang->return_array();
     if (viscacha_function_exists('imagejpeg') && IMG_JPEG) {
         define('IMAGEJPEG', true);
     } else {
         define('IMAGEJPEG', false);
     }
     if (viscacha_function_exists('imagegif') && IMG_GIF) {
         define('IMAGEGIF', true);
     } else {
         define('IMAGEGIF', false);
     }
     if (viscacha_function_exists('imagepng') && IMG_PNG) {
         define('IMAGEPNG', true);
     } else {
         define('IMAGEPNG', false);
     }
     srand((double) microtime() * time());
     mt_srand((double) microtime() * 1000000);
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:46,代码来源:class.veriword.php


示例6: readRssInfo

	function readRssInfo() {
		if (!viscacha_function_exists('xml_parser_create')) {
			return false;
		}

		global $config;
		$rssData = get_remote('http://version.viscacha.org/news/rss/?version='.base64_encode($config['version']));

		$xml = xml_parser_create();
		xml_parser_set_option($xml, XML_OPTION_CASE_FOLDING, true);
		xml_set_element_handler($xml, array($this, "startRssElement"), array($this, "endRssElement"));
		xml_set_character_data_handler($xml, array($this, "getRssElementData"));
		$success = xml_parse($xml, $rssData);
		xml_parser_free($xml);

		if (!$success || empty($this->data['news'])) {
			$this->data['news'] = '';
			return false;
		}
		else {
			$this->data['news'] = '<ul>'.$this->data['news'].'</ul>';
			return true;
		}
	}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:24,代码来源:version_check.inc.php


示例7: php4_create_parser

 /**
  * Instaniate an XML parser under PHP4
  *
  * Unfortunately PHP4's support for character encodings
  * and especially XML and character encodings sucks.  As
  * long as the documents you parse only contain characters
  * from the ISO-8859-1 character set (a superset of ASCII,
  * and a subset of UTF-8) you're fine.  However once you
  * step out of that comfy little world things get mad, bad,
  * and dangerous to know.
  *
  * The following code is based on SJM's work with FoF
  * @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
  *
  */
 function php4_create_parser($source, $in_enc, $detect)
 {
     if (!$detect) {
         return array(xml_parser_create($in_enc), $source);
     }
     if (!$in_enc) {
         if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) {
             $in_enc = strtoupper($m[1]);
             $this->source_encoding = $in_enc;
         } else {
             $in_enc = 'UTF-8';
         }
     }
     if ($this->known_encoding($in_enc)) {
         return array(xml_parser_create($in_enc), $source);
     }
     // the dectected encoding is not one of the simple encodings PHP knows
     // attempt to use the iconv extension to
     // cast the XML to a known encoding
     // @see http://php.net/iconv
     if (viscacha_function_exists('iconv')) {
         $encoded_source = iconv($in_enc, 'UTF-8', $source);
         if ($encoded_source) {
             return array(xml_parser_create('UTF-8'), $encoded_source);
         }
     }
     // iconv didn't work, try mb_convert_encoding
     // @see http://php.net/mbstring
     if (viscacha_function_exists('mb_convert_encoding')) {
         $encoded_source = mb_convert_encoding($source, 'UTF-8', $in_enc);
         if ($encoded_source) {
             return array(xml_parser_create('UTF-8'), $encoded_source);
         }
     }
     // else
     $this->error("Feed is in an unsupported character encoding. ({$in_enc}) " . "You may see strange artifacts, and mangled characters.", E_USER_NOTICE);
     return array(xml_parser_create(), $source);
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:53,代码来源:rss_parse.inc.php


示例8: unset

    unset($input);
}
if (get_magic_quotes_gpc() == 1) {
    $_GET = $gpc->stripslashes($_GET);
    $_POST = $gpc->stripslashes($_POST);
    $_REQUEST = $gpc->stripslashes($_REQUEST);
}
// Thanks to phpBB for this 6 lines
if (isset($_POST['GLOBALS']) || isset($_FILES['GLOBALS']) || isset($_GET['GLOBALS']) || isset($_COOKIE['GLOBALS'])) {
    trigger_error("Hacking attempt (Globals)", E_USER_ERROR);
}
if (isset($_SESSION) && !is_array($_SESSION)) {
    trigger_error("Hacking attempt (Session Variable)", E_USER_ERROR);
}
$http_svars = array('PHP_SELF', 'HTTP_USER_AGENT', 'SERVER_SOFTWARE', 'REMOTE_ADDR', 'SCRIPT_NAME', 'SERVER_PORT', 'SERVER_NAME', 'HTTP_REFERER', 'HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'REQUEST_URI', 'HTTP_ACCEPT_ENCODING', 'DOCUMENT_ROOT');
if (viscacha_function_exists('getallheaders')) {
    $ref = @getallheaders();
} else {
    $ref = array();
}
foreach ($http_svars as $http_var) {
    $func_key = '';
    if (substr($http_var, 0, 5) == 'HTTP_') {
        $func_key = strtolower(str_replace('_', ' ', substr($http_var, 5)));
        $func_key = str_replace(' ', '-', ucwords($func_key));
    }
    if (empty($_SERVER[$http_var]) && !empty($ref[$func_key])) {
        $_SERVER[$http_var] = $ref[$func_key];
    } else {
        $_SERVER[$http_var] = getenv($http_var);
    }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:function.gpc.php


示例9: preg_replace

            // (?:p)? => p?
            $list = preg_replace('#\\(\\?\\:(.)\\)\\?#', '\\1?', $list);
            // (?:a|b|c|d|...)? => [abcd...]?
            // TODO: a|bb|c => [ac]|bb
            static $callback_2;
            if (!isset($callback_2)) {
                $callback_2 = create_function('$matches', 'return "[" . str_replace("|", "", $matches[1]) . "]";');
            }
            $list = preg_replace_callback('#\\(\\?\\:((?:.\\|)+.)\\)#', $callback_2, $list);
        }
        // return $list without trailing pipe
        return substr($list, 0, -1);
    }
}
// End Class GeSHi
if (!viscacha_function_exists('geshi_highlight')) {
    /**
     * Easy way to highlight stuff. Behaves just like highlight_string
     *
     * @param string The code to highlight
     * @param string The language to highlight the code in
     * @param string The path to the language files. You can leave this blank if you need
     *               as from version 1.0.7 the path should be automatically detected
     * @param boolean Whether to return the result or to echo
     * @return string The code highlighted (if $return is true)
     * @since 1.0.2
     */
    function geshi_highlight($string, $language, $path = null, $return = false)
    {
        $geshi = new GeSHi($string, $language, $path);
        $geshi->set_header_type(GESHI_HEADER_NONE);
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:class.geshi.php


示例10: error

 function error($errcomment)
 {
     // Try to get better results for line and file.
     if (viscacha_function_exists('debug_backtrace') == true) {
         $backtraceInfo = debug_backtrace();
         // 0 is class.mysql.php, 1 is the calling code...
         if (isset($backtraceInfo[1]) == true) {
             $errline = $backtraceInfo[1]['line'];
             $errfile = $backtraceInfo[1]['file'];
         }
     }
     if ($this->logerrors) {
         if (file_exists($this->errlogfile)) {
             $lines = file($this->errlogfile);
             foreach ($lines as $key => $value) {
                 $value = trim($value);
                 if (empty($value)) {
                     unset($lines[$key]);
                 } else {
                     $lines[$key] = $value;
                     // Also trim it for the file
                 }
             }
         } else {
             $lines = array();
         }
         $cols = array($this->errno(), makeOneLine($this->errstr()), $errfile, $errline, makeOneLine($_SERVER['REQUEST_URI']), time(), makeOneLine($errcomment));
         $lines[] = implode("\t", $cols);
         @file_put_contents($this->errlogfile, implode("\n", $lines));
     }
     $errcomment = nl2br($errcomment);
     return "DB ERROR " . $this->errno() . ": " . $this->errstr() . "<br />File: {$errfile} on line {$errline}<br />Query: <code>{$errcomment}</code>";
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:33,代码来源:class.db_driver.php


示例11: foot

"></td>
	  </tr>
	 </table>
	</form>
	<?php 
    echo foot();
} elseif ($job == 'datetime2') {
    echo head();
    $c->getdata();
    $c->updateconfig('new_dformat4', int);
    $c->updateconfig('timezone', str);
    $c->savedata();
    ok('admin.php?action=settings&job=settings');
} elseif ($job == 'http') {
    $config = $gpc->prepare($config);
    if (!extension_loaded("zlib") || !viscacha_function_exists('gzcompress')) {
        $gzip = '<span style="color: #aa0000;">' . $lang->phrase('admin_not_enabled') . '</span>';
    } else {
        $gzip = '<span style="color: #00aa00;">' . $lang->phrase('admin_enabled') . '</span>';
    }
    echo head();
    ?>
	<form name="form" method="post" action="admin.php?action=settings&job=http2">
	 <table class="border" border="0" cellspacing="0" cellpadding="4" align="center">
	  <tr>
	   <td class="obox" colspan="2"><?php 
    echo $lang->phrase('admin_headers_cookies_gzip');
    ?>
</td>
	  </tr>
	  <tr>
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:settings.php


示例12: privSwapBackMagicQuotes

 function privSwapBackMagicQuotes()
 {
     $v_result = 1;
     // ----- Look if function exists
     if (!viscacha_function_exists("get_magic_quotes_runtime") || !viscacha_function_exists("set_magic_quotes_runtime")) {
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
         return $v_result;
     }
     // ----- Look if something to do
     if ($this->magic_quotes_status != -1) {
         //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
         return $v_result;
     }
     // ----- Swap back magic_quotes
     if ($this->magic_quotes_status == 1) {
         @set_magic_quotes_runtime($this->magic_quotes_status);
     }
     // ----- Return
     return $v_result;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:20,代码来源:class.zip.php


示例13: error

 function error($errcomment)
 {
     // Try to get better results for line and file.
     if (viscacha_function_exists('debug_backtrace') == true) {
         $backtraceInfo = debug_backtrace();
         // 0 is class.mysql.php, 1 is the calling code...
         if (isset($backtraceInfo[1]) == true) {
             $errline = $backtraceInfo[1]['line'];
             $errfile = $backtraceInfo[1]['file'];
         }
     }
     if ($this->logerrors) {
         $logs = array();
         if (file_exists($this->errlogfile)) {
             $logs = file($this->errlogfile);
             $logs = array_empty_trim($logs);
         }
         $row = array($this->errno(), $this->errstr(), $errfile, $errline, $errcomment, $_SERVER['REQUEST_URI'], time(), PHP_VERSION . " (" . PHP_OS . ")");
         $row = array_map('makeOneLine', $row);
         $logs[] = implode("\t", $row);
         @file_put_contents($this->errlogfile, implode("\n", $logs));
     }
     $errcomment = nl2br($errcomment);
     return "Database error " . $this->errno() . ": " . $this->errstr() . "<br />File: {$errfile} on line {$errline}<br />Query: <code>{$errcomment}</code>";
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:25,代码来源:class.db_driver.php


示例14: OpenSocket

 function OpenSocket($server, $port)
 {
     if (viscacha_function_exists("dns_get_record")) {
         $record = dns_get_record("_xmpp-client._tcp.{$server}", DNS_SRV);
         if (!empty($record)) {
             $server = $record[0]["target"];
             $port = $record[0]["port"];
         }
     }
     if ($this->active_socket = @fsockopen($server, $port)) {
         @socket_set_blocking($this->active_socket, 0);
         @socket_set_timeout($this->active_socket, 31536000);
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:17,代码来源:class.jabber.php


示例15: pemftp_class_module

function pemftp_class_module()
{
    if (extension_loaded('ftp')) {
        return 'ext';
    } else {
        $mod_sockets = true;
        if (!extension_loaded('sockets')) {
            if (!viscacha_function_exists('dl')) {
                $mod_sockets = false;
            } else {
                $prefix = PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '';
                if (!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) {
                    $mod_sockets = false;
                }
            }
        }
        if ($mod_sockets == true) {
            return 'sockets';
        } elseif ($mod_sockets == false && viscacha_function_exists('fsockopen')) {
            return 'pure';
        } else {
            die('Viscacha needs at least fsockopen, sockets extension or ftp extension to work! Please enable one of this features or you cannot use Viscacha!');
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:25,代码来源:class.ftp.php


示例16: pemftp_class_module

function pemftp_class_module()
{
    if (extension_loaded('ftp')) {
        return 'ext';
    } else {
        $mod_sockets = true;
        if (!extension_loaded('sockets')) {
            if (!viscacha_function_exists('dl')) {
                $mod_sockets = false;
            } else {
                $prefix = PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : '';
                if (!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) {
                    $mod_sockets = false;
                }
            }
        }
        if ($mod_sockets == true) {
            return 'sockets';
        } elseif ($mod_sockets == false && viscacha_function_exists('fsockopen')) {
            return 'pure';
        } else {
            return null;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:25,代码来源:class.ftp.php


示例17: gzAbortNotLoaded

function gzAbortNotLoaded()
{
    if (!extension_loaded("zlib") || !viscacha_function_exists('readgzfile')) {
        global $lang;
        error('javascript:history.back(-1);', $lang->phrase('admin_gzip_not_loaded'));
    }
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:7,代码来源:function.viscacha_backend.php


示例18: output

 function output($format = 'png')
 {
     if (($format == 'jpeg' || $format == 'jpe' || $format == 'jpeg') && viscacha_function_exists('imagejpeg')) {
         header("Content-Type: image/jpeg");
         imagejpeg($this->img, '', 90);
     } elseif ($format == 'gif' && viscacha_function_exists('imagegif')) {
         header("Content-Type: image/gif");
         imagegif($this->img);
     } else {
         header("Content-Type: image/png");
         imagepng($this->img);
     }
     $this->destroy();
     exit;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:15,代码来源:class.text2image.php


示例19: upload

 /**
  * Upload a file.
  *
  * Checks if the file is acceptable and uploads it to PHP's default upload diretory
  *
  * @param	string	Name of form field
  * @return	boolean
  */
 function upload($index)
 {
     global $imagetype_extension;
     if (!isset($_FILES[$index]) || !is_array($_FILES[$index])) {
         $this->error = UPLOAD_ERR_FILE_INDEX;
         return false;
     }
     // Copy PHP's global $_FILES array to a local array
     $indexes = array('extension', 'size', 'width', 'height', 'tmp_name', 'raw_name', 'form', 'type', 'name', 'image', 'filename');
     foreach ($indexes as $key) {
         $this->file[$key] = isset($_FILES[$index][$key]) ? $_FILES[$index][$key] : null;
     }
     // Set input field name
     $this->file['form'] = $index;
     // Get extension
     $this->file['extension'] = strtolower(get_extension($this->file['name']));
     // Get file size
     if (empty($this->file['size']) == true) {
         $this->file['size'] = filesize($this->file['tmp_name']);
     }
     // Set mime type
     if (empty($this->file['type']) == true) {
         if (viscacha_function_exists('mime_content_type') == true) {
             $this->file['type'] = mime_content_type($this->file['name']);
         }
     }
     // Check image data (height, width, image)
     if (in_array($this->file['extension'], $imagetype_extension) == true) {
         $this->file['image'] = true;
         $properties = @getimagesize($this->file['tmp_name']);
         if (is_array($properties) == false) {
             $this->file['image'] = false;
         } else {
             $this->file['width'] = $properties[0];
             $this->file['height'] = $properties[1];
             if (empty($this->file['type']) == true) {
                 $this->file['type'] = image_type_to_mime_type($properties[2]);
             }
         }
     } else {
         $this->file['image'] = false;
     }
     // Set raw_name
     $this->file['raw_name'] = substr($this->file['name'], 0, -(strlen($this->file['extension']) + 1));
     $this->file['filename'] = $this->file['name'];
     // test max file size
     if ($this->max_filesize > 0 && $this->file['size'] > $this->max_filesize) {
         $this->error = UPLOAD_ERR_FILE_SIZE;
         return false;
     }
     // test max image size
     if ($this->file['image'] == true) {
         if ($this->max_image_width > 0 && $this->file['width'] > $this->max_image_width) {
             $this->error = UPLOAD_ERR_IMAGE_WIDTH;
             return false;
         }
         if ($this->max_image_height > 0 && $this->file['height'] > $this->max_image_height) {
             $this->error = UPLOAD_ERR_IMAGE_HEIGHT;
             return false;
         }
     }
     // check to see if the file is of type specified
     if (count($this->file_types) > 0) {
         if (in_array($this->file['extension'], $this->file_types) == false) {
             $this->error = UPLOAD_ERR_FILE_TYPE;
             return false;
         }
     }
     if (!is_uploaded_file($this->file['tmp_name'])) {
         $this->copy_func = 'copy';
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:81,代码来源:class.upload.php


示例20: _httprequest

 function _httprequest($url, $fp, $URI, $http_method, $content_type = "", $body = "")
 {
     $temp_dir = "";
     $cmdline_params = "";
     $cookie_headers = '';
     if ($this->passcookies && $this->_redirectaddr) {
         $this->setcookies();
     }
     $URI_PARTS = parse_url($URI);
     if (empty($url)) {
         $url = "/";
     }
     $headers = $http_method . " " . $url . " " . $this->_httpversion . "\r\n";
     if (!empty($this->agent)) {
         $headers .= "User-Agent: " . $this->agent . "\r\n";
     }
     if (!empty($this->host) && !isset($this->rawheaders['Host'])) {
         $headers .= "Host: " . convert_host_to_idna($this->host);
         if (!empty($this->port)) {
             $headers .= ":" . $this->port;
         }
         $headers .= "\r\n";
     }
     if (!empty($this->accept)) {
         $headers .= "Accept: " . $this->accept . "\r\n";
     }
     if ($this->use_gzip && viscacha_function_exists('gzinflate')) {
         // make sure PHP was built with --with-zlib
         // and we can handle gzipp'ed data
         $headers .= "Accept-encoding: gzip\r\n";
     }
     if (!empty($this->referer)) {
         $headers .= "Referer: " . $this->referer . "\r\n";
     }
     if (!empty($this->cookies)) {
         if (!is_array($this->cookies)) {
             $this->cookies = (array) $this->cookies;
         }
         reset($this->cookies);
         if (count($this->cookies) > 0) {
             $cookie_headers .= 'Cookie: ';
             foreach ($this->cookies as $cookieKey => $cookieVal) {
                 $cookie_headers .= $cookieKey . "=" . urlencode($cookieVal) . "; ";
             }
             $headers .= substr($cookie_headers, 0, -2) . "\r\n";
         }
     }
     if (!empty($this->rawheaders)) {
         if (!is_array($this->rawheaders)) {
             $this->rawheaders = (array) $this->rawheaders;
         }
         while (list($headerKey, $headerVal) = each($this->rawheaders)) {
             $headers .= $headerKey . ": " . $headerVal . "\r\n";
         }
     }
     if (!empty($content_type)) {
         $headers .= "Content-type: {$content_type}";
         if ($content_type == "multipart/form-data") {
             $headers .= "; boundary=" . $this->_mime_boundary;
         }
         $headers .= "\r\n";
     }
     if (!empty($body)) {
         $headers .= "Content-length: " . strlen($body) . "\r\n";
     }
     if (!empty($this->user) || !empty($this->pass)) {
         $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n";
     }
     //add proxy auth headers
     if (!empty($this->proxy_user)) {
         $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n";
     }
     $headers .= "\r\n";
     // set the read timeout if needed
     if ($this->read_timeout > 0) {
         socket_set_timeout($fp, $this->read_timeout);
     }
     $this->timed_out = false;
     fwrite($fp, $headers . $body, strlen($headers . $body));
     $this->_redirectaddr = false;
     unset($this->headers);
     // content was returned gzip encoded?
     $is_gzipped = false;
     while ($currentHeader = fgets($fp, $this->_maxlinelen)) {
         if ($this->read_timeout > 0 && $this->_check_timeout($fp)) {
             $this->status = -100;
             return false;
         }
         if ($currentHeader == "\r\n") {
             break;
         }
         // if a header begins with Location: or URI:, set the redirect
         if (preg_match("/^(Location:|URI:)/i", $currentHeader)) {
             // get URL portion of the redirect
             preg_match("/^(Location:|URI:)[ ]+(.*)/i", chop($currentHeader), $matches);
             // look for :// in the Location header to see if hostname is included
             if (!preg_match("|\\:\\/\\/|", $matches[2])) {
                 // no host in the path, so prepend
                 $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port;
                 // eliminate double slash
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:101,代码来源:class.snoopy.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP viscacha_header函数代码示例发布时间:2022-05-23
下一篇:
PHP virtue_excerpt函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap