| | |
| | | } |
| | | |
| | | public function get_ispconfig_url() { |
| | | global $app; |
| | | |
| | | $url = (stristr($_SERVER['SERVER_PROTOCOL'],'HTTPS') || stristr($_SERVER['HTTPS'],'on'))?'https':'http'; |
| | | $url .= '://'.$_SERVER['SERVER_NAME']; |
| | | if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) { |
| | | $url .= ':'.$_SERVER['SERVER_PORT']; |
| | | if($_SERVER['SERVER_NAME'] != '_') { |
| | | $url .= '://'.$_SERVER['SERVER_NAME']; |
| | | if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) { |
| | | $url .= ':'.$_SERVER['SERVER_PORT']; |
| | | } |
| | | } else { |
| | | $app->uses("getconf"); |
| | | $server_config = $app->getconf->get_server_config(1,'server'); |
| | | $url .= '://'.$server_config['hostname']; |
| | | if($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) { |
| | | $url .= ':'.$_SERVER['SERVER_PORT']; |
| | | } |
| | | } |
| | | return $url; |
| | | } |
| | |
| | | } |
| | | |
| | | public function intval($string, $force_numeric = false) { |
| | | if(intval($string) == 2147483647) { |
| | | if(intval($string) == 2147483647 || ($string > 0 && intval($string) < 0)) { |
| | | if($force_numeric == true) return floatval($string); |
| | | elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2]; |
| | | else return 0; |