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

📄 web.pm

📁 Astercon2 开源软交换 2.2.0
💻 PM
字号:
package astercon::web;#--------------------------------------------------------------##	Astercon -- An open source softswitch and ippbx system.##	Copyright (C) 2005 - 2008, Sun bing.##	Sun bing <hoowa.sun@gmail.com>##	See http://astercon.0420.com for more information about#	the Astercon project.##   license#   The astercon project is licensed under the GNU 2.0 GPL. #   astercon carries no restrictions on re-branding and #   people are free to commercially re-distribute it.##   any questions?#   Please do not directly contact any of the maintainers of#   this project for assistance;#	the project provides a web site, bugs tracker,really chat.##--------------------------------------------------------------#use strict;use vars qw($VERSION @ISA);use CGI::Carp qw(fatalsToBrowser set_message);use CGI;use CGI::Cookie;use HTML::KTemplate;use URI::Escape;$VERSION='0.1';BEGIN {	@ISA = qw();	sub handle_errors {	  my $msg = shift;	  print "<h1>Astercon Error Report</h1>";	  print "<p>Got an error: $msg</p>";	}	set_message(\&handle_errors);}sub new {my	$class = shift;my	$self = {};my	%args = @_;	$HTML::KTemplate::VAR_START_TAG = '<%';	$HTML::KTemplate::VAR_END_TAG   = '%>';my	$tpl = HTML::KTemplate->new($args{template_path});	$self->{tpl} = $tpl;	bless $self, $class;return $self;}sub escape{	print "Content-type: text/html\n\n";	print "System Error : @_";return();}sub display{my	$self	=	shift;my	$file	=	shift;my	$astcon_conf	=	shift;my	$language_conf	=	shift;	$astcon_conf = $$astcon_conf if (ref($astcon_conf) eq 'REF');	$language_conf = $$language_conf if (ref($language_conf) eq 'REF');	print "Content-Type: text/html; charset=utf-8\n\n";	if ($astcon_conf) {		$self->{tpl}->assign(title=>$astcon_conf->{'web'}{'title'}[0]);		$self->{tpl}->assign(version=>$astcon_conf->{'general'}{'version'}[0]);		if (-e$astcon_conf->{'general'}{'tmp'}[0].'/restart') {			$self->{tpl}->assign(notice=>$language_conf->{1140}[0]);		} elsif (-e$astcon_conf->{'general'}{'tmp'}[0].'/reload') {			$self->{tpl}->assign(notice=>$language_conf->{1130}[0]);		}	}	$self->{tpl}->assign(myself_request_uri=>uri_escape($ENV{'REQUEST_URI'}));		$self->{tpl}->process($file);	$self->{tpl}->print();return();}sub user_display{my	$self	=	shift;my	%getin	=	@_;	if (!defined $getin{file}) {		$self->error('No Exists Template files. System error.');		return;	}	print "Content-Type: text/html; charset=utf-8\n\n";	$self->{tpl}->assign(title=>$getin{title}) if (defined $getin{title});	$self->{tpl}->assign(hidden_adminpanel_url=>'no') if ($getin{hidden_adminpanel_url} eq 'no');	$self->{tpl}->process($getin{file});	$self->{tpl}->print();return();}sub setcookie{my	$self = shift;my	$name = shift;my	$value = shift;my	$expire = shift;my	$session_cookie;	if ($expire) {		$session_cookie = new CGI::Cookie(-name    =>  $name,-value   =>  $value,-expires =>  $expire);	} else {		$session_cookie = new CGI::Cookie(-name    =>  $name,-value   =>  $value);	}print "Set-Cookie: $session_cookie\n";return();}sub error{my	$self = shift;my	$msg = shift;my	$button = shift;	$self->{tpl}->assign(msg=>$msg);	$self->{tpl}->assign(button=>$button);	$self->display('admin/error.html');return();}sub user_error{my	$self = shift;my	$msg = shift;my	$button = shift;	$self->{tpl}->assign(msg=>$msg);	$self->{tpl}->assign(button=>$button);	$self->display('user/error.html');return();}sub filter_htmlout{my	$self = shift;my	$text = shift;	$text =~ s/[\a\f\e\0\r\t]//isg;	$text =~ s/\&nbsp;/ /g;	$text =~ s/\@ARGV/\&\#64\;ARGV/isg;	$text =~ s/\;/\&\#59\;/isg;	$text =~ s/\&/\&amp;/g;	$text =~ s/\&amp;\#/\&\#/isg;	$text =~ s/\&amp\;(.{1,6})\&\#59\;/\&$1\;/isg;	$text =~ s/\&\#([0-9]{1,6})\&\#59\;/\&\#$1\;/isg;	$text =~ s/"/\&quot;/g;	$text =~ s/  / \&nbsp;/g;	$text =~ s/</\&lt;/g;	$text =~ s/>/\&gt;/g;	$text =~ s/  / /g;	$text =~ s/\n\n/<p>/g;	$text =~ s/\n/<br>/g;	$text =~ s/document.cookie/documents\&\#46\;cookie/isg;	$text =~ s/'/\&\#039\;/g;	$text =~ s/\$/&#36;/isg;	$text =~ s/#/&#35;/isg;	$text =~ s/&&#35;/&#/isg;	$text =~ s/'/\\'/isg;return($text);}sub assign{my	$self = shift;my	%require = @_;my	$nofilter = $require{no_filter_htmlout};	delete($require{no_filter_htmlout});	if (!$nofilter) {		foreach  (keys %require) {			$require{$_} = $self->filter_htmlout($require{$_});		}	}	$self->{tpl}->assign(\%require);return();}sub pageview {my	(%output,%input,$self,$indexfront,$indexend);	$self = shift;	%input = @_;	# max_records	# recrods_on_page	# page_current	# href_url	# page_section_view	return if ($input{max_records} == 0 || $input{recrods_on_page} == 0);	$input{page_current} = 1 if ($input{page_current} =~ /[^0-9]/);	$input{page_current} = 1 if ($input{page_current} <= 0);	#Allpagesmy	$allpages = $input{max_records}/$input{recrods_on_page};	if (int($allpages) < $allpages) {		$allpages = int($allpages)+1;	}	$input{page_current} = $allpages if ($input{page_current} > $allpages);	#褰撳墠椤垫瘮鎵

⌨️ 快捷键说明

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