#!/usr/bin/perl ######################################################################################### # In der ersten Zeile dieses Skriptes (#!/usr/bin/perl) muss der Pfad zur Perl-Version # # auf Ihrem WebServer angegeben sein. Weitere Details ersehen Sie in der # # Installationsanleitung. # ######################################################################################### # The preceding line must contain the path to the Perl installation on your web server. # # For further details see the installation manual. # ######################################################################################### # ContRay - Professional Website Engine - Release 3 Enterprise Edition # # Copyright © 2001-2008 ContRay [wwww.contray.de] # # ContRay is a registered trademark (No. 305 41 569) in Germany. All rights # # on the software are reserved by Kai Lange, Von-Anckeln-Str. 8, D-21029 Hamburg. # # The global marketing of ContRay be subject to Andreas Schwope, # # ContRay - Marketing und Vertrieb, Am Thie 13, D-31087 Landwehr. # # All rights reserved. # ######################################################################################### # # # Lesen Sie diese Bedingungen vor dem Einsatz der Software! Sollten Ihnen eine # # abweichende Lizenzvereinbarung beim Kauf von ContRay zugrunde gelegen haben, # # haben ggf. die dortigen Garantiebestimmungen Gültigkeit. # # # # Eine erweiterte Lizenzbestimmung steht Ihnen auf der ContRay Website zur Verfügung # # und ist der Software beigefügt. # # # # Unrechtmäßige Benutzer von ContRay, die ContRay ohne den Erwerb einer gültigen # # Lizenz benutzen, unterliegen dem deutschen und internationalen Recht und werden # # aufgrund von Lizenzbetrug von uns verfolgt und angeklagt. Der Gerichtsstand # # ist Hamburg, Deutschland. # # # # Mit dem Kauf, der Installation, dem Download oder anderer Art und Weise des # # in Besitzbringens dieser Software und dem betrachten, kopieren, verändern oder # # sonstiger Behandlung dieser Software, dem Sourcecode oder Teilen des # # Sourcecodes (inklusive diesen Bedingungen) erklären Sie sich mit diesen # # Bedingungen einverstanden. Sofern Sie damit nicht einverstanden sind, löschen # # Sie die Software unwiderruflich von Ihrem Computer und vernichten Sie ggf. # # vorhandene Kopien der Software. # # # # Die Copyright-Inhaber und/oder die Verkäufer dieser Software übernehmen unter # # keinen Umständen eine Haftung für die fehlerfreie Funktion dieser Software. # # ContRay ist eine Script-Software mit voller Sourcecode-Verfügbarkeit. Eine # # korrekte Funktionsweise kann aufgrund der nicht vorhanden automatischen # # Installationsmöglichkeit durch eine Setuproutine nicht zugesichert werden. # # Auf Wunsch installiert der Verkäufer gegen Berechnung die Software. # # Sofern die Software von anderen, als von den Verkäufern selbst installiert # # wird, gilt die Software als Verkauft unter Ausschluss jeglicher Gewährleistung. # # Da der Verkäufer keinerlei Einfluss auf die korrekte Intallation und # # Konfiguration der Software nehmen kann, trägt der Käufer alle Risiken des # # Betriebes der Software. Wie bei anderer Software dieser Art kann der Einsatz # # der Software einen vollständigen Ausfall der Systeme, auf denen die Software # # betrieben wird und der im Netzwerk verbundenen System zur Folge haben. Ebenso # # ist ein vollständiger Verlust aller Daten in der betriebenen Serverumgebung # # möglich. Dieses Risiko gehen Sie mit der Installation dieser Software ein. # # EINE HAFTUNG HIERFÜR IST AUSDRÜCKLICH AUSGESCHLOSSEN. # ######################################################################################### # # # Please read these terms before using the software! If you bought ContRay with a # # different license arrangement the guarantee agreement stated there might be the # # valid one. # # # # An extended license arrangement can be found on the ContRay web site and is added to # # the software. # # # # Users who install and use ContRay without a valid license are subject to German and # # international law and will be prosecuted. Venue is Hamburg, Germany. # # # # You agree to these terms by buying, installing, downloading or receiving the software # # in a different way, by viewing, copying, changing or using the software, the source # # code or part of the source code (including these terms). If you do not agree to these # # terms you must delete the software irrevocably from your computer and you must delete # # each copy of the software you have. # # # # The owners of the Copyright and/or the vendors of the software cannot be held liable # # for the error-free working of the software. ContRay is a script software with an # # open source code. An error-free working cannot be guaranteed due to the fact that # # there is no automatic installation routine. # # If the licensee wishes the vendor will install the software for a charge. # # If the software is not installed by the vendor it is sold without any warranty. # # Since the vendor cannot influence installation and configuration the licensee assumes # # all risks of running the software. As with all software of this kind running the # # software can cause a complete breakdown of the systems that run the software and a # # complete breakdown of the systems that are in the same network. It is also possible # # that all data on the server is lost. By installing the software the licensee assumes # # this risk. # # NEITHER THE PRODUCER OF THE SOFTWARE NOR THE VENDOR IS LIABLE FOR THESE DAMAGES. # ######################################################################################### ######################################################################################### # Geben Sie denn vollen Pfad zur variables.cfg an: # # Enter the full path to the variables.cfg: # # z.B. /home/yourdomain/cgi-bin/contray/variables.cfg # ######################################################################################### require '../variables.cfg'; ######################################################################################### # NEHMEN SIE KEINE ÄNDERUNGEN UNTERHALB DIESER POSITION VOR! # # ===================================================================================== # # DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING. # ######################################################################################### use CGI; require "${contraypath}language.$languageFile"; require "${contraypath}admin/session-lib.pl"; my $cgi = new CGI; # Initialize variables (Variablen initialisieren) $SORT = "TRUE"; $CONVERT = "FALSE"; # Get parameters (Parameteruebernahme) $ID = $cgi->param("ID"); $GROUP = $cgi->param("GROUP"); $TYPE = $cgi->param("TYPE"); $MODE = $cgi->param("MODE") || 'CONTENT'; $SessionID = $cgi->param("sessionid"); $info_error = $cgi->param("info_error"); # Check permissions (Zugangsberechtigung ueberpruefen) $USER = check_permission( $cgi, $ID . $GROUP ); # Get Template-Name my %tmpldata = get_template(); # show header of edit section (Kopf des Edit-Bereichs ausgeben) #&show_main(); # Read index.dat (Daten aus index.dat auslesen) &Read_Index(); # Read .dat file (Daten aus .dat File auslesen) &Read_Datfile(); # #&ShowEditForm(); #exit; $TEMPLATE =~ s/\s+$//; #$TemplateName = $TEMPLATE; print_template( 'edit.tmpl', user => $USER, id => $ID, group => $GROUP, browser => $Browser, sessionid => $SessionID, template => $TEMPLATE, type => $TYPE, mode => $MODE, title => $TITLE, sort => $SORT, form_data => \%FORM_DATA, templatename => $tmpldata{'tmplinfo'}, info => $INFO, info_error => $info_error, meta1name => $FORM_DATA{META1NAME}, meta1value => $FORM_DATA{META1VALUE}, meta2name => $FORM_DATA{META2NAME}, meta2value => $FORM_DATA{META2VALUE}, meta3name => $FORM_DATA{META3NAME}, meta3value => $FORM_DATA{META3VALUE}, META1NAME => $FORM_DATA{META1NAME}, META1VALUE => $FORM_DATA{META1VALUE}, META2NAME => $FORM_DATA{META2NAME}, META2VALUE => $FORM_DATA{META2VALUE}, META3NAME => $FORM_DATA{META3NAME}, META3VALUE => $FORM_DATA{META3VALUE}, ); &ExitProc; ############################################################################ sub check_permission { my $cgi = shift; my %perm = get_auto_permission( $cgi, @_ ); print $cgi->header( -charset => $LangInputCharset ); if( $perm{'level'} < 1 ) { print_noaccess_template(); exit; } else { Refresh_Session( $perm{'sid'} ); return $perm{'user'}; } } ############################################################################ sub Read_Index { if (open (FILE, $datapath."index.dat")) { while() { ($fID,$fGROUP,$fTYPE,$FTITLE,$fTEMPLATE,$fSORT,$fINFO) = split(/:/,$_); chomp($FTITLE,$fTEMPLATE); $TEMPLATE =~ s/ //g; if (($fID eq $ID) and ($fGROUP eq $GROUP)) { $TYPE = $fTYPE; $TITLE = $FTITLE; $TITLE =~ s/³/:/g; $TEMPLATE = $fTEMPLATE; $INFO = $fINFO; $INFO =~ s/\n//; $INFO =~ s/³/:/g; $INFO =~ s/~CR~/\n/; $fSORT =~ s/\n//; if($fSORT eq "TRUE") { $SORT = "TRUE"; } else { $SORT = "FALSE"; } } } close(FILE); } } ############################################################################ sub Read_Datfile { $DATAFILE= $datapath."$ID$GROUP.dat"; reset @FORM_DATA; open(FILE,"$DATAFILE")|| &CreateDataFile; while() { ($KEY,$VALUE) = split(/=/,$_); $KEY =~ s/ //g; $KEY = uc($KEY); $VALUE =~ s/^\s*(.*?)\s*$/$1/; $VALUE =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg; $VALUE =~ s/~CR~/\n/g; $VALUE =~ s/~EQ~/=/g; $VALUE =~ s/<%gfxurl%>/$webgfx/g; $VALUE =~ s/<%root%>/$webwww/g; $VALUE =~ s/<%media%>/$webmedia/g; $VALUE =~ s/<%contrayurl%>/$webcgi/g; $VALUE =~ s/"/"/g; $VALUE =~ s//>/g; $FORM_DATA{$KEY} = $VALUE; } close(FILE); } ############################################################################ sub CreateDataFile{ open(FILE,">$DATAFILE"); print FILE "TITLE = $TITLE\n"; close(FILE); open(FILE,"$DATAFILE"); } ############################################################################ sub get_template { my %data; if( open INDEX, "< ${datapath}index.dat" ) { my %templates; if( open TMPLLIST, "< $templatepath" . ( $TYPE ne 'L' ? 'templates.dat' : 'lists.dat' ) ) { # # build "filename => description" hash of all available templates # while( defined( my $line = ) ) { # remove padding space from line $line =~ s/^\s+//; $line =~ s/\s+$//; my ( $tmplfile, @tmplinfo ) = split /:/, $line; # remove padding space from description and filename $tmplfile =~ s/ +//g; $tmplinfo[0] =~ s/^\s+//; # fill hash with values $templates{ $tmplfile } = join ':', @tmplinfo; } close TMPLLIST; } # # find matching entry in index.dat # while( defined( my $line = ) ) { # remove padding space $line =~ s/^\s+//; $line =~ s/\s+$//; my ( $id, $group, $type, $title, $template, $sort, $info ) = split /:/, $line; if( $id eq $ID && $group eq $GROUP ) { # remove padding space from important values $title =~ s/^\s+//; $title =~ s/\s+$//; $template =~ s/ +//g; # store values $data{'title'} = $title; $data{'tmplfile'} = $template; $data{'tmplinfo'} = $templates{ $template }; $data{'info'} = $info; last; } } close INDEX; } return %data } # extra function for processing templates sub print_template { my $file = shift; my %params = @_; use CGI::Carp 'fatalsToBrowser'; use lib '../modules'; use contray::template; use contray::config; my $config = Contray::Config -> new( '../variables.cfg' ); my $tmpl = Contray::Template -> new( config => $config, file => $file, path => [ $templatepath, $wwwpath.'admin-templates' ] ); $tmpl->param( $_ => $params{$_} ) for keys %params; print $tmpl->output(); return; } sub print_noaccess_template { print_template( 'edit_noaccess.tmpl', user => $USER, id => $ID, group => $GROUP, type => $TYPE, mode => $MODE, title => $TITLE, browser => $Browser, templatename => '', sessionid => $SessionID ); }