#!/usr/bin/perl -Tw -I. -I/usr/local/positive/Perl # # This software is copyright (c) 2001-2002 Positive Networks, Inc. All rights reserved. # # This software is the proprietary and confidential property of Positive Networks, Inc. # Possession, transmission, publication, or use of this software is prohibited except by prior written consent. # use strict; use HTML::Entities; use MIME::Base64; use URI::Escape; use Pos::Webtop::Web::ModuleLoader; use Pos::Webtop::Toolbox; my $raddr = $ENV{'REMOTE_ADDR'}; sub getUserId { my ($tb) = @{{@_}}{qw/tb/}; my $db = $tb->getWebtopDbWriter(); my $raddr = $ENV{'REMOTE_ADDR'}; my $client = $tb->getClient(); my $userId = $client->getUserId(); if( ! length( $userId ) ) { ($userId) = $db->query( sql=> " SELECT user_id FROM client_sessions WHERE rawip32_to_dotted_quad(public_ip_address) = '$raddr' AND client_session_type_id IN (1,4) " ); } return( $userId ); } sub considerAuxAuth { my ($tb) = @{{@_}}{qw/tb/}; my $db = $tb->getWebtopDbWriter(); my $client = $tb->getClient(); my $userId = $client->getUserIdDB( db=> $db ); #my $userId = getUserId(tb=>$tb); my $clientSessionId = $client->getSessionId(); my @expired; if( ! length( $clientSessionId ) ) { ($clientSessionId) = $db->query( sql=> " SELECT client_session_id FROM client_sessions WHERE rawip32_to_dotted_quad(public_ip_address) = '$raddr' AND client_session_type_id IN (1,4) " ); } my @outstanding = $db->query(sql=>" select uaa.aux_auth_id as ID from client_session_aux_auths csaa inner join user_aux_auths uaa on (csaa.aux_auth_id = uaa.aux_auth_id and user_id = $userId) where csaa.client_session_id = $clientSessionId and (passed = false or expired = true) "); my $cgi = $tb->getCgi(); if (@outstanding) { # Note that this redirect code only works with simple # vars that don't need encoding -- like those used between # login.pl and main. Basically, getRefreshFormHtml doesn't # support un-uri-encoding so we cannot hand it a url with # encoded params or those encoded params will get put in # the form inputs for the refresh with those uri encodings. my $qs = ""; my $sep = "?"; foreach ($cgi->param()) { $qs .= $sep; $qs .= $_; $qs .= "="; $qs .= $cgi->param($_); $sep = "&"; } print $tb->getRefreshFormHtml( refreshUrl=> "auxauth.pl", extraVars=> {loginQueryString=> $qs}); exit; } } my $tb = Pos::Webtop::Toolbox->new(); my $oemId = $tb->getOemId(); my $client = $tb->getClient(); my $cgi = $tb->getCgi(); my $displayMain = 1; my $force = $cgi->param('f'); $force = 0 unless( length( $force ) ); $displayMain = 0 unless( ! $force ); my $db = $tb->getWebtopDbWriter(); $client->checkSession(ignoreAuxAuth=> 1, db=> $db) unless( $force ); $client->setRestrictionSetId(tb=>$tb) unless( $force ); # This *should* get the initial frame draw before anything else. considerAuxAuth(tb=>$tb); #my $userId = $client->getUserId(); my $userId = $client->getUserIdDB( db=> $db ); #my $userId = getUserId(tb=>$tb); my $action = $cgi->param('action'); my $p = $tb->getPage(); my $oemSet = $tb->getOem; my $oemName = $oemSet->getSetting(setting=> 'rebrandName'); my $webtopDescription = $oemSet->getSetting(setting=> 'webtopProductName'); $p->addNavBarElement( description=> $webtopDescription ); my $moduleName = $cgi->param('module'); my $confPassed = $cgi->param('confPassed'); my $displayFrameset = $cgi->param('displayFrameset'); my $bottomFrame = $cgi->param('bottomFrame'); my $bottomFrameStatus = $cgi->param('bottomFrameStatus'); my $bottomFrameSupport= $cgi->param('bottomFrameSupport'); my $registered = $cgi->param('r'); $registered = 0 unless defined($registered); my $isMobile = $client->isMobileWebtop(); # Check to see if they've passed the confidence online checks my $cdb = $tb->getWebtopDbReader(); if( $moduleName eq "FileShares" ) { my $q = $cgi->param('url'); my $c = $cgi->param('c'); $q =~ s/-/\\/g; $q = HTML::Entities::encode( $q ); $q = encode_base64( $q ); $q = uri_escape( $q ); $q = "secureExplorer.pl?q=$q&c=$c"; print "Content-Type: text/html\nCache-Control: no-cache\n\n
"; exit(); } # If this session is flagged as a launcher session, do not let them in. if ($client->isLauncherSession()) { print "Content-type: text/html\n\n You do not have access to this feature. "; exit; } if ( ! defined $moduleName ) { # try to get from persisted values $moduleName = $client->getPersistedValue( name=> "module" ); } if ( ! ( defined($displayFrameset) ) && defined( $moduleName ) ) { # call requested modules main if we have it in our layout #my $userId = $client->getUserId(); #my $userId = getUserId(tb=>$tb); my $db = $tb->getWebtopDbReader(); my $userId = $client->getUserIdDB( db=> $db ); my $oem = $tb->getOem; # if they are set to allow webtop but set to not allow webtop # if not using activex on a restrict set it gets very very lame. # have to make this check after the ocx failed...couldn't think # of any other way to do this...this is a really ghetto restrict set # setting but whatever if (!$client->isWebtopAccessEnabled( db=>$db, userId=>$userId )) { $client->logger( severity=>'NORMAL', logMessage=>"WEBTOP Main: no webtop access - probably caused by a restrict set setup that sux " ); my $temp = "login.pl?logout=1&err=Your account is currently not enabled for " . $oem->getSetting(setting=>'webtopProductName') . " access. Please contact " . $oem->getSetting(setting => 'rebrandName') . " technical support for more information."; print $tb->getRefreshFormHtml(refreshUrl=> $temp, top=> 1); exit; } if ( !$client->isWebtopVpnConnectionEstablished(db=>$db, userId=>$userId) && (!$client->isActivexDisabled(db=>$db, userId=>$userId) || ! defined($client->isActivexDisabled(db=>$db, userId=>$userId))) ) { $client->notUsingOcx(tb => $tb); } if(! $registered ) { my $sneakyUser = $client->isUserTryingToBeSneaky(tb=> $tb, db=> $db); if ($sneakyUser) { print "Content-type: text/html\n\n"; print " "; #print $tb->getRefreshFormHtml(refreshUrl => 'login.pl?logout=1'); exit; } } my ($portalized, $activexDisabled, $vpnConnection) = @{$client->isOcxRequiredCaptivePortalCheck(db=> $db, tb=> $tb, userId=> $userId)}; if (!$vpnConnection && !$force ) { print "Content-type: text/html\n\n"; print " "; #print $tb->getRefreshFormHtml(refreshUrl => 'login.pl?logout=1'); exit; } if ( $portalized || $activexDisabled ) { my $sessParams = $client->getSessionParams(); $activexDisabled and $sessParams .= "&ocxFailed=1&displayFrameset=1"; my $url = "main.pl?" . $sessParams . ""; print $tb->getRefreshFormHtml(refreshUrl => $url); exit; } my $cmi = $client->getUserContentModules(); $moduleName =~ /(\w+)/; $moduleName = $1; if ( exists $cmi->{$moduleName} && $cmi->{$moduleName}->{'shown'} ) { my $class = $moduleName; # persist the module name $client->setPersistedValue( name=> "module", value=> $class ); $displayMain = 0; # we display the module's main not the webtop main my $cm = Pos::Webtop::Web::ContentModuleFactory::createModuleFromClass( toolBox=> $tb, class=> $class ); #$cm->main(); $cm->main( userId=> $userId ); } } # # GET MODULE # # if ( defined($displayFrameset) ) { my @params = $cgi->param(); my $parms = ''; my $db = $tb->getWebtopDbReader(); my $sneakyUser = 0; if(! $registered ) { $sneakyUser = $client->isUserTryingToBeSneaky(tb=> $tb, db=> $db); } my $oem = $tb->getOem; # if they are set to allow webtop but set to not allow webtop # if not using activex on a restrict set it gets very very lame. # have to make this check after the ocx failed...couldn't think # of any other way to do this...this is a really ghetto restrict set # setting but whatever if (!$client->isWebtopAccessEnabled( db=>$db, userId=>$userId )) { $client->logger( severity=>'NORMAL', logMessage=>"WEBTOP Main: no webtop access - probably caused by a restrict set setup that sux " ); my $temp = "login.pl?logout=1&err=Your account is currently not enabled for " . $oem->getSetting(setting=>'webtopProductName') . " access. Please contact " . $oem->getSetting(setting => 'rebrandName') . " technical support for more information."; print $tb->getRefreshFormHtml(refreshUrl=> $temp, top=> 1); exit; } if ($sneakyUser) { print "Content-type: text/html\n\n"; print " "; #print $tb->getRefreshFormHtml(refreshUrl => 'login.pl?logout=1'); exit; } foreach my $v (@params) { if ($v eq 'displayFrameset' || $v eq 'pVprefModule') { next; } if (length($parms)) { $parms .= "&"; } $v =~ /(.*)/; $v = $1; my $p = $cgi->param($v); $p =~ /(.*)/; $p = $1; $parms .= URI::Escape::uri_escape($v, "\\W") . "=" . URI::Escape::uri_escape($p, "\\W"); } # If display frameset is enabled, we display the frame set print "Content-type: text/html\n\n
";
foreach my $mod ( @{ $col } )
{
# we need to support oem specific icons, so we have to see if each mod has an oem specific icon
# for this module...
my $iconSrc = "LocalWebLib/" . $mod->{'icon'};
my $codeOemId = Pos::Webtop::Web::OEMLoader::getSkinOemId(oemId=> $oemId);
my $oemIconSrc = "LocalWebLib/OEM/$codeOemId/" . $mod->{'icon'};
my $imgLink;
my $titleLink;
$iconSrc = $oemIconSrc if stat($oemIconSrc);
if ($mod->{'name'} eq 'Remote Desktop' && !$activeXConnected)
{
$imgLink = $client->getFormGetCode(
text=> "
\n"; print $modHtml; } print " |
";
$isMobile and print "||