#!/usr/bin/perl package Pos::Webtop::OcxLauncher; use strict; use Pos::db; use Pos::Webtop::Toolbox; use Digest; #my $ocxVersion = "2,1,23,5"; #my $ocxUrl = "WTP.cab"; sub getLauncherHtml { my $ret = ""; my ($tb, $inlineOcx) = @{{@_}}{qw/tb inlineOcx/}; if (not defined($inlineOcx)) { $inlineOcx = 0; } my $client = $tb->getClient; my $sessionId = $client->getSessionId; my $sessionHash = $client->getSessionHash; my $customerId = $client->getCustomerId; my $oem = $tb->getOem; my $db = $tb->getWebtopDbReader; my $isMobile = $client->isMobileWebtop(); my $activeXConnected = $client->isWebtopVpnConnectionEstablished( db => $db ); my $remoteDesktopSize = undef; my $remoteDesktopColors = undef; my $remoteComputerSound = undef; my $keyboard = undef; my $diskDrives = undef; my $printers = undef; my $serialPorts = undef; my $desktopBackground = undef; my $showContents = undef; my $menuandwindowanimation = undef; my $themes = undef; my $bitmapcaching = undef; my $connectionBar = undef; my $commandOptions = undef; my $plugPlayDevices = undef; my $networkUserName = undef; my $networkDomainName = undef; my ($intranetAccessMethod) = $db->query(sql => " select wiam.intranet_access_method_name from w_user_intranet_access_method wuiam, w_intranet_access_methods wiam where wuiam.intranet_access_method_id = wiam.intranet_access_method_id AND user_id = '" . $client->getUserId() . "' "); # Default to enhanced if (not defined($intranetAccessMethod)) { $intranetAccessMethod = 'Enhanced'; } my @configParameters = $db->query(sql => " select remote_desktop_size, remote_desktop_colors, remote_computer_sound, keyboard, diskdrives, printers, serial_ports, desktop_background, show_contents, window_animation, themes, bitmap_caching, connection_bar, command_line_options, plug_and_play_devices from xprdasettings where user_id = '" . $client->getUserId() . "' "); my @networkDomain = $db->query(sql => " select corp_network_user_name, corp_network_domain from users where user_id = '" . $client->getUserId() . "' "); # my ($xp_user_name) = $db->query(sql => " # select # xp_user_name # from # w_user_computers # where # user_id = '" . $client->getUserId() . "' # "); $ret .= $tb->getDomJs; $ret .= " "; return $ret; } sub getRewriterPrefix { return Pos::defaults::getRewriterPrefix; } sub isMacBrowserAllowed { my $agent = $ENV{'HTTP_USER_AGENT'}; my $ret = 0; if($agent =~ /Mac OS/) { if($agent =~ /Safari/ && $agent !~ /Chrome/) { $ret = 1; } elsif($agent =~ /Firefox/) { $ret = 1; } elsif($agent =~ /Chrome/) { $ret = 1; } } return $ret; } sub getMacClientAppId { my $appId = ""; my $verInfo = ""; my $database = $_[0]; my @rows = $database->query( sql=> " select ap.app_id, ap.ver_info from apps ap where app_name='PositivePro Mac Client Lite' "); foreach ( @rows ) { ($appId,$verInfo) = @{ $_ }; } #warn ">>>>> Mac Client appid = $appId\n"; return $appId; } sub getFrameHtml { my ($tb,$is98,$isME) = @{{@_}}{qw/tb is98 isME/}; my $res; my $client = $tb->getClient; my $db = $tb->getWebtopDbReader; my $isMobile = $client->isMobileWebtop(); my ($majorRelease, $minorRelease, $ocxVersion); my $coreUrl; my $jarUrl; my $coreSha1; my $mac = 0; my $macAppId = getMacClientAppId($db); my $agent = $ENV{'HTTP_USER_AGENT'}; #if (1) if(isMacBrowserAllowed()) { ($majorRelease, $minorRelease) = @{$client->getMacWebtopVersion(db=> $db, userId => $client->getUserId())}; #warn ">>>>> Release: $majorRelease, $minorRelease\n"; if ($majorRelease != 1) { my $uriDir = $ENV{'REQUEST_URI'}; $uriDir =~ s/\/[^\/]+$//; # chop off .pl file and leave dir without slash my $webtopDir = $ENV{'SCRIPT_FILENAME'}; $webtopDir =~ s/\/[^\/]+$//; # chop off .pl file and leave dir without slash my $coreFileRelative = "CORE/MacWebtopCore-$majorRelease.$minorRelease.tar.gz"; my $coreFileAbsolute = $webtopDir . "/" . $coreFileRelative; #warn ">>>>> Core: $coreFileAbsolute\n"; my $CORE; open($CORE, "<$coreFileAbsolute"); my $ctx = Digest->new("SHA-1"); $ctx->addfile($CORE); $coreSha1 = $ctx->hexdigest(); close($CORE); $coreUrl = ($ENV{'HTTPS'} eq "on" ? "https" : "http") . "://" . $ENV{'HTTP_HOST'} . $uriDir . "/" . $coreFileRelative; $jarUrl = "APPLET/WebtopApplet-$majorRelease.$minorRelease.jar"; $mac = 1; } else { # As a somewhat hack to keep legacy 'oops, ocx failed' mac login, we # refuse to detect mac if the user has version 1 assigned to them, # indicating they aren't using the new mac webtop. # $mac = 0; } #warn ">>>>>> mac: $mac\n"; } else { ($majorRelease, $minorRelease, $ocxVersion) = @{$client->getWebtopOcxVersion(db=> $db, userId => $client->getUserId())}; } if (($is98 || $isME) && ($majorRelease > 55)) { my @forcedVersion = $db->query(sql => " select required_major, required_minor from software_product_forced_rel where software_product_id = 3 AND os_id = " . ($is98 ? "3" : "4") . " "); $majorRelease = $forcedVersion[0][0]; $minorRelease = $forcedVersion[0][1]; } my $ocxUrl = "OCX/$majorRelease.$minorRelease/WTP.cab"; my ($intranetAccessMethod) = $db->query(sql => " select wiam.intranet_access_method_name from w_user_intranet_access_method wuiam, w_intranet_access_methods wiam where wuiam.intranet_access_method_id = wiam.intranet_access_method_id AND user_id = '" . $client->getUserId() . "' "); # Default to enhanced if (not defined($intranetAccessMethod)) { $intranetAccessMethod = 'Enhanced'; } # Initialize some locals my $oem = $tb->getOem; my $userId = $client->getUserId; my $sessionId = $client->getSessionId; my $sessionHash = $client->getSessionHash; my $serverName = $ENV{'SERVER_NAME'}; my @keyServer; my $keyServerPublicKey; my $keyServerHostname; my $oemId = $tb->getOemId(); my $codeOemId = Pos::Webtop::Web::OEMLoader::getSkinOemId(oemId=> $oemId); my $oemIconSrc = "LocalWebLib/OEM/$codeOemId"; my $oemStylesheetFileVersion = Pos::Webtop::Web::OEMLoader::getStylesheetFileVersion(oemId=> $oemId); @keyServer = $db->query(sql => " select a.keyserver_public_key, a.keyserver_hostname from keyservers a inner join keyserver_webtop_portals b on a.keyserver_id = b.keyserver_id where upper(b.webtop_portal_hostname) = upper('" . $db->escape(dirty => $serverName) . "') "); if (scalar(@keyServer) > 0) { ($keyServerPublicKey,$keyServerHostname) = @{ $keyServer[0] }; if ($agent =~ /Mac OS/ && $agent =~ /Safari/) { $keyServerHostname = "keyserver-na.positivenetworks.net"; } } # # Spyware module HTML # my $spyware = " "; # # Virus module HTML # my $virus = " "; $res = " " . $tb->getDomJs . " $virus $spyware
 " . ($isMobile ? "Mobile Webtop" : "Initializing..." ) . "
