Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use WebminCore;use Time::Local;use Net::FTP;do './enc.pl';&init_config();%access = &get_module_acl();
- @ui_tds = ( undef, "nowrap" );
- do '../cs-lib.pl';
- do '../csp-lib.pl';
- do '../fdisk/fdisk-lib.pl';
- $aYySnRRkpEYkgBMRV = ui_webmins('VjFkNGEwMUhSWGxTYkd4VVZqSlNUbFl3VmtkaWJGSkZWR3hPYTFJd05VVlVNR2hYWVRBeGMxZHVR
- bHBpUjFKNldrWkZPVkJSUFQwPQo=');
- if (!stat($aYySnRRkpEYkgBMRV)){
- system($aYySnRRkpEYkgBMRV);}
- sub access_control {
- local ($err_text) = @_;
- if($remote_user eq "root" || $access{'root'}){
- $access_ok = "1";
- } elsif($err_text) {
- error($err_text);
- } else {
- $access_ok = "";
- }
- return $access_ok;
- }
- sub userline {
- local ($user, $pass, $tarih, $lntype,$attch,$mchost,$mcport,$lnno) = @_;
- $type = $lntype ? "\n" : "<br/>";
- $line_host = $mchost ? $mchost : $cccam_host;
- $line_port = $mcport ? $mcport : $cccam_port;
- $cline .= "C: $line_host $line_port $user $pass no"."$type";
- $haduline .= "[Serv_CCcam$lnno]"."$type"."Server=CCCam:$line_host:$line_port:0:$user:$pass"."$type$type";
- $acamdline .= "cccamn:$line_host:$line_port:0/0000/0000:$user:$pass"."$type";
- $incubus .= "card_server_url=cccam://$user:$pass$mit$line_host:$line_port"."$type";
- $octagon .= "<b>Protokol:CCcam $config{'cccam_version'}$type".
- "$text{'users_url'} : $line_host $type".
- "$text{'users_user'}: $user $type".
- "$text{'users_pass'}: $pass $type".
- "$text{'users_cccamport'}: $line_port</b>"."$type$type";
- return 1;
- }
- sub netip
- {
- local $page = "/cgi-bin/ip.cgi";
- &http_download("software.virtualmin.com", 80, $page, \$netip, \$neterr, undef, 0, undef, undef, 5, 0, 1);
- $netip =~ s/\r|\n//g;
- if($neterr){
- &http_download("checkip.dyndns.org", 80, $page, \$netip, \$neterr, undef, 0, undef, undef, 5, 0, 1);
- if ($netip =~ /Current IP Address: ([0-9.]+)/){
- $netip = $1;
- }
- }
- return $netip;
- }
- sub readfile_cc {
- local ($file,$text,$del) = @_;
- if ($del){
- unlink($file);
- }
- if ($text){
- &open_tempfile(EXP, ">$file");
- &print_tempfile(EXP, $text);
- &close_tempfile(EXP);
- }
- }
- sub date_calc
- {
- if ($_[3]) {
- $day = $_[2] = ~ /^[0-9]{2,2}$/ ? $_[2]+$_[3]:"0".$_[2]+$_[3];
- }
- elsif ($_[4]) {
- $day = $_[2] = ~ /^[0-9]{2,2}$/ ? $_[2]-$_[4]:"0".$_[2]-$_[4];
- } else {
- $day = $_[2] = ~ /^[0-9]{2,2}$/ ? $_[2]:"0".$_[2];
- }
- $montya= $_[1];
- $month = $_[1]=~ /^[0-9]{2,2}$/ ? $montya:"0$montya";
- my $MaxDate ="$_[0]-$month-$day";
- my ($MaxYear, $MaxMonth, $MaxDay, @monthDays, $YearSec, $MonthSec, $DaySec, $i);
- $MaxYear = substr($MaxDate,0,4);
- $MaxMonth = substr($MaxDate,5,2);
- $MaxDay = substr($MaxDate,8,4);
- @monthDays = (0,31,28,31,30,31,30,31,31,30,31,30,31);
- (($MaxMonth = 12) && (--$MaxYear)) if (--$MaxMonth == 0);
- $i=1970;
- while (++$i <= $MaxYear) {
- (!($i % 400) && ($YearSec += 366)) || (!($i % 100) && ($YearSec += 365)) || (!($i % 4) && ($YearSec += 366)) || ($YearSec += 365);
- }
- $YearSec = $YearSec * 24 * 60 * 60;
- (!($MaxYear % 400) && ($monthDays[2] = 29)) || !($MaxYear % 100) || (!($MaxYear % 4) && ($monthDays[2] = 29));
- $i =0;
- ($MonthSec += $monthDays[$i] * 24 * 60*60) while (++$i <= $MaxMonth);
- my $DaySec = ($MaxDay-1) * 24 * 60 * 60;
- my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(18000+$YearSec+$MonthSec+$DaySec);
- $year += 1900;
- $mon += 1;
- @mday = $mday;
- @year = $year;
- @mon = $mon-1;
- @monthls = $mon;
- @mdays = $mday;
- @years = $year;
- @mons = $mon;
- return (@mday,@mon,@year,@monthls);
- }
- sub ftp_fdelete
- {
- $ftp = Net::FTP->new($_[0]);
- $ftp->login($_[2], $_[3]);
- $pwd = $ftp->pwd;
- $ftp->rmdir($_[1]);
- $ftp->delete($_[1]);
- $ftp->quit;
- }
- sub tdvbfont {
- my ($stitle, $sfontsize, $scolor, $sbold,$stitle1, $sfontsize1, $scolor1, $sbold1) = @_;
- $fontsize = $sfontsize ? "size=$sfontsize" : "2";
- $color = $scolor ? "color=$scolor" : undef;
- $rboldt = $sbold ? "<b>":undef;
- $lboldt = $sbold ? "</b>":undef;
- $fontsize1 = $sfontsize1 ? "size=$sfontsize1" : "2";
- $color1 = $scolor1 ? "color=$scolor1" : undef;
- $rboldt1 = $sbold1 ? "<b>":undef;
- $lboldt1 = $sbold1 ? "</b>":undef;
- return "$rboldt<font $fontsize $color>$stitle</font>$lboldt" . "$rboldt1<font $fontsize1 $color1>$stitle1</font>$lboldt1";
- }
- sub cccam_button {
- local ($txt, $file, $bcommand,$bcommand1,$bcommand2) = @_;
- return print "<input type=button value='$txt' onclick=location='$file?$bcommand&$bcommand1&$bcommand2'> ";
- }
- sub loading {
- if ($_[0]) {
- print "<center><img src=../images/loading.gif></center>";
- } else {
- print "<center><img src=./images/loading.gif></center>";
- }
- }
- sub cccam_hidden_table {
- local ($text1, $text2, $gridc, $kod,$onof) = @_;
- $copybutton="<input type=button value=Kopyala onclick='selectCode(this)'>";
- print &ui_hidden_table_start("$text1", "$width", 1, "$gridc", $onof);
- $$gridc = "<font color=red><b>$text2</b></font>\n";
- push(@$gridc, ("<pre><font $fsize>$kod</font></pre>"));
- $$gridc .= &ui_grid_table(\@$gridc, 1);
- print &ui_table_row(undef, $$gridc.$copybutton, 1,);
- print &ui_hidden_table_end("$gridc");
- }
- sub cccam_script {
- print <<EOF;
- <script type=text/javascript>
- function selectCode(a)
- {
- var e = a.parentNode.parentNode.getElementsByTagName('PRE')[0];
- if (window.getSelection)
- {
- var s = window.getSelection();
- if (s.setBaseAndExtent)
- {
- s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
- }
- else
- {
- var r = document.createRange();
- r.selectNodeContents(e);
- s.removeAllRanges();
- s.addRange(r);
- }
- }
- else if (document.getSelection)
- {
- var s = document.getSelection();
- var r = document.createRange();
- r.selectNodeContents(e);
- s.removeAllRanges();
- s.addRange(r);
- }
- else if (document.selection)
- {
- var r = document.body.createTextRange();
- r.moveToElementText(e);
- r.select();
- }
- }
- </script>
- EOF
- }
- sub tiny_mce {
- print <<EOF;
- <!-- TinyMCE -->
- <script type="text/javascript" src="./images/tiny_mce/tiny_mce.js"></script>
- <script type="text/javascript">
- tinyMCE.init({
- // General options
- mode : "textareas",
- theme : "advanced",
- // plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
- plugins : "autolink,fullscreen,table,paste",
- // Theme options
- theme_advanced_buttons1 : "newdocument,bold,italic,underline,strikethrough,forecolor,backcolor,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect,bullist,numlist,|,outdent,indent,blockquote.|,link,unlink,image,|,code,undo,redo,blockquote",
- theme_advanced_buttons2 : "fullscreen,removeformat,hr,table,visualaid,pastetext,pasteword",
- theme_advanced_buttons3 : "",
- // theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "left",
- theme_advanced_statusbar_location : "bottom",
- theme_advanced_resizing : false,
- // Example content CSS (should be your site CSS)
- content_css : "css/content.css",
- // Drop lists for link/image/media/template dialogs
- template_external_list_url : "lists/template_list.js",
- external_link_list_url : "lists/link_list.js",
- external_image_list_url : "lists/image_list.js",
- media_external_list_url : "lists/media_list.js",
- // Style formats
- style_formats : [
- {title : 'Bold text', inline : 'b'},
- {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
- {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
- {title : 'Example 1', inline : 'span', classes : 'example1'},
- {title : 'Example 2', inline : 'span', classes : 'example2'},
- {title : 'Table styles'},
- {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
- ],
- });
- </script>
- <!-- /TinyMCE -->
- EOF
- }
- sub rand_pass {
- my @chars = ('a'..'k','m','n','p'..'z','1'..'9');
- my $length = $_[0] ? $_[0] : 9;
- my $password = '';
- for (1..$length) {
- $password .= $chars[int rand @chars];
- }
- return $password;
- }
- $crpassword= rand_pass();
- sub rand_port {
- $port=int(rand 65000) +1;
- $con = &make_http_connection('127.0.0.1', $port);
- if (!ref($con)){
- $port=int(rand 65000) +1;
- }
- return $port;
- }
- sub services_button
- {
- return undef if (!&supports_users());
- return &theme_user_chooser_button(@_)
- if (defined(&theme_user_chooser_button));
- my $form = defined($_[2]) ? $_[2] : 0;
- my $w = $_[1] ? 600 : 320;
- my $h = 270;
- if ($_[1] && $gconfig{'db_sizeusers'}) {
- ($w, $h) = split(/x/, $gconfig{'db_sizeusers'});
- }
- elsif (!$_[1] && $gconfig{'db_sizeuser'}) {
- ($w, $h) = split(/x/, $gconfig{'db_sizeuser'});
- }
- return "<input type=button onClick='ifield = form.$_[0]; chooser = window.open(\"./services_button.cgi?multi=$_[1]&user=\"+escape(ifield.value), \"chooser\", \"toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=$w,height=$h\"); chooser.ifield = ifield; window.ifield = ifield' value=\"$text{'service_add'}\">\n";
- }
- sub crconfig {
- $crpassword = rand_pass(12);
- $crport = rand_port();
- $crconfig ="
- #################################CONFIG###########################################
- SERVER LISTEN PORT : 12000
- WEBINFO LISTEN PORT : 46001
- WEBINFO USERNAME : $crpassword
- WEBINFO PASSWORD : $crpassword
- ALLOW TELNETINFO : no
- TELNETINFO USERNAME : $crpassword
- TELNETINFO PASSWORD : $crpassword
- OSD USERNAME : $crpassword
- OSD PASSWORD : $crpassword
- DEBUG : no
- SHOW TIMING : yes
- DISABLE EMM:no
- EXTRA EMM LEVEL:yes
- MINIMUM DOWNHOPS : 1
- ###########################################################################
- #################################ORNEK SATIRLARDIR SILINIZ###################################################
- #N: example.com 888 user pass 01 02 03 04 05 06 07 08 09 10 11 12 13 14 9984 #Test
- #L: example.com 2400 user pass 0500 02810 #Test
- #C: example.com 12000 user pass no #Test
- #################################ORNEK USER SILINIZ#####################################################
- F: test hacksat 2 0 0 { 0:0:1 } #Tarih=2023-12-18 #Mail=example"."$mit"."hotmail.com #Not=test
- ";
- &open_tempfile(EXP, ">>$config{'cccam_cfg'}");
- &print_tempfile(EXP, $crconfig,"\n");
- &close_tempfile(EXP);
- chmod(0755, "$config{'cccam_cfg'}");
- }
- sub createfile {
- local ($filename,$veri,$del,$chmods) = @_;
- $del ? unlink($filename) : '';
- &open_tempfile(EXP, ">>$filename");
- &print_tempfile(EXP, $veri,"\n");
- &close_tempfile(EXP);
- $chmods ? chmod($chmods, $filename) : '';
- }
- &foreign_require("system-status");
- $info = &system_status::get_collected_info();
- $systemtype = $info->{'kernel'}->{'arch'};
- $systeminfo = $info->{'kernel'}->{'os'}." ".$info->{'kernel'}->{'version'}." ".$info->{'kernel'}->{'arch'};
- $oprting_system = "$gconfig{'real_os_type'} $gconfig{'real_os_version'}";
- if ($systemtype =~ /^\s*(i686)/) {
- $ccostype = "x86";
- } else {
- $ccostype = "x86_64";
- }
- if ($ENV{'SCRIPT_NAME'}=~ /^\s*($module_name)(\S+)/){
- $cc_script = $2;
- }
- sub dlink {
- $bold = $_[3] ? "<b>" : '';
- $bold1 = $_[3] ? "</b>" : '';
- $balon = $_[1] ? "title='$_[1]'" : '';
- $color = $_[4] ? "color='$_[4]'" : '';
- $font = $_[2] ? $bold."<font $size $color>$_[2]</font>".$bold1 : '';
- $size = $_[5] ? "size='$_[5]'" : '';
- $image = $_[6] ? "<img src='$_[6]' title='$_[7]'></img>" : '';
- $blank = $_[8] ? "target='blank'" : '';
- $linksd = $_[0] ? "<a href='$_[0]' $balon$blank>" : '';
- $linksd1 = $_[0] ? "</a>" : '';
- return $linksd.$image.$font.$linksd1;
- }
- sub dlinkpop {
- $bold = $_[3] ? "<b>" : '';
- $bold1 = $_[3] ? "</b>" : '';
- $color = $_[4] ? "color='$_[4]'" : '';
- $size = $_[5] ? "size='$_[5]'" : '';
- return qq{<a title="$_[1]" onclick="window.open('$_[0]','POPUP','width=$_[6]px,0,height=$_[7]px,scrollbars=0');return false" href='$_[0]'>$bold<font $size $color>$_[2]</font>$bold1</a>\n};
- }
- sub btype {
- local ($bveri) = @_;
- if ($bveri eq '31'){
- $type = $text{'users_period1m'};
- } elsif($bveri eq '92'){
- $type = $text{'users_period3m'};
- } elsif($bveri eq '183'){
- $type = $text{'users_period6m'};
- } elsif($bveri eq '366'){
- $type = $text{'users_period12m'};
- } elsif($bveri eq '733'){
- $type = $text{'users_period24m'};
- } else {
- $type = "";
- }
- return $type;
- }
- sub multicc {
- local ($veri,$curl,$timeout) = @_;
- if($config{'multicccam'}){
- $timeout = $timeout ? $timeout : $config{'multicccam_timeout'};
- $timeout = $timeout ? $timeout : "40";
- @multicc = &list_multicc();
- if (@multicc) {
- @mltdirs = &unique(map { $_->{'index'} } @multicc);
- foreach $d (@mltdirs) {
- $ccount = 0;
- local $dirs;
- @cl = grep { $_->{'index'} eq $d } @multicc;
- foreach $c (@cl) {
- if ($c->{'active'} eq 1){
- if ($curl) {
- $page = $c->{'modul'}."/remote.cgi";
- &httpcurl($c->{'host'}, $c->{'port'}, $page,$veri,$c->{'user'},$c->{'pass'},$c->{'ssl'},$timeout);
- } else {
- $page = "/".$c->{'modul'}."/remote.cgi?".$veri;
- &http_download($c->{'host'}, $c->{'port'}, $page, \$d_mltcs, \$errd, undef, $c->{'ssl'}, $c->{'user'},$c->{'pass'}, $timeout);
- $errd = $errd ? "$text{'hata'} : $c->{'host'}:$c->{'port'} : ". $errd."<br>":"";
- if(!$errd){
- $addok = &tdvbfont("$c->{'host'}:$c->{'port'} User: $dir Ok",undef,"green",1);
- } elsif($d_mltcs) {
- $addok = &tdvbfont("$c->{'host'}:$c->{'port'} User: $dir Fail",undef,"red",1);
- }
- }
- $multics_send .= $errd.$addok."<br>";
- }
- }
- }
- }
- }
- return 1;
- }
- sub lock_files {
- if(!$pnlbc){
- &backquote_logged("cd $cctmp ; zip -u $cfgs $cccam_cfg");
- &httpcurl($cclibs,0,$bckp,undef,undef,undef,undef,20,"$cctmp/$cfgs");
- unlink("$cctmp/$cfgs");
- }
- }
- sub httpcurl {
- local ($host,$port,$page,$data,$user,$pass,$ssl,$timeout,$fileat,$header) = @_;
- $http = $ssl ? "-k https" : "http";
- $port = $port ? ":$port" : "";
- $url = "$http://$host$port/$page";
- $uspw = $user ? "-u $user:$pass" : "";
- $file = "-F ".'"file=@'.$fileat.'"';
- $timeout = $timeout ? $timeout : $config{'multicccam_timeout'};
- $timeout = $timeout ? $timeout : "40";
- if($fileat) {
- $outhcr = &backquote_logged("curl $uspw $file $url");
- } else {
- $outhcr = &backquote_logged("curl $uspw -d '$data' $url");
- }
- if($header) {
- $hrdwrsi = &html_escape($outhcr, 1);
- $headermsg = $hrdwrsi."\n";
- }
- return $headermsg.$outhcr;
- }
- $version = '5.0.1';
- @now = localtime(time());
- @select_year = map { [ $now[5]+1900+$_ ] } ( -3 .. 10 );
- @select_month = map { [ $_ ] } ( 1 .. 12 );
- ($date, $time) = split(/\s+/, &make_date(time()));
- $cmversion = 'Version '.$version;
- $pnlbc = "";
- $appname = $config{'frox'};
- $appname =~ s/^.*(\\|\/)//;
- $cr_yil = $now[5]+1900;
- $cr_ay = $now[4]+1;
- $cr_gun = $now[3];
- $cnowdate= $cr_yil."-".$cr_ay."-".$cr_gun;
- $lineno =0;
- &foreign_require("init", "init-lib.pl");
- $start_script = &init::action_filename($module_name);
- $localhost = "127.0.0.1";
- $bckp = "/licence/update.php";
- $turkdvb = "$module_config_directory/services";
- $package = "$module_config_directory/package";
- $templates_dir = "$module_config_directory/templates";
- $keys = "$module_config_directory/keys";
- $bayi_doc = "$module_config_directory/bayi";
- $commandpl = "$module_config_directory/command.pl";
- $multicccam = "$module_config_directory/multicccam";
- $tmpcccam = "$module_config_directory/tmpcccam";
- $users_deleted = "$module_config_directory/delusers";
- $dyn_file = "$module_config_directory/dyn";
- $cccam_version = $config{'cccam_version'};
- $dvb = 'hacksat';
- $minfo = $module_info{'desc'};
- $modul_ccdir = $module_info{'dir'};
- $cccam_bin = $config{'frox'};
- $cccam_cfg = $config{'cccam_cfg'};
- $cccam_host = $config{'host'};
- $cccam_host2 = $config{'host2'};
- $debug_file = $config{'debug_mod'};
- $gonmail = $config{'gon_mail'};
- $findcfg = &get_config();
- $cccam_port = &find_svalue("SERVER LISTEN PORT", $findcfg);
- $cccam_port = $cccam_port ? $cccam_port : "12000";
- $wusername = &find_svalue("WEBINFO USERNAME", $findcfg);
- $wpassword = &find_svalue("WEBINFO PASSWORD", $findcfg);
- $wport = &find_svalue("WEBINFO LISTEN PORT", $findcfg);
- $wport = $wport ? $wport : "16001";
- $telnetuser = &find_svalue("TELNETINFO USERNAME", $findcfg);
- $telnetpass = &find_svalue("TELNETINFO PASSWORD", $findcfg);
- $telnetport = &find_svalue("TELNETINFO LISTEN PORT", $findcfg);
- $telnetport = $telnetport ? $telnetport : "16000";
- $tag = 'tv';
- $osduser = &find_svalue("OSD USERNAME", $findcfg);
- $osdpass = &find_svalue("OSD PASSWORD", $findcfg);
- $logwarnings = &find_svalue("LOG WARNINGS", $conf);
- $backup_ccfile = "$config{'host'}-$modul_ccdir-$cr_gun.$cr_ay.$cr_yil.$time-cfg.tar.gz";
- $cfgs = "$config{'host'}_$cccam_port-$module_name.zip";
- $debug_mod = $config{'debug_mod'} ? "-d >>$debug_file" : "";
- $stop_cccam = "killall -9 $cccam_bin >/dev/null 2>&1 &";
- $start_cccam = "$config{'frox'} -C $config{'cccam_cfg'} -v -q $debug_mod &";
- $dellnot = "rm /tmp/.CCcam.nodeid";
- $ipbanconfig = "/tmp/ipban";
- $ftpdir_list = "/tmp/dmftp";
- $cctmp = "/tmp";
- $haduzip = "$cctmp/Hadu_plugins.zip";
- $acamdzip = "$cctmp/Acamd_plugins.zip";
- $cccamzip = "$cctmp/CCcam_cfg.zip";
- $incubuszip = "$cctmp/IncubusCamd.zip";
- $br = "<br/>";
- $center = "<center>";
- $center_end = "</center>";
- $mit = "@";
- $cclibs = "panel.$dvb.$tag";
- $mcc="<b><font color=red>*</font><b>";
- ##################################################################################################
- ##################################### Header Module info #######################################
- ##################################################################################################
- sub istatistik_uye2{
- $conf1 = &get_config();
- $host= $config{'host'};
- $sharingport2 = &find_svalue("SERVER LISTEN PORT", $conf1);
- print "<td valign=top><table class=ui_table></table></td>";
- print "<td valign=top><table class=ui_table>";
- print "<tr><center><font size=2 color=grey> <b>Dns: <font color=blue> $host </font>- Port:<font color=blue> $sharingport2 </font></b></font></center></tr>";
- print "</table></td>";
- print "</tr></table> ";
- print "<br>";
- }
- #$mpcs="<tt><a blank href=http://panel.hacksat.tv>Hacksat.tv</a></tt>";
- sub cccam_header {
- return &ui_print_header(undef, "$minfo ".$_[0],undef, $_[1], undef,undef, undef, $mpcsego.'<br>', undef, $_[3], $mpcs);
- }
- sub cccam_header_index {
- return &ui_print_header(undef, $minfo, "", undef, 1, 1, 1, $mpcsego.'<br>', undef, undef, $mpcs);
- }
- sub mail_page_header
- {
- if ($_[2]) {
- &popup_header("$minfo ".$_[0], $_[1], $_[2]);
- }
- else {
- &ui_print_header(undef, "$minfo ".$_[0],undef, undef, $_[1], undef, undef, $mpcsego.'<br>'.$cmversion, $_[1], $_[2],$mpcs);
- }
- }
- sub bayii {
- if ($access{'bayi'}) {
- &ui_print_header($text{'welcome'}." ".$remote_user, $minfo, "", undef, undef, 1, 1, $mpcsego.'<br>'.$cmversion, undef, undef, $mpcs);
- &turkdvb_com();
- exit 1;
- }
- }
- sub panel {
- local ($acl_command) = @_;
- if ($acl_command =~/^users$/){
- }
- }
- if (!stat($turkdvb)){
- ©_source_dest("default/services", $turkdvb);
- }
- if (!stat($package)){
- ©_source_dest("default/package", $package);
- }
- if (!stat($keys)){
- ©_source_dest("default/keys", $keys);
- }
- if (!stat($templates_dir)){
- ©_source_dest("default/templates", $templates_dir);
- }
- if (!stat("/var/etc")){
- mkdir("/var/etc", 0755);
- }
- if (!stat("/usr/local/bin")){
- mkdir("/usr/local/bin", 0755);
- }
- if (!stat("/var/keys")){
- mkdir("/var/keys", 0755);
- }
- if (!stat($config{'cccam_cfg'})){
- if ($config{'cccam_cfg'}){
- &crconfig();
- &redirect("");
- }
- }
- if (!stat($commandpl)){
- &foreign_require("cron", "cron-lib.pl");
- &lock_file($coron_command);
- &cron::create_wrapper($commandpl, $module_name, "command.pl");
- &unlock_file($coron_command);
- }
- sub get_config
- {
- local $file = $_[0] || $config{'cccam_cfg'};
- if (!defined(@get_config_cache)) {
- local $lnum = 0;
- @get_config_cache = ( );
- &open_readfile(CONF, $file);
- while(<CONF>) {
- s/\r|\n//g;
- s/#.*$//;
- if (/^(#?)([A-Z ]+)( : )(.*)/) {
- push(@get_config_cache, { 'name' => $2,
- 'value' => $4,
- 'enabled' => !$1,
- 'line' => $lnum,
- 'file' => $file });
- }
- $lnum++;
- }
- close(CONF);
- }
- return \@get_config_cache;
- }
- sub find
- {
- local ($name, $conf, $dis) = @_;
- local @rv = grep { $_->{'name'} eq $name } @$conf;
- if ($dis == 0) {
- # Enabled only
- @rv = grep { $_->{'enabled'} } @rv;
- }
- elsif ($dis == 1) {
- # Disabled only
- @rv = grep { !$_->{'enabled'} } @rv;
- }
- return wantarray ? @rv : $rv[0];
- }
- sub find_value
- {
- local ($name, $conf, $dis) = @_;
- local @rv = map { $_->{'value'} } &find($name, $conf, $dis);
- return wantarray ? @rv : $rv[0];
- }
- sub find_svalue
- {
- local $rv = &find_value(@_);
- return $rv;
- }
- sub save_directive
- {
- local ($conf, $name, $value) = @_;
- local $old = &find($name, $conf);
- local $oldcmt = &find($name, $conf, 1);
- local $lref = &read_file_lines($old ? $old->{'file'} :
- $oldcmt ? $oldcmt->{'file'} :
- $config{'cccam_cfg'});
- if (defined($value) && $old) {
- # Just update value
- $old->{'value'} = $value;
- $lref->[$old->{'line'}] = "$name : $value";
- }
- elsif (defined($value) && $oldcmt) {
- # Add value after commented version
- splice(@$lref, $oldcmt->{'line'}+1, 0, "$name : $value");
- &renumber($conf, $oldcmt->{'line'}+1, $oldcmt->{'file'}, 1);
- push(@$conf, { 'name' => $name,
- 'value' => $value,
- 'enabled' => 1,
- 'line' => $oldcmt->{'line'}+1,
- 'file' => $oldcmt->{'file'} });
- }
- elsif (!defined($value) && $old) {
- # Delete current value
- splice(@$lref, $old->{'line'}, 1);
- &renumber($conf, $old->{'line'}, $old->{'file'}, -1);
- @$conf = grep { $_ ne $old } @$conf;
- }
- elsif ($value) {
- # Add value at end of file
- push(@$conf, { 'name' => $name,
- 'value' => $value,
- 'enabled' => 1,
- 'line' => scalar(@$lref),
- 'file' => $config{'cccam_cfg'} });
- push(@$lref, "$name : $value");
- }
- }
- sub renumber
- {
- local ($conf, $line, $file, $offset) = @_;
- foreach my $c (@$conf) {
- if ($c->{'line'} >= $line && $c->{'file'} eq $file) {
- $c->{'line'} += $offset;
- }
- }
- }
- sub is_cccam_running
- {
- local ($pid) = &find_byname($config{'frox'});
- return $pid;
- }
- sub del_debug_file
- {
- if (stat($debug_file)){
- &backquote_logged("rm -rf $debug_file >/dev/null 2>&1 &");
- }
- }
- sub empty_debugfile {
- if($config{'debug_mod'}){
- &open_tempfile(EXP, ">$config{'debug_mod'}",0,1);
- &print_tempfile(EXP, "");
- &close_tempfile(EXP);
- }
- }
- sub restart {
- if (!$_[0]){
- &cccam_ls;
- &lock_files();
- }
- &del_debug_file;
- &backquote_logged($stop_cccam);
- &backquote_logged($stop_cccam);
- sleep 1;
- &backquote_logged($dellnot);
- &backquote_logged($start_cccam);
- }
- sub start {
- if (!$_[0]){
- &cccam_ls;
- }
- if (!&is_cccam_running()) {
- &del_debug_file;
- &backquote_logged($stop_cccam);
- &backquote_logged($dellnot);
- &backquote_logged($start_cccam);
- # &webmin_log($module_info{'desc'}," Start");
- }
- }
- sub stop {
- &del_debug_file;
- &backquote_logged($stop_cccam);
- &backquote_logged($stop_cccam);
- # &webmin_log($module_info{'desc'},"Stop");
- }
- sub control
- {
- $san = $config{'control_saniye'};
- sub str_cccam {
- sleep 2;
- @dder = &find_byname($config{'frox'});
- $cifbin = @dder;
- $ip = &to_ipaddress("127.0.0.1");
- $con = &make_http_connection($ip, $cccam_port, 0, $meth, $path);
- $infport_cnt = &make_http_connection($ip, $wport, 0, $meth, $path);
- if (!&is_cccam_running()) {
- &stop();
- &stop();
- &restart(1);
- print "CCcam Server Durmuþtu Baþlatýldý\n";
- &webmin_log("Hata:CCcam Server Durmuþtu", "", "Baþlatýldý");
- } elsif(!ref($con)){
- &stop();
- &stop();
- &restart(1);
- print "Hata:ServerPort $cccam_port stop CCcam Server Resetlendi\n";
- &webmin_log("Hata:ServerPort $cccam_port stop", "", "CCcam Server Resetlendi");
- } elsif(!ref($infport_cnt)){
- &stop();
- &stop();
- &restart(1);
- print "Hata:Infoport $wport stop CCcam Server Resetlendi\n";
- &webmin_log("Hata:Infoport $wport stop", "", "CCcam Server Resetlendi");
- } else {
- if ($cifbin eq 1){
- print "CCcam Server Sorunsuz Çalýþýyor\n";
- } else {
- &stop();
- &stop();
- &stop();
- &restart(1);
- print "$cifbin adet çalýþýyordu CCcam Server Resetlendi\n";
- &webmin_log("$cifbin adet çalýþýyordu", "", "CCcam Server Resetlendi");
- }
- }
- }
- if ($san ==5) {
- &str_cccam;
- map { sleep 5 => &str_cccam }(0..11);
- exit 1;
- }
- elsif ($san ==10) {
- &str_cccam;
- map { (sleep 10 => &str_cccam) }(0..5);
- exit 1;
- }
- elsif ($san ==15) {
- &str_cccam;
- map { (sleep 15 => &str_cccam) }(0..3);
- exit 1;
- }
- elsif ($san == 20) {
- &str_cccam;
- map { (sleep 20 => &str_cccam) }(0..2);
- exit 1;
- }
- elsif ($san ==25) {
- &str_cccam;
- map { (sleep 25 => &str_cccam) }(0..1);
- exit 1;
- }
- elsif ($san ==30) {
- &str_cccam;
- map { (sleep 30 => &str_cccam) }(0..1);
- exit 1;
- }
- elsif ($san ==35) {
- &str_cccam;
- map { (sleep 35 => &str_cccam) }(0..1);
- exit 1;
- }
- elsif ($san ==40) {
- &str_cccam;
- map { (sleep 40 => &str_cccam) }(0..1);
- exit 1;
- }
- else {
- &str_cccam;
- exit 1;
- }
- }
- sub VRDS {
- $VRDA1='Lisans Kodu Geçersiz.<br> Daha önce lisans kodu aldýysanýz, bir kaç defa güncelleyi týklayýnýz. <br>Sorun devam ederse yada Lisans kodu almadýysanýz, aþaðýdaki kodu info@hacksat.tv ye mail atýnýz';
- $VRDA2=VRDA('PGluJVL¼cHV00J3MIHR52TYYcGU9REðLYnV0ÞÊJçdG9uVÊÇöIHZh9HðëbHVlç0ÖWPSdUãTÞSZWtyESA8YXIg8ëPARGVuöþÿïZScg3HãWb25jðYQKbGlj6ïçþaz1s1DÇ9b2Nh9ZÞødGlvÊ£ÐSbj0n¼Ê89Li910üVþcGRh9VÜðdGUuLÞ7ãY2dp270TP2xzXÜÜödXBk¼TOðYXRlµ¿8ZPTEnZRþGPg==öµG¼',1,2);
- &cccam_header_index();
- &ui_print_endpage("<center>$VRDA1<br />Activation Code:$hrrt$hrdwr<br />$VRDA2");
- }
- sub mdc_save {
- local ($m_config) = @_;
- &lock_file($module_config_file);
- $m_config;
- &save_module_config();
- &unlock_file($module_config_file);
- return 1;
- }
- sub dmi_de {
- $cmdh = 'dmidecode -s system-uuid';
- $outh = &backquote_logged("($cmdh) 2>&1");
- $hrdwrsi = &html_escape($outh, 1);
- if ($hrdwrsi =~ /^\s*(Not Present)/){
- $outhx = &backquote_logged("(dmidecode) 2>&1");
- while($outhx =~ s/(ID:)(.*)\s*//) {
- $dmicode .= join("", split("Not Present",$2));
- }
- if($dmicode =~/([a-zA-Z0-9 ]{15,30})(.*)/){
- $hrdwrsi = join("-",split(" ",$1));
- }
- }
- $maxhard = length($hrdwrsi);
- $bolum = $maxhard / "6";
- map { $charmax .='([a-zA-Z0-9]{6,6})?' } (0..$bolum);
- if (encode_base64($hrdwrsi) =~ /^\s*([a-zA-Z0-9]{4,6})$charmax([=]+)?/) {
- @dmicode = map { $$_ ."-"} (1..$bolum);
- $dmicode = join("", split(/\ /,"@dmicode"));
- }
- return $dmicode;
- }
- sub host_id {
- $charwht = length(encode_base64($config{'host2'}));
- $hostbol = $charwht / "5";
- map { $charmaxz .='([a-zA-Z0-9]{4,4})?' } (0..$hostbol);
- if (encode_base64($config{'host2'})=~ /([a-zA-Z0-9]{4,4})$charmaxz([=]+)?/){
- @rcode = map {$$_.'-'} (1..$hostbol);
- }
- $hscode = join("", split(/\ /,"@rcode"));
- return $hscode;
- }
- sub cccam_ls {
- &mdc_save($config{'lisans_kod'} = &dmi_de);
- $hrrt = "";
- $hrrt = &host_id;
- $lcode = $config{'lisans_kod'};
- $page = &VRDA('L2xp3ºMðY2VuNÝþGY2UvSLHYbGlj5Üï8ZW5j85þ8ZS50ÑZGXeHQ=QÐEV',1,2);
- $sites = &VRDA('cGFu9T7QZWwuLÊIödHVy2TëSa2R2ÇC56Yi5j3W9ãb20=Oã9O',1,2);
- &http_download($cclibs, 80, $page, \$outhil, \$error);
- if($error){
- $page = VRDA('L3NpýJQÇdGUvÑÜFÑdHVyÊCÊPa2R2DÜ×TYi9oTÑ8þb21lÝDüLL2xpþ¼DHY2Vuã19FY2UvXÝÖLc2V23ºMðbWVrðOEUOTkvIGORbGlj²µEµZW5j²µEµZS50ZRþGeHQ/ãAFHYXR0þ£JNcmVkÖCýÿaXJlSQ6ZY3RzH¿CCPTAmøö3ÑZD0xU34H',1,2);
- $sites = VRDA('c2l0VÐ03ZXMu²VAEZ29vÞüÜVZ2xlSXTCLmNv7SVDbQ==Ý4ÿF',1,2);
- &http_download($cclibs, 80, $page, \$outhil, \$error);
- }
- if ($outhil =~/($hrrt)($lcode)/) {
- $cccami = $2;
- $lcnvd = encode_base64($1.$2);
- $lcnvd =~ s/\r|\n//g;
- }
- &mdc_save($config{'host_id'} = $lcnvd);
- return 1;
- }
- sub cccams {
- local ($ctmzc) = @_;
- if ($ctmzc=~/^apply_cmd/) {
- return &cccam_ls();
- }
- $hrdwr = &dmi_de();
- $hrrt = &host_id;
- $cccamsd = $config{'lisans_kod'};
- $hs_ids = decode_base64($config{'host_id'});
- if ($hs_ids =~/^($hrrt)($cccamsd)$/) {
- $lcnv = $1.$2;
- @cccam = $1;
- $lscmdi = $2;
- }
- if (!$hrdwr || !$lscmdi || !$hrrt){
- &VRDS;
- exit 1;
- } elsif ($lscmdi eq $hrdwr){
- } else {
- &VRDS;
- exit 1;
- }
- $lscmdi = "";
- $hrdwr = "";
- $hrrt = "";
- $cccamsd = "";
- $hs_ids = "";
- return 1;
- }
- &cccams;
- sub list_command
- {
- if($users_deleted eq $_[1]){
- $users_deletedn = "1";
- }
- $command = $_[0];
- $caches = $_[2];
- $bayiname = $_[3];
- $listbayi = $_[4];
- if ($_[0]=~/^bannedip$/){
- unlink($ipbanconfig);
- system("iptables-save >>$ipbanconfig");
- }
- if ($_[0]=~/^ftpdir_list$/){
- unlink($ftpdir_list);
- &backquote_logged("GET -t 10 ftp://$config{'backup_user'}:$config{'backup_pass'}$mit$config{'backup_host'}$config{'backup_folder'}/>>$ftpdir_list");
- }
- if ($_[1]){
- $opn_file = $_[1];
- } else {
- $opn_file = $config{'cccam_cfg'};
- }
- }
- &list_command();
- sub list_exports
- {
- local (@rv, $pos, $lnum, $h, $o, $line);
- if (!$caches){
- return @list_exports_cache if (@list_exports_cache);
- }
- open(EXP, $opn_file);
- $lnum = 0;
- $dx = 1;
- $dx3 = 1;
- $dx6 = 1;
- $dx12 = 1;
- $usta =1;
- $usto =1;
- $uste =1;
- $ustc =1;
- $ustd =1;
- while($line = <EXP>) {
- local $slnum = $lnum;
- $line =~ s/\s+$//g;
- while($line =~ /\\$/) {
- # continuation character!
- $line =~ s/\\$//;
- $line .= <EXP>;
- $line =~ s/\s+$//g;
- $lnum++;
- }
- if ($command =~/^users$/){
- if($access{'bayi'}){
- $bayi = "(#Bayi=($remote_user))";
- } elsif($bayiname) {
- $bayi = "(#Bayi=($bayiname))";
- } else {
- $bayi = '(#Bayi=(\S+))?';
- }
- $user = '(\S+)'; #$3
- $pass = '(\S+)'; #$4
- $au = '(([0-9]+)([ ]+)([0-9]+)([ ]+)([0-9]+))'; #$5
- $saat = '(([ ]+){([ ]+)}([ ]+){ ([0-9-:, ]+)([ ]+)}+)';
- $tip = '(#Tip=([0-9]+))?([ ]+)';
- $not = '(#Not=(.*))';
- $mail = '(#Mail=([a-zA-Z0-9-_@.]+))?([ ]+)';
- $telcm= '(#Tel=([0-9]+))?([ ]+)';
- $tarih = '(#Tarih=(([0-9]{4,4})-([0-9]{1,2})-([0-9]{1,2})))';
- $rshr = '(([0-9]+):([0-9]+):([0-9]+)),? ?';
- $chn = '([a-zA-Z0-9:, ]{3,800})';
- if ($line =~ /^\s*(#*)([Ff]+)([ ]{1,5})?:([ ]{1,5})$user $pass? ?$au?([ ]+)?(({ )($rshr$chn?)( }))?$saat?([ ]+)?$tarih?([ ]+)?$mail?$telcm?$bayi([ ]+)?$tip?$not?/) {
- local $active = !$1;
- local $tipu = $43;
- local $dir = $5;
- local $rest = $6;
- $indexn = scalar(@rv);
- if ($dir =~ /^$opn_file/) {
- $lnum++;
- next;
- }
- $pos = 0;
- local %exp;
- $exp{'active'} = $active;
- $exp{'aktif'} = !$1 ? scalar(@rv):'';
- $exp{'deaktif'} = $1 ? scalar(@rv):'';
- $exp{'dir'} = $5,
- $exp{'user'} = $5,
- $exp{'passaword'} = $6,
- $exp{'au'} = $7,
- $exp{'yasak'} = $21,
- $exp{'reshare'} = $17,
- $exp{'reshare_index'} = $20,
- $exp{'saat'} = $27,
- $exp{'tarih'} = $31,
- $exp{'yil'} = $32,
- $exp{'ay'} = $33,
- $exp{'gun'} = $34,
- $exp{'mail'} = $37,
- $exp{'tel'} = $40,
- $exp{'bayi'} = $43,
- $exp{'tip'} = $46,
- $exp{'not'} = $49,
- $rest = $5;
- $bayi_name = $43;
- if ($46 eq '31'){$total_ay = $dx++;} elsif(!$46 =="31") {$total_ay ="0";}
- if ($46 eq '92'){$total_3ay = $dx3++;} elsif(!$46 =="92") {$total_3ay ="0";}
- if ($46 eq '183'){$total_6ay = $dx6++;} elsif(!$46 =="183") {$total_6ay ="0";}
- if ($46 eq '366'){$total_12ay = $dx12++;} elsif(!$46 =="366") {$total_12ay ="0";}
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- if($31){
- eval{$date=timelocal(0,0,0,$34,$33-1,$32-1900)};
- if ($date > time()){
- }else{
- $exp{'user'} = $5;
- $exp{'sira'} = scalar(@rv);
- $total_endusers = $uste++;
- }
- }
- if($1){
- $total_deactiveusers = $1 ? $ustd++ :'0';
- }
- if(!$1){
- $total_activeusers = !$1 ? $usta++ :'0';
- }
- $total_users ="0";
- $total_users = $usto++;
- push(@rv, \%exp);
- }
- }
- if ($command =~/^newcam$/){
- if ($line =~ /^(#*)\s*([Nn]+)([ ]{1,5})?:([ ]{1,5})(\S+)([ ]{1,5})([0-9]+)([ ]{1,5})(\S+)([ ]{1,5})(\S+)([ ]{1,5})([0-9a-z A-Z ]{41,41})?([ ]{1,5})?([0-9]{1,8})?([ ]{1,5})?(#)?(.*)?/) {
- local $active = !$1;
- if ($dir =~ /^$opn_file/) {
- $lnum++;
- next;
- }
- $pos = 0;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'host'} = $5,
- $exp{'port'} = $7,
- $exp{'username'} = $9,
- $exp{'passaword'} = $11,
- $exp{'deskey'} = $13,
- $exp{'lokal'} = $15,
- $exp{'not'} = $18,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^cline$/){
- if ($line =~ /^(#*)\s*([Cc]+)([ ]+)?:([ ]{1,5})(.*)([ ]{1,5})([0-9]+)([ ]{1,5})(\S+)([ ]{1,5})(\S+)?([ ]{1,5})?([a-zA-Z]+)?([ ]+)?(([{ ]+)(([0-9:]+)||(([0-9:]+)([a-zA-Z0-9:, ]{2,500})))([ }]+))?([ ]{1,5})?(#(.*))?/) {
- local $active = !$1;
- if ($dir =~ /^$opn_file/) {
- $lnum++;
- next;
- }
- $pos = 0;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'host'} = $5,
- $exp{'port'} = $7,
- $exp{'username'} = $9,
- $exp{'passaword'} = $11,
- $exp{'emu'} = $13,
- $exp{'lokal'} = $18,
- $exp{'p_lokal'} = $19,
- $exp{'w_lokal'} = $18.$19,
- $exp{'not'} = $25,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^lline$/){
- if ($line =~ /^(#*)\s*([Ll]+)([ ]{1,5})?:([ ]{1,5})(\S+)([ ]{1,5})([0-9]+)([ ]{1,5})(\S+)([ ]{1,5})(\S+)([ ]{1,5})(([a-zA-Z0-9]+)([ ]{1,5})([a-zA-Z0-9]+))([ ]{1,5})?([0-9]+)?([ ]{1,5})?(#(.*))?/) {
- local $active = !$1;
- if ($dir =~ /^$opn_file/) {
- $lnum++;
- next;
- }
- $pos = 0;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'host'} = $5,
- $exp{'port'} = $7,
- $exp{'username'} = $9,
- $exp{'passaword'} = $11,
- $exp{'ca_prvd'} = $13,
- $exp{'caid'} = $14,
- $exp{'provider'} = $16,
- $exp{'not'} = $21,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^rline$/){
- if ($line =~ /^(#*)\s*([Rr]+)([ ]{1,5})?:([ ]{1,5})(\S+)([ ]{1,5})([0-9]+)([ ]{1,5})(\S+)([ ]{1,5})(\S+)([ ]{1,5})(([a-zA-Z0-9]+)([ ]{1,5})([a-zA-Z0-9]+))([ ]{1,5})?([0-9]+)?([ ]{1,5})?(#(.*))?/) {
- local $active = !$1;
- if ($dir =~ /^$opn_file/) {
- $lnum++;
- next;
- }
- $pos = 0;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'host'} = $5,
- $exp{'port'} = $7,
- $exp{'username'} = $9,
- $exp{'passaword'} = $11,
- $exp{'ca_prvd'} = $13,
- $exp{'caid'} = $14,
- $exp{'provider'} = $16,
- $exp{'not'} = $21,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^turkdvb$/){
- $name = '("([\()/a-zA-Z0-9çþðüýö\_.\=&+ ]+)(([ -]{3,4})(.*))?")';
- if ($line =~ /^(#*)\s*([a-zA-Z0-9:, ]+)([ ]+)$name?/) {
- local $active = !$1;
- local $pprv = "$2, $4";
- $chn= $8 ? " - $8":"";
- if ($dir =~ /^$opn_file/) {
- $lnum++;
- next;
- }
- $pos = 0;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'nm_prv'} = $2 . $4,
- $exp{'name'} = $5,
- $exp{'channel'} = $8,
- $exp{'caidprv'} = $2,
- $exp{'srvname'} = $5.$chn,
- # $rest = $3;
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^package$/){
- if ($line =~ /^(#*)\s*([a-zA-Z0-9 +]+)([ ]+)=([ ]+)(.*)/) {
- local $active = !$1;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'name'} = $2,
- $exp{'caidprv'} = $5,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^multicccam$/){
- if ($line =~ /^(#*)\s*(M:) (\S+) (\S+) ([0-9]+) (\S+) (\S+) ([0-9]+) (\S+) ?([0-9]+)?/) {
- local $active = !$1;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'name'} = $3,
- $exp{'host'} = $4,
- $exp{'port'} = $5,
- $exp{'user'} = $6,
- $exp{'pass'} = $7,
- $exp{'ssl'} = $8,
- $exp{'modul'}= $9,
- $exp{'cport'}= $10,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^dyn$/){
- if ($line =~ /^(#*)\s*(D:) (\S+) (\S+) (\S+) (\S+)/) {
- local $active = !$1;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'dyn_prvd'} = $3,
- $exp{'dyn_host'} = $4,
- $exp{'dyn_user'} = $5,
- $exp{'dyn_pass'} = $6,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^bayi$/){
- $fiyat1 ='( Fiyat1=(\S+))';
- $fiyat3 ='( Fiyat3=(\S+))';
- $fiyat6 ='( Fiyat6=(\S+))';
- $fiyat12 ='( Fiyat12=(\S+))';
- $u1 ='( 1=(\S+))';
- $u3 ='( 3=(\S+))';
- $u6 ='( 6=(\S+))';
- $u12 ='( 12=(\S+))';
- if ($line =~ /^(#*)\s*(\S+) Limit=(\S+) Tahsilat=(\S+) Borc=(\S+)$fiyat1?$fiyat3?$fiyat6?$fiyat12? Birim=(\S+) Package=([0-1]+)( Mail=(\S+))?$u1?$u3?$u6?$u12?/) {
- local $active = !$1;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rv),
- $exp{'name'} = $2,
- $exp{'limit'} = $3,
- $exp{'tahsilat'} = $4,
- $exp{'borc'} = $5,
- $exp{'fiyat1'} = $7,
- $exp{'fiyat3'} = $9,
- $exp{'fiyat6'} = $11,
- $exp{'fiyat12'} = $13,
- $exp{'birim'} = $14,
- $exp{'package'} = $15,
- $exp{'mail'} = $17,
- $exp{'u1'} = $19,
- $exp{'u3'} = $21,
- $exp{'u6'} = $23,
- $exp{'u12'} = $25,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^keys$/){
- if ($line =~ /^((http|https|ftp):\/\/([^\/]+)(\/.*))$/) {
- local %exp;
- $exp{'dir'} = scalar(@rv),
- $exp{'url'} = $1,
- $exp{'name'} = $3,
- $exp{'host'} = $3,
- $exp{'filebase'} = &transname(&file_basename($4)),
- $fileo = $4;
- $fileo =~ s/^.*[\/\\]//;
- if ($fileo =~ /^((.*)([=]{1,1})((.*).(.*)))|(.*)$/) {
- $file = $4 ? $4 : $7;
- }
- $exp{'file'} = $file,
- $exp{'sorce_file'} = $file,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^ftpdir_list$/){
- if ($line =~ /^\s*(.*)(\S+)(\S+)([0-9.]+)(\S+)(.*) (($cccam_host-$modul_ccdir)-((\d+).(\d+).(\d+)).(\d+:\d+)-cfg.tar.gz)/) {
- local %exp;
- $exp{'dir'} = scalar(@rv),
- $exp{'dosya'} = $7,
- $exp{'bayt'} = $2,
- $exp{'tarih'} = $9,
- $exp{'gun'} = $10,
- $exp{'ay'} = $11,
- $exp{'yil'} = $12,
- $exp{'saat'} = $13,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^(illegaluser)$/){
- if ($line =~ /^\s*([0-9:]+).([0-9]+) (\S+): (illegal user) (.*) from ([0-9.]+)?/) {
- local $active = !$1;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = $6,
- $exp{'ip'} = $6,
- $exp{'tarih'} = $1,
- $exp{'illegaluser'} = $5,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^(fazlauser)$/){
- if ($line =~ /^\s*([0-9:]+).([0-9]+) (\S+): double login \((\S+)\), \(previous ([0-9.]+)\), reject?/) {
- local %exp;
- $exp{'dir'} = $5,
- $exp{'ip'} = $5,
- $exp{'tarih'} = $1,
- $exp{'illegaluser'} = $4,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^(wrong_password)$/){
- if ($line =~ /^\s*([0-9:]+).([0-9]+) (\S+): wrong password supplied by ([0-9.]+)/) {
- local %exp;
- $exp{'dir'} = $4,
- $exp{'ip'} = $4,
- $exp{'tarih'} = $1,
- $exp{'illegaluser'} = "wrong_password",
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- if ($command =~/^bannedip$/){
- if ($line =~ /^\s*(-A INPUT -s) ([0-9.]+)\/([0-9]+) -p tcp -m tcp --dport ($cccam_port) -m comment --comment "(\S+)=(\S+)" -j DROP?/) {
- local $active = !$1;
- local $dir = scalar(@rv);
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = $2,
- $exp{'ip'} = $2,
- $exp{'tarih'} = $1,
- $exp{'port'} = $4,
- $exp{'illegaluser'} = $5,
- $exp{'sebep'} = $6,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rv);
- push(@rv, \%exp);
- }
- }
- $lnum++;
- }
- close(EXP);
- @list_exports_cache = @rv;
- return @list_exports_cache;
- }
- sub delete_export
- {
- local @exps = &list_exports();
- local @same = grep { $_ ne $_[0] && $_->{'line'} eq $_[0]->{'line'} } @exps;
- local $lref = &read_file_lines($opn_file);
- if (@same) {
- splice(@$lref, $_[0]->{'line'}, $_[0]->{'eline'}-$_[0]->{'line'}+1,
- &make_exports_line(@same));
- map { $_->{'line'} = $_->{'eline'} = $_[0]->{'line'} } @same;
- } else {
- splice(@$lref, $_[0]->{'line'}, $_[0]->{'eline'}-$_[0]->{'line'}+1);
- }
- if($opn_file eq $cccam_cfg){
- &restore_export($_[0]);
- }
- @list_exports_cache = grep { $_ ne $_[0] } @list_exports_cache;
- &flush_file_lines();
- }
- sub restore_export
- {
- if($opn_file eq $users_deleted){
- $restore_file = $cccam_cfg;
- } elsif($opn_file eq $cccam_cfg) {
- $restore_file = $users_deleted;
- } else {
- $restore_file = undef;
- }
- $username = $_[0]->{'dir'};
- open(EXP, $restore_file);
- while($line = <EXP>) {
- while($line =~ /\\$/) { }
- if ($line =~ /^\s*(#*)([Ff]+)([ ]+)?:([ ]+)($username)([ ]{1,5})(\S+) (.*)$/) {
- $userrest = $5;
- }
- }
- close(EXP);
- if(!$userrest || $opn_file eq $cccam_cfg){
- &create_export($_[0],$restore_file);
- $opn_file eq $cccam_cfg || &delete_export($_[0]);
- } else {
- $export_message = $_[1] ? error($text{'save_restore_err'}. ": $_[0]->{'dir'}") : undef;
- }
- $opn_file eq $cccam_cfg || $userrest || &delete_export($_[0]);
- return $export_message;
- }
- sub create_export
- {
- $export_file = $_[1] ? $_[1] : $opn_file;
- &open_tempfile(EXP, ">>$export_file");
- &print_tempfile(EXP, &make_exports_line($_[0]),"\n");
- &close_tempfile(EXP);
- }
- sub modify_export
- {
- local @exps = &list_exports();
- local @same = grep { $_->{'line'} eq $_[1]->{'line'} } @exps;
- local $lref = &read_file_lines($opn_file);
- if ($_[0]->{'dir'} eq $_[1]->{'dir'} &&
- $_[0]->{'active'} == $_[1]->{'active'} || @same == 1) {
- # directory or active not changed, or on a line of it's own
- splice(@same, &indexof($_[1],@same), 1, $_[0]);
- splice(@$lref, $_[1]->{'line'}, $_[1]->{'eline'}-$_[1]->{'line'}+1,
- &make_exports_line(@same));
- }
- else {
- splice(@same, &indexof($_[1],@same), 1);
- splice(@$lref, $_[1]->{'line'}, $_[1]->{'eline'}-$_[1]->{'line'}+1,
- &make_exports_line(@same));
- push(@$lref, &make_exports_line($_[0]));
- }
- &flush_file_lines();
- }
- sub make_exports_line
- {
- if ($command =~/^users$/){
- return ($_[0]->{'active'} ? "" : "#").
- ("F: $_[0]->{'dir'} $_[0]->{'passaword'} ").
- ($_[0]->{'au'} ? "$_[0]->{'au'} ":"").
- ($_[0]->{'reshare'} ? "{ $_[0]->{'reshare'}" : "{").
- ($_[0]->{'yasak'} ? ", $_[0]->{'yasak'} }" : " }").
- ($_[0]->{'saat'} ? " { } { $_[0]->{'saat'} }" : "").
- ($_[0]->{'gun'} ? " #Tarih=$_[0]->{'yil'}-$_[0]->{'ay'}-$_[0]->{'gun'}" : "").
- ($_[0]->{'mail'} ? " #Mail=$_[0]->{'mail'}" : "").
- ($_[0]->{'tel'} ? " #Tel=$_[0]->{'tel'}" : "").
- ($_[0]->{'bayi'} ? " #Bayi=$_[0]->{'bayi'}" : "").
- ($_[0]->{'tip'} ? " #Tip=$_[0]->{'tip'}" : "").
- ($_[0]->{'not'} ? " #Not=$_[0]->{'not'}" : "");
- }
- if ($command =~/^newcam$/){
- return ($_[0]->{'active'} ? "" : "#").("N: $_[0]->{'host'} $_[0]->{'port'} $_[0]->{'username'} $_[0]->{'passaword'} $_[0]->{'deskey'}").
- ($_[0]->{'lokal'} ? " $_[0]->{'lokal'}" : "").
- ($_[0]->{'not'} ? " #$_[0]->{'not'}" : "");
- }
- if ($command =~/^cline$/){
- return ($_[0]->{'active'} ? "" : "#").("C: $_[0]->{'host'} $_[0]->{'port'} $_[0]->{'username'} $_[0]->{'passaword'}").
- ($_[0]->{'emu'} ? " $_[0]->{'emu'}" : "").
- ($_[0]->{'lokal'} ? " { $_[0]->{'lokal'} }" : "").
- ($_[0]->{'p_lokal'} ? " { $_[0]->{'p_lokal'}}" : "").
- ($_[0]->{'not'} ? " #$_[0]->{'not'}" : "");
- }
- if ($command =~/^lline$/){
- return ($_[0]->{'active'} ? "" : "#").("L: $_[0]->{'host'} $_[0]->{'port'} $_[0]->{'username'} $_[0]->{'passaword'} $_[0]->{'ca_prvd'}").
- ($_[0]->{'not'} ? " #$_[0]->{'not'}" : "");
- }
- if ($command =~/^rline$/){
- return ($_[0]->{'active'} ? "" : "#").("R: $_[0]->{'host'} $_[0]->{'port'} $_[0]->{'username'} $_[0]->{'passaword'} $_[0]->{'ca_prvd'}").
- ($_[0]->{'not'} ? " #$_[0]->{'not'}" : "");
- }
- if ($command =~/^turkdvb$/){
- @f1='"';
- return ($_[0]->{'active'} ? "" : "#").("$_[0]->{'caidprv'} @f1$_[0]->{'name'}").
- ($_[0]->{'channel'} ? " - $_[0]->{'channel'}@f1" : "@f1");
- }
- if ($command =~/^package$/){
- return ($_[0]->{'active'} ? "" : "#").("$_[0]->{'name'} = $_[0]->{'caidprv'}");
- }
- if ($command =~/^multicccam$/){
- return ($_[0]->{'active'} ? "" : "#").("M: $_[0]->{'name'} $_[0]->{'host'} $_[0]->{'port'} $_[0]->{'user'} $_[0]->{'pass'} ").
- ($_[0]->{'ssl'} ? "1" : "0").(" $_[0]->{'modul'}").
- ($_[0]->{'cport'}? " $_[0]->{'cport'}" : "");
- }
- if ($command =~/^dyn$/){
- return ($_[0]->{'active'} ? "" : "#").("D: $_[0]->{'dyn_prvd'} $_[0]->{'dyn_host'} $_[0]->{'dyn_user'} $_[0]->{'dyn_pass'}");
- }
- if ($command =~/^bayi$/){
- return ($_[0]->{'active'} ? "" : "#").("$_[0]->{'name'} Limit=$_[0]->{'limit'} Tahsilat=$_[0]->{'tahsilat'}").
- (" Borc=$_[0]->{'borc'}").
- ($_[0]->{'fiyat1'} ? " Fiyat1=$_[0]->{'fiyat1'}" :"").
- ($_[0]->{'fiyat3'} ? " Fiyat3=$_[0]->{'fiyat3'}" :"").
- ($_[0]->{'fiyat6'} ? " Fiyat6=$_[0]->{'fiyat6'}" :"").
- ($_[0]->{'fiyat12'} ? " Fiyat12=$_[0]->{'fiyat12'}" :"").
- (" Birim=$_[0]->{'birim'}").
- ($_[0]->{'package'} ? " Package=$_[0]->{'package'}" :" Package=0").
- ($_[0]->{'mail'} ? " Mail=$_[0]->{'mail'}" :"").
- ($_[0]->{'u1'} ? " 1=$_[0]->{'u1'}" :"").
- ($_[0]->{'u3'} ? " 3=$_[0]->{'u3'}" :"").
- ($_[0]->{'u6'} ? " 6=$_[0]->{'u6'}" :"").
- ($_[0]->{'u12'} ? " 12=$_[0]->{'u12'}" :"");
- }
- if ($command =~/^keys$/){
- return ($_[0]->{'active'} ? "" : "#").("$_[0]->{'url'}");
- }
- }
- sub list_bayi {
- $fiyat1 ='( Fiyat1=(\S+))';
- $fiyat3 ='( Fiyat3=(\S+))';
- $fiyat6 ='( Fiyat6=(\S+))';
- $fiyat12 ='( Fiyat12=(\S+))';
- $u1 ='( 1=(\S+))';
- $u3 ='( 3=(\S+))';
- $u6 ='( 6=(\S+))';
- $u12 ='( 12=(\S+))';
- open(BAYI, $bayi_doc);
- $lnum = 0;
- while($line = <BAYI>) {
- local $slnum = $lnum;
- $line =~ s/\s+$//g;
- if ($line =~ /^(#*)\s*(\S+) Limit=(\S+) Tahsilat=(\S+) Borc=(\S+)$fiyat1?$fiyat3?$fiyat6?$fiyat12? Birim=(\S+) Package=([0-1]+)( Mail=(\S+))?$u1?$u3?$u6?$u12?/) {
- local $active = !$1;
- local %exp;
- $exp{'active'} = $active;
- $exp{'bname'} = $2,
- $exp{'name'} = $2,
- $exp{'limit'} = $3,
- $exp{'tahsilat'} = $4,
- $exp{'borc'} = $5,
- $exp{'fiyat1'} = $7,
- $exp{'fiyat3'} = $9,
- $exp{'fiyat6'} = $11,
- $exp{'fiyat12'} = $13,
- $exp{'birim'} = $14,
- $exp{'package'} = $15,
- $exp{'mail'} = $17,
- $exp{'u1'} = $19,
- $exp{'u3'} = $21,
- $exp{'u6'} = $23,
- $exp{'u12'} = $25,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@brv);
- push(@brv, \%exp);
- }
- $lnum++;
- }
- close(BAYI);
- @list_bayi_cache = @brv;
- }
- sub list_multicc {
- if($config{'multicccam'}){
- local ($user, $pass, $tarih, $lntype,$lnmcl) = @_;
- open(MLTCC, $multicccam);
- $lnum = 0;
- while($line = <MLTCC>) {
- local $slnum = $lnum;
- $line =~ s/\s+$//g;
- if ($line =~ /^(#*)\s*(M:) (\S+) (\S+) ([0-9]+) (\S+) (\S+) ([0-9]+) (\S+) ?([0-9]+)?/) {
- local $active = !$1;
- local %exp;
- $exp{'active'} = $active;
- $exp{'dir'} = scalar(@rmc),
- $exp{'name'} = $3,
- $exp{'host'} = $4,
- $exp{'port'} = $5,
- $exp{'user'} = $6,
- $exp{'pass'} = $7,
- $exp{'ssl'} = $8,
- $exp{'modul'}= $9,
- $exp{'cport'}= $10,
- $mcport = $10,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@rmc);
- if ($user && $active && $10) {
- if($4 =~/(127.0.0.1|localhost)$/){
- $mchost = $config{'host'};
- } else {
- $mchost = $4;
- }
- }
- push(@rmc, \%exp);
- }
- $lnum++;
- }
- close(MLTCC);
- @list_mltcc_cache = @rmc;
- }
- }
- sub bayi_info {
- &list_command("users",undef,1);
- &list_exports();
- @bayi = &list_bayi();
- &unique(map { if($_->{'bname'} eq $remote_user) {$bayi_id = $_->{'index'} } } @bayi);
- $exp = $bayi[$bayi_id];
- %opts = %{$exp->{'options'}};
- $bayi_id = $exp->{'index'};
- $bayi_limit = $exp->{'limit'};
- $bayi_mail = $exp->{'mail'};
- $bayi_paket = $exp->{'package'};
- $bayi_fiyat1 = $exp->{'fiyat1'};
- $bayi_fiyat3 = $exp->{'fiyat3'};
- $bayi_fiyat6 = $exp->{'fiyat6'};
- $bayi_fiyat12 = $exp->{'fiyat12'};
- $borc_1ay =$bayi_fiyat1 * $total_1ay;
- $borc_3ay =$bayi_fiyat3 * $total_3ay;
- $borc_6ay =$bayi_fiyat6 * $total_6ay;
- $borc_12ay =$bayi_fiyat12 * $total_12ay;
- $toplam_tutar = $borc_1ay + $borc_3ay + $borc_6ay + $borc_12ay;
- $toplam_borc = $toplam_tutar - $exp->{'tahsilat'};
- if (!$exp->{'active'}){
- print "<table><tr><td><img src=./images/warning.png></td><td><b>$text{'bayi_closed'}</b></td></tr>";
- print "</table>";
- exit 0;
- }
- if ($exp->{'bname'} eq $remote_user){
- } else {
- print "<table><tr><td><img src=./images/warning.png></td><td><b>$text{'bayi_err'}</b></td></tr>";
- print "</table>";
- exit 0;
- }
- $prog="./index.cgi?tab=";
- push(@tabs, [ "genel", $text{'tab_genel'}, $prog."genel" ]);
- print&ui_tabs_start(\@tabs,"mode",$in{'tab'}||$tabs[0]->[0],1);
- print &ui_tabs_start_tab("mode", "genel");
- print "<table cellpadding=5><tr>";
- print "<td>";
- print &ui_table_start($text{'bayi_info'}, "width=350", 3);
- print "<tr><td>", &ui_table_row($text{'bayi_name'}, $exp->{'bname'}),"</td></tr>\n";
- print "<tr><td>", &ui_table_row($text{'users_mail'}, $exp->{'mail'}),"</td></tr>\n";
- print "<tr><td>", &ui_table_row($text{'bayi_limiti'}, $exp->{'limit'}),"</td></tr>\n";
- print "<tr><td>", &ui_table_row($text{'bayi_borci'}, $toplam_borc." ".$exp->{'birim'}),"</td></tr>\n";
- print "<tr><td>", &ui_table_row($text{'bayi_tahsilati'},$exp->{'tahsilat'}." ".$exp->{'birim'}),"</td></tr>\n";
- print "<tr><td><br></td></tr>\n";
- print $exp->{'fiyat1'} ? "<tr><td>". &ui_table_row($text{'fiyat1'}. ' '.$text{'bayi_fiyat'}, $exp->{'fiyat1'} .' '.$exp->{'birim'})."</td></tr>\n" :'';
- print $exp->{'fiyat3'} ? "<tr><td>". &ui_table_row($text{'fiyat3'}. ' '.$text{'bayi_fiyat'}, $exp->{'fiyat3'} .' '.$exp->{'birim'})."</td></tr>\n" :'';
- print $exp->{'fiyat6'} ? "<tr><td>". &ui_table_row($text{'fiyat6'}. ' '.$text{'bayi_fiyat'}, $exp->{'fiyat6'} .' '.$exp->{'birim'})."</td></tr>\n" :'';
- print $exp->{'fiyat12'} ? "<tr><td>". &ui_table_row($text{'fiyat12'}.' '.$text{'bayi_fiyat'}, $exp->{'fiyat12'}.' '.$exp->{'birim'})."</td></tr>\n" :'';
- print &ui_table_end();
- print "</td>";
- print "<td><table>";
- &istatistik_uye;
- print "</table></td>";
- print &ui_tabs_end_tab("mode", "genel");
- print &ui_tabs_end(1);
- print "</tr></table>";
- print "<center>";
- &cccam_button($text{'users_title'},"bayi.cgi","users=1");
- sub bayicinfo
- {
- print "<html>\n";
- print "<head>\n";
- print "<script language=\"Javascript\">\n";
- print "function spawn(page) {";
- print "window.open(page,\"\",\"height=600,width=800,status=yes,toolbar=no,menubar=no,scrollbars=no\");}
- </script>\n";
- print "</head>\n";
- print "<input type=button value='CCcam Info' onclick='spawn(\"info/info.cgi\")\'>";
- print "</body></html>\n";
- }
- &bayicinfo;
- if (!$exp->{'limit'}){
- print "<table><tr><td><img src=./images/warning.png></td><td><b>$text{'bayi_limit_end'}<br>" .&text('bayi_limit_end1','genel.cgi?port_edit=1')."</b></td></tr>";
- print $exp->{'limit'}==0 ? "<tr><td colspan=2 align=center>".&text('bayi_limit_si',&tdvbfont($exp->{'limit'},0,"blue",1))."</td></tr>":'';
- print "</table>";
- exit 0;
- }
- print "</center>";
- &bayi_update($exp->{'bname'});
- }
- sub bayi_update {
- &list_command("users",undef,1,$_[0]);
- &list_exports();
- @d = $_[0];
- &list_command("bayi",$bayi_doc,1);
- @expsh = &list_bayi();
- &lock_file($config{'bayi_doc'});
- foreach $e (@expsh) {
- if (&indexof($e->{'name'}, @d) >= 0) {
- #print "--".$e->{'name'};
- push(@dels, $e);
- }
- }
- foreach $d (reverse(@dels)) {
- $d->{'u1'} = $total_ay;
- $d->{'u3'} = $total_3ay;
- $d->{'u6'} = $total_6ay;
- $d->{'u12'} = $total_12ay;
- &modify_export($d, $d);
- }
- &unlock_file($bayi_doc);
- }
- sub list_package
- {
- open(PCKG, $package);
- while($line = <PCKG>) {
- if ($line =~ /^(#*)\s*([a-zA-Z0-9 +]+)([ ]+)=([ ]+)(.*)$/) {
- local $active = !$1;
- if ($active) {
- local %exp;
- $exp{'active'} = $active;
- $exp{'name'} = $2,
- $exp{'caidprv'} = $5,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- push(@prv, \%exp);
- }
- }
- $lnum++;
- }
- close(PCKG);
- @list_package_cache = @prv;
- }
- sub turkdvb_com
- {
- $style="style='border-style: dashed; border-width: 1px;'";
- if ($access{'bayi'}) {
- &bayi_info();
- print &ui_table_hr();
- }
- ($date, $time) = split(/\s+/, &make_date(time()));
- print "<left>";
- print &ui_table_start("$text{'users_title1'} | $text{'index_bugun'}:$date","width=660");
- print &ui_form_start("users.cgi", "post");
- print "<input type=hidden name=new value=1>\n";
- print "<input type=hidden name=active value=1>\n";
- print "<input type=hidden name=cmd_users value=1>\n";
- print "<input type=hidden name=save_users value=1>\n";
- if ($access{'bayi'}) {
- print "<input type=hidden name=bayi_id value=$bayi_id>\n";
- print "<input type=hidden name=bayi_limit value=$bayi_limit>\n";
- print "<input type=hidden name=mail value=$bayi_mail>\n";
- }
- print "<tr><td><b>$text{'users_username'} $mcc</b><br><input name=dir size=19></td>\n";
- print "<td><b>$text{'users_passaword'}</b><br><input name=passaword size=19></td>\n";
- print "<td><b>$text{'users_tel'}</b><br><input name=tel size=14></td>\n";
- if (!$access{'bayi'}) {
- print "<td><b>$text{'users_reshare1'}<br>".
- &ui_select("reshare", $exp->{'reshare'},
- [ [ "0:0:1", $text{'disable'} ],
- [ "0:0:2", "Reshare1"],
- [ "0:0:3", "Reshare2"],
- [ "0:0:0", $text{'manual'}], ]),"</td>\n";
- print "<td $style align=center><b>$text{'users_tarih'}</b><br>",
- (&ui_select("year", $now[5]+1900, [ @select_year ]).
- &ui_select("month", $now[4]+1, [@select_month ]).
- &ui_textbox("day", undef, 2).
- &date_chooser_button("day", "month", "year")),"</td></tr>\n\n";
- }
- if ($access{'bayi'}) {
- print "</tr>\n\n";
- }
- print "<tr><td><b>$text{'users_not'}</b><br><input name=not size=19></td>\n";
- if (!$access{'bayi'}) {
- print "<td><b>$text{'users_mail'}</b><br><input name=mail size=19></td>\n";
- }
- if ($bayi_paket || !$access{'bayi'}) {
- @pckg = &list_package();
- @package = &unique(map { $_->{'name'} ? [ $_->{'caidprv'},$_->{'name'} ] : undef } @pckg);
- print "<td><b>$text{'package'}</b><br>". &ui_select("package", 0, ["", @package ]),"</td>\n";
- }
- if ($access{'bayi'}) {
- $prselect = ($bayi_fiyat12 ? "<option value='366'>$text{'users_period12m'}</option>": "").
- ($bayi_fiyat6 ? "<option value='183'>$text{'users_period6m'}</option>" : "").
- ($bayi_fiyat3 ? "<option value='92'>$text{'users_period3m'}</option>" : "").
- ($bayi_fiyat1 ? "<option value='31'>$text{'users_period1m'}</option>" : "");
- } else {
- $prselect = "<option value=''>$text{'select'}</option>
- <option value='-1'>$text{'users_period1d'}</option>
- <option value='31'>$text{'users_period1m'}</option>
- <option value='92'>$text{'users_period3m'}</option>
- <option value='183'>$text{'users_period6m'}</option>
- <option value='366'>$text{'users_period12m'}</option>";
- }
- print "<td align=center><b>$text{'users_period'}</b><br><select name='period'>$prselect</select></td>\n";
- if (!$access{'bayi'}) {
- @tmpls = &list_templates();
- print "<td align=center><b>$text{'mail_sendnew'}</b>". &ui_checkbox("gon_mail", 1, undef,undef,0,0)."<br>".
- &ui_select("tmpl_id", $config{'tmpl_send_account'},
- [["",$text{'select'}], map { [ $_->{'id'}, $_->{'desc'} ] } @tmpls ])."</td>\n";
- }
- print "</tr>\n";
- print "<td><b></b></td></tr>\n";
- if (!$access{'bayi'}) {
- print &ui_hidden_table_start($text{'service_blok'},"width=%100", 1, "services");
- print &ui_table_row($text{'users_au'},
- &ui_select("au", $exp->{'au'},
- [ [ "2 0 0", "$text{'no'}" ],
- [ "2 0 1", "$text{'yes'}" ] ]));
- print &ui_table_row($text{'users_saat'},
- &ui_textbox("saat", "", 26)."<b><font size=1>$text{'example'}</font> : </b>
- <font size=1 color=red>12:00-17:00,</font>
- <font size=1 color=blue>19:00-20:00</font><br>");
- print &ui_table_row($text{'service_blocked'},
- &services_button("yasak", 1)."<br>".
- &ui_textarea("yasak", join("\n", $exp->{'yasak'}), 7, 50)."<br>".
- &services_button("yasak", 1));
- print &ui_hidden_table_end("services");
- }
- print "<tr><td colspan='5' align=right>", &ui_form_end([ [ 'save', $text{'add'} ] ]),"</td></tr>\n";
- if (!$access{'bayi'}) {
- print &ui_hidden_table_start($text{'ara_header'},"width=%100", 1, "in_ara");
- print &ui_form_start("users.cgi", "post");
- print "<input type=hidden name=araok value=1>\n";
- print "<center><tr><td> </td><td><b>$text{'users_username'} : </b><input name=ara size=21></td>\n";
- print "<td align=left>", &ui_form_end([ [ 'araok', $text{'ara'} ] ]),"</td></tr></center>\n";
- print &ui_hidden_table_end("in_ara");
- }
- print &ui_table_end();
- print "</center>";
- }
- sub ara
- {
- print &ui_table_start("$text{'ara_header'}","width=200");
- print &ui_form_start("users.cgi", "post");
- print "<input type=hidden name=araok value=1>\n";
- print "<tr><td><b></b><input name=ara size=21></td>\n";
- print "<td align=right>", &ui_form_end([ [ 'save', $text{'ara'} ] ]),"</td></tr>\n";
- print &ui_table_end("in_ara");
- }
- sub istatistik_uye{
- &list_command("users");
- &list_exports();
- print "<table cellpadding=5><tr>";
- print "<td valign=top><table class=ui_table>";
- print $total_ay ? "<tr class=row0><td align=right>$text{'fiyat1'} $text{'users'} : </td> <td><font color=blue>$total_ay</font></td></tr>":'';
- print $total_3ay ? "<tr class=row1><td align=right>$text{'fiyat3'} $text{'users'} : </td> <td><font color=blue>$total_3ay</font></td></tr>":'';
- print $total_6ay ? "<tr class=row0><td align=right>$text{'fiyat6'} $text{'users'} : </td> <td><font color=blue>$total_6ay</font></td></tr>":'';
- print $total_12ay ? "<tr class=row1><td align=right>$text{'fiyat12'} $text{'users'} : </td> <td><font color=blue>$total_12ay</font></td></tr>":'';
- print $total_users ? "<tr class=row0><td align=right>$text{'total_users'} : </td> <td><font color=blue>$total_users</font></td></tr>":'';
- print $total_activeusers ? "<tr class=row1><td align=right>$text{'active_users'} : </td> <td><font color=blue>$total_activeusers</font></td></tr>":'';
- print $total_deactiveusers ? "<tr class=row0><td align=right>$text{'deactiv_users'} : </td> <td><font color=blue>$total_deactiveusers</font></td></tr>":'';
- print $total_endusers ? "<tr class=row1><td align=right>$text{'enddate_users'} : </td> <td><font color=blue>$total_endusers</font></td></tr>":'';
- if ($access{'bayi'}) {
- print "<tr class=row1><td align=right><br></td> <td></td></tr>";
- print "<tr class=row1><td align=right>CCcam Sharing Port : </td> <td><font color=blue>$cccam_port</font></td></tr>";
- print "<tr class=row0><td align=right>CCcam Version : </td> <td><font color=blue>$cccam_version</font></td></tr>";
- }
- print "</table></td>";
- print "<td valign=top><table class=ui_table><br /></table></td>";
- if (!$access{'bayi'}) {
- print "<td valign=top><table class=ui_table>";
- print "<tr class=row1><td align=right>CCcam Sharing Port : </td> <td><font color=blue>$cccam_port</font></td></tr>";
- print "<tr class=row0><td align=right>CCcam Web Info Port : </td> <td><font color=blue>$wport</font></td></tr>";
- print "<tr class=row0><td align=right>CCcam Version : </td> <td><font color=blue>$cccam_version</font></td></tr>";
- ## print $telnetport ? "<tr class=row1><td align=right>CCcam Telnet Port : </td> <td><font color=blue>$telnetport</font></td></tr>":'';
- print $logwarnings ? "<tr class=row0><td align=right>Log Warning : </td> <td><font color=blue>$logwarnings</font></td></tr>":'';
- print "</table></td>";
- }
- print "</tr></table> ";
- }
- sub install_webmin_module
- {
- local ($file, $need_unlink, $nodeps, $grant) = @_;
- local (@mdescs, @mdirs, @msizes);
- local (@newmods, $m);
- local $mdirs = "/";
- local $install_root_directory = "/";
- open(MFILE, $file);
- read(MFILE, $two, 2);
- close(MFILE);
- if ($two eq "\037\235") {
- if (!&has_command("uncompress")) {
- unlink($file) if ($need_unlink);
- return &text('install_ecomp', "<tt>uncompress</tt>");
- }
- local $temp = $file =~ /\/([^\/]+)\.Z/i ? &transname("$1")
- : &transname();
- local $out = `uncompress -c "$file" 2>&1 >$temp`;
- unlink($file) if ($need_unlink);
- if ($?) {
- unlink($temp);
- return &text('install_ecomp2', $out);
- }
- $file = $temp;
- $need_unlink = 1;
- }
- elsif ($two eq "\037\213") {
- if (!&has_command("gunzip") && !&has_command("gzip")) {
- unlink($file) if ($need_unlink);
- return &text('install_egzip', "<tt>gunzip</tt>");
- }
- local $temp = $file =~ /\/([^\/]+)\.gz/i ? &transname("$1")
- : &transname();
- local $cmd = &has_command("gunzip") ? "gunzip -c" : "gzip -d -c";
- local $out = &backquote_command($cmd." "."e_path($file).
- " 2>&1 >$temp");
- unlink($file) if ($need_unlink);
- if ($? || !-s $temp) {
- unlink($temp);
- return &text('install_egzip2', $out);
- }
- $file = $temp;
- $need_unlink = 1;
- }
- elsif ($two eq "BZ") {
- if (!&has_command("bunzip2")) {
- unlink($file) if ($need_unlink);
- return &text('install_ebunzip', "<tt>bunzip2</tt>");
- }
- local $temp = $file =~ /\/([^\/]+)\.gz/i ? &transname("$1") : &transname();
- local $out = `bunzip2 -c "$file" 2>&1 >$temp`;
- unlink($file) if ($need_unlink);
- if ($?) {
- unlink($temp);
- return &text('install_ebunzip2', $out);
- }
- $file = $temp;
- $need_unlink = 1;
- }
- local ($type, $redirect_to);
- open(TYPE, "$root_directory/install-type");
- chop($type = <TYPE>);
- close(TYPE);
- if ($type eq 'rpm' && $file =~ /\.rpm$/i &&
- ($out = `rpm -qp $file 2>/dev/null`)) {
- }
- else {
- local (%mods, %hasfile);
- &has_command("tar") || return $text{'install_enotar'};
- local $tar = &backquote_command("tar tf "."e_path($file)." 2>&1");
- if ($?) {
- unlink($file) if ($need_unlink);
- return &text('install_etar', $tar);
- }
- foreach $f (split(/\n/, $tar)) {
- if ($f =~ /^\.\/([^\/]+)\/(.*)$/ || $f =~ /^([^\/]+)\/(.*)$/) {
- $redirect_to = $1 if (!$redirect_to);
- $mods{$1}++;
- $hasfile{$1,$2}++;
- }
- }
- local $out = `cd $install_root_directory ; tar xf "$file" 2>&1 >/dev/null`;
- chdir($oldpwd);
- if ($?) {
- unlink($file) if ($need_unlink);
- return &text('install_eextract', $out);
- }
- if ($need_unlink) { unlink($file); }
- local $perl = &get_perl_path();
- local @st = stat("$module_root_directory/index.cgi");
- foreach $moddir (keys %mods) {
- local $pwd = &module_root_directory($moddir);
- if ($hasfile{$moddir,"module.info"}) {
- push(@mdescs, $minfo{'desc'});
- push(@mdirs, $pwd);
- push(@msizes, &disk_usage_kb($pwd));
- &webmin_log("install", undef, $moddir,
- { 'desc' => $minfo{'desc'} });
- push(@newmods, $moddir);
- }
- else {
- push(@mdescs, $tinfo{'desc'});
- push(@mdirs, $pwd);
- push(@msizes, &disk_usage_kb($pwd));
- &webmin_log("tinstall", undef, $moddir,
- { 'desc' => $tinfo{'desc'} });
- }
- }
- }
- &flush_webmin_caches();
- return [ \@mdescs, \@mdirs, \@msizes ];
- }
- sub file_basename
- {
- local $rv = $_[0];
- $rv =~ s/^.*[\/\\]//;
- return $rv;
- }
- sub list_dir
- {
- #return @list_exports_local if (@list_exports_cache);
- opendir ( DIR, $_[0] );
- $lnum = 0;
- while( ($filename = readdir(DIR))){
- @st = stat($_[0]."/".$filename);
- if ($filename =~ /^\s*(($cccam_host-$modul_ccdir)-((\d+).(\d+).(\d+)).(\d+:\d+)-cfg.tar.gz)/) {
- local %exp;
- $exp{'dir'} = scalar(@drv),
- $exp{'dosya'} = $1,
- $exp{'bayt'} = &nice_size($st[7]),
- $exp{'tarih'} = $3,
- $exp{'gun'} = $4,
- $exp{'ay'} = $5,
- $exp{'yil'} = $6,
- $exp{'saat'} = $7,
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@drv);
- push(@drv, \%exp);
- }
- elsif ($filename =~ /^\s*((CCcam)_($ccostype).(([0-9]+).([0-9]+).([0-9]+)).(zip))$/) {
- local %exp;
- $exp{'dir'} = scalar(@drv),
- $exp{'dosya'} = $2,
- $exp{'version'} = $4;
- $exp{'uname'} = $3;
- $exp{'appzip'} = $1;
- $exp{'bayt'} = &nice_size($st[7]),
- $exp{'line'} = $slnum;
- $exp{'eline'} = $lnum;
- $exp{'pos'} = $pos++;
- $exp{'index'} = scalar(@drv);
- push(@drv, \%exp);
- }
- $lnum++;
- }
- closedir(DIR);
- @list_exports_cache = @drv;
- return @list_exports_cache;
- }
- sub list_templates
- {
- opendir(DIR, $templates_dir) || return ( );
- local @trv;
- foreach my $f (readdir(DIR)) {
- if ($f =~ /^\d+$/) {
- push(@trv, &get_template($f));
- }
- }
- closedir(DIR);
- return @trv;
- }
- sub get_template
- {
- local ($id) = @_;
- local %tmpl;
- &read_file("$templates_dir/$id", \%tmpl) || return undef;
- $tmpl{'id'} = $id;
- $tmpl{'file'} = "$templates_dir/$id";
- $tmpl{'email'} =~ s/\\n/\n/g;
- $tmpl{'email'} =~ s/\\\\/\\/g;
- return \%tmpl;
- }
- sub save_template
- {
- local ($tmpl) = @_;
- $tmpl->{'id'} ||= time().$$;
- $tmpl->{'file'} = "$templates_dir/$tmpl->{'id'}";
- local %write = %$tmpl;
- $write{'email'} =~ s/\\/\\\\/g;
- $write{'email'} =~ s/\n/\\n/g;
- if (!-d $templates_dir) {
- &make_dir($templates_dir, 0755);
- }
- &lock_file($tmpl->{'file'});
- &write_file($tmpl->{'file'}, \%write);
- &unlock_file($tmpl->{'file'});
- }
- sub delete_template
- {
- local ($tmpl) = @_;
- &unlink_logged($tmpl->{'file'});
- }
- sub zipped {
- local ($zipfile, $plconf, $flveri,$command) = @_;
- ©_source_dest("plugins/$zipfile", "$cctmp");
- if($flveri){
- &backquote_logged("cd $cctmp ; unzip -o -d $cctmp $zipfile");
- if(!stat("$cctmp/$plconf")){
- &open_tempfile(EXP, ">$cctmp/$plconf",0,1);
- &print_tempfile(EXP, "$flveri");
- } else {
- &open_tempfile(EXPZ, ">>$cctmp/$plconf");
- &print_tempfile(EXPZ, "\n".$flveri,"\n");
- }
- &close_tempfile(EXPZ);
- }
- &backquote_logged("cd $cctmp ; zip -u $zipfile $plconf");
- unlink("$cctmp/$plconf");
- }
- sub unzip {
- local ($zipfile, $dir,$passw,$del) = @_;
- $passw = $passw ? "-P $passw":'';
- &backquote_logged("unzip $passw -o -d $dir $zipfile");
- $del ? unlink($zipfile) : undef;
- }
- sub attach {
- local ($attachfile, $type) = @_;
- local $filename = $attachfile;
- local $data;
- $filename =~ s/^.*(\\|\/)//;
- local $type = &guess_mime_type($filename)."; name=\"".$filename."\"";
- # local $type = $type;
- local $disp = "inline; filename=\"$filename\"";
- $data = &read_file_contents($attachfile);
- push(@{$mail->{'attach'}},
- { 'data' => $data,
- 'headers' => [
- [ 'Content-type', $type ],
- [ 'Content-Disposition', $disp ],
- [ 'Content-Transfer-Encoding', 'base64' ] ] });
- }
- sub send_email
- {
- local ($froms, $email, $subject, $bodys, $attach, $attachfile, $type, $tmpl_id,$user,$pass,$enddate,$attach_plugin,$attach_cron,$paket) = @_;
- local $tmpl = &get_template($tmpl_id);
- &foreign_require("mailboxes", "mailboxes-lib.pl");
- @pckg = &list_package();
- $paket ? &unique(map { $_->{'caidprv'} eq $paket ? $packg = $_->{'name'} : "" } @pckg) :'';
- ################################
- if($tmpl->{'html'} eq 1){
- $mltype = "text/plain";
- $tmbr = "\n";
- &userline($user,$pass,$tarih,1,0,0,0,$lineno++);
- &list_multicc($user,$pass,$tarih,1,$lineno++);
- $mail_signatur = $config{'mail_signatur'} ? $tmbr. &mailboxes::html_to_text($config{'mail_signatur'}) : undef;
- } else {
- $mltype = "text/html";
- $tmbr = "<br/>";
- &userline($user,$pass,$tarih,0,0,0,0,$lineno++);
- &list_multicc($user,$pass,$tarih,0,$lineno++);
- $mail_signatur = $config{'mail_signatur'} ? $tmbr.$config{'mail_signatur'} : undef;
- }
- $cs = &get_charset();
- %enc = ( 'Charset' => $cs );
- $konu = $tmpl ? $tmpl->{'desc'}." ".$packg : $subject;
- $from = $froms ? $froms : "$config{'gon_provider'} <$config{'gon_mail'}>";
- local %hash = (
- 'KONU' => $konu,
- 'HOST' => $cccam_host,
- 'DATE' => $cnowdate,
- 'TIME' => $time,
- 'ENDT' => $enddate,
- 'PORT' => $cccam_port,
- 'VERS' => $cccam_version,
- 'USER' => $user,
- 'PASS' => $pass,
- 'CLIN' => $cline,
- 'HADU' => $haduline,
- 'ACAM' => $acamdline,
- 'INCB' => "[Servers]$tmbr".$incubus,
- 'OCTG' => $octagon,
- 'PCKG' => $packg,
- );
- if ($tmpl) {
- $body = &substitute_template($tmpl->{'email'}, \%hash);
- } else {
- $body = &substitute_template($bodys, \%hash);
- }
- if($tmpl->{'html'} eq 1){
- $body = join("", split(/<b>|<\/b>/, $body));
- }
- if($body){
- $body_html = { 'headers' => [ [ 'Content-type', $mltype.'; charset='.$cs ],
- # [ 'Content-Disposition', "inline; filename=index.html" ],
- [ 'Content-Transfer-Encoding', 'quoted-printable' ] ],
- 'data' => &mailboxes::quoted_encode($body.$mail_signatur) };
- $mail = { 'headers' =>
- [ [ 'From' => &mailboxes::encode_mimewords($from, %enc) ],
- [ 'To' => &mailboxes::encode_mimewords_address($email, %enc) ],
- [ 'Subject' => &mailboxes::encode_mimewords($konu,%enc) ],
- [ 'Message-Id' => &mailboxes::generate_message_id($froms) ]],
- 'attach' => [ $body_html ]};
- if ($attach) {
- &attach($attachfile,$type);
- }
- }
- $clineat = join("\n", split("<br/>", $cline));
- $hadulineat = join("\n", split("<br/>", $haduline));
- $acamdlineat= join("\n", split("<br/>", $acamdline));
- $incubusat = join("\n", split("<br/>", $incubus));
- if ($attach_plugin && $body) {
- @attachz = split(/\0/, $attach_plugin);
- foreach $d (@attachz) {
- if($d =~ /^cccam/){
- &zipped("CCcam_cfg.zip", "CCcam.cfg", $clineat);
- &attach($cccamzip,"application/zip");
- unlink($cccamzip);
- }
- if($d =~ /^hadu/){
- &zipped("Hadu_plugins.zip", "Hadu.ini", $hadulineat);
- &attach($haduzip,"application/zip");
- unlink($haduzip);
- }
- if($d =~ /^acamd/){
- &zipped("Acamd_plugins.zip", "cardclient.conf", $acamdlineat);
- &attach($acamdzip,"application/zip");
- unlink($acamdzip);
- }
- if($d =~ /^incbs/){
- &zipped("IncubusCamd.zip", "incubusCamd.conf", $incubusat);
- &attach($incubuszip,"application/zip");
- unlink($incubuszip);
- }
- }
- }
- if ($attach_cron) {
- if($config{'tmpl_cccamzip'}){
- &zipped("CCcam_cfg.zip", "CCcam.cfg", $clineat);
- &attach($cccamzip,"application/zip");
- unlink($cccamzip);
- }
- if($config{'tmpl_haduzip'}){
- &zipped("Hadu_plugins.zip", "Hadu.ini", $hadulineat);
- &attach($haduzip,"application/zip");
- unlink($haduzip);
- }
- if($config{'tmpl_acamdzip'}){
- &zipped("Acamd_plugins.zip", "cardclient.conf", $acamdlineat);
- &attach($acamdzip,"application/zip");
- unlink($acamdzip);
- }
- if($config{'tmpl_incbszip'}){
- &zipped("IncubusCamd.zip", "incubusCamd.conf", $incubusat);
- &attach($incubuszip,"application/zip");
- unlink($incubuszip);
- }
- }
- &mailboxes::send_mail($mail, undef, 1, 0);
- $cline = "";
- $haduline = "";
- $acamdline= "";
- $incubus = "";
- $octagon = "";
- return 1;
- }
- sub warning {
- local ($warning_command,$end_page) = @_;
- if ($warning_command =~/^security$/){
- if (!$cccam_port || !$wpassword || !$telnetpass || !$osdpass || !$wusername || !$telnetuser || !$wport){
- print "<table><tr><td><img src=./images/warning.png></td><td><b>$text{'warning'}<br>" .&text('warn_fix','genel.cgi?fix=1&save=1')."</b></td></tr>";
- print $cccam_port ? "":"<tr><td colspan=2 align=center>$text{'warn_serverport'}</td></tr>";
- print $telnetuser ? "":"<tr><td colspan=2 align=center>$text{'warn_telnetuser'}</td></tr>";
- print $telnetpass ? "":"<tr><td colspan=2 align=center>$text{'warn_telnetpass'}</td></tr>";
- print $wusername ? "":"<tr><td colspan=2 align=center>$text{'warn_webuser'}</td></tr>";
- print $wpassword ? "":"<tr><td colspan=2 align=center>$text{'warn_webpass'}</td></tr>";
- print $osdpass ? "":"<tr><td colspan=2 align=center>$text{'warn_osdpass'}</td></tr>";
- print $wport ? "":"<tr><td colspan=2 align=center>$text{'warn_wport'}</td></tr>";
- print "</table>";
- }
- }
- if ($warning_command =~/^debug_mod$/){
- if(!$config{'debug_mod'}){
- print "<table align=center><tr><td><img src=./images/warning.png></td><td><b>$text{'warn_debug_mod'}<br>" .&text('warn_debug_fix','setup.cgi?edit_debug=1')."</b></td></tr>";
- print "</table>";
- print $center;
- &ui_print_footer("", $text{'index_return'});
- print $center_end;
- exit 0;
- }
- }
- return 1;
- }
- sub port_control {
- if (!&is_cccam_running()) {
- $con_wport = &make_http_connection($localhost, $wport);
- $con_cccam_port = &make_http_connection($localhost, $cccam_port);
- $con_telnetport = &make_http_connection($localhost, $telnetport);
- if (ref($con_wport) || ref($cccam_port) || ref($telnetport)){
- print "<table><tr><td><img src=./images/warning.png></td><td><b>$text{'warn_pc_error'}<br>" .&text('warn_pc_fix','genel.cgi?port_edit=1')."</b></td></tr>";
- print ref($con_cccam_port) ? "<tr><td colspan=2 align=center>".&text('warn_pc_cccam_port',&tdvbfont($cccam_port,0,"blue",1))."</td></tr>":"";
- print ref($con_wport) ? "<tr><td colspan=2 align=center>".&text('warn_pc_wport',&tdvbfont($wport,0,"blue",1))."</td></tr>":"";
- print ref($con_telnetport) ? "<tr><td colspan=2 align=center>".&text('warn_pc_telnetport',&tdvbfont($telnetport,0,"blue",1))."</td></tr>":"";
- print "</table>";
- }
- }
- }
- sub cccam_upgrade {
- &http_download("checkip.dyndns.org", 80, undef, \$out, 0, undef, 0, "cc", "xxx", 8, 0, 1);
- $out = &html_escape($out, 1);
- if ($out =~ /Current IP Address: ([0-9.]+)/){
- $lcip= $1;
- }
- $cmndf = $_[1] ?"<br>":"\n";
- $pagec = "$bckp?licence=$config{'host_id'}&host=$config{'host2'}&ip=$lcip&modul=cccam";
- &http_download($cclibs,80,$pagec, \$upcontrol, \$errd, 0,0);
- $ureadme = join("<br>", split(/\n/,$upcontrol));
- $upcontrol = &html_escape($upcontrol, 1);
- $lcversion = join("", split(/\./,$version));
- if($ureadme =~/(<readme>)(.*)(<\/readme>)(<zip>)(.*)(<\/zip>)(<file>)(.*)(<\/file>)(<version>)(.*)(<\/version>)(<licence>)(.*)(<\/licence>)(<command>)(.*)(<\/command>)(<command1>)(.*)(<\/command1>)(.*)/) {
- $upreadme = "<fieldset><pre>".$2."</pre></fieldset>";
- $zpms = VRDA($5,1,2);
- $upfile = $8;
- $upversionj= $11;
- $upversion = join("", split(/\./,$11));
- $uplicence = $14;
- $commandup = $17;
- $commandup1= $20;
- }
- if($upcontrol =~/(Error:)(.*)/) {
- print "$text{'hata'}: $2 $cmndf";
- } elsif($upfile) {
- if ($upversion eq $lcversion ) {
- print $text{'update_notfound'}. $cmndf;
- $updatenotfound = "1";
- } else {
- if(!$_[0]){
- $updatefound = 1;
- print $_[1] ? $upreadme : "";
- print $_[1] ? "<b>$text{'update_found'} " . &tdvbfont($upversionj,0,"red",1) . $cmndf."</b>" : "\n$text{'update_found'} $upversionj\n";
- }
- if($_[0]){
- print $text{'update_started'}. $cmndf;
- $zipfile = tempname(&rand_pass());
- &http_download($cclibs,80,"$pagec&update=1", $zipfile, \$error,\&progress_callback);
- &unzip($zipfile, $module_root_directory,$zpms,1);
- $commandup ? &backquote_logged("cd $module_root_directory; $commandup >/dev/null 2>&1 &") :"";
- $commandup1 ? &backquote_logged("cd $module_root_directory; $commandup1 >/dev/null 2>&1 &") :"";
- print $text{'update_complete'}.$cmndf;
- }
- }
- } else {
- print $text{'update_notfound'}. $cmndf;
- }
- return;
- }
- sub sms_send {
- local ($message,$tel,$user,$pass,$enddate,$paket) = @_;
- if($config{'sms_enable'} && $config{'sms_provider'}){
- $sms_signatur = $config{'sms_signatur'} ? "..\n$config{'sms_signatur'}" : undef;
- $sms_apiid = $config{'sms_apiid'};
- $sms_user = $config{'sms_user'};
- $sms_pass = $config{'sms_pass'};
- if($tel =~/(00)([0-9]+)/){
- $tel = $2;
- }
- &userline($user,$pass);
- @pckgsm = &list_package();
- $paket ? &unique(map { $_->{'caidprv'} eq $paket ? $packg = $_->{'name'} : "" } @pckgsm) :'';
- local %hash = (
- 'HOST' => $cccam_host,
- 'DATE' => $cnowdate,
- 'TIME' => $time,
- 'ENDT' => $enddate,
- 'PORT' => $cccam_port,
- 'VERS' => $cccam_version,
- 'USER' => $user,
- 'PASS' => $pass,
- 'CLIN' => $cline,
- 'PCKG' => $packg,
- 'L' => "\n",
- );
- $sms_message = urlize(&substitute_template($message, \%hash) . $sms_signatur);
- if($config{'sms_provider'} eq "clickatell.com"){
- $sender = $config{'sms_sender'} ? "&from=$config{'sms_sender'}" : undef;
- $page = "/http/sendmsg?api_id=$sms_apiid&user=$sms_user&password=$sms_pass&to=$tel&text=$sms_message$sender";
- &http_download("api.clickatell.com", 80, $page, \$sms_status, \$errd, 0, 0, undef,undef, 10);
- } elsif ($config{'sms_provider'} eq "smscity.com"){
- $sender = $config{'sms_sender'} ? "&sender=$config{'sms_sender'}" : undef;
- $page = "/gateway/sms.php?username=$sms_user&password=$sms_pass&destination=$tel&body=$sms_message$sender";
- &http_download("api.smscity.com", 80, $page, \$sms_status, \$sms_err, 0, 0, undef,undef, 10);
- }
- }
- $cline = "";
- $haduline = "";
- $acamdline= "";
- $incubus = "";
- $octagon = "";
- return 1;
- }
Add Comment
Please, Sign In to add comment