コード例 #1
0
function fixImageURL(&$html, &$did)
{
    $images = getImages($html);
    $imgs = array_unique($images[1]);
    foreach ($imgs as $img) {
        $html = str_replace($img, fixurl($img), $html);
        //print_r($did);
        if (!in_array($img, $did)) {
            $base64 = image_base64_encode($img);
            if ($base64) {
                echo "<img><src><![CDATA[";
                echo fixurl($img);
                echo "]]></src><base64><![CDATA[";
                echo $base64;
                echo "]]></base64></img>";
            }
            array_push($did, $img);
        }
    }
}
コード例 #2
0
ファイル: function_core.php プロジェクト: hutao1004/yintt
function dreferer($default = '') {
	global $_G;

	$default = empty($default) ? $_ENV['curapp'].'.php' : '';
	$_G['referer'] = !empty($_GET['referer']) ? $_GET['referer'] : $_SERVER['HTTP_REFERER'];
	$_G['referer'] = substr($_G['referer'], -1) == '?' ? substr($_G['referer'], 0, -1) : $_G['referer'];

	if(strpos($_G['referer'], 'member.php?mod=logging')) {
		$_G['referer'] = $default;
	}

	$reurl = parse_url($_G['referer']);
	if(!empty($reurl['host']) && !in_array($reurl['host'], array($_SERVER['HTTP_HOST'], 'www.'.$_SERVER['HTTP_HOST'])) && !in_array($_SERVER['HTTP_HOST'], array($reurl['host'], 'www.'.$reurl['host']))) {
		if(!in_array($reurl['host'], $_G['setting']['domain']['app']) && !isset($_G['setting']['domain']['list'][$reurl['host']])) {
			$domainroot = substr($reurl['host'], strpos($reurl['host'], '.')+1);
			if(empty($_G['setting']['domain']['root']) || (is_array($_G['setting']['domain']['root']) && !in_array($domainroot, $_G['setting']['domain']['root']))) {
				$_G['referer'] = $_G['setting']['domain']['defaultindex'] ? $_G['setting']['domain']['defaultindex'] : 'index.php';
			}
		}
	} elseif(empty($reurl['host'])) {
		$_G['referer'] = $_G['siteurl'].'./'.$_G['referer'];
	}

	$_G['referer'] = fixurl($_G['referer']);
	return$_G['referer'];
}