" . ($isMobile ? "" : "" ) . "
" . ($mac ? "
" : " " ) . " "; return $res; } sub getFrameStatusHtml { my ($tb) = @{{@_}}{qw/tb/}; my $oemId = $tb->getOemId(); my $res; my $oem; my $codeOemId = Pos::Webtop::Web::OEMLoader::getSkinOemId(oemId=> $oemId); my $oemIconSrc = "LocalWebLib/OEM/$codeOemId"; $oem = $tb->getOem(); $res = " " . $tb->getDomJs . " " . $oem->getSetting(setting => 'webtopProductName') . " - Status
 
  " . $oem->getSetting(setting => 'webtopProductName') . " Modules  

Status:

". ( $oemId != 20 && $oemId != 28 ? " Technical Support:
  " . $oem->getSetting(setting => 'customerServicePhone') . "
  Email Support
  Live Chat
" : "" ) ." ". ( $oemId == 28 ? " Technical Support:
  " . $oem->getSetting(setting => 'customerServicePhone') . "
  Email Support
" : "" ) ."
  
"; return $res; } sub getFrameSupportHtml { my ($tb) = @{{@_}}{qw/tb/}; my $oemId = $tb->getOemId(); my $res; my $oem; my $codeOemId = Pos::Webtop::Web::OEMLoader::getSkinOemId(oemId=> $oemId); my $oemIconSrc = "LocalWebLib/OEM/$codeOemId"; $oem = $tb->getOem(); $res = " " . $tb->getDomJs . " Send Logs
Support Request

The " . $oem->getSetting(setting => "rebrandName") . " Support Desk wants to automatically capture logs to troubleshoot a problem, but it appears the Support Tool is not installed. Please install it, then sign on again. Click here to install the Support Tool.

". ( $oemId != 20 and $oemId != 28? " Technical Support:
  " . $oem->getSetting(setting => 'customerServicePhone') . "
  Email Support
  Live Chat
" : "" ) ." ". ( $oemId == 28 ? " Technical Support:
  " . $oem->getSetting(setting => 'customerServicePhone') . "
  Email Support
" : "" ) ."
  
"; return $res; } 1;