$version = "5.2"; $action=$ENV{'QUERY_STRING'}; $action =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; @allowable_ascii_extensions = qw(); @allowable_binary_extensions = qw(); @STYLES=(); @NOTFND=(); $path_to_config=$path_to_library."/config.txt"; open(CONFG,"$path_to_config") || error("Can't locate config.txt at $path_to_config"); while(){eval()} $path_to_domain_root =~ s!/$!!; $url_to_editor=lc($url_to_editor); $url_to_editor =~ m!(.+?\..+?)/!;$url_to_domain_root=$1; $url_to_library=$path_to_library; $url_to_library=~s!$path_to_domain_root!$url_to_domain_root!; $url_to_wrx_library_folder =~ s!/$!!; ($this_action,$param,$cycle)=split(/=/,$action); if($this_action eq ''){&get_login} &$this_action; sub logged_in{ &check_cookie; &check_login; &get_toolbar; }#logged_in sub prompt{ print "Content-type: text/html\n\n"; print qq~kys="";key="272727" document.onkeypress=katch function katch(){ kys+=event.keyCode if(kys.indexOf(key)!=-1){kys="";wrxLogin()} } function wrxLogin(){ answer = window.showModalDialog("$url_to_editor?modal",window,"dialogHeight: 250px; dialogWidth: 210px; edge: Raised; center: Yes; help: No; resizable: No; status: No;"); if(answer == "L_OK"){location="$url_to_editor?logged_in="+location} } ~; exit }#prompt sub modal{ &check_cookie; if($USERNAME){$remember="checked"} print "Content-type: text/html\n\n"; print qq~ editWRX Login to edit...................................................
Login

Enter Username

Enter Password
Remember Me?
~; } sub open_page{ print "Content-type: text/html\n\n"; open(OH,"$path_to_library/openpage.htm"); while(){ s/\$(\w+)/${$1}/eg; print } exit; }#open sub delete_file{ $param=~m!http://.+?(/.+)!;$file=$1; $file=$path_to_domain_root.$file; unlink($file); print "Content-type: text/html\n\n"; print qq~~; } sub get_toolbar{ #TOOL if($ENV{'QUERY_STRING'} eq ""){ $URL=qq~$url_to_editor?get_login~; }else{ if($param){ $param=~m!([^/:\\]*)$!; $file=$1; unless($file =~ m!\..+$!){ $param=~s!/$!!; $param=$param."/".$default_file_name; } $URL=qq~IFcanvas.location="$param"~} $INIT=qq~document.getElementById("toolbar").style.display="" document.getElementById("OPN").style.visibility="visible" if(document.cookie.indexOf("Editor_Login")==-1){alert("Your browser is not accepting cookies!\\nChange your browser setting to accept cookies and login again.\\n\\nThe toolbar did not initialize");document.getElementById("toolbar").style.display="none"} $URL ~; } &check_cookie; &check_login;$user_root=~s!/$!!; $url_to_icons_folder=~s!/$!!; &seed; @buttons=split(/\|/,$buttons); for (@buttons){ $icon = $_."_";$$_=$$icon; if($_ eq "classes" || $_ eq "inline" || $_ eq "freehand"){$style=$style_} } for (@separators){$icon = $_."_";$$_=$$icon} $path_to_library=~s!/$!!; print "Content-type: text/html\n\n"; open(T,"$path_to_library/toolbar.htm"); while(){ s/\$(\w+)/${$1}/eg; print} exit; }#get_editor sub get_page{ &get_input; $REDIRECT=$HTTP.$page; print "Location: $REDIRECT\n\n"; }#get_page sub get_login{ &check_cookie; if($USERNAME){$remember="checked"} $url_to_editor=~s!/$!!; print "Content-type: text/html\n\n"; print qq~editWRX Login


User Name


Password



