From 55eddd7accf2c5f9b0f52b22a010c4c4b7c130d1 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Fri, 6 Feb 2009 19:18:00 -0600 Subject: mv packages to config dir to match web layout --- packages/squidGuard/sgerror.php | 284 ---------------------------------------- 1 file changed, 284 deletions(-) delete mode 100644 packages/squidGuard/sgerror.php (limited to 'packages/squidGuard/sgerror.php') diff --git a/packages/squidGuard/sgerror.php b/packages/squidGuard/sgerror.php deleted file mode 100644 index 8084c5c3..00000000 --- a/packages/squidGuard/sgerror.php +++ /dev/null @@ -1,284 +0,0 @@ - $val) { - if (strpos(strtolower($url), strval($key)) === 0) { - $err_id = $key; - break; - } - } - - # blank page - if ($url === TAG_BLANK) { - echo get_page(''); - } - # blank image - elseif ($url === TAG_BLANK_IMG) { - $msg = trim($msg); - if(strpos($msg, "maxlen_") !== false) { - $maxlen = intval(trim(str_replace("maxlen_", "", $url))); - filter_by_image_size($cl['u'], $maxlen); - exit(); - } - else { - # -------------------------------------------------------------- - # return blank image - # -------------------------------------------------------------- - header("Content-Type: image/gif;"); // charset=windows-1251"); - echo GIF_BODY; - } - } - # error code - elseif ($err_id !== 0) { - $er_msg = strstr($_GET['url'], ' '); - echo get_error_page($err_id, $er_msg); - } - # redirect url - elseif ((strpos(strtolower($url), "http://") === 0) or (strpos(strtolower($url), "https://") === 0)) { - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # redirect to specified url - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - header("HTTP/1.0"); - header("Location: $url", '', 302); - } - // error arguments - else { - echo get_page("sgerror: error arguments $url"); - } -} -else { - echo get_page($_SERVER['QUERY_STRING']); //$url . implode(" ", $_GET)); -# echo get_error_page(500); -} - -# ~~~~~~~~~~ -# Exit -# ~~~~~~~~~~ -exit(); - -# ---------------------------------------------------------------------------------------------------------------------- -# functions -# ---------------------------------------------------------------------------------------------------------------------- -function get_page($body) { - $str = Array(); - $str[] = ''; - $str[] = "\n$body\n"; - $str[] = ''; - return implode("\n", $str); -} - -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# IE displayed self-page, if them size > 1024 -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -function get_error_page($er_code_id, $err_msg='') { - global $err_code; - global $cl; - $str = Array(); - - header("HTTP/1.1 " . $err_code[$er_code_id]); - - $str[] = ''; - $str[] = ''; - $str[] = '

Request denied by pfSense proxy: ' . $err_code[$er_code_id] . '

'; - if ($err_msg) $str[] = " Reason: $err_msg"; - $str[] = '
'; - if ($cl['a']) $str[] = " Client address: {$cl['a']}
"; - if ($cl['n']) $str[] = " Client name: {$cl['n']}
"; - if ($cl['i']) $str[] = " Client user: {$cl['i']}
"; - if ($cl['s']) $str[] = " Client group: {$cl['s']}
"; - if ($cl['t']) $str[] = " Target group: {$cl['t']}
"; - if ($cl['u']) $str[] = " URL: {$cl['u']}
"; - $str[] = '
'; - $str[] = ""; - $str[] = ""; - - return implode("\n", $str); -} - -function get_about() { - global $err_code; - global $page_info; - $str = Array(); - - // about info - $s = str_replace("\n", "
", $page_info); - $str[] = $s; - $str[] = "
"; - - $str[] = ''; - $str[] = ' HTTP error codes (ERROR_CODE):'; - foreach($err_code as $val) { - $str []= "
$val"; - } - $str[] = '
'; - - return implode("\n", $str); -} - -function filter_by_image_size($url, $val_size) { - - # load url header - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_HEADER, 1); - curl_setopt($ch, CURLOPT_NOBODY, 1); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - $hd = curl_exec($ch); - curl_close($ch); - - $size = 0; - $SKEY = "content-length:"; - $s_tmp = strtolower($hd); - $s_tmp = str_replace("\n", " ", $s_tmp); # replace all "\n" - if (strpos($s_tmp, $SKEY) !== false) { - $s_tmp = trim(substr($s_tmp, strpos($s_tmp, $SKEY) + strlen($SKEY))); - $s_tmp = trim(substr($s_tmp, 0, strpos($s_tmp, " "))); - if (is_numeric($s_tmp)) - $size = intval($s_tmp); - else $size = 0; - } - - # === check url type and content size === - # redirect to specified url - if (($size !== 0) && ($size < $val_size)) { - header("HTTP/1.0"); - header("Location: $url", '', 302); - } - # return blank image - else { - header("Content-Type: image/gif;"); - echo GIF_BODY; - } -} -?> \ No newline at end of file -- cgit v1.2.3