Remember Me
~; exit; }##get_login sub do_login{ &get_input; &login; print "Content-type: text/html\n\n"; print qq~~; exit; }##do_login sub login{ $fdate = time + 360 * 86400; $ftime=gmtime($fdate); $pdate = time - 360 * 86400; $ptime=gmtime($pdate); open(USR,"$path_to_library/users.txt"); while(){ if(/^$username=/){ chomp(); ($un,$pw,$user_root,$buttons,$imagesize,$editing,$usermb)=split(/=/); last; } } if($pw eq "start"){$password_=$password}else{$password_=crypt($password,"ce")} if($password_ eq $pw){ if($username eq "admin"){&admin} $modal_ok=1; print "Set-Cookie: Editor_Login=$un|$pw;path=/;\n"; if($remember==1){ $expire= qq~expires=$ftime;~; print "Set-Cookie: UP=$un|$password;$expire path=/;\n"; }else{ $expire= qq~expires=$ptime;~; print "Set-Cookie: UP=;$expire path=/;\n"; } }else{ if(!$modal){ error("Wrong Password");exit; } } }##login sub modal_login{ &get_input; $modal=1; &login; print "Content-type: text/html\n\n"; if($modal_ok){ print qq~ ~; }else{ print qq~ ~; } exit; }##modal_login sub check_this_path{ &check_cookie; &check_login; $user_root=~s!/$!!; $user_root=lc($user_root);$para=lc($param); unless($para =~ /$user_root/){error2("$username does not have privilage to edit this file")} print "Content-type: text/html\n\n"; print " "; exit } sub check_path{ &check_cookie; &check_login; $users_path=$user_root; $users_path=~s!/$!!;$users_path.="/"; $ptdr=$path_to_domain_root;$ptdr=~s!/$!!;$ptdr.="/"; $users_path =~ s`http://.+?/`$ptdr`i; unless($_[0] =~ /$users_path/){error("$username does not have privilege to edit this file")} } sub write{ &get_input; &check_cookie; &check_login; $URL =~ m!^http://.+?/(.+)!;$FILE=$1; $FILE = $path_to_domain_root."/".$FILE; check_path($FILE); if($saveas ne ''){&save_it_as} @stats=stat($FILE); chmod(0666,"$FILE"); open(H,"$FILE") || error("Could Not Read File $path_to_domain_root"); while(){$PAGE .= $_} close(H); if(length($PAGE) < 10){error("FILE Was Found To Be Empty No Change Was Made")} foreach $eblock (@EDITS){ ($n,$v)=split(/_/,$eblock,2); $$eblock=~s!<=textarea!)(.*)(`g; if($edit_full_page==0){error("Full Page Editing Is Not Allowed")} if($edit_full_page==2 && $PAGE !~ /FULL_PAGE_EDITING="YES"/){error("Full Page Editing Is Not Allowed For This Page")} if($edit_full_page==1){ $PAGE =~ s`(\)`$edit_body`si; } if($edit_full_page==2 && $PAGE =~ /FULL_PAGE_EDITING="YES"/){ $PAGE =~ s`(\)`$edit_body`si; } } open(H,">$FILE") || error("Could Not Write To $URL"); print H "$PAGE"; close(H); chmod($stats[2],$FILE); foreach $iblock (@INCLUDES){ ($n,$INC)=split(/_/,$iblock,2); $INC=~s!^/!!; $INC=$path_to_domain_root."/".$INC; @stat=stat($INC); chmod(0666,"$INC"); open(P,">$INC") || error("Could Not Open INCLUDE To Write To It $INC"); print P "$$iblock"; close(P); chmod($stat[2],"$INC"); $INC=''; } print "Location: $URL\n\n"; }##write sub save_it_as{ $saveas =~ m!^http://.+?/(.+)!;$XFILE=$1; $XFILE=~m!\.(\w+)$!;$ext=$1; if("@allowable_ascii_extensions" !~ /\b$ext\b/){error("$ext is not an allowed extension for file saving")} if($usermb ne ''){ @sz=stat($FILE); $SZ=$sz[7]; $szz=$SZ/100000; $szz=sprintf("%1.2f",$szz); &allocation; $reMB=$uMB - $szz; if($uMB > $usermb){ $xMB=$uMB-$usermb; $xMB=sprintf("%1.2f",$xMB); error("The File Size Is $SZ - Saving as a new file would exceed your $usermb MB allocation by $xMB MB. The file was not saved."); } } open(GF,"$FILE"); while(){ s!.+?!$page_title!; $X_FILE .= $_; } close(GF); $path_to_domain_root =~ s!/$!!; $XFILE = $path_to_domain_root."/".$XFILE; open(XF,">$XFILE"); print XF "$X_FILE"; close(XF); $FILE=$XFILE; $URL=$saveas; }##saveitas sub saveas{ &check_cookie; &check_login; if($usermb ne ''){ &allocation; $aMB=$usermb-$uMB; $aMB=sprintf("%1.2f",$aMB); $MB=qq~ ($uMB Used MB - $aMB MB Available)~; } print "Content-type: text/html\n\n"; open(SH,"$path_to_library/saveas.htm"); while(){ s/\$(\w+)/${$1}/eg; print } exit; }##saveas sub check_cookie{ @jar = split(/\;/,$ENV{'HTTP_COOKIE'}); foreach $cookie (@jar){ ($name, $value) = split(/=/,$cookie); $name =~ s/^\s*//; $$name=$value; } if($Editor_Login ne ""){($username,$PW)=split(/\|/,$Editor_Login);} if($UP ne ''){($USERNAME,$PASSWORD)=split(/\|/,$UP);} $Current_Dir =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; }##get_cookie sub check_login{ open(USR,"$path_to_library/users.txt"); while(){ if(/^$username=/){ chomp(); ($un,$pw,$user_root,$buttons,$imagesize,$editing,$usermb)=split(/=/); last; } } if($PW ne $pw){ if(!$modal){ error("Wrong Password");exit; } } #$user_root=lc($user_root); }##check_login sub path_tree{ $path_to_domain_root.="/"; $url_to_icons_folder=~s!/$!!; $dir=qq~~; $txt=qq~~; $bin=qq~~; $aro=qq~~; $stop=0; &check_cookie; &check_login; $user_root=~s!/$!!;$user_root.="/"; $user_root=~m!(http://.+?/)!;$LOC=$1; $DIR=$user_root; $DIR =~ s!http://.+?/!$path_to_domain_root!; unless(-e $DIR){error("

The user's root folder
$user_root
does not exist when converted to
$DIR
")} if($param){if($param eq "up"){$Current_Dir=~m!(.*?/)\w*?-?\w*?/$!;$DIR=$1}else{$DIR=$param."/"}} if(length($DIR)$aro $LOC$curr_dir~; $un_url=$LOC.$curr_dir; if($user_root eq $un_url){$aro_display="none"}else{$aro_display=""} foreach $file (@files){ if($file !~ /\.$/ && $file !~ /^\./){ $file_=$DIR.$file; $url=$file_;$url=~s!$path_to_domain_root!$LOC!; if($cycle eq "create_link"){$user_root=$LOC} if(-d $file_){push(@fldrs,$file); $DIRS.=qq~ $dir $file   ~} if(-T $file_){push(@txts,$file);push(@bins,$file); get_title("$file_"); $file_=~m!\.(\w+)$!;$ext=$1; if("@allowable_ascii_extensions" =~ /\b$ext\b/){ if($cycle ne "upload_file"){$hrf=qq~~} $TXT.=qq~ $hrf$txt $file    • $PT~}} if(-B $file_){push(@bins,$file); $file_=~m!\.(\w+)$!;$ext=$1; if("@allowable_binary_extensions" =~ /\b$ext\b/ && $ext ne ''){ if($cycle ne "upload_file"){$hrf=qq~~} $BIN.=qq~ $hrf$bin $file    • binary file~}} }} print "Set-Cookie: Current_Dir=$DIR;path=/\n"; if($cycle eq "create_link"){$RETURN=$DIRS.$TXT.$BIN} if($cycle eq "upload_file"){$RETURN=$DIRS.$TXT.$BIN;$array=join("\",\"",@bins)} if($cycle eq "open_page"){$RETURN=$DIRS.$TXT} if($cycle eq "insert_image"){$RETURN=$DIRS.$BIN} if($cycle eq "saveas"){$RETURN=$DIRS.$TXT; $CURRENT= qq~parent.document.getElementById("saveas_url").value="$un_url"~; $array=join("\",\"",@txts)} $folders=join("\",\"",@fldrs); if($RETURN eq ''){$RETURN=$Current_Dir} print "Content-type: text/html\n\n"; print qq~ $RETURN
~; }## sub create_folder{ ($dir,$folder)=split(/&/,$param); chmod(0777,"$dir"); $DIR=$dir.$folder; mkdir($DIR,0755); chmod(0755,"$dir"); print "Content-type: text/html\n\n"; print qq~~; exit; }#create_folder sub get_title{ open(P,"$_[0]"); while(

){ m!(.+?)!;$PT=$1; } $PT=substr($PT,0,60); }##get title sub insert_table{ print "Content-type: text/html\n\n"; open(CH,"$path_to_library/tablewizard.htm"); while(){ s/\$(\w+)/${$1}/eg; print; } exit; }##insert_table sub insert_image{ if($param eq "forms"){ $form=qq~form=1~; $alt_tr=qq~document.getElementById("alt_tr").style.display="none" document.getElementById("form_tr").style.display=""~; } print "Content-type: text/html\n\n"; open(I,"$path_to_library/insertimage.htm"); while(){ s/\$(\w+)/${$1}/eg; print } exit; }##insert_image sub uploading_file{ &check_cookie; &check_login; $imagesizeKB = $imagesize*1000; use CGI qw/:standard :html3/; if($winserver==1){ $TempFile::TMPDIRECTORY="$path_to_domain_root/Temp"; } $file = param('upload'); $dir = param('folder'); $file_type = param('file_type'); if (!$file) {&no_file} $file =~ m!([^/:\\]*)$!; #capture file name $short_name = $1; $short_name=~m!\.(\w+)$!;$ext=$1; if($file_type eq "binary"){if("@allowable_binary_extensions" !~ /$ext/){alert("$ext Is Not An Allowed BINARY File Type For Uploading")}} if($file_type eq "ascii"){if("@allowable_ascii_extensions" !~ /$ext/){alert("$ext Is Not An Allowed ASCII File Type For Uploading")}} $file_name = $dir.$short_name; open (SAVE,">$file_name") || die $!; binmode SAVE if $^O eq 'MSWin32'; while ($size = read($file,$data,1024)) { print SAVE $data; $total_size += $size; } close SAVE; if ($total_size > 0) {} else{unlink($file_name);alert("No content was uploaded")} if($total_size > $imagesizeKB){unlink($file_name);$TS=$total_size/1000;$TS=sprintf("%1.2f",$TS); alert("The File Upload Was Rejected The File Size $TS KB Exceeded $imagesize KB"); } if($usermb ne ''){ @sz=stat($file_name); $SZ=$sz[7]; $szz=$SZ/100000; $szz=sprintf("%1.2f",$szz); &allocation; $reMB=$uMB - $szz; $aMB=$usermb-$uMB; $aMB=sprintf("%1.2f",$aMB); if($uMB > $usermb){ unlink($file_name); $xMB=$uMB-$usermb; $xMB=sprintf("%1.2f",$xMB); alert("The File Size Is $SZ - Saving the upload would exceed your $usermb MB allocation by $xMB MB. The file was not saved."); } } if($winserver==1){ $temp=$TempFile::TMPDIRECTORY; opendir(TEMP,"$temp"); @temps=readdir(TEMP); foreach $file (@temps){ if($file =~ /CGItemp/i){ $ftemp=$temp."/".$file; unlink($ftemp); }} } print "Content-type: text/html\n\n"; print qq~ ~; exit; }#uploading_image sub upload_file{ &check_cookie; &check_login; if($usermb ne ''){ &allocation; $aMB=$usermb-$uMB; $aMB=sprintf("%1.2f",$aMB); $MB=qq~ ($uMB Used MB - $aMB MB Available)~; } print "Content-type: text/html\n\n"; open(I,"$path_to_library/uploadfile.htm"); while(){ s/\$(\w+)/${$1}/eg; print } exit; }##upload_image sub create_link{ &check_cookie; &check_login; if($buttons =~ /create_popup/){$Create_Pop_Ups="yes"}else{$Create_Pop_Ups="no"} &get_style; print "Content-type: text/html\n\n"; open(LH,"$path_to_library/linkwizard.htm"); while(){ s/\$(\w+)/${$1}/eg; print } exit; }##create_link sub get_forms{ &get_script; $forms_file=$path_to_library."/formwizard.htm"; print "Content-type: text/html\n\n"; open(FW,"$forms_file"); while(){ s/\$(\w+)/${$1}/eg; print } exit; }#get_forms sub get_script{ $file=$param; $file=~s!$url_to_domain_root!$path_to_domain_root!; @SCRIPTS=(); open(F,"$file"); while(){ if(m!.*){ if(m!function(.+?)\(.+allow!){if("@SCRIPTS" !~/$1/){push(@SCRIPTS,$1)}} } } $SCRIPTS = qq~~; if($#SCRIPTS>-1){ &get_style; $CONTENT = qq~

Apply Styles
$STYLES $DIVS $FREEHAND
 
~; $height+=20; }else{ $height=200; $SCRIPTS=qq~No Functions Available For This Page~; } if($action =~ /get_script/){ $script_inc=$path_to_library."/scriptwizard.htm"; print "Content-type: text/html\n\n"; open(S,"$script_inc"); while(){ s/\$(\w+)/${$1}/eg; print } 1; }else{ $SCRIPTS1=$SCRIPTS;$SCRIPTS1=~s!view_fun!view_fun_onsubmit!; $SCRIPTS2=$SCRIPTS;$SCRIPTS2=~s!view_fun!view_fun_onfocusA!; $SCRIPTS3=$SCRIPTS;$SCRIPTS3=~s!view_fun!view_fun_onblurA!; $SCRIPTS4=$SCRIPTS;$SCRIPTS4=~s!view_fun!view_fun_onchangeA!; $SCRIPTS5=$SCRIPTS;$SCRIPTS5=~s!view_fun!view_fun_onfocusB!; $SCRIPTS6=$SCRIPTS;$SCRIPTS6=~s!view_fun!view_fun_onblurB!; $SCRIPTS7=$SCRIPTS;$SCRIPTS7=~s!view_fun!view_fun_onchangeB!; $SCRIPTS8=$SCRIPTS;$SCRIPTS8=~s!view_fun!view_fun_onclickA!; $SCRIPTS9=$SCRIPTS;$SCRIPTS9=~s!view_fun!view_fun_onclickB!; $SCRIPTS0=$SCRIPTS;$SCRIPTS0=~s!view_fun!view_fun_onclickC!; $SCRIPTS11=$SCRIPTS;$SCRIPTS11=~s!view_fun!view_fun_onchangeC!; } }#get_script sub get_function{ open(F,"$param"); while(){ if(m!.*){ if(m!function.+?$cycle.+?allow(.+)!){$function=$1;last} } } $function =~s/^ //;chomp($function); print "Content-type: text/html\n\n"; print qq~~; }#get_function sub get_style{ &check_cookie; &check_login; @buttons=split(/\|/,$buttons); for (@buttons){$$_=1} $height=220; $file=$param; if($classes){ $file=~s!$url_to_domain_root!$path_to_domain_root!; $cb="{"; open(F,"$file"); while(){ if(m!){ if(m!\.(.+)$cb!){if("@STYLES" !~/$1/){push(@STYLES,$1)}} } } @STYLES=sort(@STYLES); for(@STYLES){ $_=~s/\.//;$_=~s/\s//g;chomp(); $STYLES.=qq~